#sccs "@(#)uts/kern/sys:drv.h 1.4" /* * drv.h - structures and defines for loadable driver option */ #ifndef drv_h #define drv_h #include "sys/types.h" #include "sys/pte.h" #include "sys/conf.h" /* * structure for allocation */ struct drvalloc { uint d_size; /* desired size/returned alloced size */ char *d_addr; /* virtual address */ short d_bmaj; /* blk major/returned alloced blk major */ short d_cmaj; /* char major/returned alloced char major */ short d_linesw; ushort d_flags; /* status flags */ ushort d_drvid; /* driver id/returned driver id */ }; /* allocation options */ #define DRVALLOC 0x001 /* allocate virtual space */ #define DRVMALLOC 0x002 /* allocate major number and virtual space */ #define DRVSTAT 0x004 /* return info on drv_id */ #define DRVUNALLOC 0x008 /* un-allocate space & major # */ /* * structure for driver binding */ struct drvbind { uint d_size; /* size to load */ char *d_addr; /* address in process to load */ ushort d_drvid; /* driver id */ struct bdevsw *d_bsw; /* ptr to blk entry points */ struct cdevsw *d_csw; /* ptr to char entry points */ struct linesw *d_lsw; int (*d_init)(); /* ptr to device init routine */ int (*d_release)(); /* ptr to device release routine */ }; /* binding options */ #define DRVBIND 0x100 /* load in driver */ #define DRVUNBIND 0x200 /* unload driver */ /* * internal representation of loadable driver * drv_id is index into table */ #define DMMXSZ 32 /* max # pages for a driver */ struct drv_tbl { char *d_addr; /* virtual address */ ushort d_size; /* alloced size in pages */ short d_bmaj; /* blk major */ short d_cmaj; /* char major */ short d_linesw; ushort d_flags; /* status flags */ int (*d_release)(); /* ptr to device release routine */ struct mpte *d_mpte; /* page table entries for driver (in kv_mpte) */ }; /* values for status flags */ #define DBOUND 0x1 /* driver is loaded & bound */ #define DALLOC 0x2 /* slot is allocated */ struct drv_int { struct drv_int *next; /* link */ int (*routine)(); /* interrupt routine */ }; #endif