NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-amd64/45575: 5.1/amd64 doesn't run on certain AMD-equiped HP Server hardware (BL465c G7)
>Number: 45575
>Category: port-amd64
>Synopsis: 5.1/amd64 doesn't run on certain AMD-equiped HP Server
>hardware (BL465c G7)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-amd64-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Nov 06 10:55:00 +0000 2011
>Originator: Torsten Harenberg
>Release: 5.1
>Organization:
Bergische Universität Wuppertal
>Environment:
n/a as it doesn't boot
>Description:
trying to install NetBSD 5.1 / amd64 on a HP Blade BL465c G7 with 2 Opteron
6172 CPUs.
Kernel doesn't boot, but instead the boot loader seems to be overwritten, funny
characters appear:
http://www.atlas.uni-wuppertal.de/~harenber/amd64.png
(As a reference, CentOS 5, CentOS 6 and Knoppix booted fine).
After applying some patches provided by Anders Hjalmarsson on port amd-64
(thanks again Anders!), kernel boots up to
Attempting Boot From CD-ROM
NetBSD/x86 cd9660 Primary Bootstrap
Test if A20 is already enabled
testa20: failed
A20 is not already enabled
Try biosA20
biosA20 fail
testa20: failed
A20 kbd nok
testa20: 0 iter
A20 92 ok
consdev com0
NetBSD/x86 BIOS Boot, Revision 5.9 (from NetBSD 5.99.56)
Memory: 636/3144704 k
boot cd0a:netbsd -d
11976248+626664+590072 [816048+539020]=0xee0870
Loading cd0a:/stand/amd64/5.99.56/modules/cd9660/cd9660.kmod
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff80252bc5 cs 8 rflags 202 cr2 0 cpl 8 rsp
ffffffff80ff3ed0
Stopped in pid 0.1 (system) at netbsd:breakpoint+0x5: leave
db{0}> cont
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011
The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
NetBSD 5.99.56 (GENERIC) #0: Thu Nov 3 23:16:45 CET 2011
root%vmware01.pleiades.uni-wuppertal.de@localhost:/usr/current/obj/sys/arch/amd64/compile/GENERIC
total memory = 65531 MB
avail memory = 63644 MB
mainbus0 (root)
cpu0 at mainbus0 apid 16: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu1 at mainbus0 apid 32: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu2 at mainbus0 apid 17: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu3 at mainbus0 apid 33: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu4 at mainbus0 apid 18: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu5 at mainbus0 apid 34: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu6 at mainbus0 apid 19: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu7 at mainbus0 apid 35: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu8 at mainbus0 apid 20: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu9 at mainbus0 apid 36: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu10 at mainbus0 apid 21: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu11 at mainbus0 apid 37: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu12 at mainbus0 apid 22: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu13 at mainbus0 apid 38: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu14 at mainbus0 apid 23: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu15 at mainbus0 apid 39: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu16 at mainbus0 apid 24: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu17 at mainbus0 apid 40: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu18 at mainbus0 apid 25: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu19 at mainbus0 apid 41: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu20 at mainbus0 apid 26: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu21 at mainbus0 apid 42: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu22 at mainbus0 apid 27: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu23 at mainbus0 apid 43: AMD Opteron(tm) Processor 6172, id 0x100f91
ioapic0 at mainbus0 apid 8
ioapic1 at mainbus0 apid 9
acpi0 at mainbus0: Intel ACPICA 20110623
hpet0 at acpi0: high precision event timer (mem 0xfed00000-0xfed00400)
MOMB (PNP0C02) at acpi0 not configured
MI0 (IPI0001) at acpi0 not configured
attimer1 at acpi0 (TIME, PNP0100): io 0x40-0x43 irq 0
pcppi1 at acpi0 (BEEP, PNP0800): io 0x61
midi0 at pcppi1: PC speaker
sysbeep0 at pcppi1
pckbc1 at acpi0 (KBD, PNP0303) (kbd port): io 0x60,0x64 irq 1
pckbc2 at acpi0 (PS2M, PNP0F13) (aux port): irq 12
COMB (PNP0501) at acpi0 not configured
PMI0 (ACPI000D) at acpi0 not configured
attimer1: attached to pcppi1
pckbd0 at pckbc1 (kbd slot)
pckbc1: using irq 1 for kbd slot
wskbd0 at pckbd0 mux 1
pms0 at pckbc1 (aux slot)
pckbc1: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
ipmi0 at mainbus0
pci0 at mainbus0 bus 0: configuration mode 1
pchb0 at pci0 dev 0 function 0: vendor 0x1002 product 0x5a10 (rev. 0x02)
ppb0 at pci0 dev 3 function 0: vendor 0x1002 product 0x5a17 (rev. 0x00)
ppb0: PCI Express 2.0 <Root Port of PCI-E Root Complex>
pci1 at ppb0 bus 4
vendor 0x19a2 product 0x0700 (ethernet network, revision 0x02) at pci1 dev 0
function 0 not configured
vendor 0x19a2 product 0x0700 (ethernet network, revision 0x02) at pci1 dev 0
function 1 not configured
vendor 0x19a2 product 0x0702 (miscellaneous mass storage, revision 0x02) at
pci1 dev 0 function 2 not configured
vendor 0x19a2 product 0x0702 (miscellaneous mass storage, revision 0x02) at
pci1 dev 0 function 3 not configured
ppb1 at pci0 dev 4 function 0: vendor 0x1002 product 0x5a18 (rev. 0x00)
ppb1: PCI Express 2.0 <Root Port of PCI-E Root Complex>
pci2 at ppb1 bus 3
ciss has not been converted to device_t
ciss0 at pci2 dev 0 function 0: HP Smart Array 11
ciss0: interrupting at ioapic1 pin 0
ciss0: 1 LD, HW rev 2, FW 3.50/3.50
scsibus0 at ciss0: 1 target, 1 lun per target
ppb2 at pci0 dev 10 function 0: vendor 0x1002 product 0x5a1d (rev. 0x00)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>
pci3 at ppb2 bus 2
vendor 0x103c product 0x3306 (miscellaneous system, revision 0x04) at pci3 dev
0 function 0 not configured
vendor 0x103c product 0x3307 (miscellaneous system, revision 0x04) at pci3 dev
0 function 2 not configured
uhci0 at pci3 dev 0 function 4: vendor 0x103c product 0x3300 (rev. 0x01)
uhci0: interrupting at ioapic1 pin 1
usb0 at uhci0: USB revision 1.0
ixpide0 at pci0 dev 17 function 0: ATI Technologies IXP IDE Controller (rev.
0x00)
ixpide0: using ioapic0 pin 16 for native-PCI interrupt
atabus0 at ixpide0 channel 0
atabus1 at ixpide0 channel 1
ohci0 at pci0 dev 18 function 0: vendor 0x1002 product 0x4397 (rev. 0x00)
ohci0: interrupting at ioapic0 pin 22
ohci0: OHCI version 1.0, legacy support
usb1 at ohci0: USB revision 1.0
ohci1 at pci0 dev 18 function 1: vendor 0x1002 product 0x4398 (rev. 0x00)
ohci1: interrupting at ioapic0 pin 22
ohci1: OHCI version 1.0, legacy support
usb2 at ohci1: USB revision 1.0
ehci0 at pci0 dev 18 function 2: vendor 0x1002 product 0x4396 (rev. 0x00)
ehci0: interrupting at ioapic0 pin 23
ehci0: dropped intr workaround enabled
Disabling some USB related drivers brings the kernel up to:
uc> disable 177
[177] ehci* disabled
uc> disable 178
[178] ehci* disabled
uc> disable 345
[345] uhub* disabled
uc> disable 346
[346] uhub* disabled
uc> disable 341
[341] usb* disabled
uc> disable 342
[342] usb* disabled
uc> dis
Unknown command, try help
uc> disable 343
[343] usb* disabled
uc> disable 344
[344] usb* disabled
uc> disable 345
[345] uhub* already disabled
uc> exit
Continuing...
mainbus0 (root)
cpu0 at mainbus0 apid 16: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu1 at mainbus0 apid 32: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu2 at mainbus0 apid 17: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu3 at mainbus0 apid 33: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu4 at mainbus0 apid 18: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu5 at mainbus0 apid 34: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu6 at mainbus0 apid 19: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu7 at mainbus0 apid 35: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu8 at mainbus0 apid 20: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu9 at mainbus0 apid 36: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu10 at mainbus0 apid 21: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu11 at mainbus0 apid 37: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu12 at mainbus0 apid 22: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu13 at mainbus0 apid 38: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu14 at mainbus0 apid 23: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu15 at mainbus0 apid 39: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu16 at mainbus0 apid 24: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu17 at mainbus0 apid 40: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu18 at mainbus0 apid 25: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu19 at mainbus0 apid 41: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu20 at mainbus0 apid 26: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu21 at mainbus0 apid 42: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu22 at mainbus0 apid 27: AMD Opteron(tm) Processor 6172, id 0x100f91
cpu23 at mainbus0 apid 43: AMD Opteron(tm) Processor 6172, id 0x100f91
ioapic0 at mainbus0 apid 8
ioapic1 at mainbus0 apid 9
acpi0 at mainbus0: Intel ACPICA 20110623
hpet0 at acpi0: high precision event timer (mem 0xfed00000-0xfed00400)
MOMB (PNP0C02) at acpi0 not configured
MI0 (IPI0001) at acpi0 not configured
attimer1 at acpi0 (TIME, PNP0100): io 0x40-0x43 irq 0
pcppi1 at acpi0 (BEEP, PNP0800): io 0x61
midi0 at pcppi1: PC speaker
sysbeep0 at pcppi1
pckbc1 at acpi0 (KBD, PNP0303) (kbd port): io 0x60,0x64 irq 1
pckbc2 at acpi0 (PS2M, PNP0F13) (aux port): irq 12
COMB (PNP0501) at acpi0 not configured
PMI0 (ACPI000D) at acpi0 not configured
attimer1: attached to pcppi1
pckbd0 at pckbc1 (kbd slot)
pckbc1: using irq 1 for kbd slot
wskbd0 at pckbd0 mux 1
pms0 at pckbc1 (aux slot)
pckbc1: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
ipmi0 at mainbus0
pci0 at mainbus0 bus 0: configuration mode 1
pchb0 at pci0 dev 0 function 0: vendor 0x1002 product 0x5a10 (rev. 0x02)
ppb0 at pci0 dev 3 function 0: vendor 0x1002 product 0x5a17 (rev. 0x00)
ppb0: PCI Express 2.0 <Root Port of PCI-E Root Complex>
pci1 at ppb0 bus 4
vendor 0x19a2 product 0x0700 (ethernet network, revision 0x02) at pci1 dev 0
function 0 not configured
vendor 0x19a2 product 0x0700 (ethernet network, revision 0x02) at pci1 dev 0
function 1 not configured
vendor 0x19a2 product 0x0702 (miscellaneous mass storage, revision 0x02) at
pci1 dev 0 function 2 not configured
vendor 0x19a2 product 0x0702 (miscellaneous mass storage, revision 0x02) at
pci1 dev 0 function 3 not configured
ppb1 at pci0 dev 4 function 0: vendor 0x1002 product 0x5a18 (rev. 0x00)
ppb1: PCI Express 2.0 <Root Port of PCI-E Root Complex>
pci2 at ppb1 bus 3
ciss has not been converted to device_t
ciss0 at pci2 dev 0 function 0: HP Smart Array 11
ciss0: interrupting at ioapic1 pin 0
ciss0: 1 LD, HW rev 2, FW 3.50/3.50
scsibus0 at ciss0: 1 target, 1 lun per target
ppb2 at pci0 dev 10 function 0: vendor 0x1002 product 0x5a1d (rev. 0x00)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>
pci3 at ppb2 bus 2
vendor 0x103c product 0x3306 (miscellaneous system, revision 0x04) at pci3 dev
0 function 0 not configured
vendor 0x103c product 0x3307 (miscellaneous system, revision 0x04) at pci3 dev
0 function 2 not configured
uhci0 at pci3 dev 0 function 4: vendor 0x103c product 0x3300 (rev. 0x01)
uhci0: interrupting at ioapic1 pin 1
usb at uhci0 not configured
ixpide0 at pci0 dev 17 function 0: ATI Technologies IXP IDE Controller (rev.
0x00)
ixpide0: using ioapic0 pin 16 for native-PCI interrupt
atabus0 at ixpide0 channel 0
atabus1 at ixpide0 channel 1
ohci0 at pci0 dev 18 function 0: vendor 0x1002 product 0x4397 (rev. 0x00)
ohci0: interrupting at ioapic0 pin 22
ohci0: OHCI version 1.0, legacy support
usb at ohci0 not configured
ohci1 at pci0 dev 18 function 1: vendor 0x1002 product 0x4398 (rev. 0x00)
ohci1: interrupting at ioapic0 pin 22
ohci1: OHCI version 1.0, legacy support
usb at ohci1 not configured
vendor 0x1002 product 0x4396 (USB serial bus, interface 0x20) at pci0 dev 18
function 2 not configured
ohci2 at pci0 dev 19 function 0: vendor 0x1002 product 0x4397 (rev. 0x00)
ohci2: interrupting at ioapic0 pin 23
ohci2: OHCI version 1.0, legacy support
usb at ohci2 not configured
ohci3 at pci0 dev 19 function 1: vendor 0x1002 product 0x4398 (rev. 0x00)
ohci3: interrupting at ioapic0 pin 23
ohci3: OHCI version 1.0, legacy support
usb at ohci3 not configured
vendor 0x1002 product 0x4396 (USB serial bus, interface 0x20) at pci0 dev 19
function 2 not configured
piixpm0 at pci0 dev 20 function 0
piixpm0: vendor 0x1002 product 0x4385 (rev. 0x3d)
piixpm0: interrupting at SMI, polling
iic0 at piixpm0: I2C bus
ixpide1 at pci0 dev 20 function 1: ATI Technologies IXP IDE Controller (rev.
0x00)
ixpide1: primary channel interrupting at ioapic0 pin 14
atabus2 at ixpide1 channel 0
ixpide1: secondary channel interrupting at ioapic0 pin 15
atabus3 at ixpide1 channel 1
pcib0 at pci0 dev 20 function 3: vendor 0x1002 product 0x439d (rev. 0x00)
ppb3 at pci0 dev 20 function 4: vendor 0x1002 product 0x4384 (rev. 0x00)
pci4 at ppb3 bus 1
vga0 at pci4 dev 3 function 0: vendor 0x1002 product 0x515e (rev. 0x02)
wsdisplay0 at vga0 kbdmux 1
pckbport_cmd: send error
pckbd_enable: command error
radeondrm0 at vga0: ATI ES1000 RN50
radeondrm0: Initialized radeon 1.29.0 20080613
pchb1 at pci0 dev 24 function 0: vendor 0x1022 product 0x1200 (rev. 0x00)
pchb2 at pci0 dev 24 function 1: vendor 0x1022 product 0x1201 (rev. 0x00)
pchb3 at pci0 dev 24 function 2: vendor 0x1022 product 0x1202 (rev. 0x00)
pchb4 at pci0 dev 24 function 3: vendor 0x1022 product 0x1203 (rev. 0x00)
amdtemp0 at pchb4: AMD CPU Temperature Sensors (Family10h)
pchb5 at pci0 dev 24 function 4: vendor 0x1022 product 0x1204 (rev. 0x00)
pchb6 at pci0 dev 25 function 0: vendor 0x1022 product 0x1200 (rev. 0x00)
pchb7 at pci0 dev 25 function 1: vendor 0x1022 product 0x1201 (rev. 0x00)
pchb8 at pci0 dev 25 function 2: vendor 0x1022 product 0x1202 (rev. 0x00)
pchb9 at pci0 dev 25 function 3: vendor 0x1022 product 0x1203 (rev. 0x00)
amdtemp1 at pchb9: AMD CPU Temperature Sensors (Family10h)
pchb10 at pci0 dev 25 function 4: vendor 0x1022 product 0x1204 (rev. 0x00)
pchb11 at pci0 dev 26 function 0: vendor 0x1022 product 0x1200 (rev. 0x00)
pchb12 at pci0 dev 26 function 1: vendor 0x1022 product 0x1201 (rev. 0x00)
pchb13 at pci0 dev 26 function 2: vendor 0x1022 product 0x1202 (rev. 0x00)
pchb14 at pci0 dev 26 function 3: vendor 0x1022 product 0x1203 (rev. 0x00)
amdtemp2 at pchb14: AMD CPU Temperature Sensors (Family10h)
pchb15 at pci0 dev 26 function 4: vendor 0x1022 product 0x1204 (rev. 0x00)
pchb16 at pci0 dev 27 function 0: vendor 0x1022 product 0x1200 (rev. 0x00)
pchb17 at pci0 dev 27 function 1: vendor 0x1022 product 0x1201 (rev. 0x00)
pchb18 at pci0 dev 27 function 2: vendor 0x1022 product 0x1202 (rev. 0x00)
pchb19 at pci0 dev 27 function 3: vendor 0x1022 product 0x1203 (rev. 0x00)
amdtemp3 at pchb19: AMD CPU Temperature Sensors (Family10h)
pchb20 at pci0 dev 27 function 4: vendor 0x1022 product 0x1204 (rev. 0x00)
isa0 at pcib0
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com0: console
com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
acpicpu0 at cpu0: ACPI CPU
acpicpu1 at cpu1: ACPI CPU
acpicpu2 at cpu2: ACPI CPU
acpicpu3 at cpu3: ACPI CPU
acpicpu4 at cpu4: ACPI CPU
acpicpu5 at cpu5: ACPI CPU
acpicpu6 at cpu6: ACPI CPU
acpicpu7 at cpu7: ACPI CPU
acpicpu8 at cpu8: ACPI CPU
acpicpu9 at cpu9: ACPI CPU
acpicpu10 at cpu10: ACPI CPU
acpicpu11 at cpu11: ACPI CPU
acpicpu12 at cpu12: ACPI CPU
acpicpu13 at cpu13: ACPI CPU
acpicpu14 at cpu14: ACPI CPU
acpicpu15 at cpu15: ACPI CPU
acpicpu16 at cpu16: ACPI CPU
acpicpu17 at cpu17: ACPI CPU
acpicpu18 at cpu18: ACPI CPU
acpicpu19 at cpu19: ACPI CPU
acpicpu20 at cpu20: ACPI CPU
acpicpu21 at cpu21: ACPI CPU
acpicpu22 at cpu22: ACPI CPU
acpicpu23 at cpu23: ACPI CPU
scsibus0: waiting 2 seconds for devices to settle...
ciss0: unqueued ccb 0xffff8000c9bd1c00 ready, state=0x10
(no activity for 2min, sending break)
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff80252bc5 cs 8 rflags 202 cr2 0 cpl 8 rsp
ffff8000ba1688f8
Stopped in pid 0.2 (system) at netbsd:breakpoint+0x5: leave
db{0}> b
db{0}> bt
breakpoint() at netbsd:breakpoint+0x5
comintr() at netbsd:comintr+0x518
Xintr_ioapic_edge10() at netbsd:Xintr_ioapic_edge10+0xee
--- interrupt ---
bus_space_read_4() at netbsd:bus_space_read_4+0xa
intr_biglock_wrapper() at netbsd:intr_biglock_wrapper+0x1d
Xintr_ioapic_level6() at netbsd:Xintr_ioapic_level6+0xf6
--- interrupt ---
x86_stihlt() at netbsd:x86_stihlt+0x6
acpicpu_cstate_idle_enter() at netbsd:acpicpu_cstate_idle_enter+0x48
acpicpu_cstate_idle() at netbsd:acpicpu_cstate_idle+0xbc
idle_loop() at netbsd:idle_loop+0x17c
db{0}>
Full discussion in on the mailing list starting here:
http://mail-index.netbsd.org/port-amd64/2011/11/02/msg001517.html
>How-To-Repeat:
install NetBSD 5.1/amd64 on AMD equipped HP Server hardware (tested BL465cG7,
other hardware seems also be affected, see mail thread).
>Fix:
Anders provided this patch for a problem in the A20 handling:
his comment was
Can you try this patch, it is not well-tested especially not on different
motherboards but it got a DL385 G7 to load a kernel some time ago (it
still had problems, but could at least load the kernel and start finding
devices).
The patch is loosely based on what linux does, I picked the same
adress to test, on the assumption it is a safe adress.
If someone who knows more about gate A20 can clean up this mess
I would be grateful.
This is a patch against current, it may not apply cleanly to 5.1,
in particular, i think the patch for cpufunc.S should be removed for 5.1
Also the bootroms will become too big so just try building the boot program
you need.
Index: sys/arch/i386/stand/lib/cpufunc.S
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/cpufunc.S,v
retrieving revision 1.4
diff -u -r1.4 cpufunc.S
--- sys/arch/i386/stand/lib/cpufunc.S 8 Jun 2011 16:03:42 -0000 1.4
+++ sys/arch/i386/stand/lib/cpufunc.S 2 Nov 2011 22:09:09 -0000
@@ -150,3 +150,7 @@
outsl
popl %esi
ret
+
+NENTRY(wbinvd)
+ wbinvd
+ ret
Index: sys/arch/i386/stand/lib/cpufunc.h
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/cpufunc.h,v
retrieving revision 1.2
diff -u -r1.2 cpufunc.h
--- sys/arch/i386/stand/lib/cpufunc.h 28 Apr 2008 20:23:25 -0000 1.2
+++ sys/arch/i386/stand/lib/cpufunc.h 2 Nov 2011 22:09:09 -0000
@@ -47,3 +47,5 @@
void outsw(unsigned, void *, int);
void outl(unsigned, uint32_t);
void outsl(unsigned, void *, int);
+
+void wbinvd(void);
Index: sys/arch/i386/stand/lib/gatea20.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/gatea20.c,v
retrieving revision 1.12
diff -u -r1.12 gatea20.c
--- sys/arch/i386/stand/lib/gatea20.c 23 Aug 2009 12:31:05 -0000 1.12
+++ sys/arch/i386/stand/lib/gatea20.c 2 Nov 2011 22:09:09 -0000
@@ -25,6 +25,10 @@
enable data line
disable clock line */
+static void gateA20_92(void);
+static void gateA20_kbd(void);
+static int testa20(void);
+
/*
* Gate A20 for high memory
*/
@@ -34,7 +38,16 @@
gateA20(void)
{
int biosA20(void);
- u_long psl;
+
+ /*
+ * First, check if A2 is enabled.
+ */
+ printf("Test if A20 is already enabled\n");
+ if (testa20()) {
+ printf("A20 already enabled\n");
+ return;
+ }
+ printf("A20 is not already enabled\n");
/*
* First, try asking the BIOS to enable A20.
@@ -45,36 +58,130 @@
* and playing with port 0x92 may cause some systems to break.
*
* Otherwise, use the traditional method (keyboard controller).
+ * If that fails try port 0x92 anyway.
*/
- if (!biosA20())
- return;
- psl = x86_read_psl();
- x86_disable_intr();
+ unsigned temp;
+
+ printf("Try biosA20\n");
+ temp = biosA20();
+ if (!temp) {
+ if (testa20()) {
+ printf("A20 biosA20 ok\n");
+ return;
+ }
+ printf("A20 nok\n");
+ } else {
+ printf("biosA20 fail\n");
+ }
+
if (
#ifdef SUPPORT_PS2
biosmca_ps2model == 0xf82 ||
#endif
(inb(K_STATUS) == 0xff && inb(K_RDWR) == 0xff)) {
- int data;
+ gateA20_92();
+ if (testa20()) {
+ printf("A20 92 ok\n");
+ return;
+ }
+ }
- data = inb(0x92);
- outb(0x92, data | 0x2);
+ gateA20_kbd();
+ if (testa20()) {
+ printf("A20 kbd ok\n");
+ return;
} else {
- while (inb(K_STATUS) & K_IBUF_FUL);
+ printf("A20 kbd nok\n");
+ }
- while (inb(K_STATUS) & K_OBUF_FUL)
- (void)inb(K_RDWR);
+ gateA20_92();
+ if (testa20()) {
+ printf("A20 92 ok\n");
+ return;
+ } else {
+ printf("A20 92 nok\n");
+ }
+ printf("failed to enable A20, reboot\n");
- outb(K_CMD, KC_CMD_WOUT);
+ delay(10000);
+ reboot();
+}
- while (inb(K_STATUS) & K_IBUF_FUL);
+void
+gateA20_92(void)
+{
+ u_long psl;
+ int data;
- outb(K_RDWR, x_20);
+ psl = x86_read_psl();
+ x86_disable_intr();
- while (inb(K_STATUS) & K_IBUF_FUL);
+ data = inb(0x92);
+ outb(0x92, data | 0x2);
+ x86_write_psl(psl);
+}
+
+static void
+gateA20_kbd(void)
+{
+ u_long psl;
+
+ psl = x86_read_psl();
+ x86_disable_intr();
+
+ while (inb(K_STATUS) & K_IBUF_FUL);
+
+ while (inb(K_STATUS) & K_OBUF_FUL)
+ (void)inb(K_RDWR);
+
+ outb(K_CMD, KC_CMD_WOUT);
+
+ while (inb(K_STATUS) & K_IBUF_FUL);
+
+ outb(K_RDWR, x_20);
+
+ while (inb(K_STATUS) & K_IBUF_FUL);
+
+ while (inb(K_STATUS) & K_OBUF_FUL)
+ (void)inb(K_RDWR);
- while (inb(K_STATUS) & K_OBUF_FUL)
- (void)inb(K_RDWR);
- }
x86_write_psl(psl);
}
+
+/*
+ * Test if A20 is enabled
+ * Returns 1 if A20 is enabled.
+ */
+static int
+testa20x(void)
+{
+ short *lo = (short *)0x200;
+ short * volatile hi = (short *)0x100200;
+ short oldval = *lo;
+ short i;
+
+ for (i = 0; i < 32; i++) {
+ *lo = i;
+ wbinvd();
+ if (*hi != i) {
+ *lo = oldval;
+ return 1;
+ }
+ }
+ *lo = oldval;
+ return 0;
+}
+static int
+testa20(void)
+{
+ int j;
+
+ for (j = 0; j < 10; j++) {
+ if (testa20x()) {
+ printf("testa20: %d iter\n", j);
+ return 1;
+ }
+ }
+ printf("testa20: failed\n");
+ return 0;
+}
Home |
Main Index |
Thread Index |
Old Index