Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Sep 2015 02:37:58 +0000
From:      "Pokala, Ravi" <rpokala@panasas.com>
To:        John Baldwin <jhb@freebsd.org>, "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: bus_.*_resource() and rid
Message-ID:  <D217B20D.1455A1%rpokala@panasas.com>
In-Reply-To: <1685918.WyYIclYTSg@ralph.baldwin.cx>
References:  <D214E963.145154%rpokala@panasas.com> <1685918.WyYIclYTSg@ralph.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
-----Original Message-----
From: John Baldwin <jhb@freebsd.org>
Date: 2015-09-10, Thursday at 17:24
To: "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Cc: Ravi Pokala <rpokala@panasas.com>
Subject: Re: bus_.*_resource() and rid

>Each bus decides how to manage RIDs.  For PCI devices, RIDs are the
>address of the corresponding BAR for memory and I/O port resources and
>follow a different convention for interrupts (0 =3D=3D INTx, 1...N =3D=3D
>MSI/MSI-X). For ISA devices (and ACPI) RIDs are 0...N.  If a device is
>enumerated via the firmware (e.g. ACPI DSDT entry with _CRS or PNPBIOS
>data for non-ACPI) then the firmware assigned resources are set for you
>by the parent bus and start at 0 (if you have two I/O port resources
>you'd have the second one at rid 1).

I see the address ranges w/ `devinfo -r', but they don't list RIDs.

>If you are doing this on the LPC, then that it is actually a PCI device,
>and I don't know if the PCI bus is really going to let you create a rid
>at 0 via bus_set_resource().  Hmm, it should, but it's kind of a bit
>hacky.  It might be somewhat cleaner if instead you treat this as an ISA
>device that is a child of isa0 below the LPC device.  You can use an
>identify routine that looks at the grandparent isab0 device and then
>allocates this.

My understanding was that the *only* way to treat devices hanging off the
LPC was as an ISA device, so that's what I've been doing. That is, the LPC
controller is a transparent bridge to allow ISA devices to connect to
modern systems. (In several cases, the LPC controller also has some BARs
which point at integrated ISA devices, like GPIO controllers, but that's
beside the point.)

>However, a rid of 0 "should" work.  You can check the resource list of
>the device in kgdb to see if there's a valid resource entry for rid 0.
>You could also try calling bus_get_resource() in your attach routine to
>see if the bus_set_resource() "worked".

I'll look into bus_get_resource(). Oh, look - there's no manpage
(share/man/man9/bus_get_resource.9 does not exist, despite being a "see
also" entry in bus_set_resource.9). :-S

-Ravi

>--=20
>John Baldwin




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D217B20D.1455A1%rpokala>