On 2/2/16, Jonathan Gray <[email protected]> wrote:
>
> Putting a "return false;" at the top of radeon_read_platform_bios()
> should prevent this method from being tried entirely.
>

Following up on this. I continued to encounter panics afterward. I
even substituted all the code in radeon_read_platform_bios() with a
printf and return false;

Was the stack trace wrong? I instrumented many printfs in
radeon_read_bios() and this is what I see.

OpenBSD 5.9 (GENERIC.MP) #9: Wed Feb  3 21:56:18 EST 2016
    [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
RTC BIOS diagnostic error 80<clock_battery>
real mem = 1690714112 (1612MB)
avail mem = 1635336192 (1559MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0x66abc000 (45 entries)
bios0: vendor Insyde version "F.65" date 06/04/2014
bios0: Hewlett-Packard Compaq CQ58 Notebook PC
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP UEFI HPET APIC MCFG ASF! BOOT SPCR WDRT WDAT
FPDT MSDM SSDT SSDT VFCT BGRT
acpi0: wakeup devices PB6_(S4) SPB0(S4) XPDV(S4) SPB1(S4) SPB3(S4)
GEC_(S4) OHC1(S3) OHC2(S3) OHC3(S3) OHC4(S3) EHC1(S3) EHC2(S3)
EHC3(S3) P2P_(S5)
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpihpet0 at acpi0: 14318180 Hz
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: AMD C-60 APU with Radeon(tm) HD Graphics, 998.69 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,MWAIT,SSSE3,CX16,POPCNT,NXE,MMXX,FFXSR,PAGE1GB,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,IBS,SKINIT,ITSC
cpu0: 32KB 64b/line 2-way I-cache, 32KB 64b/line 8-way D-cache, 512KB
64b/line 16-way L2 cache
cpu0: 8 4MB entries fully associative
cpu0: DTLB 40 4KB entries fully associative, 8 4MB entries fully associative
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 199MHz
cpu0: mwait min=64, max=64, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: AMD C-60 APU with Radeon(tm) HD Graphics, 997.87 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,MWAIT,SSSE3,CX16,POPCNT,NXE,MMXX,FFXSR,PAGE1GB,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,IBS,SKINIT,ITSC
cpu1: 32KB 64b/line 2-way I-cache, 32KB 64b/line 8-way D-cache, 512KB
64b/line 16-way L2 cache
cpu1: 8 4MB entries fully associative
cpu1: DTLB 40 4KB entries fully associative, 8 4MB entries fully associative
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 4 pa 0xfec00000, version 21, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 4
acpimcfg0 at acpi0 addr 0xf8000000, bus 0-63
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (PB4_)
acpiprt2 at acpi0: bus -1 (PB5_)
acpiprt3 at acpi0: bus -1 (PB6_)
acpiprt4 at acpi0: bus -1 (PB7_)
acpiprt5 at acpi0: bus 2 (SPB0)
acpiprt6 at acpi0: bus 6 (SPB1)
acpiprt7 at acpi0: bus 7 (SPB2)
acpiprt8 at acpi0: bus -1 (SPB3)
acpiprt9 at acpi0: bus 1 (P2P_)
acpiec0 at acpi0
acpicpu0 at acpi0: C2(0@100 io@0xf800), C1(@1 halt!), PSS
acpicpu1 at acpi0: C2(0@100 io@0xf800), C1(@1 halt!), PSS
acpipwrres0 at acpi0: FN00, resource for FAN0
acpitz0 at acpi0: critical temperature is 125 degC
acpibtn0 at acpi0: PWRB
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT0 not present
acpibtn1 at acpi0: LID_
acpivideo0 at acpi0: VGA_
acpivideo1 at acpi0: VGA_
cpu0: 998 MHz: speeds: 1000 800 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "AMD AMD64 14h Host" rev 0x00
radeondrm0 at pci0 dev 1 function 0 "ATI Radeon HD 6290" rev 0x00
drm0 at radeondrm0
radeondrm0: msi
ahci0 at pci0 dev 17 function 0 "ATI SBx00 SATA" rev 0x00: apic 4 int
19, AHCI 1.2
ahci0: port 0: 3.0Gb/s
ahci0: port 2: 1.5Gb/s
scsibus1 at ahci0: 32 targets
sd0 at scsibus1 targ 0 lun 0: <ATA, ST320LT020-9YG14, 0002> SCSI3
0/direct fixed naa.5000c500536c9072
sd0: 305245MB, 512 bytes/sector, 625142448 sectors
cd0 at scsibus1 targ 2 lun 0: <hp, DVDRAM GT50N, MP01> ATAPI 5/cdrom removable
ohci0 at pci0 dev 18 function 0 "ATI SB700 USB" rev 0x00: apic 4 int
18, version 1.0, legacy support
ehci0 at pci0 dev 18 function 2 "ATI SB700 USB2" rev 0x00: apic 4 int 17
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "ATI EHCI root hub" rev 2.00/1.00 addr 1
ohci1 at pci0 dev 19 function 0 "ATI SB700 USB" rev 0x00: apic 4 int
18, version 1.0, legacy support
ehci1 at pci0 dev 19 function 2 "ATI SB700 USB2" rev 0x00: apic 4 int 17
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 "ATI EHCI root hub" rev 2.00/1.00 addr 1
piixpm0 at pci0 dev 20 function 0 "ATI SBx00 SMBus" rev 0x42: polling
iic0 at piixpm0
spdmem0 at iic0 addr 0x51: 2GB DDR3 SDRAM PC3-12800 SO-DIMM
azalia0 at pci0 dev 20 function 2 "ATI SBx00 HD Audio" rev 0x40: apic 4 int 16
azalia0: codecs: IDT 92HD81B1X
audio0 at azalia0
pcib0 at pci0 dev 20 function 3 "ATI SB700 ISA" rev 0x40
ppb0 at pci0 dev 20 function 4 "ATI SB600 PCI" rev 0x40
pci1 at ppb0 bus 1
ppb1 at pci0 dev 21 function 0 "ATI SB800 PCIE" rev 0x00
pci2 at ppb1 bus 2
re0 at pci2 dev 0 function 0 "Realtek 8101E" rev 0x05: RTL8105E
(0x4080), msi, address c8:cb:b8:01:0d:22
rlphy0 at re0 phy 7: RTL8201E 10/100 PHY, rev. 2
ppb2 at pci0 dev 21 function 1 "ATI SB800 PCIE" rev 0x00
pci3 at ppb2 bus 6
vendor "Ralink", unknown product 0x539b (class network subclass
miscellaneous, rev 0x00) at pci3 dev 0 function 0 not configured
ppb3 at pci0 dev 21 function 2 "ATI SB800 PCIE" rev 0x00
pci4 at ppb3 bus 7
rtsx0 at pci4 dev 0 function 0 "Realtek RTS5209 Card Reader" rev 0x01: msi
sdmmc0 at rtsx0
pchb1 at pci0 dev 24 function 0 "AMD AMD64 14h Link Cfg" rev 0x43
pchb2 at pci0 dev 24 function 1 "AMD AMD64 14h Address Map" rev 0x00
pchb3 at pci0 dev 24 function 2 "AMD AMD64 14h DRAM Cfg" rev 0x00
km0 at pci0 dev 24 function 3 "AMD AMD64 14h Misc Cfg" rev 0x00
pchb4 at pci0 dev 24 function 4 "AMD AMD64 14h CPU Power" rev 0x00
pchb5 at pci0 dev 24 function 5 "AMD AMD64 14h Reserved" rev 0x00
pchb6 at pci0 dev 24 function 6 "AMD AMD64 14h NB Power" rev 0x00
pchb7 at pci0 dev 24 function 7 "AMD AMD64 14h Reserved" rev 0x00
usb2 at ohci0: USB revision 1.0
uhub2 at usb2 "ATI OHCI root hub" rev 1.00/1.00 addr 1
usb3 at ohci1: USB revision 1.0
uhub3 at usb3 "ATI OHCI root hub" rev 1.00/1.00 addr 1
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pms0: Synaptics touchpad, firmware 7.5
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
efifb at mainbus0 not configured
uvideo0 at uhub1 port 1 configuration 1 interface 0 "Generic HP
Truevision HD" rev 2.00/1.07 addr 2
video0 at uvideo0
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on sd0a (25d8a15ad48f6fbb.a) swap on sd0b dump on sd0b
radeon_read_platform_bios()
radeon_read_bios()
radeon_read_bios() address = pci_conf_read()
radeon_read_bios() address: 0
radeon_read_bios() pci_conf_write
radeon_read_bios() mask = pci_conf_read()
radeon_read_bios() mask: 0
radeon_read_bios() pci_conf_write()
radeon_read_bios() address: 1
radeon_read_bios() bus_space_map
extent_alloc_region: extent `iomem', size 0x0
panic: extent_alloc_region: bad size
Stopped at      Debugger+0x9:   leave   
   TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
 11883  11883      0     0x14000      0x200    1  reaper
*    0      0      0     0x10000      0x200    0  swapper
Debugger() at Debugger+0x9
panic() at panic+0xfe
extent_alloc_region() at extent_alloc_region+0x20f
bus_space_map() at bus_space_map+0x67
radeon_read_platform_bios() at radeon_read_platform_bios+0x27d
radeon_get_bios() at radeon_get_bios+0x17a
evergreen_init() at evergreen_init+0x13
radeon_device_init() at radeon_device_init+0x285
radeondrm_attachhook() at radeondrm_attachhook+0x24
config_process_deferred_mountroot() at config_process_deferred_mountroot+0x3c
main() at main+0x795
end trace frame: 0x0, count: 4
http://www.openbsd.org/ddb.html describes the minimum info required in bug
reports.  Insufficient info makes it difficult to find and fix bugs.
ddb{0}>    TID   PPID   PGRP    UID  S       FLAGS  WAIT
COMMAND
  7752      0      0      0  2     0x14200                zerothread
 11109      0      0      0  2     0x14200                aiodoned
 30512      0      0      0  2     0x14200                update
 26749      0      0      0  2     0x14200                cleaner
 11883      0      0      0  7     0x14200                reaper
  8505      0      0      0  2     0x14200                pagedaemon
 26840      0      0      0  3     0x14200  bored         crypto
 28742      0      0      0  3     0x14200  pftm          pfpurge
 24837      0      0      0  3     0x14200  bored         sensors
  2636      0      0      0  3     0x14200  mmctsk        sdmmc0
 12244      0      0      0  3     0x14200  usbtsk        usbtask
  3225      0      0      0  3     0x14200  usbatsk       usbatsk
  3031      0      0      0  3  0x40014200  acpi0         acpi0
 18616      0      0      0  1     0x14200                idle1
 26657      0      0      0  3     0x14200  bored         softnet
 12007      0      0      0  3     0x14200  bored         systqmp
 18549      0      0      0  3     0x14200  bored         systq
 12643      0      0      0  3  0x40014200                idle0
  2341      0      0      0  3     0x14200  bored         sbar
     1      0      0      0  3           0  initexec      swapper
*    0     -1      0      0  7     0x10200                swapper
ddb{0}> rdi                              0x1
rsi                            0x296
rbp               0xffffffff81a73b40    end+0x73b40
rbx               0xffffffff8171783c    systqmp+0xbac
rdx                                0
rcx               0xffffffff818c6680    cpu_info_primary
rax                              0x1
r8                0xffffffff81a73a60    end+0x73a60
r9                0xffffff00803e4f4c
r10               0xffffffff81a73a10    end+0x73a10
r11                              0x8
r12                            0x100
r13               0xffffffff81a73b50    end+0x73b50
r14               0xffffffff81933360    __kernel_bss_virt+0x4e360
r15                                0
rip               0xffffffff81349689    Debugger+0x9
cs                               0x8
rflags                         0x286
rsp               0xffffffff81a73b30    end+0x73b30
ss                              0x10
Debugger+0x9:   leave   
ddb{0}> syncing disks... done

Index: radeon_bios.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/radeon/radeon_bios.c,v
retrieving revision 1.6
diff -u -p -r1.6 radeon_bios.c
--- radeon_bios.c       12 Apr 2015 12:14:30 -0000      1.6
+++ radeon_bios.c       4 Feb 2016 03:27:38 -0000
@@ -46,41 +46,7 @@ bool  radeon_read_platform_bios(struct r
 bool
 radeon_read_platform_bios(struct radeon_device *rdev)
 {
-#if defined(__amd64__) || defined(__i386__)
-       uint8_t __iomem *bios;
-       bus_size_t size = 256 * 1024; /* ??? */
-       uint8_t *found = NULL;
-       int i;
-       
-       
-       if (!(rdev->flags & RADEON_IS_IGP))
-               if (!radeon_card_posted(rdev))
-                       return false;
-
-       rdev->bios = NULL;
-
-       bios = (u8 *)ISA_HOLE_VADDR(0xc0000);
-
-       for (i = 0; i + 2 < size; i++) {
-               if (bios[i] == 0x55 && bios[i + 1] == 0xaa) {
-                       found = bios + i;
-                       break;
-               }
-                       
-       }
-       if (found == NULL) {
-               DRM_ERROR("bios size zero or checksum mismatch\n");
-               return false;
-       }
-
-       rdev->bios = kmalloc(size, GFP_KERNEL);
-       if (rdev->bios == NULL)
-               return false;
-
-       memcpy(rdev->bios, found, size);
-
-       return true;
-#endif
+       printf("radeon_read_platform_bios()\n");
        return false;
 }

@@ -134,22 +100,40 @@ static bool radeon_read_bios(struct rade
        bus_space_handle_t romh;
        int rc;

+       printf("radeon_read_bios()\n");
+
        rdev->bios = NULL;
        /* XXX: some cards may return 0 for rom size? ddx has a workaround */
-
+       
+       printf("radeon_read_bios() address = pci_conf_read()\n");
        address = pci_conf_read(rdev->pc, rdev->pa_tag, PCI_ROM_REG);
+       printf("radeon_read_bios() address: %x\n", address);
+
+       printf("radeon_read_bios() pci_conf_write\n");
        pci_conf_write(rdev->pc, rdev->pa_tag, PCI_ROM_REG, ~PCI_ROM_ENABLE);
+
+       printf("radeon_read_bios() mask = pci_conf_read()\n");
        mask = pci_conf_read(rdev->pc, rdev->pa_tag, PCI_ROM_REG);
+       printf("radeon_read_bios() mask: %x\n", mask);
+
        address |= PCI_ROM_ENABLE;
+
+       printf("radeon_read_bios() pci_conf_write\n");
        pci_conf_write(rdev->pc, rdev->pa_tag, PCI_ROM_REG, address);

        size = PCI_ROM_SIZE(mask);
+
+       printf("radeon_read_bios() address: %x\n", address);
+       printf("radeon_read_bios() bus_space_map\n");
+
        rc = bus_space_map(rdev->memt, PCI_ROM_ADDR(address), size,
            BUS_SPACE_MAP_LINEAR, &romh);
        if (rc != 0) {
                printf(": can't map PCI ROM (%d)\n", rc);
                return false;
        }
+       
+       printf("radeon_read_bios() bus_space_vaddr\n");
        bios = (uint8_t *)bus_space_vaddr(rdev->memt, romh);
        if (!bios) {
                printf(": bus_space_vaddr failed\n");
@@ -158,11 +142,17 @@ static bool radeon_read_bios(struct rade

        if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa)
                goto fail;
+       printf("radeon_read_bios() kmalloc\n");
        rdev->bios = kmalloc(size, GFP_KERNEL);
+
+       printf("radeon_read_bios() memcpy\n");
        memcpy(rdev->bios, bios, size);
+
+       printf("radeon_read_bios() bus_space_unmap\n");
        bus_space_unmap(rdev->memt, romh, size);
        return true;
 fail:
+       printf("radeon_read_bios() bus_space_unmap\n");
        bus_space_unmap(rdev->memt, romh, size);
        return false;
 }

Reply via email to