1 1.1 mycroft /* 2 1.1 mycroft * Mail box defs etc. 3 1.1 mycroft * these could be bigger but we need the bha_softc to fit on a single page.. 4 1.1 mycroft */ 5 1.1 mycroft #define BHA_MBX_SIZE 32 /* mail box size (MAX 255 MBxs) */ 6 1.1 mycroft /* don't need that many really */ 7 1.1 mycroft #define BHA_CCB_MAX 32 /* store up to 32 CCBs at one time */ 8 1.1 mycroft #define CCB_HASH_SIZE 32 /* hash table size for phystokv */ 9 1.1 mycroft #define CCB_HASH_SHIFT 9 10 1.1 mycroft #define CCB_HASH(x) ((((long)(x))>>CCB_HASH_SHIFT) & (CCB_HASH_SIZE - 1)) 11 1.1 mycroft 12 1.1 mycroft #define bha_nextmbx(wmb, mbx, mbio) \ 13 1.1 mycroft if ((wmb) == &(mbx)->mbio[BHA_MBX_SIZE - 1]) \ 14 1.1 mycroft (wmb) = &(mbx)->mbio[0]; \ 15 1.1 mycroft else \ 16 1.1 mycroft (wmb)++; 17 1.1 mycroft 18 1.1 mycroft struct bha_mbx { 19 1.1 mycroft struct bha_mbx_out mbo[BHA_MBX_SIZE]; 20 1.1 mycroft struct bha_mbx_in mbi[BHA_MBX_SIZE]; 21 1.1 mycroft struct bha_mbx_out *cmbo; /* Collection Mail Box out */ 22 1.1 mycroft struct bha_mbx_out *tmbo; /* Target Mail Box out */ 23 1.1 mycroft struct bha_mbx_in *tmbi; /* Target Mail Box in */ 24 1.1 mycroft }; 25 1.1 mycroft 26 1.1 mycroft struct bha_softc { 27 1.1 mycroft struct device sc_dev; 28 1.1 mycroft bus_chipset_tag_t sc_bc; 29 1.1 mycroft 30 1.1 mycroft bus_io_handle_t sc_ioh; 31 1.1 mycroft int sc_irq, sc_drq; 32 1.1 mycroft void *sc_ih; 33 1.1 mycroft 34 1.1 mycroft char sc_model[7], 35 1.1 mycroft sc_firmware[6]; 36 1.1 mycroft 37 1.1 mycroft struct bha_mbx sc_mbx; /* all our mailboxes */ 38 1.1 mycroft #define wmbx (&sc->sc_mbx) 39 1.1 mycroft struct bha_ccb *sc_ccbhash[CCB_HASH_SIZE]; 40 1.1 mycroft TAILQ_HEAD(, bha_ccb) sc_free_ccb, sc_waiting_ccb; 41 1.1 mycroft int sc_numccbs, sc_mbofull; 42 1.1 mycroft int sc_scsi_dev; /* adapters scsi id */ 43 1.1 mycroft struct scsi_link sc_link; /* prototype for devs */ 44 1.1 mycroft }; 45 1.1 mycroft 46 1.1 mycroft int bha_find __P((bus_chipset_tag_t, bus_io_handle_t, struct bha_softc *)); 47 1.1 mycroft void bha_attach __P((struct bha_softc *)); 48 1.1 mycroft int bha_intr __P((void *)); 49