- Use d_thread_t rather than struct thread directly.

- Use the PCIR_BAR() macro rather than hardcoding the offsets of BAR
  registers in PCI config space.
This commit is contained in:
John Baldwin 2003-12-31 18:21:58 +00:00
parent 96ffa091d2
commit dff04d611f
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=19411

View file

@ -65,7 +65,7 @@ static dev_t sdev;
open/close/read/write at this point */
int
mypci_open(dev_t dev, int oflags, int devtype, struct thread *td)
mypci_open(dev_t dev, int oflags, int devtype, d_thread_t *td)
{
int err = 0;
@ -74,7 +74,7 @@ mypci_open(dev_t dev, int oflags, int devtype, struct thread *td)
}
int
mypci_close(dev_t dev, int fflag, int devtype, struct thread *td)
mypci_close(dev_t dev, int fflag, int devtype, struct d_thread_t *td)
{
int err=0;
@ -226,7 +226,7 @@ DRIVER_MODULE(mypci, pci, mypci_driver, mypci_devclass, 0, 0);</programlisting>
<para>For example, a typical driver might have something similar
to this in the <function>attach()</function> function:</para>
<programlisting> sc->bar0id = 0x10;
<programlisting> sc->bar0id = PCIR_BAR(0);
sc->bar0res = bus_alloc_resource(dev, SYS_RES_MEMORY, &amp;(sc->bar0id),
0, ~0, 1, RF_ACTIVE);
if (sc->bar0res == NULL) {
@ -235,7 +235,7 @@ DRIVER_MODULE(mypci, pci, mypci_driver, mypci_devclass, 0, 0);</programlisting>
goto fail1;
}
sc->bar1id = 0x14;
sc->bar1id = PCIR_BAR(1);
sc->bar1res = bus_alloc_resource(dev, SYS_RES_MEMORY, &amp;(sc->bar1id),
0, ~0, 1, RF_ACTIVE);
if (sc->bar1res == NULL) {