diff options
-rw-r--r-- | sys/dev/ic/mpt.c | 124 | ||||
-rw-r--r-- | sys/dev/ic/mpt.h | 48 | ||||
-rw-r--r-- | sys/dev/ic/mpt_openbsd.c | 70 | ||||
-rw-r--r-- | sys/dev/ic/mpt_openbsd.h | 19 |
4 files changed, 131 insertions, 130 deletions
diff --git a/sys/dev/ic/mpt.c b/sys/dev/ic/mpt.c index b195dd4236f..b0e9c3571cc 100644 --- a/sys/dev/ic/mpt.c +++ b/sys/dev/ic/mpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpt.c,v 1.19 2005/12/02 03:55:57 marco Exp $ */ +/* $OpenBSD: mpt.c,v 1.20 2005/12/03 04:00:08 marco Exp $ */ /* $NetBSD: mpt.c,v 1.4 2003/11/02 11:07:45 wiz Exp $ */ /* @@ -50,39 +50,39 @@ static int maxwait_ack = 0; static int maxwait_int = 0; static int maxwait_state = 0; -__inline u_int32_t mpt_rd_db(mpt_softc_t *); -__inline u_int32_t mpt_rd_intr(mpt_softc_t *); -int mpt_wait_db_ack(mpt_softc_t *); -int mpt_wait_db_int(mpt_softc_t *); -int mpt_wait_state(mpt_softc_t *, enum DB_STATE_BITS); -int mpt_get_iocfacts(mpt_softc_t *, MSG_IOC_FACTS_REPLY *); -int mpt_get_portfacts(mpt_softc_t *, MSG_PORT_FACTS_REPLY *); -int mpt_send_ioc_init(mpt_softc_t *, u_int32_t); -void mpt_print_header(mpt_softc_t *, char *, CONFIG_PAGE_HEADER *); -int mpt_read_config_info_mfg(mpt_softc_t *); -int mpt_read_config_info_iou(mpt_softc_t *); -int mpt_read_config_info_ioc(mpt_softc_t *); -int mpt_read_config_info_raid(mpt_softc_t *); -int mpt_read_config_info_spi(mpt_softc_t *); -int mpt_set_initial_config_spi(mpt_softc_t *); -int mpt_send_port_enable(mpt_softc_t *, int); -int mpt_send_event_request(mpt_softc_t *, int); +__inline u_int32_t mpt_rd_db(struct mpt_softc *); +__inline u_int32_t mpt_rd_intr(struct mpt_softc *); +int mpt_wait_db_ack(struct mpt_softc *); +int mpt_wait_db_int(struct mpt_softc *); +int mpt_wait_state(struct mpt_softc *, enum DB_STATE_BITS); +int mpt_get_iocfacts(struct mpt_softc *, MSG_IOC_FACTS_REPLY *); +int mpt_get_portfacts(struct mpt_softc *, MSG_PORT_FACTS_REPLY *); +int mpt_send_ioc_init(struct mpt_softc *, u_int32_t); +void mpt_print_header(struct mpt_softc *, char *, CONFIG_PAGE_HEADER *); +int mpt_read_config_info_mfg(struct mpt_softc *); +int mpt_read_config_info_iou(struct mpt_softc *); +int mpt_read_config_info_ioc(struct mpt_softc *); +int mpt_read_config_info_raid(struct mpt_softc *); +int mpt_read_config_info_spi(struct mpt_softc *); +int mpt_set_initial_config_spi(struct mpt_softc *); +int mpt_send_port_enable(struct mpt_softc *, int); +int mpt_send_event_request(struct mpt_softc *, int); __inline u_int32_t -mpt_rd_db(mpt_softc_t *mpt) +mpt_rd_db(struct mpt_softc *mpt) { return mpt_read(mpt, MPT_OFFSET_DOORBELL); } __inline u_int32_t -mpt_rd_intr(mpt_softc_t *mpt) +mpt_rd_intr(struct mpt_softc *mpt) { return mpt_read(mpt, MPT_OFFSET_INTR_STATUS); } /* Busy wait for a door bell to be read by IOC */ int -mpt_wait_db_ack(mpt_softc_t *mpt) +mpt_wait_db_ack(struct mpt_softc *mpt) { int i; for (i=0; i < MPT_MAX_WAIT; i++) { @@ -98,7 +98,7 @@ mpt_wait_db_ack(mpt_softc_t *mpt) /* Busy wait for a door bell interrupt */ int -mpt_wait_db_int(mpt_softc_t *mpt) +mpt_wait_db_int(struct mpt_softc *mpt) { int i; for (i=0; i < MPT_MAX_WAIT; i++) { @@ -113,7 +113,7 @@ mpt_wait_db_int(mpt_softc_t *mpt) /* Wait for IOC to transition to a give state */ void -mpt_check_doorbell(mpt_softc_t *mpt) +mpt_check_doorbell(struct mpt_softc *mpt) { u_int32_t db = mpt_rd_db(mpt); @@ -137,7 +137,7 @@ mpt_check_doorbell(mpt_softc_t *mpt) /* Wait for IOC to transition to a give state */ int -mpt_wait_state(mpt_softc_t *mpt, enum DB_STATE_BITS state) +mpt_wait_state(struct mpt_softc *mpt, enum DB_STATE_BITS state) { int i; @@ -155,7 +155,7 @@ mpt_wait_state(mpt_softc_t *mpt, enum DB_STATE_BITS state) /* Issue the reset COMMAND to the IOC */ int -mpt_soft_reset(mpt_softc_t *mpt) +mpt_soft_reset(struct mpt_softc *mpt) { if (mpt->verbose) { mpt_prt(mpt, "soft reset"); @@ -197,7 +197,7 @@ mpt_soft_reset(mpt_softc_t *mpt) * processors in the chip. */ void -mpt_hard_reset(mpt_softc_t *mpt) +mpt_hard_reset(struct mpt_softc *mpt) { u_int32_t diag0; int count; @@ -263,7 +263,7 @@ mpt_hard_reset(mpt_softc_t *mpt) * fouls up the PCI configuration registers. */ int -mpt_reset(mpt_softc_t *mpt) +mpt_reset(struct mpt_softc *mpt) { int ret; @@ -284,7 +284,7 @@ mpt_reset(mpt_softc_t *mpt) /* Return a command buffer to the free queue */ void -mpt_free_request(mpt_softc_t *mpt, request_t *req) +mpt_free_request(struct mpt_softc *mpt, struct req_entry *req) { if (req == NULL || req != &mpt->request_pool[req->index]) { panic("mpt_free_request bad req ptr"); @@ -306,7 +306,7 @@ mpt_free_request(mpt_softc_t *mpt, request_t *req) /* Initialize command buffer */ void -mpt_init_request(mpt_softc_t *mpt, request_t *req) +mpt_init_request(struct mpt_softc *mpt, struct req_entry *req) { if (req == NULL || req != &mpt->request_pool[req->index]) { panic("mpt_init_request bad req ptr"); @@ -318,10 +318,10 @@ mpt_init_request(mpt_softc_t *mpt, request_t *req) SLIST_INSERT_HEAD(&mpt->request_free_list, req, link); } /* Get a command buffer from the free queue */ -request_t * -mpt_get_request(mpt_softc_t *mpt) +struct req_entry * +mpt_get_request(struct mpt_softc *mpt) { - request_t *req; + struct req_entry *req; req = SLIST_FIRST(&mpt->request_free_list); if (req != NULL) { if (req != &mpt->request_pool[req->index]) { @@ -339,7 +339,7 @@ mpt_get_request(mpt_softc_t *mpt) /* Pass the command to the IOC */ void -mpt_send_cmd(mpt_softc_t *mpt, request_t *req) +mpt_send_cmd(struct mpt_softc *mpt, struct req_entry *req) { req->sequence = mpt->sequence++; if (mpt->verbose > 1) { @@ -366,14 +366,14 @@ mpt_send_cmd(mpt_softc_t *mpt, request_t *req) * finished processing it. */ void -mpt_free_reply(mpt_softc_t *mpt, u_int32_t ptr) +mpt_free_reply(struct mpt_softc *mpt, u_int32_t ptr) { mpt_write(mpt, MPT_OFFSET_REPLY_Q, ptr); } /* Get a reply from the IOC */ u_int32_t -mpt_pop_reply_queue(mpt_softc_t *mpt) +mpt_pop_reply_queue(struct mpt_softc *mpt) { return mpt_read(mpt, MPT_OFFSET_REPLY_Q); } @@ -385,7 +385,7 @@ mpt_pop_reply_queue(mpt_softc_t *mpt) * commands such as device/bus reset as specified by LSI. */ int -mpt_send_handshake_cmd(mpt_softc_t *mpt, size_t len, void *cmd) +mpt_send_handshake_cmd(struct mpt_softc *mpt, size_t len, void *cmd) { int i; u_int32_t data, *data32; @@ -445,7 +445,7 @@ mpt_send_handshake_cmd(mpt_softc_t *mpt, size_t len, void *cmd) /* Get the response from the handshake register */ int -mpt_recv_handshake_reply(mpt_softc_t *mpt, size_t reply_len, void *reply) +mpt_recv_handshake_reply(struct mpt_softc *mpt, size_t reply_len, void *reply) { int left, reply_left; u_int16_t *data16; @@ -515,7 +515,7 @@ mpt_recv_handshake_reply(mpt_softc_t *mpt, size_t reply_len, void *reply) } int -mpt_get_iocfacts(mpt_softc_t *mpt, MSG_IOC_FACTS_REPLY *freplp) +mpt_get_iocfacts(struct mpt_softc *mpt, MSG_IOC_FACTS_REPLY *freplp) { MSG_IOC_FACTS f_req; int error; @@ -531,7 +531,7 @@ mpt_get_iocfacts(mpt_softc_t *mpt, MSG_IOC_FACTS_REPLY *freplp) } int -mpt_get_portfacts(mpt_softc_t *mpt, MSG_PORT_FACTS_REPLY *freplp) +mpt_get_portfacts(struct mpt_softc *mpt, MSG_PORT_FACTS_REPLY *freplp) { MSG_PORT_FACTS f_req; int error; @@ -554,7 +554,7 @@ mpt_get_portfacts(mpt_softc_t *mpt, MSG_PORT_FACTS_REPLY *freplp) * frames from the IOC that we will be allocating. */ int -mpt_send_ioc_init(mpt_softc_t *mpt, u_int32_t who) +mpt_send_ioc_init(struct mpt_softc *mpt, u_int32_t who) { int error = 0; MSG_IOC_INIT init; @@ -606,11 +606,11 @@ mpt_send_ioc_init(mpt_softc_t *mpt, u_int32_t who) */ int -mpt_read_cfg_header(mpt_softc_t *mpt, int PageType, int PageNumber, +mpt_read_cfg_header(struct mpt_softc *mpt, int PageType, int PageNumber, int PageAddress, CONFIG_PAGE_HEADER *rslt) { int count; - request_t *req; + struct req_entry *req; MSG_CONFIG *cfgp; MSG_CONFIG_REPLY *reply; @@ -657,10 +657,10 @@ mpt_read_cfg_header(mpt_softc_t *mpt, int PageType, int PageNumber, #define CFG_DATA_OFF 128 int -mpt_read_cfg_page(mpt_softc_t *mpt, int PageAddress, CONFIG_PAGE_HEADER *hdr) +mpt_read_cfg_page(struct mpt_softc *mpt, int PageAddress, CONFIG_PAGE_HEADER *hdr) { int count; - request_t *req; + struct req_entry *req; SGE_SIMPLE32 *se; MSG_CONFIG *cfgp; size_t amt; @@ -744,10 +744,10 @@ mpt_read_cfg_page(mpt_softc_t *mpt, int PageAddress, CONFIG_PAGE_HEADER *hdr) } int -mpt_write_cfg_page(mpt_softc_t *mpt, int PageAddress, CONFIG_PAGE_HEADER *hdr) +mpt_write_cfg_page(struct mpt_softc *mpt, int PageAddress, CONFIG_PAGE_HEADER *hdr) { int count, hdr_attr; - request_t *req; + struct req_entry *req; SGE_SIMPLE32 *se; MSG_CONFIG *cfgp; size_t amt; @@ -829,7 +829,7 @@ mpt_write_cfg_page(mpt_softc_t *mpt, int PageAddress, CONFIG_PAGE_HEADER *hdr) } void -mpt_print_header(mpt_softc_t *mpt, char *s, CONFIG_PAGE_HEADER *phdr) +mpt_print_header(struct mpt_softc *mpt, char *s, CONFIG_PAGE_HEADER *phdr) { mpt_prt(mpt, "%s %x: %x %x %x %x", s, @@ -844,7 +844,7 @@ mpt_print_header(mpt_softc_t *mpt, char *s, CONFIG_PAGE_HEADER *phdr) * Read manufacturing configuration information */ int -mpt_read_config_info_mfg(mpt_softc_t *mpt) +mpt_read_config_info_mfg(struct mpt_softc *mpt) { int rv, i; CONFIG_PAGE_HEADER *phdr[5] = { @@ -934,7 +934,7 @@ mpt_read_config_info_mfg(mpt_softc_t *mpt) * Read IO Unit configuration information */ int -mpt_read_config_info_iou(mpt_softc_t *mpt) +mpt_read_config_info_iou(struct mpt_softc *mpt) { int rv, i; @@ -998,7 +998,7 @@ mpt_read_config_info_iou(mpt_softc_t *mpt) * Read IOC configuration information */ int -mpt_read_config_info_ioc(mpt_softc_t *mpt) +mpt_read_config_info_ioc(struct mpt_softc *mpt) { int rv, i; CONFIG_PAGE_HEADER *phdr[5] = { @@ -1098,7 +1098,7 @@ mpt_read_config_info_ioc(mpt_softc_t *mpt) * Read RAID Volume pages */ int -mpt_read_config_info_raid(mpt_softc_t *mpt) +mpt_read_config_info_raid(struct mpt_softc *mpt) { int rv, i; @@ -1214,7 +1214,7 @@ mpt_read_config_info_raid(mpt_softc_t *mpt) * Read SCSI configuration information */ int -mpt_read_config_info_spi(mpt_softc_t *mpt) +mpt_read_config_info_spi(struct mpt_softc *mpt) { int rv, i; @@ -1364,7 +1364,7 @@ mpt_read_config_info_spi(mpt_softc_t *mpt) * In particular, validate SPI Port Page 1. */ int -mpt_set_initial_config_spi(mpt_softc_t *mpt) +mpt_set_initial_config_spi(struct mpt_softc *mpt) { int i, pp1val = ((1 << mpt->mpt_ini_id) << 16) | mpt->mpt_ini_id; @@ -1423,10 +1423,10 @@ mpt_set_initial_config_spi(mpt_softc_t *mpt) * Enable IOC port */ int -mpt_send_port_enable(mpt_softc_t *mpt, int port) +mpt_send_port_enable(struct mpt_softc *mpt, int port) { int count; - request_t *req; + struct req_entry *req; MSG_PORT_ENABLE *enable_req; req = mpt_get_request(mpt); @@ -1464,9 +1464,9 @@ mpt_send_port_enable(mpt_softc_t *mpt, int port) * instead of the handshake register. */ int -mpt_send_event_request(mpt_softc_t *mpt, int onoff) +mpt_send_event_request(struct mpt_softc *mpt, int onoff) { - request_t *req; + struct req_entry *req; MSG_EVENT_NOTIFY *enable_req; req = mpt_get_request(mpt); @@ -1491,7 +1491,7 @@ mpt_send_event_request(mpt_softc_t *mpt, int onoff) * Un-mask the interrupts on the chip. */ void -mpt_enable_ints(mpt_softc_t *mpt) +mpt_enable_ints(struct mpt_softc *mpt) { /* Unmask every thing except door bell int */ mpt_write(mpt, MPT_OFFSET_INTR_MASK, MPT_INTR_DB_MASK); @@ -1501,7 +1501,7 @@ mpt_enable_ints(mpt_softc_t *mpt) * Mask the interrupts on the chip. */ void -mpt_disable_ints(mpt_softc_t *mpt) +mpt_disable_ints(struct mpt_softc *mpt) { /* Mask all interrupts */ mpt_write(mpt, MPT_OFFSET_INTR_MASK, @@ -1510,7 +1510,7 @@ mpt_disable_ints(mpt_softc_t *mpt) /* (Re)Initialize the chip for use */ int -mpt_init(mpt_softc_t *mpt, u_int32_t who) +mpt_init(struct mpt_softc *mpt, u_int32_t who) { int try; MSG_IOC_FACTS_REPLY facts; @@ -1763,7 +1763,7 @@ mpt_init(mpt_softc_t *mpt, u_int32_t who) * Returns 0 for success, error for failure */ int -mpt_do_upload(mpt_softc_t *mpt) +mpt_do_upload(struct mpt_softc *mpt) { u_int8_t request[MPT_RQSL(mpt)]; FWUploadReply_t reply; @@ -1889,7 +1889,7 @@ mpt_do_upload(mpt_softc_t *mpt) * Returns 0 for success, <0 for failure */ int -mpt_downloadboot(mpt_softc_t *mpt) +mpt_downloadboot(struct mpt_softc *mpt) { MpiFwHeader_t *fwhdr = NULL; MpiExtImageHeader_t *exthdr = NULL; diff --git a/sys/dev/ic/mpt.h b/sys/dev/ic/mpt.h index df38e00b585..6a89eb07ec9 100644 --- a/sys/dev/ic/mpt.h +++ b/sys/dev/ic/mpt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpt.h,v 1.6 2005/12/01 02:15:21 krw Exp $ */ +/* $OpenBSD: mpt.h,v 1.7 2005/12/03 04:00:08 marco Exp $ */ /* $NetBSD: mpt.h,v 1.2 2003/07/08 10:06:31 itojun Exp $ */ /* @@ -158,33 +158,33 @@ enum _MPT_DIAG_BITS { #define MPT_CONTEXT_MASK (~0xE0000000) #ifdef _KERNEL -int mpt_soft_reset(mpt_softc_t *); -void mpt_hard_reset(mpt_softc_t *); -int mpt_recv_handshake_reply(mpt_softc_t *, size_t, void *); - -void mpt_send_cmd(mpt_softc_t *, request_t *); -void mpt_free_reply(mpt_softc_t *, u_int32_t); -void mpt_enable_ints(mpt_softc_t *); -void mpt_disable_ints(mpt_softc_t *); -u_int32_t mpt_pop_reply_queue(mpt_softc_t *); -int mpt_init(mpt_softc_t *, u_int32_t); -int mpt_reset(mpt_softc_t *); -int mpt_send_handshake_cmd(mpt_softc_t *, size_t, void *); -request_t * mpt_get_request(mpt_softc_t *); -void mpt_free_request(mpt_softc_t *, request_t *); -void mpt_init_request(mpt_softc_t *, request_t *); +int mpt_soft_reset(struct mpt_softc *); +void mpt_hard_reset(struct mpt_softc *); +int mpt_recv_handshake_reply(struct mpt_softc *, size_t, void *); + +void mpt_send_cmd(struct mpt_softc *, struct req_entry *); +void mpt_free_reply(struct mpt_softc *, u_int32_t); +void mpt_enable_ints(struct mpt_softc *); +void mpt_disable_ints(struct mpt_softc *); +u_int32_t mpt_pop_reply_queue(struct mpt_softc *); +int mpt_init(struct mpt_softc *, u_int32_t); +int mpt_reset(struct mpt_softc *); +int mpt_send_handshake_cmd(struct mpt_softc *, size_t, void *); +struct req_entry * mpt_get_request(struct mpt_softc *); +void mpt_free_request(struct mpt_softc *, struct req_entry *); +void mpt_init_request(struct mpt_softc *, struct req_entry *); int mpt_intr(void *); -void mpt_check_doorbell(mpt_softc_t *); +void mpt_check_doorbell(struct mpt_softc *); -int mpt_read_cfg_page(mpt_softc_t *, int, CONFIG_PAGE_HEADER *); -int mpt_write_cfg_page(mpt_softc_t *, int, CONFIG_PAGE_HEADER *); -int mpt_read_cfg_header(mpt_softc_t *, int, int, int, CONFIG_PAGE_HEADER *); +int mpt_read_cfg_page(struct mpt_softc *, int, CONFIG_PAGE_HEADER *); +int mpt_write_cfg_page(struct mpt_softc *, int, CONFIG_PAGE_HEADER *); +int mpt_read_cfg_header(struct mpt_softc *, int, int, int, CONFIG_PAGE_HEADER *); /* FW Download Boot */ -int mpt_downloadboot(mpt_softc_t *); -int mpt_do_upload(mpt_softc_t *); -int mpt_alloc_fw_mem(mpt_softc_t *, int); -void mpt_free_fw_mem(mpt_softc_t *); +int mpt_downloadboot(struct mpt_softc *); +int mpt_do_upload(struct mpt_softc *); +int mpt_alloc_fw_mem(struct mpt_softc *, int); +void mpt_free_fw_mem(struct mpt_softc *); /* mpt_debug.c functions */ void mpt_print_reply(void *); diff --git a/sys/dev/ic/mpt_openbsd.c b/sys/dev/ic/mpt_openbsd.c index 6d67292c16a..7319fde2f3a 100644 --- a/sys/dev/ic/mpt_openbsd.c +++ b/sys/dev/ic/mpt_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpt_openbsd.c,v 1.30 2005/12/01 02:15:21 krw Exp $ */ +/* $OpenBSD: mpt_openbsd.c,v 1.31 2005/12/03 04:00:08 marco Exp $ */ /* $NetBSD: mpt_netbsd.c,v 1.7 2003/07/14 15:47:11 lukem Exp $ */ /* @@ -106,15 +106,15 @@ #include <dev/ic/mpt.h> /* pulls in all headers */ -void mpt_run_ppr(mpt_softc_t *, int); -int mpt_ppr(mpt_softc_t *, struct scsi_link *, int, int); -int mpt_poll(mpt_softc_t *, struct scsi_xfer *, int); +void mpt_run_ppr(struct mpt_softc *, int); +int mpt_ppr(struct mpt_softc *, struct scsi_link *, int, int); +int mpt_poll(struct mpt_softc *, struct scsi_xfer *, int); void mpt_timeout(void *); -void mpt_done(mpt_softc_t *, uint32_t); -int mpt_run_xfer(mpt_softc_t *, struct scsi_xfer *); -void mpt_check_xfer_settings(mpt_softc_t *, struct scsi_xfer *, MSG_SCSI_IO_REQUEST *); -void mpt_ctlop(mpt_softc_t *, void *vmsg, uint32_t); -void mpt_event_notify_reply(mpt_softc_t *, MSG_EVENT_NOTIFY_REPLY *); +void mpt_done(struct mpt_softc *, uint32_t); +int mpt_run_xfer(struct mpt_softc *, struct scsi_xfer *); +void mpt_check_xfer_settings(struct mpt_softc *, struct scsi_xfer *, MSG_SCSI_IO_REQUEST *); +void mpt_ctlop(struct mpt_softc *, void *vmsg, uint32_t); +void mpt_event_notify_reply(struct mpt_softc *, MSG_EVENT_NOTIFY_REPLY *); int mpt_action(struct scsi_xfer *); void mpt_minphys(struct buf *); @@ -139,7 +139,7 @@ enum mpt_scsi_speed { U320, U160, U80 }; * return 1 if passed */ int -mpt_ppr(mpt_softc_t *mpt, struct scsi_link *sc_link, int speed, int flags) +mpt_ppr(struct mpt_softc *mpt, struct scsi_link *sc_link, int speed, int flags) { CONFIG_PAGE_SCSI_DEVICE_0 page0; CONFIG_PAGE_SCSI_DEVICE_1 page1; @@ -356,7 +356,7 @@ mpt_ppr(mpt_softc_t *mpt, struct scsi_link *sc_link, int speed, int flags) * Run PPR on all attached devices */ void -mpt_run_ppr(mpt_softc_t *mpt, int flags) +mpt_run_ppr(struct mpt_softc *mpt, int flags) { struct scsi_link *sc_link; struct device *dev; @@ -411,7 +411,7 @@ mpt_run_ppr(mpt_softc_t *mpt, int flags) * Complete attachment of hardware, include subdevices. */ void -mpt_attach(mpt_softc_t *mpt) +mpt_attach(struct mpt_softc *mpt) { struct scsi_link *lptr = &mpt->sc_link; @@ -453,7 +453,7 @@ mpt_attach(mpt_softc_t *mpt) } int -mpt_dma_mem_alloc(mpt_softc_t *mpt) +mpt_dma_mem_alloc(struct mpt_softc *mpt) { bus_dma_segment_t reply_seg, request_seg; int reply_rseg, request_rseg; @@ -470,7 +470,7 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt) * Allocate the request pool. This isn't really DMA'd memory, * but it's a convenient place to do it. */ - len = sizeof(request_t) * MPT_MAX_REQUESTS(mpt); + len = sizeof(struct req_entry) * MPT_MAX_REQUESTS(mpt); mpt->request_pool = malloc(len, M_DEVBUF, M_WAITOK); if (mpt->request_pool == NULL) { printf("%s: unable to allocate request pool\n", @@ -554,7 +554,7 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt) end = pptr + MPT_REQ_MEM_SIZE(mpt); for (i = 0; pptr < end; i++) { - request_t *req = &mpt->request_pool[i]; + struct req_entry *req = &mpt->request_pool[i]; req->index = i; /* Store location of Request Data */ @@ -582,7 +582,7 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt) unload_request: for (--i; i >= 0; i--) { - request_t *req = &mpt->request_pool[i]; + struct req_entry *req = &mpt->request_pool[i]; if (req->dmap != NULL) bus_dmamap_destroy(mpt->sc_dmat, req->dmap); } @@ -616,7 +616,7 @@ free_request_pool: int mpt_intr(void *arg) { - mpt_softc_t *mpt = arg; + struct mpt_softc *mpt = arg; int nrepl = 0; uint32_t reply; @@ -658,7 +658,7 @@ mpt_intr(void *arg) } void -mpt_prt(mpt_softc_t *mpt, const char *fmt, ...) +mpt_prt(struct mpt_softc *mpt, const char *fmt, ...) { va_list ap; @@ -670,7 +670,7 @@ mpt_prt(mpt_softc_t *mpt, const char *fmt, ...) } int -mpt_poll(mpt_softc_t *mpt, struct scsi_xfer *xs, int count) +mpt_poll(struct mpt_softc *mpt, struct scsi_xfer *xs, int count) { /* Timeouts are in msec, so we loop in 1000usec cycles */ @@ -688,10 +688,10 @@ mpt_poll(mpt_softc_t *mpt, struct scsi_xfer *xs, int count) void mpt_timeout(void *arg) { - request_t *req = arg; + struct req_entry *req = arg; struct scsi_xfer *xs = req->xfer; struct scsi_link *linkp = xs->sc_link; - mpt_softc_t *mpt = (void *) linkp->adapter_softc; + struct mpt_softc *mpt = (void *) linkp->adapter_softc; uint32_t oseq; int s, index; @@ -733,12 +733,12 @@ mpt_timeout(void *arg) } void -mpt_done(mpt_softc_t *mpt, uint32_t reply) +mpt_done(struct mpt_softc *mpt, uint32_t reply) { struct scsi_xfer *xs = NULL; struct scsi_link *linkp; int index; - request_t *req; + struct req_entry *req; MSG_REQUEST_HEADER *mpt_req; MSG_SCSI_IO_REPLY *mpt_reply; @@ -790,7 +790,7 @@ mpt_done(mpt_softc_t *mpt, uint32_t reply) /* Make sure memory hasn't been trashed. */ if (req->index != index) { - mpt_prt(mpt, "mpt_done: corrupted request_t (0x%x)", index); + mpt_prt(mpt, "mpt_done: corrupted struct req_entry (0x%x)", index); return; } @@ -989,10 +989,10 @@ mpt_done(mpt_softc_t *mpt, uint32_t reply) } int -mpt_run_xfer(mpt_softc_t *mpt, struct scsi_xfer *xs) +mpt_run_xfer(struct mpt_softc *mpt, struct scsi_xfer *xs) { struct scsi_link *linkp = xs->sc_link; - request_t *req; + struct req_entry *req; MSG_SCSI_IO_REQUEST *mpt_req; int error, s; @@ -1242,7 +1242,7 @@ mpt_run_xfer(mpt_softc_t *mpt, struct scsi_xfer *xs) } void -mpt_ctlop(mpt_softc_t *mpt, void *vmsg, uint32_t reply) +mpt_ctlop(struct mpt_softc *mpt, void *vmsg, uint32_t reply) { MSG_DEFAULT_REPLY *dmsg = vmsg; @@ -1263,7 +1263,7 @@ mpt_ctlop(mpt_softc_t *mpt, void *vmsg, uint32_t reply) if (mpt->verbose > 1) mpt_prt(mpt, "enable port reply index %d", index); if (index >= 0 && index < MPT_MAX_REQUESTS(mpt)) { - request_t *req = &mpt->request_pool[index]; + struct req_entry *req = &mpt->request_pool[index]; req->debug = REQ_DONE; } mpt_free_reply(mpt, (reply << 1)); @@ -1275,7 +1275,7 @@ mpt_ctlop(mpt_softc_t *mpt, void *vmsg, uint32_t reply) MSG_CONFIG_REPLY *msg = vmsg; int index = msg->MsgContext & ~0x80000000; if (index >= 0 && index < MPT_MAX_REQUESTS(mpt)) { - request_t *req = &mpt->request_pool[index]; + struct req_entry *req = &mpt->request_pool[index]; req->debug = REQ_DONE; req->sequence = reply; } else @@ -1289,7 +1289,7 @@ mpt_ctlop(mpt_softc_t *mpt, void *vmsg, uint32_t reply) } void -mpt_event_notify_reply(mpt_softc_t *mpt, MSG_EVENT_NOTIFY_REPLY *msg) +mpt_event_notify_reply(struct mpt_softc *mpt, MSG_EVENT_NOTIFY_REPLY *msg) { switch (msg->Event) { @@ -1431,7 +1431,7 @@ mpt_event_notify_reply(mpt_softc_t *mpt, MSG_EVENT_NOTIFY_REPLY *msg) if (msg->AckRequired) { MSG_EVENT_ACK *ackp; - request_t *req; + struct req_entry *req; if ((req = mpt_get_request(mpt)) == NULL) { /* XXX XXX XXX XXXJRT */ @@ -1451,7 +1451,7 @@ mpt_event_notify_reply(mpt_softc_t *mpt, MSG_EVENT_NOTIFY_REPLY *msg) } void -mpt_check_xfer_settings(mpt_softc_t *mpt, struct scsi_xfer *xs, MSG_SCSI_IO_REQUEST *mpt_req) +mpt_check_xfer_settings(struct mpt_softc *mpt, struct scsi_xfer *xs, MSG_SCSI_IO_REQUEST *mpt_req) { if (mpt->is_fc) { /* @@ -1486,7 +1486,7 @@ mpt_check_xfer_settings(mpt_softc_t *mpt, struct scsi_xfer *xs, MSG_SCSI_IO_REQU int mpt_action(struct scsi_xfer *xfer) { - mpt_softc_t *mpt = (void *) xfer->sc_link->adapter_softc; + struct mpt_softc *mpt = (void *) xfer->sc_link->adapter_softc; int ret; ret = mpt_run_xfer(mpt, xfer); @@ -1516,7 +1516,7 @@ mpt_minphys(struct buf *bp) * maxsgl : maximum number of DMA segments */ int -mpt_alloc_fw_mem(mpt_softc_t *mpt, int maxsgl) +mpt_alloc_fw_mem(struct mpt_softc *mpt, int maxsgl) { int error, rseg; @@ -1566,7 +1566,7 @@ destroy: } void -mpt_free_fw_mem(mpt_softc_t *mpt) +mpt_free_fw_mem(struct mpt_softc *mpt) { bus_dmamap_unload(mpt->sc_dmat, mpt->fw_dmap); bus_dmamem_unmap(mpt->sc_dmat, (caddr_t)mpt->fw, mpt->fw_image_size); diff --git a/sys/dev/ic/mpt_openbsd.h b/sys/dev/ic/mpt_openbsd.h index ef413aadb7d..c77c1de8db4 100644 --- a/sys/dev/ic/mpt_openbsd.h +++ b/sys/dev/ic/mpt_openbsd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpt_openbsd.h,v 1.18 2005/12/01 02:15:21 krw Exp $ */ +/* $OpenBSD: mpt_openbsd.h,v 1.19 2005/12/03 04:00:08 marco Exp $ */ /* $NetBSD: mpt_netbsd.h,v 1.2 2003/04/16 23:02:14 thorpej Exp $ */ /* @@ -184,7 +184,8 @@ enum mpt_req_state { REQ_ON_CHIP, REQ_DONE }; -typedef struct req_entry { + +struct req_entry { uint16_t index; /* index of this entry */ struct scsi_xfer *xfer; /* scsipi xfer request */ void *req_vbuf; /* virtual address of entry */ @@ -195,9 +196,9 @@ typedef struct req_entry { SLIST_ENTRY(req_entry) link; /* pointer to next in list */ enum mpt_req_state debug; /* debugging */ uint32_t sequence; /* sequence number */ -} request_t; +}; -typedef struct mpt_softc { +struct mpt_softc { struct device mpt_dev; /* base device glue */ int verbose; @@ -307,7 +308,7 @@ typedef struct mpt_softc { bus_addr_t request_phys; /* scsi linkage */ - request_t *request_pool; + struct req_entry *request_pool; SLIST_HEAD(req_queue, req_entry) request_free_list; struct scsi_link sc_link; @@ -329,7 +330,7 @@ typedef struct mpt_softc { /* To restore configuration after hard reset. */ void (*sc_set_config_regs)(struct mpt_softc *); -} mpt_softc_t; +}; #define MPT_SYNC_REQ(mpt, req, ops) \ bus_dmamap_sync((mpt)->sc_dmat, (mpt)->request_dmap, \ @@ -341,10 +342,10 @@ typedef struct mpt_softc { #define mpt_write(mpt, reg, val) \ bus_space_write_4((mpt)->sc_st, (mpt)->sc_sh, (reg), (val)) -void mpt_attach(mpt_softc_t *); -int mpt_dma_mem_alloc(mpt_softc_t *); +void mpt_attach(struct mpt_softc *); +int mpt_dma_mem_alloc(struct mpt_softc *); int mpt_intr(void *); -void mpt_prt(mpt_softc_t *, const char *, ...); +void mpt_prt(struct mpt_softc *, const char *, ...); #define mpt_set_config_regs(mpt) \ |