Three content changes:
1) Use the new c99 initialization in the pci driver example. Also, don't claim this device is a tty. 2) Add notes about caution needed during detach routine wrt interrupts and locking. 3) Add note that vtophys is deprecated and to use busdma instead. Since the busdma API isn't completely settled for 5.x yet, don't document it. I'll leave that to others when the API is done being frobbed.
This commit is contained in:
parent
1c722a4f22
commit
6891feb81d
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=17467
2 changed files with 46 additions and 28 deletions
en_US.ISO8859-1/books
|
@ -47,20 +47,11 @@ d_write_t mypci_write;
|
|||
/* Character device entry points */
|
||||
|
||||
static struct cdevsw mypci_cdevsw = {
|
||||
mypci_open,
|
||||
mypci_close,
|
||||
mypci_read,
|
||||
mypci_write,
|
||||
noioctl,
|
||||
nopoll,
|
||||
nommap,
|
||||
nostrategy,
|
||||
"mypci",
|
||||
36, /* reserved for lkms - /usr/src/sys/conf/majors */
|
||||
nodump,
|
||||
nopsize,
|
||||
D_TTY,
|
||||
-1
|
||||
.d_open = mypci_open,
|
||||
.d_close = mypci_close,
|
||||
.d_read = mypci_read,
|
||||
.d_write = mypci_write,
|
||||
.d_name = "mypci",
|
||||
};
|
||||
|
||||
/* vars */
|
||||
|
@ -325,10 +316,28 @@ board_write(struct ni_softc *sc, uint16_t address, uint16_t value) {
|
|||
sc->irq_bh = rman_get_bushandle(sc->irqres);
|
||||
</programlisting>
|
||||
|
||||
<para>Some care must be taken in the detach routine of the
|
||||
driver. You must quiess the device's interrupt stream, and
|
||||
remove the interrupt hanlder. Once
|
||||
<function>bus_space_teardown_intr()</function> has returned, you
|
||||
know that your interrupt handler will no longer be called, and
|
||||
that all threads that might have been this interrupt handler
|
||||
have returned. Depending on the locking strategy of your
|
||||
driver, you will also need to be careful with what locks you
|
||||
hold when you do this to avoid deadlock.</para>
|
||||
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>DMA</title>
|
||||
<para>This section is obsolete, and present only for historical
|
||||
reasons. The proper methods for dealing with these issues is to
|
||||
use the <function>bus_space_dma*()</function> functions instead.
|
||||
This paragraph can be removed when this section is updated to reflect
|
||||
that usage. However, at the moment, the API is in a bit of
|
||||
flux, so once that settles down, it would be good to update this
|
||||
section to reflect that.</para>
|
||||
|
||||
<para>On the PC, peripherals that want to do bus-mastering DMA
|
||||
must deal with physical addresses. This is a problem since
|
||||
FreeBSD uses virtual memory and deals almost exclusively with
|
||||
|
|
|
@ -47,20 +47,11 @@ d_write_t mypci_write;
|
|||
/* Character device entry points */
|
||||
|
||||
static struct cdevsw mypci_cdevsw = {
|
||||
mypci_open,
|
||||
mypci_close,
|
||||
mypci_read,
|
||||
mypci_write,
|
||||
noioctl,
|
||||
nopoll,
|
||||
nommap,
|
||||
nostrategy,
|
||||
"mypci",
|
||||
36, /* reserved for lkms - /usr/src/sys/conf/majors */
|
||||
nodump,
|
||||
nopsize,
|
||||
D_TTY,
|
||||
-1
|
||||
.d_open = mypci_open,
|
||||
.d_close = mypci_close,
|
||||
.d_read = mypci_read,
|
||||
.d_write = mypci_write,
|
||||
.d_name = "mypci",
|
||||
};
|
||||
|
||||
/* vars */
|
||||
|
@ -325,10 +316,28 @@ board_write(struct ni_softc *sc, uint16_t address, uint16_t value) {
|
|||
sc->irq_bh = rman_get_bushandle(sc->irqres);
|
||||
</programlisting>
|
||||
|
||||
<para>Some care must be taken in the detach routine of the
|
||||
driver. You must quiess the device's interrupt stream, and
|
||||
remove the interrupt hanlder. Once
|
||||
<function>bus_space_teardown_intr()</function> has returned, you
|
||||
know that your interrupt handler will no longer be called, and
|
||||
that all threads that might have been this interrupt handler
|
||||
have returned. Depending on the locking strategy of your
|
||||
driver, you will also need to be careful with what locks you
|
||||
hold when you do this to avoid deadlock.</para>
|
||||
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>DMA</title>
|
||||
<para>This section is obsolete, and present only for historical
|
||||
reasons. The proper methods for dealing with these issues is to
|
||||
use the <function>bus_space_dma*()</function> functions instead.
|
||||
This paragraph can be removed when this section is updated to reflect
|
||||
that usage. However, at the moment, the API is in a bit of
|
||||
flux, so once that settles down, it would be good to update this
|
||||
section to reflect that.</para>
|
||||
|
||||
<para>On the PC, peripherals that want to do bus-mastering DMA
|
||||
must deal with physical addresses. This is a problem since
|
||||
FreeBSD uses virtual memory and deals almost exclusively with
|
||||
|
|
Loading…
Reference in a new issue