Skip to content

Re-use nvram module

Finn Thain linux-api linux-fbdev linux-m68k linux-scsi linuxppc-dev lkml platform-driver-x86 7 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest26 patches 0 repliesNew
  2. v6 RFC25 patches 3 repliesSuperseded
  3. v5 RFC26 patches 4 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v4 RFC25 patches29 repliesSuperseded
v3 RFC24 patches4 repliesSuperseded
v2 RFC24 patches6 repliesSuperseded
v1 RFC24 patches11 repliesSuperseded

Changes in v7 from the cover letter

- In patch 21, the '#ifdef CONFIG_NVRAM' conditional was changed to '#if defined(CONFIG_NVRAM) && defined(CONFIG_PPC32)' to avoid changing behaviour as CONFIG_NVRAM becomes available to PPC64.
- Added a new patch (22) in response to Ben's comment about XPRAM accessors. The patch replaces the calls to pmac_xpram_read() with calls to arch_nvram_ops.read_byte()

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/26scsi/atari_scsi: Dont select CONFIG_NVRAMdrivers/char/Kconfig drivers/scsi/Kconfig drivers/scsi/atari_scsi.c+8 -110 replies
2/26m68k/atari: Move Atari-specific code out of drivers/char/nvram.carch/m68k/atari/Makefile arch/m68k/atari/nvram.c drivers/char/nvram.c+292 -2450 replies
3/26m68k/atari: Replace nvram_{read,write}_byte with arch_nvram_opsarch/m68k/atari/nvram.c drivers/scsi/atari_scsi.c include/linux/nvram.h+70 -360 replies
4/26char/nvram: Re-order functions to remove forward declarations and #ifdefsdrivers/char/nvram.c+86 -1080 replies
5/26char/nvram: Adopt arch_nvram_opsdrivers/char/nvram.c include/linux/nvram.h+29 -30 replies
6/26x86/thinkpad_acpi: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()drivers/platform/x86/thinkpad_acpi.c+10 -100 replies
7/26char/nvram: Allow the set_checksum and initialize ioctls to be omitteddrivers/char/nvram.c include/linux/nvram.h+43 -300 replies
8/26char/nvram: Implement NVRAM read/write methodsdrivers/char/nvram.c+114 -480 replies
9/26char/nvram: Use generic fixed_size_llseek()drivers/char/nvram.c+1 -150 replies
10/26m68k/atari: Implement arch_nvram_ops methods and enable CONFIG_HAVE_ARCH_NVRAM_OPSarch/m68k/Kconfig arch/m68k/Kconfig.machine arch/m68k/atari/nvram.c +1 more+29 -10 replies
11/26char/nvram: Add "devname:nvram" module aliasdrivers/char/nvram.c+1 -00 replies
12/26powerpc: Cleanup nvram includesarch/powerpc/include/asm/nvram.h arch/powerpc/kernel/setup_32.c drivers/char/generic_nvram.c +1 more+3 -40 replies
13/26powerpc: Add missing ppc_md.nvram_size for CHRP and PowerMacarch/powerpc/platforms/chrp/nvram.c arch/powerpc/platforms/powermac/nvram.c+19 -40 replies
14/26powerpc: Implement arch_nvram_ops.get_size() and remove old nvram_* exportsarch/powerpc/include/asm/nvram.h arch/powerpc/kernel/setup_32.c drivers/char/generic_nvram.c+19 -180 replies
15/26powerpc: Implement nvram sync ioctlarch/powerpc/include/asm/nvram.h arch/powerpc/kernel/setup_32.c drivers/char/generic_nvram.c +2 more+47 -70 replies
16/26powerpc, fbdev: Use NV_CMODE and NV_VMODE only when CONFIG_PPC32 and CONFIG_PPC_PMAC and CONFIG_NVRAMdrivers/video/fbdev/Kconfig drivers/video/fbdev/imsttfb.c drivers/video/fbdev/matrox/matroxfb_base.c +1 more+13 -180 replies
17/26powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()arch/powerpc/kernel/setup_32.c drivers/char/generic_nvram.c drivers/video/fbdev/controlfb.c +4 more+15 -150 replies
18/26nvram: Drop nvram_* symbol exports and prototypesarch/m68k/atari/nvram.c drivers/char/nvram.c include/linux/nvram.h+8 -330 replies
19/26powerpc: Remove CONFIG_GENERIC_NVRAM and adopt CONFIG_HAVE_ARCH_NVRAM_OPSarch/powerpc/Kconfig arch/powerpc/kernel/setup_32.c arch/powerpc/platforms/chrp/Makefile +3 more+11 -100 replies
20/26char/generic_nvram: Remove as unuseddrivers/char/Makefile drivers/char/generic_nvram.c+1 -1800 replies
21/26powerpc: Adopt nvram module for PPC64arch/powerpc/Kconfig arch/powerpc/kernel/nvram_64.c arch/powerpc/platforms/powermac/Makefile +4 more+37 -1820 replies
22/26powerpc: Remove pmac_xpram_{read,write} functionsarch/powerpc/include/asm/nvram.h arch/powerpc/kernel/nvram_64.c arch/powerpc/kernel/setup_32.c +4 more+25 -370 replies
23/26m68k/mac: Adopt naming and calling conventions for PRAM routinesarch/m68k/mac/misc.c+46 -450 replies
24/26m68k/mac: Use macros for RTC accesses not magic numbersarch/m68k/mac/misc.c+41 -180 replies
25/26m68k/mac: Fix PRAM accessorsarch/m68k/mac/misc.c include/uapi/linux/pmu.h+35 -60 replies
26/26m68k: Dispatch nvram_ops calls to Atari or Mac functionsarch/m68k/Kconfig.machine arch/m68k/atari/nvram.c arch/m68k/include/asm/atarihw.h +3 more+133 -170 replies

Reviews trailers per patch

9 of 26 patches have a Reviewed-by or Acked-by.

PatchChristian T. SteigiesGeert UytterhoevenHenrique de Moraes HolschuhDarren HartLaurent Vivier
1/26T-b
2/26T-b A-b
3/26T-b A-b
4/26
5/26
6/26A-b R-b
7/26
8/26
9/26
10/26A-b
11/26
12/26
13/26
14/26
15/26
16/26
17/26
18/26A-b
19/26
20/26
21/26T-b
22/26
23/26A-b
24/26A-b
25/26A-b
26/26T-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v7 thread

Cover letter [PATCH v7 00/26] Re-use nvram module

The generic NVRAM module, drivers/char/generic_nvram, implements a /dev/nvram misc device. It is used only by 32-bit PowerPC platforms and isn't generic enough to be more widely used.

The RTC NVRAM module, drivers/char/nvram, also implements a /dev/nvram misc device. It is used by x86, ARM and m68k.

The former module cannot be used on x86, ARM or m68k because it cannot co-exist with the latter module, partly due to the Kconfig logic.

It is possible to modify the modules so that one kernel binary could have either, neither or both. However, automatically loading the appropriate module is then impossible; if both provide the char-major-10-144 alias then the wrong module will end up being loaded. Hence a multi-platform kernel binary needs a single generic nvram module with alias char-major-10-144.

Therefore, drivers/char/nvram.c should be made more generic and the arch-specific code therein should be moved to a more appropriate place under arch/. Also, drivers/char/generic_nvram.c should be removed to reduce code duplication.

In this patch series, Atari-specific code is moved from the nvram module to arch/m68k/atari. More arch-specific code in the nvram module could be moved, probably to arch/x86, but it is difficult to determine just what code is relevant to ARM platforms and what code is x86-only.

In addressing code duplication, v1 of this patch series removes three inconsistent /dev/nvram misc device implementations. One of these, drivers/macintosh/nvram.c is entirely unused already. The other two, drivers/char/generic_nvram.c and the misc device implementation in arch/powerpc/kernel/nvram_64.c, are replaced by drivers/char/nvram.c.

A benefit of this work is better consistency -- between PPC32 and PPC64 as well as between PPC_PMAC and MAC. This new uniformity does have implications for userspace, that is, some error codes for some ioctl calls become consistent on all PowerPC platforms.

The drivers/char/nvram module becomes sufficiently generic to be useful to other platforms and architectures, besides those with "CMOS" RTC. At the end of this patch series the module is adopted by the m68k Mac port, which already has PRAM access functions but lacks the /dev/nvram misc device.

This patch series has been compile-tested for arm, m68k, powerpc and x86. The nvram and thinkpad_acpi modules were regression tested on a ThinkPad T43. The /dev/nvram functionality was also regression tested on a G3 PowerMac. The nvram module was also tested on a PowerBook 520, Quadra 650 and Atari Falcon. The PPC64 changes were tested on a G5 PowerMac.

Changes since v1:
- Minor changes to patches 7, 15 and 20 as described in commit logs.
- Revised patches 21 and 24 to address comments from Geert.

Changes since v2:
- Dropped patch 1, "macintosh/nvram: Remove as unused", because it has since been merged.
- Inserted a new patch, "m68k/mac: Use macros for RTC accesses not magic numbers".
- Revised patches 21 and 23 to address comments from Geert.

Changes since v3:
- Split the patch, "m68k/atari: Move Atari-specific code out of drivers/char/nvram.c", as suggested by Geert.
- Revised patches 11 and 25 to address comments from Geert.
- Minor change to patch 21 as described in commit log.

Changes since v4:
- Split the patch, "powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()", so as to separately address inconsistent use of Kconfig symbols in PowerMac fbdev drivers.
- Fix possible git bisect build failure with CONFIG_PPC_PMAC=n.

Changes since v5:
- Dropped patch 2, "char/nvram: Use bitwise OR to obtain Atari video mode data", since it has been added to Greg Kroah-Hartman's char-misc-next queue.
- In patch 15, error codes from the IOC_NVRAM_GET_OFFSET ioctl are now consistent with the old generic_nvram module.

Changes since v6:
- In patch 21, the '#ifdef CONFIG_NVRAM' conditional was changed to '#if defined(CONFIG_NVRAM) && defined(CONFIG_PPC32)' to avoid changing behaviour as CONFIG_NVRAM becomes available to PPC64.
- Added a new patch (22) in response to Ben's comment about XPRAM accessors. The patch replaces the calls to pmac_xpram_read() with calls to arch_nvram_ops.read_byte()

---
 arch/m68k/Kconfig                          |    3 
 arch/m68k/Kconfig.machine                  |    2 
 arch/m68k/atari/Makefile                   |    2 
 arch/m68k/atari/nvram.c                    |  291 +++++++++++
 arch/m68k/include/asm/atarihw.h            |    6 
 arch/m68k/include/asm/macintosh.h          |    4 
 arch/m68k/kernel/setup_mm.c                |  100 +++
 arch/m68k/mac/misc.c                       |  207 +++++---
 arch/powerpc/Kconfig                       |    5 
 arch/powerpc/include/asm/nvram.h           |   13 
 arch/powerpc/kernel/nvram_64.c             |  206 +-------
 arch/powerpc/kernel/setup_32.c             |   30 -
 arch/powerpc/platforms/chrp/Makefile       |    2 
 arch/powerpc/platforms/chrp/nvram.c        |   14 
 arch/powerpc/platforms/chrp/setup.c        |    2 
 arch/powerpc/platforms/powermac/Makefile   |    5 
 arch/powerpc/platforms/powermac/nvram.c    |   37 -
 arch/powerpc/platforms/powermac/setup.c    |    3 
 arch/powerpc/platforms/powermac/time.c     |   19 
 arch/powerpc/platforms/pseries/nvram.c     |    2 
 drivers/char/Kconfig                       |   13 
 drivers/char/Makefile                      |    6 
 drivers/char/generic_nvram.c               |  174 ------
 drivers/char/nvram.c                       |  740 ++++++++++++-----------------
 drivers/platform/x86/thinkpad_acpi.c       |   20 
 drivers/scsi/Kconfig                       |    6 
 drivers/scsi/atari_scsi.c                  |   16 
 drivers/video/fbdev/Kconfig                |    2 
 drivers/video/fbdev/controlfb.c            |    4 
 drivers/video/fbdev/imsttfb.c              |   17 
 drivers/video/fbdev/matrox/matroxfb_base.c |    6 
 drivers/video/fbdev/platinumfb.c           |    4 
 drivers/video/fbdev/valkyriefb.c           |   18 
 include/linux/nvram.h                      |   24 
 include/uapi/linux/pmu.h                   |    2 
 35 files changed, 1020 insertions(+), 985 deletions(-)

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev