From owner-freebsd-current Fri Apr 12 5: 3:44 2002 Delivered-To: freebsd-current@freebsd.org Received: from mailout.informatik.tu-muenchen.de (mailout.informatik.tu-muenchen.de [131.159.0.5]) by hub.freebsd.org (Postfix) with ESMTP id 88E0037B419; Fri, 12 Apr 2002 05:03:08 -0700 (PDT) Received: from mailrelay2.informatik.tu-muenchen.de (mailrelay2.informatik.tu-muenchen.de [131.159.254.8]) by mailout.informatik.tu-muenchen.de (Postfix) with ESMTP id 4F7D7630A; Fri, 12 Apr 2002 14:03:07 +0200 (MEST) Received: from sunhalle19 (sunhalle19.informatik.tu-muenchen.de [131.159.4.179]) by mailrelay2.informatik.tu-muenchen.de (Postfix) with ESMTP id E4DB347384; Fri, 12 Apr 2002 14:03:06 +0200 (MEST) Date: Fri, 12 Apr 2002 14:03:06 +0200 (MEST) From: Klaus Leibrandt X-X-Sender: leibrand@sunhalle19 To: freebsd-current@FreeBSD.org Cc: freebsd-mobile@FreeBSD.org Subject: Possible bug in /sys/i386/pci/pci_cfgreg.c Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi Folks. I spent some time tracking down my CardBus problem and found the following: In /sys/i386/pci/pci_cfgreg.c: In Function: static int pci_cfgintr_linked(struct PIR_entry *pe, int pin): There you can find this code (my changes included): /* link destination mapped to a unique interrupt? */ /* if (powerof2(pi->irqs)) { // i changed this line to the next line of code */ /* the reason is given below*/ /* On my system the CardBus bridge has no interrupt assigned (lazy BIOS I would say). So pi->irqs is 0. powerof2 returns true (which is wrong as ahown below). Then ffs returs 0. that - 1 gives an irq of -1 whis is totally wrong) The if clause must evaluate to false if there is no interrut assigned otherwise the system will panic during boot as I experineced it. */ /* I added "&& pi->irqs != 0 */ if (powerof2(pi->irqs) && pi->irqs != 0) { irq = ffs(pi->irqs) - 1; PRVERB(("pci_cfgintr_linked: linked (%x) to hard-routed irq %d\n", pi->link, irq)); return(irq); } In my opinion the macro powerof2(x) defined in /sys/i386/sys/param.h is correct for all input values except 0 (zero). Proof for zero being illegal input: powerof2(0) = ((((0x00000000)-1) & (0x00000000)) == 0) = ((( 0xffffffff ) & (0x00000000)) == 0) = (( 0x00000000 ) == 0) = true Since zero is not a power of 2 the returnvalue of powerof2(0) is wrong. ---- This change may have implictions I do not forsee, so I leave to the experts what should be done about it. In my eyes a similar change may be useful in function pci_cfgintr_unique(..,..). Now, the system is booting without panic. It does assign an Interrupt for the CardBus Bridge and my CardBus NIC is detected. But all this didnt't sove my problem entirely. Although the network card driver (dc) is loading it is still not configured the right way. I get a watchdog timeout when trying to use the interface. The shown MAC adres is also not correct. I am eager to hear your comment on this issue. This is my dmesg output with the above mentioned patch applied (boot -v): ---- Copyright (c) 1992-2002 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 5.0-DP1 #1: Fri Apr 12 12:22:33 GMT 2002 root@:/usr/src/sys/i386/compile/NEWCARD Preloaded elf kernel "/boot/kernel/kernel" at 0xc0536000. Calibrating clock(s) ... TSC clock: 450965769 Hz, i8254 clock: 1193032 Hz CLK_USE_I8254_CALIBRATION not specified - using default frequency Timecounter "i8254" frequency 1193182 Hz CLK_USE_TSC_CALIBRATION not specified - using old calibration method Timecounter "TSC" frequency 451024942 Hz CPU: Pentium III/Pentium III Xeon/Celeron (451.02-MHz 686-class CPU) Origin = "GenuineIntel" Id = 0x681 Stepping = 1 Features=0x383f9ff real memory = 268369920 (262080K bytes) Physical memory chunk(s): 0x00001000 - 0x0009efff, 647168 bytes (158 pages) 0x0055d000 - 0x0ffe7fff, 262713344 bytes (64139 pages) avail memory = 255537152 (249548K bytes) bios32: Found BIOS32 Service Directory header at 0xc00fdb70 bios32: Entry = 0xfdb80 (c00fdb80) Rev = 0 Len = 1 pcibios: PCI BIOS entry at 0xf0000+0xdba1 pnpbios: Found PnP BIOS data at 0xc00f5de0 pnpbios: Entry = f0000:5744 Rev = 1.0 Other BIOS signatures found: null: random: mem: Pentium Pro MTRR support enabled pcibios: BIOS version 2.10 Using $PIR table, 6 entries at 0xc00f6420 npx0: on motherboard npx0: INT 16 interface pcib0: at pcibus 0 on motherboard pci0: physical bus=0 map[10]: type 3, range 32, base e0000000, size 26, enabled found-> vendor=0x8086, dev=0x7190, revid=0x03 bus=0, slot=0, func=0 class=06-00-00, hdrtype=0x00, mfdev=0 found-> vendor=0x8086, dev=0x7191, revid=0x03 bus=0, slot=1, func=0 class=06-04-00, hdrtype=0x01, mfdev=0 found-> vendor=0x8086, dev=0x7110, revid=0x02 bus=0, slot=7, func=0 class=06-01-00, hdrtype=0x00, mfdev=1 map[20]: type 4, range 32, base 0000ffa0, size 4, enabled found-> vendor=0x8086, dev=0x7111, revid=0x01 bus=0, slot=7, func=1 class=01-01-80, hdrtype=0x00, mfdev=0 map[20]: type 4, range 32, base 0000e800, size 5, enabled found-> vendor=0x8086, dev=0x7112, revid=0x01 bus=0, slot=7, func=2 class=0c-03-00, hdrtype=0x00, mfdev=0 intpin=d, irq=9 map[90]: type 4, range 32, base 00000440, size 4, enabled found-> vendor=0x8086, dev=0x7113, revid=0x02 bus=0, slot=7, func=3 class=06-80-00, hdrtype=0x00, mfdev=0 map[10]: type 4, range 32, base 0000ea00, size 8, enabled found-> vendor=0x125d, dev=0x1968, revid=0x00 bus=0, slot=9, func=0 class=04-01-00, hdrtype=0x00, mfdev=0 intpin=a, irq=9 powerspec 1 supports D0 D1 D2 D3 current D0 found-> vendor=0x104c, dev=0xac1c, revid=0x01 bus=0, slot=10, func=0 class=06-07-00, hdrtype=0x02, mfdev=1 intpin=a, irq=255 powerspec 1 supports D0 D1 D2 D3 current D0 found-> vendor=0x104c, dev=0xac1c, revid=0x01 bus=0, slot=10, func=1 class=06-07-00, hdrtype=0x02, mfdev=1 intpin=a, irq=255 powerspec 1 supports D0 D1 D2 D3 current D0 map[10]: type 1, range 32, base febfff00, size 8, enabled map[14]: type 4, range 32, base 0000ee00, size 3, enabled map[18]: type 4, range 32, base 0000ec00, size 8, enabled found-> vendor=0x11c1, dev=0x0448, revid=0x01 bus=0, slot=12, func=0 class=07-80-00, hdrtype=0x00, mfdev=0 intpin=a, irq=9 powerspec 2 supports D0 D2 D3 current D0 pci0: on pcib0 pcib1: at device 1.0 on pci0 pcib1: secondary bus 1 pcib1: subordinate bus 1 pcib1: I/O decode 0xb000-0xcfff pcib1: memory decode 0xfca00000-0xfeafffff pcib1: prefetched decode 0xff900000-0xff9fffff pci1: physical bus=1 map[10]: type 1, range 32, base fd000000, size 24, enabled map[14]: type 4, range 32, base 0000c800, size 8, enabled map[18]: type 1, range 32, base feaff000, size 12, enabled found-> vendor=0x1002, dev=0x4c42, revid=0xdc bus=1, slot=0, func=0 class=03-00-00, hdrtype=0x00, mfdev=0 intpin=a, irq=11 powerspec 1 supports D0 D1 D2 D3 current D0 pci1: on pcib1 pci1: at device 0.0 (no driver attached) isab0: at device 7.0 on pci0 isa0: on isab0 atapci0: port 0xffa0-0xffaf at device 7.1 on pci0 ata0: iobase=0x01f0 altiobase=0x03f6 bmaddr=0xffa0 ata0: mask=03 ostat0=50 ostat2=00 ata0-master: ATAPI 00 00 ata0-slave: ATAPI 00 00 ata0: mask=03 stat0=50 stat1=00 ata0-master: ATA 01 a5 ata0: devices=01 ata0: at 0x1f0 irq 14 on atapci0 ata1: iobase=0x0170 altiobase=0x0376 bmaddr=0xffa8 ata1: mask=03 ostat0=50 ostat2=00 ata1-master: ATAPI 14 eb ata1-slave: ATAPI 7f 7f ata1: mask=03 stat0=00 stat1=00 ata1: devices=04 ata1: at 0x170 irq 15 on atapci0 uhci0: port 0xe800-0xe81f irq 9 at device 7.2 on pci0 usb0: on uhci0 usb0: USB revision 1.0 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 2 ports with 2 removable, self powered ums0: Microsoft Microsoft Wheel Mouse Optical\M-., rev 1.10/1.21, addr 2, iclass 3/1 ums0: 3 buttons and Z dir. pci0: at device 7.3 (no driver attached) pci0: at device 9.0 (no driver attached) pccbb0: at device 10.0 on pci0 cardbus0: on pccbb0 pccard0: <16-bit PCCard bus> on pccbb0 pci_cfgintr_search: linked (62) to configured irq 9 at 0:9:0 pci_cfgintr: 0:10 INTA routed to irq 9 pccbb1: at device 10.1 on pci0 cardbus1: on pccbb1 pccard1: <16-bit PCCard bus> on pccbb1 pci_cfgintr_search: linked (62) to configured irq 9 at 0:9:0 pci_cfgintr: 0:10 INTA routed to irq 9 pci0: at device 12.0 (no driver attached) ata: ata0 already exists; skipping it ata: ata1 already exists; skipping it Trying Read_Port at 203 Trying Read_Port at 243 Trying Read_Port at 283 Trying Read_Port at 2c3 Trying Read_Port at 303 Trying Read_Port at 343 Trying Read_Port at 383 Trying Read_Port at 3c3 ex_isa_identify() pnpbios: 17 devices, largest 218 bytes PNP0c01: adding fixed memory32 range 0-0x9fbff, size=0x9fc00 PNP0c01: adding fixed memory32 range 0x9fc00-0x9ffff, size=0x400 PNP0c01: adding fixed memory32 range 0xe0000-0xfffff, size=0x20000 PNP0c01: adding fixed memory32 range 0x100000-0xffeffff, size=0xfef0000 PNP0c01: adding fixed memory32 range 0xfff0000-0xfff7fff, size=0x8000 PNP0c01: adding fixed memory32 range 0xfff8000-0xfffffff, size=0x8000 PNP0c01: adding fixed memory32 range 0xfec00000-0xfec00fff, size=0x1000 PNP0c01: adding fixed memory32 range 0xfee00000-0xfee00fff, size=0x1000 PNP0c01: adding fixed memory32 range 0xfffe0000-0xffffffff, size=0x20000 pnpbios: handle 0 device ID PNP0c01 (010cd041) PNP0000: adding fixed io range 0x20-0x21, size=0x2, align=0x1 PNP0000: adding fixed io range 0xa0-0xa1, size=0x2, align=0x1 PNP0000: adding irq mask 0x4 pnpbios: handle 1 device ID PNP0000 (0000d041) PNP0200: adding dma mask 0x10 PNP0200: adding fixed io range 0-0xf, size=0x10, align=0x1 PNP0200: adding fixed io range 0x80-0x90, size=0x11, align=0x1 PNP0200: adding fixed io range 0x94-0x9f, size=0xc, align=0x1 PNP0200: adding fixed io range 0xc0-0xdf, size=0x20, align=0x1 pnpbios: handle 2 device ID PNP0200 (0002d041) PNP0100: adding irq mask 0x1 PNP0100: adding fixed io range 0x40-0x43, size=0x4, align=0x1 pnpbios: handle 3 device ID PNP0100 (0001d041) PNP0b00: adding irq mask 0x100 PNP0b00: adding fixed io range 0x70-0x71, size=0x2, align=0x1 pnpbios: handle 4 device ID PNP0b00 (000bd041) PNP0303: adding irq mask 0x2 PNP0303: adding fixed io range 0x60-0x60, size=0x1, align=0x1 PNP0303: adding fixed io range 0x64-0x64, size=0x1, align=0x1 pnpbios: handle 5 device ID PNP0303 (0303d041) PNP0800: adding fixed io range 0x61-0x61, size=0x1, align=0x1 pnpbios: handle 6 device ID PNP0800 (0008d041) PNP0c04: adding irq mask 0x2000 PNP0c04: adding fixed io range 0xf0-0xff, size=0x10, align=0x1 pnpbios: handle 7 device ID PNP0c04 (040cd041) PNP0c02: adding io range 0x4d0-0x4d1, size=0x2, align=0x1 PNP0c02: adding io range 0xcf8-0xcff, size=0x8, align=0x1 PNP0c02: adding io range 0x440-0x44f, size=0x10, align=0x1 PNP0c02: adding io range 0x400-0x43f, size=0x40, align=0x1 PNP0c02: adding fixed memory32 range 0xcf000-0xcffff, size=0x1000 pnpbios: handle 8 device ID PNP0c02 (020cd041) PNP0c02: adding io range 0x10-0x1f, size=0x10, align=0x1 PNP0c02: adding io range 0x22-0x3f, size=0x1e, align=0x1 PNP0c02: adding io range 0x44-0x5f, size=0x1c, align=0x1 PNP0c02: adding io range 0x62-0x63, size=0x2, align=0x1 PNP0c02: adding io range 0x65-0x6f, size=0xb, align=0x1 PNP0c02: adding io range 0x72-0x7d, size=0xc, align=0x1 PNP0c02: adding io range 0x91-0x93, size=0x3, align=0x1 PNP0c02: adding io range 0xa2-0xbf, size=0x1e, align=0x1 PNP0c02: adding io range 0xe0-0xef, size=0x10, align=0x1 PNP0c02: adding io range 0x3800-0x383f, size=0x40, align=0x1 pnpbios: handle 9 device ID PNP0c02 (020cd041) PNP0501: adding io range 0x3f8-0x3ff, size=0x8, align=0x8 PNP0501: adding irq mask 0x10 pnpbios: handle 10 device ID PNP0501 (0105d041) SMCf010: adding io range 0x3e8-0x3ef, size=0x8, align=0x8 SMCf010: adding io range 0x100-0x107, size=0x8, align=0x8 SMCf010: adding irq mask 0x8 SMCf010: adding dma mask 0x1 pnpbios: handle 11 device ID SMCf010 (10f0a34d) PNP0400: adding io range 0x378-0x37f, size=0x8, align=0x8 PNP0400: adding irq mask 0x80 pnpbios: handle 12 device ID PNP0400 (0004d041) PNP0700: adding io range 0x3f0-0x3f5, size=0x6, align=0x1 PNP0700: adding irq mask 0x40 PNP0700: adding dma mask 0x4 pnpbios: handle 13 device ID PNP0700 (0007d041) pnpbios: handle 14 device ID PNP0e03 (030ed041) PNP0f13: adding irq mask 0x1000 pnpbios: handle 15 device ID PNP0f13 (130fd041) pnpbios: handle 16 device ID PNP0a03 (030ad041) sc: sc0 already exists; skipping it vga: vga0 already exists; skipping it isa_probe_children: disabling PnP devices isa_probe_children: probing non-PnP devices orm0: