Re: Get PCI resources from ACPI

2016-01-08 Thread Devin Reade

dmesg diff, followed by full dmesg with 2nd patch applied.  No panic,
at least in the time it took to grab the dmesg and reboot.

Devin

1c1
< OpenBSD 5.9-beta (GENERIC.MP) #10: Fri Jan  8 09:00:37 MST 2016
---

OpenBSD 5.9-beta (GENERIC.MP) #11: Fri Jan  8 10:37:00 MST 2016

18c18
< cpu0: Intel(R) Core(TM)2 Duo CPU E6850 @ 3.00GHz, 3000.38 MHz
---

cpu0: Intel(R) Core(TM)2 Duo CPU E6850 @ 3.00GHz, 3000.35 MHz

32a33,38

bus 0
extent `pcimem' (0x0 - 0x), flags=0
 0x0 - 0x9
 0xc - 0xc
 0xe - 0x7f6f
 0x1 - 0x



OpenBSD 5.9-beta (GENERIC.MP) #11: Fri Jan  8 10:37:00 MST 2016
   r...@something.gno.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 2120744960 (2022MB)
avail mem = 2052399104 (1957MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xf06e0 (68 entries)
bios0: vendor American Megatrends Inc. version "0902" date 06/20/2008
bios0: ASUSTeK Computer INC. P5K-VM
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP APIC MCFG OEMB HPET GSCI OSFR
acpi0: wakeup devices P0P2(S4) P0P1(S4) UAR1(S4) PS2K(S4) EUSB(S4) USBE(S4) 
P0P5(S4) P0P6(S4) P0P7(S4) P0P8(S4) P0P9(S4) USB0(S4) USB1(S4) USB2(S4) 
USB3(S4) USB4(S4) [...]

acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM)2 Duo CPU E6850 @ 3.00GHz, 3000.35 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF,SENSOR

cpu0: 4MB 64b/line 16-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 333MHz
cpu0: mwait min=64, max=64, C-substates=0.2.2, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 Duo CPU E6850 @ 3.00GHz, 2999.95 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF,SENSOR

cpu1: 4MB 64b/line 16-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xe000, bus 0-255
acpihpet0 at acpi0: 14318179 Hz
bus 0
extent `pcimem' (0x0 - 0x), flags=0
0x0 - 0x9
0xc - 0xc
0xe - 0x7f6f
0x1 - 0x
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (P0P2)
acpiprt2 at acpi0: bus 4 (P0P1)
acpiprt3 at acpi0: bus -1 (P0P5)
acpiprt4 at acpi0: bus -1 (P0P6)
acpiprt5 at acpi0: bus -1 (P0P7)
acpiprt6 at acpi0: bus 2 (P0P8)
acpiprt7 at acpi0: bus 1 (P0P9)
acpiprt8 at acpi0: bus 3 (P0P4)
acpicpu0 at acpi0: C1(@1 halt!), PSS
acpicpu1 at acpi0: C1(@1 halt!), PSS
aibs0 at acpi0 RTMP RVLT RFAN GGRP GITM SITM
acpibtn0 at acpi0: PWRB
cpu0: Enhanced SpeedStep 3000 MHz: speeds: 2997, 1998 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82G33 Host" rev 0x02
inteldrm0 at pci0 dev 2 function 0 "Intel 82G33 Video" rev 0x02
drm0 at inteldrm0
intagp0 at inteldrm0
agp0 at intagp0: aperture at 0xd000, size 0x1000
inteldrm0: msi
inteldrm0: 1024x768
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
"Intel 82G33 Video" rev 0x02 at pci0 dev 2 function 1 not configured
uhci0 at pci0 dev 26 function 0 "Intel 82801I USB" rev 0x02: apic 2 int 16
uhci1 at pci0 dev 26 function 1 "Intel 82801I USB" rev 0x02: apic 2 int 21
uhci2 at pci0 dev 26 function 2 "Intel 82801I USB" rev 0x02: apic 2 int 18
ehci0 at pci0 dev 26 function 7 "Intel 82801I USB" rev 0x02: apic 2 int 18
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 "Intel 82801I HD Audio" rev 0x02: msi
azalia0: codecs: Realtek ALC883
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel 82801I PCIE" rev 0x02: msi
pci1 at ppb0 bus 3
ppb1 at pci0 dev 28 function 4 "Intel 82801I PCIE" rev 0x02: msi
pci2 at ppb1 bus 2
jmb0 at pci2 dev 0 function 0 "JMicron JMB368 IDE" rev 0x00
pciide0 at jmb0: DMA, channel 0 wired to native-PCI, channel 1 wired to 
native-PCI

pciide0: using apic 2 int 16 for native-PCI interrupt
atapiscsi0 at pciide0 channel 0 drive 1
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0:  ATAPI 5/cdrom removable
cd0(pciide0:0:1): using PIO mode 4, Ultra-DMA mode 4
pciide0: channel 1 disabled (no drives)
ppb2 at pci0 dev 28 function 5 "Intel 82801I PCIE" rev 0x02: msi
pci3 at ppb2 bus 1
mskc0 at pci3 dev 0 function 0 "Marvell Yukon 88E8056" rev 0x12, Yukon-2 EC 
Ultra rev. B0 (0x3): apic 2 int 17

msk0 at mskc0 port A: address 00:1d:60:a2:98:28
eephy0 at msk0 phy 0: 88E1149 Gigabit PHY, rev. 1
uhci3 at 

Re: Get PCI resources from ACPI

2016-01-07 Thread Mike Belopuhov
On Thu, Jan 07, 2016 at 06:28 +0100, Pablo Méndez Hernández wrote:
> Hi team,
> 
> On Thu, Dec 31, 2015 at 10:05 PM, Philip Guenther  wrote:
> > On Wed, 30 Dec 2015, Mark Kettenis wrote:
> > ...
> >> Updated diff.  Once again the ACPI standard is ambiguous and/or violated
> >> by the hardware vendors.  This should fix at least the ports Dell r620
> >> that naddy@ told me about.
> >
> > Here's the diff of dmesgs with-vs-without this diff on my yoga12:
> >
> > @@ -41,6 +41,11 @@
> >  cpu3: smt 1, core 1, package 0
> >  ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 40 pins
> >  acpimcfg0 at acpi0 addr 0xf800, bus 0-63
> > +bus 0
> > +extent `pcimem' (0x0 - 0x), flags=0
> > + 0x0 - 0x9
> > + 0xe - 0xcfff
> > + 0xfeb0 - 0x
> >  acpiprt0 at acpi0: bus 0 (PCI0)
> >  acpiprt1 at acpi0: bus -1 (PEG0)
> >  acpiprt2 at acpi0: bus -1 (PEG1)
> 
> Here's mine with a current snapshot in a KVM VM:
> 

And the one from Xen 4.5.

OpenBSD 5.9-beta (GENERIC.MP) #1792: Thu Jan  7 04:48:10 MST 2016
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 511700992 (487MB)
avail mem = 492122112 (469MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xfc001000 (12 entries)
bios0: vendor Xen version "4.5.0" date 09/02/2015
bios0: Xen HVM domU
acpi0 at bios0: rev 2
acpi0: sleep states S3 S4 S5
acpi0: tables DSDT FACP APIC HPET WAET SSDT SSDT
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 11, 48 pins
ioapic0: misconfigured as apic 0, remapped to apid 1
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Xeon(R) CPU E5-2603 0 @ 1.80GHz, 1800.29 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,PCLMUL,SSSE3,CX16,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,HV,NXE,LONG,LAHF
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Xeon(R) CPU E5-2603 0 @ 1.80GHz, 1800.04 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,PCLMUL,SSSE3,CX16,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,HV,NXE,LONG,LAHF
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
acpihpet0 at acpi0: 6250 Hz
bus 0
extent `pcimem' (0x0 - 0x), flags=0
 0x0 - 0x9
 0xc - 0xefff
 0xfc00 - 0x
acpiprt0 at acpi0: bus 0 (PCI0)
acpicpu0 at acpi0: C1(@1 halt!)
acpicpu1 at acpi0: C1(@1 halt!)
pvbus0 at mainbus0: Xen 4.5
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02
pcib0 at pci0 dev 1 function 0 "Intel 82371SB ISA" rev 0x00
pciide0 at pci0 dev 1 function 1 "Intel 82371SB IDE" rev 0x00: DMA, channel 0 
wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: 
wd0: 16-sector PIO, LBA48, 1024MB, 2097152 sectors
wd0(pciide0:0:0): using PIO mode 4, DMA mode 2
atapiscsi0 at pciide0 channel 1 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0:  ATAPI 5/cdrom removable
cd0(pciide0:1:0): using PIO mode 4, DMA mode 2
piixpm0 at pci0 dev 1 function 3 "Intel 82371AB Power" rev 0x03: SMBus disabled
"XenSource Platform Device" rev 0x01 at pci0 dev 2 function 0 not configured
vga1 at pci0 dev 3 function 0 "Cirrus Logic CL-GD5446" rev 0x00
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
em0 at pci0 dev 4 function 0 "Intel 82540EM" rev 0x03: apic 1 int 32, address 
00:16:3e:43:25:6b
isa0 at pcib0
isadma0 at isa0
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
fd0 at fdc0 drive 1: density unknown
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
nvram: invalid checksum
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on wd0a (6ea72b88dcbdb96b.a) swap on wd0b dump on wd0b
clock: unknown CMOS layout



Re: Get PCI resources from ACPI

2016-01-07 Thread Lampshade
Firstly diff, secondly all dmesg from unmodified and modified with yours patch 
kernel.
OpenBSD-current amd64 with source code updated using
cvs -d$CVSROOT up -D "2016-01-07 05:00" -Pd

diff -u  /katalogDmesg/nieZmodyfikowaneAcpiMark/dmesg.log  
/katalogDmesg/zmodyfikowaneAcpiMark/dmesg.log


--- /katalogDmesg/nieZmodyfikowaneAcpiMark/dmesg.log   Thu Jan  7 19:20:03 
2016
+++ /katalogDmesg/zmodyfikowaneAcpiMark/dmesg.log   Thu Jan  7 18:42:46 2016
@@ -1,7 +1,7 @@
-OpenBSD 5.9-beta (GENERIC.MP) #2: Thu Jan  7 19:16:41 CET 2016
-
r...@r2d2.my.domain:/usr/originalKernel/src/sys/arch/amd64/compile/GENERIC.MP
+OpenBSD 5.9-beta (GENERIC.MP) #1: Thu Jan  7 18:40:17 CET 2016
+
o...@r2d2.my.domain:/usr/originalKernel/src/sys/arch/amd64/compile/GENERIC.MP
 real mem = 632704 (6018MB)
-avail mem = 6115713024 (5832MB)
+avail mem = 6115708928 (5832MB)
 mpath0 at root
 scsibus0 at mpath0: 256 targets
 mainbus0 at root
@@ -16,7 +16,7 @@
 acpihpet0 at acpi0: 14318179 Hz
 acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
 cpu0 at mainbus0: apid 0 (boot processor)
-cpu0: Intel(R) Pentium(R) CPU B960 @ 2.20GHz, 2195.31 MHz
+cpu0: Intel(R) Pentium(R) CPU B960 @ 2.20GHz, 2195.36 MHz
 cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT
 cpu0: 256KB 64b/line 8-way L2 cache
 cpu0: smt 0, core 0, package 0
@@ -30,6 +30,11 @@
 cpu1: smt 0, core 1, package 0
 ioapic0 at mainbus0: apid 0 pa 0xfec0, version 20, 24 pins
 acpimcfg0 at acpi0 addr 0xf000, bus 0-63
+bus 0
+extent `pcimem' (0x0 - 0x), flags=0
+ 0x0 - 0x9
+ 0xc - 0x9f9f
+ 0xfeb0 - 0x
 acpiprt0 at acpi0: bus 0 (PCI0)
 acpiprt1 at acpi0: bus -1 (P0P1)
 acpiprt2 at acpi0: bus 2 (RP01)


Dmesg from unmodified kernel

OpenBSD 5.9-beta (GENERIC.MP) #2: Thu Jan  7 19:16:41 CET 2016

r...@r2d2.my.domain:/usr/originalKernel/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 632704 (6018MB)
avail mem = 6115713024 (5832MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xe6df0 (39 entries)
bios0: vendor Acer version "V2.21" date 12/16/2013
bios0: Acer Aspire E1-531G
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP UEFI ASF! HPET APIC MCFG SSDT BOOT ASPT DBGP FPDT SSDT 
SSDT SSDT
acpi0: wakeup devices P0P1(S4) GLAN(S4) EHC1(S3) EHC2(S3) XHC_(S3) HDEF(S0) 
PXSX(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) RP04(S4) 
PXSX(S4) RP05(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Pentium(R) CPU B960 @ 2.20GHz, 2195.31 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1.2, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Pentium(R) CPU B960 @ 2.20GHz, 2195.02 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 0 pa 0xfec0, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xf000, bus 0-63
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (P0P1)
acpiprt2 at acpi0: bus 2 (RP01)
acpiprt3 at acpi0: bus 3 (RP02)
acpiprt4 at acpi0: bus -1 (RP03)
acpiprt5 at acpi0: bus -1 (RP04)
acpiprt6 at acpi0: bus -1 (RP05)
acpiprt7 at acpi0: bus -1 (RP06)
acpiprt8 at acpi0: bus -1 (RP07)
acpiprt9 at acpi0: bus -1 (RP08)
acpiprt10 at acpi0: bus 1 (PEG0)
acpiprt11 at acpi0: bus -1 (PEG1)
acpiprt12 at acpi0: bus -1 (PEG2)
acpiprt13 at acpi0: bus -1 (PEG3)
acpiec0 at acpi0
acpicpu0 at acpi0: C2(350@104 mwait.1@0x20), C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C2(350@104 mwait.1@0x20), C1(1000@1 mwait.1), PSS
acpibat0 at acpi0: BAT1 model "Li_Ion_4000mA " serial 684 type Lion oem "SONY "
acpiac0 at acpi0: AC unit online
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: LID0
acpibtn2 at acpi0: SLPB
acpivideo0 at acpi0: GFX0
acpivout0 at acpivideo0: DD02
cpu0: Enhanced SpeedStep 2195 MHz: speeds: 2200, 2100, 2000, 1900, 1800, 1700, 
1600, 1500, 1400, 1300, 1200, 1100, 1000, 900, 800 MHz
pci0 at mainbus0 bus 0
pchb0 at 

Re: Get PCI resources from ACPI

2016-01-06 Thread Pablo Méndez Hernández
Hi team,

On Thu, Dec 31, 2015 at 10:05 PM, Philip Guenther  wrote:
> On Wed, 30 Dec 2015, Mark Kettenis wrote:
> ...
>> Updated diff.  Once again the ACPI standard is ambiguous and/or violated
>> by the hardware vendors.  This should fix at least the ports Dell r620
>> that naddy@ told me about.
>
> Here's the diff of dmesgs with-vs-without this diff on my yoga12:
>
> @@ -41,6 +41,11 @@
>  cpu3: smt 1, core 1, package 0
>  ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 40 pins
>  acpimcfg0 at acpi0 addr 0xf800, bus 0-63
> +bus 0
> +extent `pcimem' (0x0 - 0x), flags=0
> + 0x0 - 0x9
> + 0xe - 0xcfff
> + 0xfeb0 - 0x
>  acpiprt0 at acpi0: bus 0 (PCI0)
>  acpiprt1 at acpi0: bus -1 (PEG0)
>  acpiprt2 at acpi0: bus -1 (PEG1)

Here's mine with a current snapshot in a KVM VM:

OpenBSD 5.9-beta (GENERIC.MP) #1790: Wed Jan  6 18:51:16 MST 2016
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP

@@ -46,11 +46,6 @@
 cpu3: smt 1, core 1, package 0
 ioapic0 at mainbus0: apid 0 pa 0xfec0, version 11, 24 pins
 acpihpet0 at acpi0: 1 Hz
+bus 0
+extent `pcimem' (0x0 - 0x), flags=0
+ 0x0 - 0x9
+ 0xc - 0xbfff
+ 0xfec0 - 0x
 acpiprt0 at acpi0: bus 0 (PCI0)
 acpicpu0 at acpi0: C1(@1 halt!)
 acpicpu1 at acpi0: C1(@1 halt!)


Regards.

-- 

Pablo Méndez Hernández



Re: Get PCI resources from ACPI

2015-12-31 Thread Philip Guenther
On Wed, 30 Dec 2015, Mark Kettenis wrote:
...
> Updated diff.  Once again the ACPI standard is ambiguous and/or violated 
> by the hardware vendors.  This should fix at least the ports Dell r620 
> that naddy@ told me about.

Here's the diff of dmesgs with-vs-without this diff on my yoga12:

@@ -41,6 +41,11 @@
 cpu3: smt 1, core 1, package 0
 ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 40 pins
 acpimcfg0 at acpi0 addr 0xf800, bus 0-63
+bus 0
+extent `pcimem' (0x0 - 0x), flags=0
+ 0x0 - 0x9
+ 0xe - 0xcfff
+ 0xfeb0 - 0x
 acpiprt0 at acpi0: bus 0 (PCI0)
 acpiprt1 at acpi0: bus -1 (PEG0)
 acpiprt2 at acpi0: bus -1 (PEG1)


Everything seems to still be working


Philip Guenther



Get PCI resources from ACPI

2015-12-30 Thread Mark Kettenis
It seems more and more server machines ship in a "64-bit"
configuration where the BIOS assigns addresses above the 4GB mark to
64-bit BARs.  We have a hack in arch/amd64/pci_machdep.c:pci_init_extents()
to deal with some of these configurations:

/*
 *  ...
 *
 * Dell 13G servers have important devices outside the
 * 36-bit address space.  Until we can extract the address
 * ranges from ACPI, expand the allowed range to suit.
 */

I ran into a SuperMicro machine that puts stuff even higher.  And
ratherthan extending the range again, I think it is time to bite the
bullet and trust ACPI.

The diff below is a first stab.  Needs a bit more polish, but before I
spend more time on it, I'd like to get some test results.  I'd like to
see the diff tested on a wide variety of machines.  Please send me old
and new dmesg and acpidump output.

Warning!  A kernel with this diff might panic early on in the boot
process, so don't play with it unless you have a way to boot your
previous kernel.


Index: acpi.c
===
RCS file: /cvs/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.297
diff -u -p -r1.297 acpi.c
--- acpi.c  23 Nov 2015 00:10:53 -  1.297
+++ acpi.c  30 Dec 2015 13:03:38 -
@@ -561,6 +561,48 @@ acpi_matchhids(struct acpi_attach_args *
return (0);
 }
 
+int
+acpi_fill_memex(union acpi_resource *crs, void *arg)
+{
+   int type = AML_CRSTYPE(crs);
+   struct extent *ex = arg;
+   uint64_t min, max, len;
+   uint16_t flags;
+
+   switch (type) {
+   case LR_DWORD:
+   type = crs->lr_dword.type;
+   flags = crs->lr_dword.flags;
+   len = crs->lr_dword._len;
+   min = crs->lr_dword._min;
+   max = crs->lr_dword._max;
+   break;
+   case LR_QWORD:
+   type = crs->lr_qword.type;
+   flags = crs->lr_qword.flags;
+   len = crs->lr_qword._len;
+   min = crs->lr_qword._min;
+   max = crs->lr_qword._max;
+   break;
+   default:
+   return 0;
+   }
+
+   if (type != 0)
+   return 0;
+   if (len == 0)
+   return 0;
+   if ((flags & 0xc) != 0xc)
+   return 0;
+   if (min >= max)
+   return 0;
+   if (len != max - min + 1)
+   return 0;
+
+   extent_free(ex, min, len, EX_NOWAIT);
+   return 0;
+}
+
 /* Map ACPI device node to PCI */
 int
 acpi_getpci(struct aml_node *node, void *arg)
@@ -573,10 +615,17 @@ acpi_getpci(struct aml_node *node, void 
pcitag_t tag;
uint64_t val;
uint32_t reg;
+   int64_t sta = 0;
 
if (!node->value || node->value->type != AML_OBJTYPE_DEVICE)
return 0;
-   if (!aml_evalhid(node, )) {
+
+   /* Evaluate _STA to decide PCI Root node fate and walk fate */
+   if (aml_evalinteger(sc, node, "_STA", 0, NULL, ))
+   sta = STA_PRESENT | STA_ENABLED | STA_DEV_OK | 0x1000;
+
+   if ((sta & (STA_PRESENT|STA_ENABLED)) == (STA_PRESENT|STA_ENABLED) &&
+   !aml_evalhid(node, )) {
/* Check if this is a PCI Root node */
if (_acpi_matchhids(res.v_string, pcihid)) {
aml_freevalue();
@@ -603,6 +652,18 @@ acpi_getpci(struct aml_node *node, void 
dnprintf(10, "found PCI root: %s %d\n",
aml_nodename(node), pci->bus);
TAILQ_INSERT_TAIL(_pcirootdevs, pci, next);
+
+   pci->memex = extent_create("pcimem", 0, -1, M_DEVBUF, 
NULL, 0, EX_NOWAIT | EX_FILLED);
+   KASSERT(pci->memex != NULL);
+
+   if (aml_evalname(sc, node, "_CRS", 0, NULL, ) == 0) 
{
+   aml_parse_resource(, acpi_fill_memex, 
pci->memex);
+   aml_freevalue();
+   printf("bus %d\n", pci->bus);
+   extent_print(pci->memex);
+   if (pci->bus == 0)
+   pcimem_ex = pci->memex;
+   }
}
aml_freevalue();
return 0;
@@ -833,6 +894,7 @@ acpi_pciroots_attach(struct device *dev,
1, EX_NOWAIT) != 0)
continue;
pba->pba_bus = pdev->bus;
+   pba->pba_memex = pdev->memex;
config_found(dev, pba, pr);
}
 }
Index: amltypes.h
===
RCS file: /cvs/src/sys/dev/acpi/amltypes.h,v
retrieving revision 1.40
diff -u -p -r1.40 amltypes.h
--- amltypes.h  7 Sep 2012 19:19:59 -   1.40
+++ amltypes.h  30 Dec 2015 13:03:38 -
@@ -362,6 +362,8 @@