Skip to contentSkip to conversation

nvram driver

PATCH New Tim Hockin 1 participant 1 message Jul 10, 2001

Subsystems (2)
lore
Share & tools
lore

Tim Hockin

author
#0 lore raw

PATCH 1/1 nvram driver

All,

Attached is a patch to the nvram driver.

* Add support (via ioctl()) for paged nvram systems
* Add support for NatSemi PC[89]7317 chips to be paged
* Add Cobalt Networks support to NVRAM
* Make NVRAM_BYTES be machine dependant
* Add a 'magic' page for machine-specific NVRAM-like functions
* spinlock the nvram state
* remove a lock_kernel()
* Add Cobalt Magic page support

Please let me know if there is any reason this can not be included in the general kernel source.

Thanks

Tim

Signature · 4 lines
Tim Hockin
Systems Software Engineer
Sun Microsystems, Cobalt Server Appliances
[email protected]
Documentation/Configure.help +13 -2
diff -ruN dist-2.4.6/Documentation/Configure.help cobalt-2.4.6/Documentation/Configure.help
@@ -14649,9 +14784,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
@@ -14669,6 +14806,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
diff -ruN dist-2.4.6/drivers/char/Config.in cobalt-2.4.6/drivers/char/Config.in
@@ -158,6 +158,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 +530 -47

772 lines not on this page · raw message

include/linux/cobalt-nvram.h +114 -0

114 lines not on this page · raw message

include/linux/nvram.h +8 -0
diff -ruN dist-2.4.6/include/linux/nvram.h cobalt-2.4.6/include/linux/nvram.h
@@ -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 */