On Sat, Aug 5, 2017 at 2:11 PM, Mark Kettenis <mark.kette...@xs4all.nl> wrote:
>> Date: Sat, 5 Aug 2017 13:47:16 +0200
>> From: Stefan Sperling <s...@stsp.name>
>>
>> On Sat, Jun 10, 2017 at 02:23:55PM +0200, Stefan Sperling wrote:
>> > On Tue, May 23, 2017 at 07:51:14AM +0200, Cesare Gargano wrote:
>> > > Hi,
>> > > I made E200HA keyboard and touchpad work configuring node->parent deps.
>> > > As Mark says, it's a order problem, we should attach all deps drivers 
>> > > before
>> > > attaching the device driver itself.
>> > >
>> > > Attached diff and a (old) dmesg.
>> > >
>> > > -
>> > > C.
>> >
>> > This diff has not caused a problem on any of my machines, and I still
>> > have it in my build tree.
>> >
>> > What happened to it?
>>
>> Ping. Should this diff be discarded?
>
> Setting node->parent->attached is a bit of an ugly hack.  Is tis to
> prevent us from entering an infinite loop because the i2c device has a
> _DEP pointing back at the i2c controller?
>
> Perhaps the solution here is to set node->parent->attached to 1 before
> calling config_found() in acpi.c?
>
>> > > diff --git a/.gitignore b/.gitignore
>> > > new file mode 100644
>> > > index 00000000000..dbd7620a943
>> > > --- /dev/null
>> > > +++ b/.gitignore
>> > > @@ -0,0 +1,4 @@
>> > > +obj/
>> > > +~*
>> > > +*.o
>> > > +*.d
>> > > diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
>> > > index 09495657aad..092693e192c 100644
>> > > --- a/sys/dev/acpi/acpi.c
>> > > +++ b/sys/dev/acpi/acpi.c
>> > > @@ -2819,7 +2819,7 @@ acpi_attach_deps(struct acpi_softc *sc, struct 
>> > > aml_node *node)
>> > >           if (dep == NULL || dep->attached)
>> > >                   continue;
>> > >           dep = aml_searchname(dep, "_HID");
>> > > -         if (dep)
>> > > +         if (dep && dep->parent->attached != 2)
>> > >                   acpi_foundhid(dep, sc);
>> > >   }
>> > >
>> > > diff --git a/sys/dev/acpi/dwiic.c b/sys/dev/acpi/dwiic.c
>> > > index 60bf8d17a22..302b0051229 100644
>> > > --- a/sys/dev/acpi/dwiic.c
>> > > +++ b/sys/dev/acpi/dwiic.c
>> > > @@ -196,6 +196,8 @@ int           dwiic_i2c_exec(void *, i2c_op_t, 
>> > > i2c_addr_t, const void *,
>> > >               size_t, void *, size_t, int);
>> > >  void             dwiic_xfer_msg(struct dwiic_softc *);
>> > >
>> > > +extern void      acpi_attach_deps(struct acpi_softc *, struct aml_node 
>> > > *);
>> > > +
>> > >  struct cfattach dwiic_ca = {
>> > >   sizeof(struct dwiic_softc),
>> > >   dwiic_match,
>> > > @@ -567,11 +569,15 @@ dwiic_acpi_found_hid(struct aml_node *node, void 
>> > > *arg)
>> > >           aml_freevalue(&res);
>> > >           return (0);
>> > >   }
>> > > +
>> > >   memset(&crs, 0, sizeof(crs));
>> > >   crs.devnode = sc->sc_devnode;
>> > >   aml_parse_resource(&res, dwiic_acpi_parse_crs, &crs);
>> > >   aml_freevalue(&res);
>> > >
>> > > + node->parent->attached = 2;
>> > > + acpi_attach_deps(acpi_softc, node->parent);
>> > > +
>> > >   if (dwiic_matchhids(cdev, ihidev_hids))
>> > >           return dwiic_acpi_found_ihidev(sc, node, dev, crs);
>> > >   else if (dwiic_matchhids(dev, iatp_hids))
>> >
>> >
>>
>>

Hi,
works fine with your suggestion. I tested this with Asus E200HA (dmesg
attached), T420s, T400, T23,
and all runs without problems. Please test the diff below.

-
C.

diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index e5a44e5197f..2bd7e8b9ade 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -2878,8 +2878,8 @@ acpi_foundhid(struct aml_node *node, void *arg)
 #endif

        if (!node->parent->attached) {
-               config_found(self, &aaa, acpi_print);
                node->parent->attached = 1;
+               config_found(self, &aaa, acpi_print);
        }

        return (0);
diff --git a/sys/dev/acpi/dwiic.c b/sys/dev/acpi/dwiic.c
index 60bf8d17a22..3e230f9725b 100644
--- a/sys/dev/acpi/dwiic.c
+++ b/sys/dev/acpi/dwiic.c
@@ -196,6 +196,8 @@ int         dwiic_i2c_exec(void *, i2c_op_t,
i2c_addr_t, const void *,
                    size_t, void *, size_t, int);
 void           dwiic_xfer_msg(struct dwiic_softc *);

+extern void    acpi_attach_deps(struct acpi_softc *, struct aml_node *);
+
 struct cfattach dwiic_ca = {
        sizeof(struct dwiic_softc),
        dwiic_match,
@@ -567,11 +569,14 @@ dwiic_acpi_found_hid(struct aml_node *node, void *arg)
                aml_freevalue(&res);
                return (0);
        }
+
        memset(&crs, 0, sizeof(crs));
        crs.devnode = sc->sc_devnode;
        aml_parse_resource(&res, dwiic_acpi_parse_crs, &crs);
        aml_freevalue(&res);

+       acpi_attach_deps(acpi_softc, node->parent);
+
        if (dwiic_matchhids(cdev, ihidev_hids))
                return dwiic_acpi_found_ihidev(sc, node, dev, crs);
        else if (dwiic_matchhids(dev, iatp_hids))
OpenBSD 6.1-current (GENERIC.MP) #2: Sun Aug  6 01:51:42 CEST 2017
    
gar...@zingiber.plusiagamma.com:/home/garcer/Projects/Repos/github.com/garcer/openbsd-src/sys/arch/amd64/compile/GENERIC.MP
RTC BIOS diagnostic error 3f<config_unit,memory_size,fixed_disk,invalid_time>
real mem = 2019655680 (1926MB)
avail mem = 1952129024 (1861MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 3.0 @ 0x7b127000 (19 entries)
bios0: vendor American Megatrends Inc. version "E200HA.300" date 06/01/2016
bios0: ASUSTeK COMPUTER INC. E200HA
acpi0 at bios0: rev 2
acpi0: sleep states S0 S4 S5
acpi0: tables DSDT FACP APIC FPDT FIDT MCFG SSDT SSDT SSDT UEFI HPET SSDT SSDT 
SSDT SSDT TPM2 LPIT BCFG PRAM BGRT CSRT WDAT MSDM
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Atom(TM) x5-Z8300 CPU @ 1.44GHz, 1440.25 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,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT
cpu0: 1MB 64b/line 16-way L2 cache
cpu0: TSC frequency 1440253980 Hz
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 79MHz
cpu0: mwait min=64, max=64, C-substates=0.2.0.0.0.0.3.3, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Atom(TM) x5-Z8300 CPU @ 1.44GHz, 1439.96 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,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT
cpu1: 1MB 64b/line 16-way L2 cache
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 4 (application processor)
cpu2: Intel(R) Atom(TM) x5-Z8300 CPU @ 1.44GHz, 1439.96 MHz
cpu2: 
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,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT
cpu2: 1MB 64b/line 16-way L2 cache
cpu2: smt 0, core 2, package 0
cpu3 at mainbus0: apid 6 (application processor)
cpu3: Intel(R) Atom(TM) x5-Z8300 CPU @ 1.44GHz, 1439.96 MHz
cpu3: 
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,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT
cpu3: 1MB 64b/line 16-way L2 cache
cpu3: smt 0, core 3, package 0
ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 20, 115 pins
acpimcfg0 at acpi0 addr 0xe0000000, bus 0-255
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (RP01)
acpiprt2 at acpi0: bus -1 (RP02)
acpiprt3 at acpi0: bus -1 (RP03)
acpiprt4 at acpi0: bus -1 (RP04)
acpiec0 at acpi0: not present
acpicpu0 at acpi0
C2: state 6: substate 8 >= num 3
C3: state 7: substate 4 >= num 3: C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0
C2: state 6: substate 8 >= num 3
C3: state 7: substate 4 >= num 3: C1(1000@1 mwait.1), PSS
acpicpu2 at acpi0
C2: state 6: substate 8 >= num 3
C3: state 7: substate 4 >= num 3: C1(1000@1 mwait.1), PSS
acpicpu3 at acpi0
C2: state 6: substate 8 >= num 3
C3: state 7: substate 4 >= num 3: C1(1000@1 mwait.1), PSS
acpipwrres0 at acpi0: ID3C, resource for ISP3
acpipwrres1 at acpi0: CLK3, resource for CNXT
acpipwrres2 at acpi0: CLK4
acpipwrres3 at acpi0: CLK2
acpipwrres4 at acpi0: CLK0
acpipwrres5 at acpi0: CLK1
acpipwrres6 at acpi0: CLK0
acpipwrres7 at acpi0: CLK1
acpipwrres8 at acpi0: USBC, resource for XHC1, OTG1
acpipwrres9 at acpi0: P28X
acpipwrres10 at acpi0: P18X
acpipwrres11 at acpi0: P12X
acpipwrres12 at acpi0: P28P
acpipwrres13 at acpi0: P18P
acpipwrres14 at acpi0: P19X
acpipwrres15 at acpi0: P06X
acpipwrres16 at acpi0: P28T
acpipwrres17 at acpi0: P18D
acpipwrres18 at acpi0: P18T
acpipwrres19 at acpi0: P3P3
acpipwrres20 at acpi0: P12T
acpipwrres21 at acpi0: P28W
acpipwrres22 at acpi0: P18W
acpipwrres23 at acpi0: P12W
acpipwrres24 at acpi0: P33W
acpipwrres25 at acpi0: P33X
acpitz0 at acpi0: critical temperature is 90 degC
"INT33A4" at acpi0 not configured
"INT33BD" at acpi0 not configured
dwiic0 at acpi0: I2C7 addr 0x91626000/0x1000 irq 38
iic0 at dwiic0
chvgpio0 at acpi0: GPO1 uid 2 addr 0xfed88000/0x8000 irq 48, 59 pins
dwiic1 at acpi0: I2C1 addr 0x91632000/0x1000 irq 32
iic1 at dwiic1
chvgpio1 at acpi0: GPO0 uid 1 addr 0xfed80000/0x8000 irq 49, 56 pins
ihidev0 at iic1 addr 0x68 gpio 93, vendor 0xb05 product 0x8585, PDEC3393
ihidev0: 9 report ids
ikbd0 at ihidev0 reportid 1: 8 variable keys, 6 key codes
wskbd0 at ikbd0 mux 1
hid at ihidev0 reportid 3 not configured
hid at ihidev0 reportid 6 not configured
hid at ihidev0 reportid 9 not configured
dwiic2 at acpi0: I2C3 addr 0x9162e000/0x1000 irq 34
iic2 at dwiic2
ihidev1 at iic2 addr 0x15 gpio 17, vendor 0xb05 product 0x101, FTE1000
ihidev1: 93 report ids
ims0 at ihidev1 reportid 1: 2 buttons, Z dir
wsmouse0 at ims0 mux 0
hid at ihidev1 reportid 11 not configured
hid at ihidev1 reportid 12 not configured
hid at ihidev1 reportid 13 not configured
hid at ihidev1 reportid 93 not configured
chvgpio2 at acpi0: GPO2 uid 3 addr 0xfed90000/0x8000 irq 50, 24 pins
sdhc0 at acpi0: SDHA addr 0x91638000/0x1000 irq 45
sdhc0: SDHC 3.0, 200 MHz base clock
sdmmc0 at sdhc0: 8-bit, sd high-speed, mmc high-speed, dma
sdhc1 at acpi0: SHC1 addr 0x91636000/0x1000 irq 47
sdhc1: SDHC 3.0, 200 MHz base clock
sdmmc1 at sdhc1: 4-bit, sd high-speed, mmc high-speed, dma
"INTL9C60" at acpi0 not configured
"INTL9C60" at acpi0 not configured
"8086228A" at acpi0 not configured
"8086228A" at acpi0 not configured
"8086228E" at acpi0 not configured
"8086228E" at acpi0 not configured
"8086228E" at acpi0 not configured
"PDEC3393" at acpi0 not configured
dwiic3 at acpi0: I2C2 addr 0x91630000/0x1000 irq 33
iic3 at dwiic3
"14F10720" at acpi0 not configured
"FTE1000" at acpi0 not configured
dwiic4 at acpi0: I2C4 addr 0x9162c000/0x1000 irq 35
iic4 at dwiic4
dwiic5 at acpi0: I2C5 addr 0x9162a000/0x1000 irq 36
iic5 at dwiic5
dwiic6 at acpi0: I2C6 addr 0x91628000/0x1000 irq 37
iic6 at dwiic6
"INT33F5" at acpi0 not configured
"808622A8" at acpi0 not configured
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: SLPB
chvgpio3 at acpi0: GPO3 uid 4 addr 0xfed98000/0x8000 irq 91, 55 pins
chvgpio4 at acpi0: GPO4 uid 5
"ACPI000C" at acpi0 not configured
"PNP0C14" at acpi0 not configured
"ATK4002" at acpi0 not configured
acpiac0 at acpi0: AC unit online
acpibtn2 at acpi0: LID_
"INTCFD9" at acpi0 not configured
"INT33D3" at acpi0 not configured
"INT3400" at acpi0 not configured
"INT3403" at acpi0 not configured
"INT3406" at acpi0 not configured
"MSFT0101" at acpi0 not configured
acpivideo0 at acpi0: GFX0
acpivout0 at acpivideo0: DD01
acpivout at acpivideo0 not configured
acpivout at acpivideo0 not configured
acpivout at acpivideo0 not configured
acpivout at acpivideo0 not configured
acpivout at acpivideo0 not configured
acpivout at acpivideo0 not configured
acpivout at acpivideo0 not configured
cpu0: Enhanced SpeedStep 1440 MHz: speeds: 1441, 1440, 1360, 1280, 1200, 1120, 
1040, 960, 880, 800, 720, 640, 560, 480 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel Braswell Host" rev 0x22
inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics" rev 0x22
drm0 at inteldrm0
inteldrm0: msi
inteldrm0: 1366x768, 32bpp
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation)
wskbd0: connecting to wsdisplay0
wsdisplay0: screen 1-5 added (std, vt100 emulation)
"Intel Braswell Power" rev 0x22 at pci0 dev 11 function 0 not configured
xhci0 at pci0 dev 20 function 0 "Intel Braswell xHCI" rev 0x22: msi
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "Intel xHCI root hub" rev 3.00/1.00 
addr 1
"Intel Braswell TXE" rev 0x22 at pci0 dev 26 function 0 not configured
ppb0 at pci0 dev 28 function 0 "Intel Braswell PCIE" rev 0x22: msi
pci1 at ppb0 bus 1
vendor "Atheros", unknown product 0x0042 (class network subclass miscellaneous, 
rev 0x30) at pci1 dev 0 function 0 not configured
pcib0 at pci0 dev 31 function 0 "Intel Braswell PCU LPC" rev 0x22
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com1 at isa0 port 0x2f8/8 irq 3: ns8250, no fifo
com2 at isa0 port 0x3e8/8 irq 5: ns8250, no fifo
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd1 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
vmm0 at mainbus0: VMX/EPT
efifb at mainbus0 not configured
sdmmc1: can't enable card
scsibus1 at sdmmc0: 2 targets, initiator 0
sd0 at scsibus1 targ 1 lun 0: <Samsung, BGND3R, 0000> SCSI2 0/direct removable
sd0: 29820MB, 512 bytes/sector, 61071360 sectors
uvideo0 at uhub0 port 1 configuration 1 interface 0 "Chicony Electronics 
Co.,Ltd. USB2.0 VGA UVC WebCam" rev 2.00/95.56 addr 2
video0 at uvideo0
umass0 at uhub0 port 2 configuration 1 interface 0 "Silicon Integrated Systems 
Corp. product 0x0151" rev 2.00/1.00 addr 3
umass0: using SCSI over Bulk-Only
scsibus2 at umass0: 2 targets, initiator 0
sd1 at scsibus2 targ 1 lun 0: <USBest, USB2FlashStorage, 0.00> SCSI2 0/direct 
removable
sd1: 125MB, 512 bytes/sector, 256000 sectors
ugen0 at uhub0 port 3 "AsureWave product 0x3496" rev 1.10/0.01 addr 4
vscsi0 at root
scsibus3 at vscsi0: 256 targets
softraid0 at root
scsibus4 at softraid0: 256 targets
root on sd1a (ba9c89b9a7f2b0cb.a) swap on sd1b dump on sd1b
hw.sensors.cpu0.temp0=52.00 degC
hw.sensors.acpitz0.temp0=0.00 degC (zone temperature)
hw.sensors.acpiac0.indicator0=On (power supply)
hw.sensors.acpibtn2.indicator0=On (lid open)

Reply via email to