Subject: Re: CVS commit: syssrc
To: None <jhawk@MIT.EDU>
From: Noriyuki Soda <soda@sra.co.jp>
List: source-changes
Date: 07/19/2000 03:31:02
jhawk wrote:
> | 	  syssrc/sys/arch/i386/pci: pci_intr_fixup.c
> ...
> | cvs rdiff -r1.6 -r1.7 syssrc/sys/arch/i386/pci/pci_intr_fixup.c
> 
> This stuff is pretty confusing already. Could some of the documentation
> that you've placed in the log messages make it somewhere that's useful
> to users trying to configure this, such as pcibios(4)?

I hope that GENERIC configuration has the following options.
(i.e. almost all PCIBIOS options enabled.)

# Configure PCI using BIOS information
options 	PCIBIOS			# PCI BIOS support
options 	PCIBIOSVERBOSE		# PCI BIOS verbose info
options 	PCIBIOS_BUS_FIXUP	# fixup PCI bus numbering
options 	PCIBIOS_ADDR_FIXUP	# fixup PCI I/O addresses
options 	PCIBIOS_INTR_FIXUP	# fixup PCI interrupt routing
options 	PCIBIOS_IRQS_HINT=0	# PCI interrupts hint.
#options 	PCIINTR_DEBUG		# super-verbose PCI interrupt fixup

I suppose that PCIBIOS_BUS_FIXUP is already stable, and probably 
it is OK to enable this option by default.

Uchiyama-san said PCIBIOS_ADDR_FIXUP may still have problem with
pccbb (cardbus bridge), so probably it is a bit early to to enable 
this for now.

About PCIBIOS_INTR_FIXUP, I believe that pci_intr_fixup.c revision 1.7 
is more robust than previous version. So, please try to enable 
this option with the revision 1.7. I hope this option enabled 
in NetBSD-1.5.


Anyway, the description of pcibios.4 should be improved.
For example, I think pcibios.4 should have the following descriptions.
(Please correct if there is incorrect or misleading description,
 also please correct mistakes about English expression.)

------------------------------------------------------------------------
PCIBIOS_ADDR_FIXUP
	Some BIOS doesn't allocate I/O space and memory space for 
	some PCI devices. Especially, BIOS which is PnP OS mode 
	enabled shows this behavior. Also many BIOS leaves CardBus
	bridge's space unallocated. Since necessary space isn't
	allocated, those devices will not work in this situation.

	This option allocates the I/O space and memory space
	instead of such BIOS.

	If the space is already correctly assigned to devices,
	this option leaves I/O space and memory space as is,

PCIBIOS_BUS_FIXUP
	Each PCI bus and CardBus should have unique bus number. 
	But some BIOS doesn't assign bus number for subordinate 
	PCI buses. And many BIOS doesn't assign bus number for 
	CardBuses.
	Typical symptom of this is the following boot message:
		cardbus0 at cardslot0: bus 0 device 0...
	Please note that this cardbus0 has a bus number `0',
	but normally the bus number 0 is used by the machine's
	primary PCI bus, thus, this bus number for cardbus is
	incorrect (not assigned). In this situation, a device
	located in cardbus0 doesn't show correct device ID,
	because it's bus number 0 incorrectly refers primary 
	PCI bus, a device ID in the primary PCI bus are shown
	in boot message instead of the device's ID in the cardbus0.

	This option assigns bus numbers for all subordinate
	PCI buses and CardBuses.

	Since this option renumbers all PCI buses and CardBuses,
	all bus numbers of subordinate buses becomes different
	when this option enabled.

PCIBIOS_INTR_FIXUP
	Some BIOS doesn't assign interrupt for some devices.

	This option assigns interrupt for such devices instead
	of such BIOS.

	This option leaves already assigned interrupt as is.

PCIBIOS_IRQS_HINT
	PCIBIOS_INTR_FIXUP tries to detect a IRQ which can be used
	for a PCI device. This option specifies a hint which is 
	used when the automatic IRQ detection doesn't work.

	Ths value is a logical-or of power-of-2s of allowable interrupts:
	IRQ Val      IRQ Val      IRQ Val       IRQ Val
	 0  0x0001    4  0x0010    8  0x0100    12  0x1000
	 1  0x0002    5  0x0020    9  0x0200    13  0x2000
	 2  0x0004    6  0x0040   10  0x0400    14  0x4000
	 3  0x0008    7  0x0080   11  0x0800    15  0x8000
	For example, "options PCIBIOS_IRQS_HINT=0x0a00" allows 
	irq 9 and irq 11.

	Kernel global variable `pcibios_irqs_hint' holds this value,
	so a user can override this value without kernel recompilation.
	For example:
	- To specify this value on the fly, type "boot -d" on
	  boot prompt to drop into DDB (the in-kernel debuger, 
	  you have to specify "options DDB" to make kernel with DDB).
	  Specify "write pcibios_irqs_hint 0x0a00" on "db>" prompt 
	  and type "c" to continue to boot.
	- To modify kernel image without kernel recompilation,
	  run "gdb --write /netbsd" on shell, 
	  type "set pcibios_irqs_hint=0xa00" on "(gdb)" prompt, 
	  and type "quit" 

PCIBIOS_INTR_FIXUP_FORCE
	Some buggy BIOS provides inconsistent information between
	PCI Interrupt Configuration Register and PCI Interrupt
	Routing table. In such case, PCI Interrupt Configuration 
	Register takes precedence by default. If this happens,
	a kernel with PCIBIOSVERBOSE shows "WARNING: leave irq XX"
	in the PCI routing table.

	If PCIBIOS_INTR_FIXUP_FORCE is specified in addtion to
	PCIBIOS_INTR_FIXUP, PCI Interrupt Routing table takes
	precedence. In this case, a kernel with PCIBIOSVERBOSE 
	shows "WARNING: override irq XX" in the PCI routing table.

PCIINTR_DEBUG
	Display detailed information about PCIBIOS_INTR_FIXUP processing.

PCIBIOS
	If one of the above PCIBIOS_* options is used, this option
	should be specified, too.

PCIBIOSVERBOSE
	Display information about PCIBIOS processing.
------------------------------------------------------------------------
--
soda