nioprobe(D3DK) —
.IX \f4nioprobe\fP(D3DK)
NAME
nioprobe − probe an I/O address for a device
SYNOPSIS
#include <sys/types.h>
#include <sys/buf.h>
#include <sys/iosystm.h>
int nioprobe(u_int access, addr_t addr, u_int ∗data);
ARGUMENTS
accessThe type of probe desired.
addrThe address to probe.
dataThe data read or written by nioprobe.
DESCRIPTION
nioprobe is used in driver initialization routines to probe for a controller at addr.
The controller may be probed in different ways depending on the value of access. The following constants are used to define the access type:
| IOP_READ | 0 |
| IOP_WRITE | 1 |
| IOP_BYTE | 2 |
| IOP_SHORT | 4 |
| IOP_LONG | 6 |
| IOP_DEFBUS | 0 |
| IOP_VIRTUAL | 8 |
nioprobe is called with an access value that is a combination (bit-wise “or”) of these constants. Acceptable access values (defined in sys/iosystm.h) and the resulting behavior of ioprobe follow:
| IOP_READ|IOP_BYTE|IOP_DEFBUS | Read a byte from addr. |
| IOP_READ|IOP_SHORT|IOP_DEFBUS | Read an unsigned short integer from addr. |
| IOP_READ|IOP_LONG|IOP_DEFBUS | Read an unsigned long integer from addr. |
| IOP_WRITE|IOP_BYTE|IOP_DEFBUS | Write a byte to addr. |
| IOP_WRITE|IOP_SHORT|IOP_DEFBUS | Write a short to addr. |
| IOP_WRITE|IOP_LONG|IOP_DEFBUS | Write a long to addr. |
nioprobe normally reads or writes physical addresses. However, if IOP_VIRTUAL is used in place of IOP_DEFBUS, then it will read or write a virtual address. It is up to the caller in this case to ensure that the address has been mapped. As a rule of thumb, if IOP_DEFBUS is specified, then addr is a value that could be used as the addr parameter of niomapin. However, if IOP_VIRTUAL is specified to nioprobe, then addr is a value that could be directly referenced by the driver such as an address returned from niomapin.
nioprobe is not guaranteed to work when called from interrupt level without IOP_VIRTUAL.
If addr is invalid or nonexistent, nioprobe returns −1.
RETURN VALUES
Zero if the probe suceeds, or −1 if no device responded or if IOP_VIRTUAL was specified and the specified virtual address is not mapped.
LEVEL
Base or Interrupt
SEE ALSO
niomapin(D3DK)
DDI/DKI