Skip to contentSkip to conversation

sysctl interface to bootflags?

DISCUSSION Thomas Hood 3 participants 10 messages Oct 9, 2001

lore
Share & tools
lore
#0 lore raw

As I've said, I think it would be nice to have /proc control over two boot flags: the DIAG bit (which switches on (1) and off (0) the BIOS diagnostics) and the PnP-OS bit (which switches on (0) and off (1) PnP BIOS device configuration).

Would it be a good idea to do this using the sysctl infrastructure? If so, can someone please suggest an appropriate pathname for the flag files? How about "/proc/sys/BIOS/bootflags/diagnostics" and "/proc/sys/BIOS/bootflags/PnP-OS" ?

If this is a bad idea, someone please stop me before I waste my time implementing it.

--
Thomas

#1 lore raw
Quoted 4 lines

Would it be a good idea to do this using the sysctl infrastructure? If so, can someone please suggest an appropriate pathname for the flag files? How about "/proc/sys/BIOS/bootflags/diagnostics" and "/proc/sys/BIOS/bootflags/PnP-OS" ?

Userspace can already do it via /dev/nvram

#2 lore raw
Quoted 1 line · Alan Cox

Userspace can already do it via /dev/nvram

I see. Good.

I think that it would be helpful if the title for this feature in the kernel configuration menu was something more explanatory than "/dev/nvram support". I thought this had something to do with video RAM!

Cheers
Thomas

#3 lore raw
In reply to Thomas Hood
Quoted 6 lines · Thomas Hood

Would it be a good idea to do this using the sysctl infrastructure? If so, can someone please suggest an appropriate pathname for the flag files? How about "/proc/sys/BIOS/bootflags/diagnostics" and "/proc/sys/BIOS/bootflags/PnP-OS" ?
If this is a bad idea, someone please stop me before I waste my time implementing it.

Last week, I pointed you at http://www.codemonkey.org.uk/sbf.c
Can you give a reason why this needs to be done in kernel space ?

regards,

Dave.

Signature · 2 lines
| Dave Jones.        http://www.suse.de/~davej
| SuSE Labs
#4 lore raw

Hi. I looked at your code and I saw that it depended on ACPI. Since ACPI doesn't work on my machine, I thought I should look for another solution. However, Alan now tells me that what I want to do can already be done via /dev/nvram.

Thanks to both of you.
Thomas

Quoted 15 lines · Dave Jones
Quoted 6 lines · Thomas Hood

Would it be a good idea to do this using the sysctl infrastructure? If so, can someone please suggest an appropriate pathname for the flag files? How about "/proc/sys/BIOS/bootflags/diagnostics" and "/proc/sys/BIOS/bootflags/PnP-OS" ?
If this is a bad idea, someone please stop me before I waste my time implementing it.

Last week, I pointed you at http://www.codemonkey.org.uk/sbf.c
Can you give a reason why this needs to be done in kernel space ?

regards,

Dave.

#5 lore raw
Quoted 3 lines · Thomas Hood

Hi. I looked at your code and I saw that it depended on ACPI. Since ACPI doesn't work on my machine, I thought I should look for another solution. However,

Huh ? Read the code again.
Its no more dependant upon ACPI than bootflag.c is. The bootflag is pointed at by an ACPI table. The code I wrote functions /exactly/ the same on a kernel with APM, ACPI or NO power management.

Quoted 2 lines

Alan now tells me that what I want to do can already be done via /dev/nvram.

My code _is_ using /dev/nvram !

regards,

Dave.

Signature · 2 lines
| Dave Jones.        http://www.suse.de/~davej
| SuSE Labs
#6 lore raw

Sorry, I didn't read your code very carefully before because I thought it relied on ACPI. Now I understand it better. It doesn't use /dev/nvram, but /dev/mem.

Here's what happens when I run it.

jdthood@thanatos:~/src/sbf$ gcc sbf.c
jdthood@thanatos:~/src/sbf$ su
Password: 
root@thanatos:/home/jdthood/src/sbf# gdb -q ./a.out
(no debugging symbols found)...(gdb) run
Starting program: /mnt/p/home/jdthood/src/sbf/./a.out 
BOOT @ 0x07fd0040
CMOS register:51
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x80489be in outb_p ()

--
Thomas

Quoted 25 lines · Dave Jones
Quoted 3 lines · Thomas Hood

Hi. I looked at your code and I saw that it depended on ACPI. Since ACPI doesn't work on my machine, I thought I should look for another solution. However,

Huh ? Read the code again.
Its no more dependant upon ACPI than bootflag.c is. The bootflag is pointed at by an ACPI table. The code I wrote functions /exactly/ the same on a kernel with APM, ACPI or NO power management.

Quoted 2 lines

Alan now tells me that what I want to do can already be done via /dev/nvram.

My code _is_ using /dev/nvram !

regards,

Dave.

Signature · 2 lines
| Dave Jones.        http://www.suse.de/~davej
| SuSE Labs
#7 lore raw
Quoted 3 lines · Thomas Hood
jdthood@thanatos:~/src/sbf$ gcc sbf.c
Program received signal SIGSEGV, Segmentation fault.
0x80489be in outb_p ()

outb doesn't work unless you compile with -O2 iirc.

regards,

Dave.

Signature · 2 lines
| Dave Jones.        http://www.suse.de/~davej
| SuSE Labs
#8 lore raw
jdthood@thanatos:~/src/sbf$ gcc -O2 sbf.c
jdthood@thanatos:~/src/sbf$ su
Password: 
root@thanatos:/home/jdthood/src/sbf# l
./  ../  a.out*  sbf.c
root@thanatos:/home/jdthood/src/sbf# ./a.out
BOOT @ 0x07fd0040
CMOS register:51
Segmentation fault

:(

Thomas

Quoted 16 lines · Dave Jones
Quoted 3 lines · Thomas Hood
jdthood@thanatos:~/src/sbf$ gcc sbf.c
Program received signal SIGSEGV, Segmentation fault.
0x80489be in outb_p ()

outb doesn't work unless you compile with -O2 iirc.

regards,

Dave.

Signature · 2 lines
| Dave Jones.        http://www.suse.de/~davej
| SuSE Labs
#9 lore raw
Quoted 2 lines · Thomas Hood
jdthood@thanatos:~/src/sbf$ gcc -O2 sbf.c
Segmentation fault

Ok, I managed to repeat this here. Fortunatly, the pending fixes from Randy Dunlap include a fix for this. Updated version at http://www.codemonkey.org.uk/cruft/
(including a version with the /dev/nvram using interface which got dropped for reasons I don't recall).

regards,

Dave.

Signature · 2 lines
| Dave Jones.        http://www.suse.de/~davej
| SuSE Labs