Linux should not set the "PnP OS" boot flag
My problem was: After running a recent 2.4.x kernel, on a subsequent boot of Linux, all configurable devices (internal modem, audio chip, parallel, serial and IR ports) were disabled. This would causes oopses in my sound device drivers.
My workarounds were:
(1) to reinitialize the BIOS prior to booting, or,
(2) to run "setpnp on" on all the configurable devices early in the boot sequence.
I just now figured out what was going on. When the PnP BIOS is going to boot a non-PnP OS, it configures all configurable devices itself. When the PnP BIOS is going to boot a PnP OS (which it tells from a "boot flag") it leaves configurable devices, other than those needed to boot the OS, unconfigured. Recent Linux kernels have set the "boot flag" indicating that the OS being booted is a PnP OS.
Unfortunately, Linux isn't really a "PnP OS". The kernel alone doesn't configure the devices. One has to use setpnp to do that.
On the ThinkPad there is an additional solution:
(3) Disable QuickBoot in EasySetup Config (the BIOS setup program)
The PnP BIOS mode in which it refrains from configuring the configurable devices (because it thinks it's booting a PnP OS) is called "QuickBoot" on the ThinkPad. Recent Linux kernels switch on QuickBoot. However if QuickBoot is disabled in EasySetup then the boot flag is ignored and the PnP BIOS goes ahead and configures the devices itself. One can still use setpnp to reconfigure the devices, so this doesn't create a problem.
The best solution, though, is
(4) to modify Linux so that it doesn't set the QuickBoot boot flag. The problem isn't just that Linux isn't a PnP OS. It's that Linux can't possibly know in a multi-boot setup WHICH OS is going to be booted _next_. So it just shouldn't futz with that boot flag. Instead, control over the flag should be given to the user via a /proc entry or something like that. I append a short patch to remove the bit of code that sets the boot flag. (I see where the function also zeroes out the sbf value if it appears not to be a valid value. That seems rather rash to me, but I leave it alone because I don't understand why it's there.)
Thanks to [email protected] for pointing me to the bootflag code, of whose existence I was until recently unaware.
--
Thomas Hood
The patch:
arch/i386/kernel/bootflag.c +1 -1
@@ -119,7 +119,7 @@u8 v =sbf_read ();if (!sbf_value_valid (v)) v =0 ; -#if defined(CONFIG_PNPBIOS ) +#if 0 // WAS: #if defined(CONFIG_PNPBIOS) /* Tell the BIOS to fast init as we are a PnP OS */ v |= (1 <<0 );/* Set PNPOS flag */ #endif
Quoted 18 lines · Thomas Hood
My problem was: After running a recent 2.4.x kernel, on a subsequent boot of Linux, all configurable devices (internal modem, audio chip, parallel, serial and IR ports) were disabled. This would causes oopses in my sound device drivers.
My workarounds were:
(1) to reinitialize the BIOS prior to booting, or,
(2) to run "setpnp on" on all the configurable devices early in the boot sequence.I just now figured out what was going on. When the PnP BIOS is going to boot a non-PnP OS, it configures all configurable devices itself. When the PnP BIOS is going to boot a PnP OS (which it tells from a "boot flag") it leaves configurable devices, other than those needed to boot the OS, unconfigured. Recent Linux kernels have set the "boot flag" indicating that the OS being booted is a PnP OS.
Quoted 2 lines
Unfortunately, Linux isn't really a "PnP OS". The kernel alone doesn't configure the devices. One has to use setpnp to do that.
Hmm. Linux isn't quite a "PnP OS". I agree that in the short term we should not set the boot flag. But we should also investigate what needs to added so that setpnp does not need to be called.
In the normal case the pci subsystem gets this correct, and we need the logic to get this correct to support hot plug devices.
Do you have any insite into what needs to be done so that the kernel will automatically configure isa pnp devices?
Eric
Quoted 2 lines
Do you have any insite into what needs to be done so that the kernel will automatically configure isa pnp devices?
We already configure isapnp devices. We don't yet configure all the PnPbios devices
Quoted 5 lines · Alan Cox
Quoted 2 lines
Do you have any insite into what needs to be done so that the kernel will automatically configure isa pnp devices?
We already configure isapnp devices. We don't yet configure all the PnPbios devices
O.k. I'm getting more interested as I read this. So we have things like superio chips and the like with configureable resources, (and possibly some pci<->isa bridge resources that need to bec onfigured.)
Coming from the linuxBIOS side I'm interested as that will allow me to rip out more code, from linuxBIOS. And I think it is only sane to report such devices.
I don't know about the stock BIOS interfaces to those devices though. I'll keep an eye on them and see what I can do. Hopefully within the next couple of mounths I can start attacking this problem.
Eric