try #2 - nvram driver work
Subsystems (2)
PATCH 1/1 try #2 - nvram driver work
I've fixed the formatting better, and fixed the bug whereby PC's could not access the top 64 bytes of NVRAM again.
Linus et al,
Attached is a patch for the nvram driver. I've submitted it before, and Alan OK'ed it, but it didn't wind up in 2.4.7 or 2.4.8.
This patch does 4 main things:
1) Add generic support for paged nvrams, and supporting ioctls
2) Add a 'Magic' page for system-specific NVRAM-like things
3) Add support for NatSemi PC[89]7317 paged nvram
4) Add support for Cobalt's magic page
It also does some re-formatting, so things look good at tabstops between 1 and 8.
We've been using this patch for months. Please apply it to the next 2.4.x kernel, or let me know if you have problems with it. It is against 2.4.8 and should patch cleanly (just a bit of fuzz).
thanks
Tim
Signature · 4 lines
Tim Hockin Systems Software Engineer Sun Microsystems, Cobalt Server Appliances [email protected]
Documentation/Configure.help +13 -2
@@ -14836,9 +14971,11 @@ CONFIG_NVRAM If you say Y here and create a character special file /dev/nvram with major number 10 and minor number 144 using mknod ("man mknod"), - you get read and write access to the 50 bytes of non-volatile memory + you get read and write access to the extra bytes of non-volatile memory in the real time clock (RTC), which is contained in every PC and - most Ataris. + most Ataris. The actual number of bytes varies, depending on the + nvram in the system, but is usually 50. In addition, multiple banks or + 'pages' of nvram may be available. This memory is conventionally called "CMOS RAM" on PCs and "NVRAM" on Ataris. /dev/nvram may be used to view settings there, or to
@@ -14856,6 +14993,15 @@ inserted in and removed from the running kernel whenever you want). The module will be called nvram.o. If you want to compile it as a module, say M here and read Documentation/modules.txt. + +NatSemi PC[89]7317 paged NVRAM support +CONFIG_NVRAM_NATSEMI + If you have a National Semiconductor PC87317 or PC97317 Superio chip, + you may want to say Y here. This provides access to NVRAM pages other + than the default. Some systems, like some Cobalt Networks servers, use + these other pages. + + If in doubt, say N here. Joystick support CONFIG_JOYSTICK
drivers/char/Config.in +3 -0
@@ -162,6 +162,9 @@ dep_tristate 'Intel i8x0 Random Number Generator support' CONFIG_INTEL_RNG $CONFIG_PCI tristate '/dev/nvram support' CONFIG_NVRAM +if [ "$CONFIG_NVRAM" = "y" -o "$CONFIG_NVRAM" = "m" ]; then + bool ' NatSemi PC[89]7317 paged NVRAM support' CONFIG_NVRAM_NATSEMI +fi tristate 'Enhanced Real Time Clock Support' CONFIG_RTC if [ "$CONFIG_IA64" = "y" ]; then bool 'EFI Real Time Clock Services' CONFIG_EFI_RTC
drivers/char/nvram.c +595 -113
966 lines not on this page · raw message
include/linux/cobalt-nvram.h +115 -0
115 lines not on this page · raw message
include/linux/nvram.h +8 -0
@@ -6,12 +6,20 @@/* /dev/nvram ioctls */ #define NVRAM_INIT _IO('p', 0x40)/* initialize NVRAM and set checksum */ #define NVRAM_SETCKS _IO('p', 0x41)/* recalculate checksum */ +#define NVRAM_GETPAGE _IO('p', 0x42)/* get nvram page */ +#define NVRAM_SETPAGE _IO('p', 0x43)/* set nvram page */ +#define NVRAM_GETNPAGES _IO('p', 0x44)/* get the number of pages */ +#define NVRAM_GETSIZE _IO('p', 0x45)/* get the nvram page size */ + +#define NVRAM_MAGIC_PAGE 0x10000#ifdef __KERNEL__extern unsigned char nvram_read_byte (int i );extern void nvram_write_byte (unsigned char c,int i );extern int nvram_check_checksum (void );extern void nvram_set_checksum (void ); +extern void nvram_set_page (int newpage); +extern int nvram_get_page (void );#endif #endif /* _LINUX_NVRAM_H */