Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Aug 2016 16:51:03 +0300
From:      "karu.pruun" <karu.pruun@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   problem attaching driver at LPC bus
Message-ID:  <CADdF=MJY4OGEXJCo60NoxTZAVkN74TpyLTUYWpbcG4XnPm1aEg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hello

I am trying to write a small driver for a device (gmux) attached to the LPC
bus, but am stuck with allocation of I/O ports. The device shows as
follows:

---
devinfo -rv | grep GMUX:

unknown pnpinfo _HID=APP000B _UID=0 at handle=\_SB_.PCI0.LPCB.GMUX
---

I took cue from sys/dev/acpica/acpi_ec.c. Probing works fine with
ACPI_ID_PROBE in analogy to acpi_ec.c:

--- ---
sys/dev/acpica/acpi_ec.c:
---

acpi_ec_probe(. . .)
{
    . . .

    ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids)

    . . .
}
--- ---

Then attach() calls bus_alloc_resource():

--- ---
sys/dev/acpica/acpi_ec.c:
---

acpi_ec_attach(. . .)
{
    struct resource *res;
    . . .

    res = bus_alloc_resource_any(sc->ec_dev, SYS_RES_IOPORT,
&sc->ec_data_rid, RF_ACTIVE);

    . . .
}
--- ---

But this fails for my driver, res is always NULL. I looked up acpi tables
(acpidump -td), the IO resources for GMUX are there:

--- ---
    Scope (\_SB.PCI0.LPCB)
    {
        Device (GMUX)
        {
            Name (_HID, EisaId ("APP000B"))  // _HID: Hardware ID
            Name (_CID, "gmux")  // _CID: Compatible ID
            Name (_STA, 0x0B)  // _STA: Status
            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource
Settings
            {
                IO (Decode16,
                    0x0700,             // Range Minimum
                    0x07FF,             // Range Maximum
                    0x01,               // Alignment
                    0xFF,               // Length
                    )
            })
--- ---

Could someone explain where I have gone wrong?

Thank you

Peeter

--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADdF=MJY4OGEXJCo60NoxTZAVkN74TpyLTUYWpbcG4XnPm1aEg>