Skip to contentSkip to conversation

nvram - add Cobalt support

PATCH New Tim Hockin 1 participant 1 message Aug 6, 2002 Char and misc drivers

lore
Share & tools
lore

Tim Hockin

author
#0 lore raw

PATCH 1/1 nvram - add Cobalt support

This patch adds support for Cobalt systems to the nvram driver. In the process, the nvram symbols were exported, and a few other minor cleanup went in. This iwll soon be available through bk, but I thought I'd solicit any gripes before I push it up. :)

This is another in a series of patches trying desperately to get our tree synced :). If it all looks ok, I'll ask Marcelo and Linus to pull it.

Tim

Signature · 4 lines
Tim Hockin
Systems Software Engineer
Sun Microsystems, Cobalt Server Appliances
[email protected]

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.582.2.80 -> 1.582.2.81
# include/linux/nvram.h 1.1 -> 1.3
# drivers/char/nvram.c 1.9 -> 1.11
# drivers/char/Makefile 1.18 -> 1.19
# Documentation/Configure.help 1.110 -> 1.111
# (new) -> 1.2 include/linux/cobalt-nvram.h
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/08/02 [email protected] 1.582.2.81
# Add Cobalt Networks support to nvram driver

# export nvram interfaces
# general cleanup of nvram driver
# protect nvram state with a lock
# fix nvram O_EXCL hack to actually work
# --------------------------------------------
#
diff -Nru a/Documentation/Configure.help b/Documentation/Configure.help
--- a/Documentation/Configure.help	Mon Aug  5 18:55:26 2002
+++ b/Documentation/Configure.help	Mon Aug  5 18:55:26 2002
@@ -18187,9 +18187,10 @@
 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
-  in the real time clock (RTC), which is contained in every PC and
-  most Ataris.
+  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.  The actual number of bytes varies, depending on the
+  nvram in the system, but is usually 114 (128-14 for the RTC).

This memory is conventionally called "CMOS RAM" on PCs and "NVRAM" on Ataris. /dev/nvram may be used to view settings there, or to

drivers/char/Makefile +1 -1
diff -Nru a/drivers/char/Makefile b/drivers/char/Makefile
@@ -24,7 +24,7 @@
 export-objs     :=	busmouse.o console.o keyboard.o sysrq.o \
 			misc.o pty.o random.o selection.o serial.o \
 			sonypi.o tty_io.o tty_ioctl.o generic_serial.o \
-			au1000_gpio.o
+			au1000_gpio.o nvram.o
 
 mod-subdirs	:=	joystick ftape drm drm-4.0 pcmcia
 
drivers/char/nvram.c +304 -101

645 lines not on this page · raw message

include/linux/cobalt-nvram.h new file +109 -0

109 lines not on this page · raw message

include/linux/nvram.h +16 -6
diff -Nru a/include/linux/nvram.h b/include/linux/nvram.h
@@ -4,14 +4,24 @@
 #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 */
+
+/* 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);
 #endif
 
 #endif  /* _LINUX_NVRAM_H */