struct isa_device StructureThis structure is required, but generally it is created by config(8) from the kernel configuration file. It is required on a per-device basis, meaning that if you have a driver which controls two serial boards, you will have two isa_device structures. If you build a device as an LKM, you must create your own isa_device structure to reflect your configuration. (lines 85 - 131 in pcaudio_lkm.c) There is nearly a direct mapping between the config file and the isa_device structure. The definition from /usr/src/sys/i386/isa/isa_device.h is:
struct isa_device {
int id_id; /* device id */
struct isa_driver *id_driver;
int id_iobase; /* base i/o address */
u_short id_irq; /* interrupt request */
short id_drq; /* DMA request */
caddr_t id_maddr; /* physical i/o memory address on bus (if any)*/
int id_msize; /* size of i/o memory */
inthand2_t *id_intr; /* interrupt interface routine */
int id_unit; /* unit number */
int id_flags; /* flags */
int id_scsiid; /* scsi id if needed */
int id_alive; /* device is present */
#define RI_FAST 1 /* fast interrupt handler */
u_int id_ri_flags; /* flags for register_intr() */
int id_reconfig; /* hot eject device support (such as PCMCIA) */
int id_enabled; /* is device enabled */
int id_conflicts; /* we're allowed to conflict with things */
struct isa_device *id_next; /* used in isa_devlist in userconfig() */
};
struct isa_driver StructureThis structure is defined in ``/usr/src/sys/i386/isa/isa_device.h''. These are required on a per-driver basis. The definition is:
struct isa_driver {
int (*probe) __P((struct isa_device *idp));
/* test whether device is present */
int (*attach) __P((struct isa_device *idp));
/* setup driver for a device */
char *name; /* device name */
int sensitive_hw; /* true if other probes confuse us */
};
This is the structure used by the probe/attach code to detect and
initialize your device. The probe member is a pointer to your
device probe function; the attach member is a pointer to your
attach function. The name member is a character pointer to the
two or three letter name for your driver. This is the name reported
during the probe/attach process (and probably also in
lsdev(8)). The
sensitive_hw member is a flag which helps the probe code
determine probing order.
A typical instantiation is:
struct isa_driver mcddriver = { mcd_probe, mcd_attach, "mcd" };