Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Oct 2001 11:35:01 -0400
From:      "Alexander N. Kabaev" <ak03@gte.com>
To:        freebsd-current@freebsd.org
Subject:   Re: Weird PCI BIOS - long
Message-ID:  <20011003113501.A1533@kanpc.gte.com>
In-Reply-To: <200110030436.f934aX718507@harmony.village.org>
References:  <20011002170646.A81966@kanpc.gte.com> <200110030436.f934aX718507@harmony.village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> You lose.  Until someone writes a fallback for machines that don't
> have the BIOS32 entry point for PCIBIOS, you are stuck.
> 
> Warner

No I don't. I knew I will get bitten by putting my comments at the end
of the long message, but I did it nonetheless :(. Anyway, here is shorter
and hopefully more clear explanation:

When kernel boots, PCI BIOS call entry _is_ found, according to the
following log output:

bios32: Found BIOS32 Service Directory header at 0xc00fd800
bios32: Entry = 0xfd820 (c00fd820)  Rev = 0  Len = 1
pcibios: PCI BIOS entry at 0xfd880+0x0
                ^^^^^^^^^^^^^^^^^^^^^^^^^^ Here

Hovewher, kernel fails to realize, that the call entry is here because
entry address is a pair of non-zero base (0xfd880) and zero offset.
The code in sys/i386/pci_cfgreg.c is checking only offset to be non-null
and ignores base altogether and as a result it mistakenly thinks that
PCI BIOS call entry is not available. I patched the kernel to check for
base + offset with the patch below and now pci_get_version is able to to
a bios32 call and is correctly reporting PCI BIOS 2.10 present.
Unfortunately, that is the only good result caused by the patch, as
kernel freezes shortly after any key has been pressed on the console :(
Patch also changes pci_cfgintr to print out the PCI BIOS version
returned from pcibios_get_version and here are relevant lines from the
boot -v output produced by the modified kernel:

pcard0: <PC Card bus (classic)> on pcic0
pci_cfgintr: using BIOS 2.10 for interrupt routing
		^^^^^^^^^^^^^^^^^^^
pci_cfgintr_virgin: using routable PCI-only interrupt 11
pci_cfgintr: ROUTE_INTERRUPT failed.
pcic1: <TI PCI-1250 PCI-CardBus Bridge> mem 0x20821000-0x20821fff at device 2.1
on pci0
pci_cfgintr: using BIOS 2.10 for interrupt routing
pci_cfgintr_virgin: using routable PCI-only interrupt 11
pci_cfgintr: ROUTE_INTERRUPT failed.
pcic1: No PCI interrupt routed, trying ISA.
pcic1: Polling mode
pcic1: TI12XX PCI Config Reg: [ring enable][speaker enable][pwr save][CSC
parallel isa irq]


The patch is here: 
Index: pci_cfgreg.c
===================================================================
RCS file: /usr/ncvs/src/sys/i386/pci/pci_cfgreg.c,v
retrieving revision 1.80
diff -u -r1.80 pci_cfgreg.c
--- pci_cfgreg.c	28 Aug 2001 16:35:01 -0000	1.80
+++ pci_cfgreg.c	2 Oct 2001 19:10:07 -0000
@@ -94,7 +94,7 @@
 {
     struct bios_regs args;
 
-    if (PCIbios.entry == 0) {
+    if (BIOS_VADDRTOPADDR(PCIbios.ventry) == 0) {
 	PRVERB(("pcibios: No call entry point\n"));
 	return (0);
     }
@@ -244,7 +244,12 @@
 	  "pci_cfgintr: BIOS %x.%02x doesn't support interrupt routing\n",
 	  (v & 0xff00) >> 8, v & 0xff));
 	return (255);
+    } else {
+	PRVERB((
+	  "pci_cfgintr: using BIOS %x.%02x for interrupt routing\n",
+	  (v & 0xff00) >> 8, v & 0xff));
     }
+
     if ((bus < 0) || (bus > 255) || (device < 0) || (device > 255) ||
       (pin < 1) || (pin > 4))
 	return(255);
@@ -496,7 +501,7 @@
 {
     u_int16_t		v = 0;
     
-    if (PCIbios.entry != 0 && enable_pcibios) {
+    if (BIOS_VADDRTOPADDR(PCIbios.ventry) != 0 && enable_pcibios) {
 	v = pcibios_get_version();
 	if (v > 0)
 	    printf("pcibios: BIOS version %x.%02x\n", (v & 0xff00) >> 8,

--------------------------------------------
E-Mail: Alexander N. Kabaev <ak03@gte.com>
Date: 03-Oct-2001
Time: 10:55:24
--------------------------------------------

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011003113501.A1533>