biggish NVRAM driver patch
Subsystems (2)
PATCH 1/1 biggish NVRAM driver patch
All,
Attached is a largish patch to nvram.c for various things. We've been using this for some time, and I have submitted it a few times before. Last time it was OK'ed, but never turned up in a release.
* Paging - support paged NVRAMs
* Formatting - nice on all tabstops
* Cobalt support - have the ability to dump cobalt information
* Natsemi superio paging support
Please apply for the next 2.4.x, or let me know if anything is wrong with the patch.
Thanks!
p.s. - is there a maintainer for the NVRAM driver? If not I volunteer to take it over.
Tim
Signature · 4 lines
Tim Hockin Systems Software Engineer Sun Microsystems, Cobalt Server Appliances [email protected]
Documentation/Configure.help +13 -2
@@ -15038,9 +15177,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
@@ -15058,6 +15199,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_PC87317 + 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
@@ -182,6 +182,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_PC87317 +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 +568 -137
1,016 lines not on this page · raw message
include/linux/cobalt-nvram.h +112 -0
112 lines not on this page · raw message
include/linux/nvram.h +28 -6
@@ -4,14 +4,36 @@#include <linux/ioctl.h> /* /dev/nvram ioctls */ -#define NVRAM_INIT _IO('p', 0x40)/* initialize NVRAM and set checksum */ -#define NVRAM_SETCKS _IO('p', 0x41)/* recalculate checksum */ +#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 + + +/* for all current systems, this is where NVRAM starts */ +#define NVRAM_FIRST_BYTE 14 + +/* all these functions expect an NVRAM offset, not an absolute */ +#define NVRAM_OFFSET (x) ((x)-NVRAM_FIRST_BYTE)#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 ); +/* __foo is foo without grabbing the rtc_lock - get it yourself */ +extern unsigned char nvram_read_byte (int i); +extern unsigned char __nvram_read_byte (int i); +extern void nvram_write_byte (unsigned char c,int i); +extern void __nvram_write_byte (unsigned char c,int i); +extern int nvram_check_checksum (void ); +extern int __nvram_check_checksum (void ); +extern void nvram_set_checksum (void ); +extern void __nvram_set_checksum (void ); +extern unsigned char nvram_read_page_byte (int page,int i); +extern unsigned char __nvram_read_page_byte (int page,int i); +extern void nvram_write_page_byte (int page,unsigned char c,int i); +extern void __nvram_write_page_byte (int page,unsigned char c,int i);#endif #endif /* _LINUX_NVRAM_H */