[PATCH] Support for SRM environment variables through procfs

2001-06-18 Thread Jan-Benedict Glaw

Hi!

I've found a patch on Compaq's Jumpstart-CD which provides access to
SRM'S environment variables. I've ported that patch to 2.4.x and
here's the patch. Please test it. However, I've not got an Alpha
system booting via SRM handy so this patch is untested:-(

MfG, JBG

-- 
Fehler eingestehen, Größe zeigen: Nehmt die Rechtschreibreform zurück!!!
/* Jan-Benedict Glaw <[EMAIL PROTECTED]> -- +49-172-7608481 */
keyID=0x8399E1BB fingerprint=250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB
 "insmod vi.o and there we go..." (Alexander Viro on linux-kernel)


diff -Nur linux-2.4.6-pre1/Documentation/Configure.help 
linux-2.4.6-pre1-srm/Documentation/Configure.help
--- linux-2.4.6-pre1/Documentation/Configure.help   Tue Jun  5 11:24:47 2001
+++ linux-2.4.6-pre1-srm/Documentation/Configure.help   Tue Jun  5 12:15:29 2001
@@ -17311,6 +17311,16 @@
 
   If you're not sure, say N.
 
+SRM environment variables in procfs
+CONFIG_SRM_ENV
+  If you enable this option, a subdirectory called srm_environment
+  will give you access to the most important SRM environment
+  variables. If you've got an Alpha style system supporting
+  SRC, then it is a good idea to say Yes or Module to this driver.
+
+  This driver is also available as a module and will be called
+  srm_env.o if you build it as a module.
+  
 Footbridge internal watchdog
 CONFIG_21285_WATCHDOG
   The Intel Footbridge chip contains a builtin watchdog circuit. Say Y 
diff -Nur linux-2.4.6-pre1/arch/alpha/config.in 
linux-2.4.6-pre1-srm/arch/alpha/config.in
--- linux-2.4.6-pre1/arch/alpha/config.in   Tue Jun  5 11:22:08 2001
+++ linux-2.4.6-pre1-srm/arch/alpha/config.in   Tue Jun  5 12:15:29 2001
@@ -179,7 +179,7 @@
-o "$CONFIG_ALPHA_TAKARA" = "y" -o "$CONFIG_ALPHA_EB164" = "y" \
-o "$CONFIG_ALPHA_ALCOR" = "y"  -o "$CONFIG_ALPHA_MIATA" = "y" \
-o "$CONFIG_ALPHA_LX164" = "y"  -o "$CONFIG_ALPHA_SX164" = "y" \
-   -o "$CONFIG_ALPHA_NAUTILUS" = "y" ]
+   -o "$CONFIG_ALPHA_NAUTILUS" = "y" -o "$CONFIG_ALPHA_NONAME" = "y" ]
 then
   bool 'Use SRM as bootloader' CONFIG_ALPHA_SRM
 fi
@@ -235,6 +235,10 @@
"ELFCONFIG_KCORE_ELF\
 A.OUT  CONFIG_KCORE_AOUT" ELF
 fi
+if [ "$CONFIG_PROC_FS" != "n" -a CONFIG_ALPHA_SRM = "y" ]; then
+   tristate 'SRM environment through procfs' CONFIG_SRM_ENV
+fi
+ 
 tristate 'Kernel support for a.out (ECOFF) binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
diff -Nur linux-2.4.6-pre1/arch/alpha/kernel/Makefile 
linux-2.4.6-pre1-srm/arch/alpha/kernel/Makefile
--- linux-2.4.6-pre1/arch/alpha/kernel/Makefile Tue Jun  5 11:07:28 2001
+++ linux-2.4.6-pre1-srm/arch/alpha/kernel/Makefile Tue Jun  5 12:15:29 2001
@@ -32,6 +32,7 @@
 
 obj-$(CONFIG_SMP)+= smp.o irq_smp.o
 obj-$(CONFIG_PCI)+= pci.o pci_iommu.o
+obj-$(CONFIG_SRM_ENV)  += srm_env.o
 
 ifdef CONFIG_ALPHA_GENERIC
 
diff -Nur linux-2.4.6-pre1/arch/alpha/kernel/alpha_ksyms.c 
linux-2.4.6-pre1-srm/arch/alpha/kernel/alpha_ksyms.c
--- linux-2.4.6-pre1/arch/alpha/kernel/alpha_ksyms.cTue Jun  5 11:22:08 2001
+++ linux-2.4.6-pre1-srm/arch/alpha/kernel/alpha_ksyms.cTue Jun  5 12:16:35 
+2001
@@ -18,6 +18,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -56,6 +57,11 @@
 EXPORT_SYMBOL(probe_irq_mask);
 EXPORT_SYMBOL(screen_info);
 EXPORT_SYMBOL(perf_irq);
+#ifdef CONFIG_ALPHA_SRM
+EXPORT_SYMBOL(callback_getenv);
+EXPORT_SYMBOL(callback_setenv);
+EXPORT_SYMBOL(callback_save_env);
+#endif /* CONFIG_ALPHA_SRM */
 
 /* platform dependent support */
 EXPORT_SYMBOL(_inb);
diff -Nur linux-2.4.6-pre1/arch/alpha/kernel/srm_env.c 
linux-2.4.6-pre1-srm/arch/alpha/kernel/srm_env.c
--- linux-2.4.6-pre1/arch/alpha/kernel/srm_env.cThu Jan  1 01:00:00 1970
+++ linux-2.4.6-pre1-srm/arch/alpha/kernel/srm_env.cTue Jun  5 12:15:29 2001
@@ -0,0 +1,219 @@
+/*
+ * srm_env.c - Access to SRC environment variables through
+ * the linux procfs
+ *
+ * (C)2001, Jan-Benedict Glaw <[EMAIL PROTECTED]>
+ *
+ * This driver is at all a modified version of Erik Mouw's
+ * ./linux/Documentation/DocBook/procfs_example.c, so: thanky
+ * you, erik! He can be reached via email at
+ * <[EMAIL PROTECTED]>. It is based on an idea
+ * provided by DEC^WCompaq's "Jumpstart" CD. They included
+ * a patch like this as well. Thanks for idea!
+ *
+ *
+ * This software has been developed while working on the LART
+ * computing board (http://www.lart.tudelft.nl/). The
+ * development has been sponsored by the Mobile Multi-media
+ * Communications (http://www.mmc.tudelft.nl/) and Ubiquitous
+ * Communications (http://www.ubicom.tudelft.nl/) projects.
+ *
+ * This program is free software; you can redistribute
+ * it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software
+ * Foundation version 2.
+ *
+ * This program is distributed in the hope 

[PATCH] Support for SRM environment variables through procfs

2001-06-18 Thread Jan-Benedict Glaw

Hi!

I've found a patch on Compaq's Jumpstart-CD which provides access to
SRM'S environment variables. I've ported that patch to 2.4.x and
here's the patch. Please test it. However, I've not got an Alpha
system booting via SRM handy so this patch is untested:-(

MfG, JBG

-- 
Fehler eingestehen, Größe zeigen: Nehmt die Rechtschreibreform zurück!!!
/* Jan-Benedict Glaw [EMAIL PROTECTED] -- +49-172-7608481 */
keyID=0x8399E1BB fingerprint=250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB
 insmod vi.o and there we go... (Alexander Viro on linux-kernel)


diff -Nur linux-2.4.6-pre1/Documentation/Configure.help 
linux-2.4.6-pre1-srm/Documentation/Configure.help
--- linux-2.4.6-pre1/Documentation/Configure.help   Tue Jun  5 11:24:47 2001
+++ linux-2.4.6-pre1-srm/Documentation/Configure.help   Tue Jun  5 12:15:29 2001
@@ -17311,6 +17311,16 @@
 
   If you're not sure, say N.
 
+SRM environment variables in procfs
+CONFIG_SRM_ENV
+  If you enable this option, a subdirectory called srm_environment
+  will give you access to the most important SRM environment
+  variables. If you've got an Alpha style system supporting
+  SRC, then it is a good idea to say Yes or Module to this driver.
+
+  This driver is also available as a module and will be called
+  srm_env.o if you build it as a module.
+  
 Footbridge internal watchdog
 CONFIG_21285_WATCHDOG
   The Intel Footbridge chip contains a builtin watchdog circuit. Say Y 
diff -Nur linux-2.4.6-pre1/arch/alpha/config.in 
linux-2.4.6-pre1-srm/arch/alpha/config.in
--- linux-2.4.6-pre1/arch/alpha/config.in   Tue Jun  5 11:22:08 2001
+++ linux-2.4.6-pre1-srm/arch/alpha/config.in   Tue Jun  5 12:15:29 2001
@@ -179,7 +179,7 @@
-o $CONFIG_ALPHA_TAKARA = y -o $CONFIG_ALPHA_EB164 = y \
-o $CONFIG_ALPHA_ALCOR = y  -o $CONFIG_ALPHA_MIATA = y \
-o $CONFIG_ALPHA_LX164 = y  -o $CONFIG_ALPHA_SX164 = y \
-   -o $CONFIG_ALPHA_NAUTILUS = y ]
+   -o $CONFIG_ALPHA_NAUTILUS = y -o $CONFIG_ALPHA_NONAME = y ]
 then
   bool 'Use SRM as bootloader' CONFIG_ALPHA_SRM
 fi
@@ -235,6 +235,10 @@
ELFCONFIG_KCORE_ELF\
 A.OUT  CONFIG_KCORE_AOUT ELF
 fi
+if [ $CONFIG_PROC_FS != n -a CONFIG_ALPHA_SRM = y ]; then
+   tristate 'SRM environment through procfs' CONFIG_SRM_ENV
+fi
+ 
 tristate 'Kernel support for a.out (ECOFF) binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
diff -Nur linux-2.4.6-pre1/arch/alpha/kernel/Makefile 
linux-2.4.6-pre1-srm/arch/alpha/kernel/Makefile
--- linux-2.4.6-pre1/arch/alpha/kernel/Makefile Tue Jun  5 11:07:28 2001
+++ linux-2.4.6-pre1-srm/arch/alpha/kernel/Makefile Tue Jun  5 12:15:29 2001
@@ -32,6 +32,7 @@
 
 obj-$(CONFIG_SMP)+= smp.o irq_smp.o
 obj-$(CONFIG_PCI)+= pci.o pci_iommu.o
+obj-$(CONFIG_SRM_ENV)  += srm_env.o
 
 ifdef CONFIG_ALPHA_GENERIC
 
diff -Nur linux-2.4.6-pre1/arch/alpha/kernel/alpha_ksyms.c 
linux-2.4.6-pre1-srm/arch/alpha/kernel/alpha_ksyms.c
--- linux-2.4.6-pre1/arch/alpha/kernel/alpha_ksyms.cTue Jun  5 11:22:08 2001
+++ linux-2.4.6-pre1-srm/arch/alpha/kernel/alpha_ksyms.cTue Jun  5 12:16:35 
+2001
@@ -18,6 +18,7 @@
 #include linux/mm.h
 
 #include asm/io.h
+#include asm/console.h
 #include asm/hwrpb.h
 #include asm/uaccess.h
 #include asm/processor.h
@@ -56,6 +57,11 @@
 EXPORT_SYMBOL(probe_irq_mask);
 EXPORT_SYMBOL(screen_info);
 EXPORT_SYMBOL(perf_irq);
+#ifdef CONFIG_ALPHA_SRM
+EXPORT_SYMBOL(callback_getenv);
+EXPORT_SYMBOL(callback_setenv);
+EXPORT_SYMBOL(callback_save_env);
+#endif /* CONFIG_ALPHA_SRM */
 
 /* platform dependent support */
 EXPORT_SYMBOL(_inb);
diff -Nur linux-2.4.6-pre1/arch/alpha/kernel/srm_env.c 
linux-2.4.6-pre1-srm/arch/alpha/kernel/srm_env.c
--- linux-2.4.6-pre1/arch/alpha/kernel/srm_env.cThu Jan  1 01:00:00 1970
+++ linux-2.4.6-pre1-srm/arch/alpha/kernel/srm_env.cTue Jun  5 12:15:29 2001
@@ -0,0 +1,219 @@
+/*
+ * srm_env.c - Access to SRC environment variables through
+ * the linux procfs
+ *
+ * (C)2001, Jan-Benedict Glaw [EMAIL PROTECTED]
+ *
+ * This driver is at all a modified version of Erik Mouw's
+ * ./linux/Documentation/DocBook/procfs_example.c, so: thanky
+ * you, erik! He can be reached via email at
+ * [EMAIL PROTECTED]. It is based on an idea
+ * provided by DEC^WCompaq's Jumpstart CD. They included
+ * a patch like this as well. Thanks for idea!
+ *
+ *
+ * This software has been developed while working on the LART
+ * computing board (http://www.lart.tudelft.nl/). The
+ * development has been sponsored by the Mobile Multi-media
+ * Communications (http://www.mmc.tudelft.nl/) and Ubiquitous
+ * Communications (http://www.ubicom.tudelft.nl/) projects.
+ *
+ * This program is free software; you can redistribute
+ * it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software
+ * Foundation version 2.
+ *
+ * This program is