Use c99 uintN_t.
This commit is contained in:
parent
f0b22f966f
commit
8c6707812d
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: twa.c,v 1.6 2006/07/11 00:18:04 simonb Exp $ */
|
||||
/* $NetBSD: twa.c,v 1.7 2006/07/11 00:25:42 simonb Exp $ */
|
||||
/* $wasabi: twa.c,v 1.25 2006/05/01 15:16:59 simonb Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -74,7 +74,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.6 2006/07/11 00:18:04 simonb Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.7 2006/07/11 00:25:42 simonb Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -115,15 +115,15 @@ __KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.6 2006/07/11 00:18:04 simonb Exp $");
|
|||
|
||||
static int twa_fetch_aen(struct twa_softc *);
|
||||
static void twa_aen_callback(struct twa_request *);
|
||||
static int twa_find_aen(struct twa_softc *sc, u_int16_t);
|
||||
static int twa_find_aen(struct twa_softc *sc, uint16_t);
|
||||
static uint16_t twa_enqueue_aen(struct twa_softc *sc,
|
||||
struct twa_command_header *);
|
||||
|
||||
static void twa_attach(struct device *, struct device *, void *);
|
||||
static void twa_shutdown(void *);
|
||||
static int twa_init_connection(struct twa_softc *, u_int16_t, u_int32_t,
|
||||
u_int16_t, u_int16_t, u_int16_t, u_int16_t, u_int16_t *,
|
||||
u_int16_t *, u_int16_t *, u_int16_t *, u_int32_t *);
|
||||
static int twa_init_connection(struct twa_softc *, uint16_t, uint32_t,
|
||||
uint16_t, uint16_t, uint16_t, uint16_t, uint16_t *,
|
||||
uint16_t *, uint16_t *, uint16_t *, uint32_t *);
|
||||
static int twa_intr(void *);
|
||||
static int twa_match(struct device *, struct cfdata *, void *);
|
||||
static int twa_reset(struct twa_softc *);
|
||||
|
@ -131,14 +131,14 @@ static int twa_reset(struct twa_softc *);
|
|||
static int twa_print(void *, const char *);
|
||||
static int twa_soft_reset(struct twa_softc *);
|
||||
|
||||
static int twa_check_ctlr_state(struct twa_softc *, u_int32_t);
|
||||
static int twa_check_ctlr_state(struct twa_softc *, uint32_t);
|
||||
static int twa_get_param(struct twa_softc *, int, int, size_t,
|
||||
void (* callback)(struct twa_request *),
|
||||
struct twa_param_9k **);
|
||||
static int twa_set_param(struct twa_softc *, int, int, int, void *,
|
||||
void (* callback)(struct twa_request *));
|
||||
static void twa_describe_controller(struct twa_softc *);
|
||||
static int twa_wait_status(struct twa_softc *, u_int32_t, u_int32_t);
|
||||
static int twa_wait_status(struct twa_softc *, uint32_t, uint32_t);
|
||||
static int twa_done(struct twa_softc *);
|
||||
#if 0
|
||||
static int twa_flash_firmware(struct twa_softc *sc);
|
||||
|
@ -408,7 +408,7 @@ static const struct twa_pci_identity pci_twa_products[] = {
|
|||
|
||||
|
||||
static inline void
|
||||
twa_outl(struct twa_softc *sc, int off, u_int32_t val)
|
||||
twa_outl(struct twa_softc *sc, int off, uint32_t val)
|
||||
{
|
||||
|
||||
bus_space_write_4(sc->twa_bus_iot, sc->twa_bus_ioh, off, val);
|
||||
|
@ -416,7 +416,7 @@ twa_outl(struct twa_softc *sc, int off, u_int32_t val)
|
|||
BUS_SPACE_BARRIER_WRITE);
|
||||
}
|
||||
|
||||
static inline u_int32_t twa_inl(struct twa_softc *sc, int off)
|
||||
static inline uint32_t twa_inl(struct twa_softc *sc, int off)
|
||||
{
|
||||
|
||||
bus_space_barrier(sc->twa_bus_iot, sc->twa_bus_ioh, off, 4,
|
||||
|
@ -452,7 +452,7 @@ twa_match(struct device *parent, struct cfdata *cfdata, void *aux)
|
|||
}
|
||||
|
||||
static const char *
|
||||
twa_find_msg_string(const struct twa_message *table, u_int16_t code)
|
||||
twa_find_msg_string(const struct twa_message *table, uint16_t code)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -488,7 +488,7 @@ static void
|
|||
twa_unmap_request(struct twa_request *tr)
|
||||
{
|
||||
struct twa_softc *sc = tr->tr_sc;
|
||||
u_int8_t cmd_status;
|
||||
uint8_t cmd_status;
|
||||
|
||||
/* If the command involved data, unmap that too. */
|
||||
if (tr->tr_data != NULL) {
|
||||
|
@ -538,7 +538,7 @@ twa_unmap_request(struct twa_request *tr)
|
|||
* non-zero-- failure
|
||||
*/
|
||||
static int
|
||||
twa_wait_request(struct twa_request *tr, u_int32_t timeout)
|
||||
twa_wait_request(struct twa_request *tr, uint32_t timeout)
|
||||
{
|
||||
time_t end_time;
|
||||
struct timeval t1;
|
||||
|
@ -616,7 +616,7 @@ twa_wait_request(struct twa_request *tr, u_int32_t timeout)
|
|||
* non-zero-- failure
|
||||
*/
|
||||
static int
|
||||
twa_immediate_request(struct twa_request *tr, u_int32_t timeout)
|
||||
twa_immediate_request(struct twa_request *tr, uint32_t timeout)
|
||||
{
|
||||
struct timeval t1;
|
||||
int s = 0, error = 0;
|
||||
|
@ -1000,7 +1000,7 @@ static int
|
|||
twa_start(struct twa_request *tr)
|
||||
{
|
||||
struct twa_softc *sc = tr->tr_sc;
|
||||
u_int32_t status_reg;
|
||||
uint32_t status_reg;
|
||||
int s;
|
||||
int error;
|
||||
|
||||
|
@ -1043,7 +1043,7 @@ static int
|
|||
twa_drain_response_queue(struct twa_softc *sc)
|
||||
{
|
||||
union twa_response_queue rq;
|
||||
u_int32_t status_reg;
|
||||
uint32_t status_reg;
|
||||
|
||||
for (;;) {
|
||||
status_reg = twa_inl(sc, TWA_STATUS_REGISTER_OFFSET);
|
||||
|
@ -1125,7 +1125,7 @@ twa_drain_aen_queue(struct twa_softc *sc)
|
|||
struct twa_request *tr;
|
||||
struct twa_command_header *cmd_hdr;
|
||||
struct timeval t1;
|
||||
u_int32_t timeout;
|
||||
uint32_t timeout;
|
||||
|
||||
for (;;) {
|
||||
if ((tr = twa_get_request(sc, 0)) == NULL) {
|
||||
|
@ -1193,7 +1193,7 @@ twa_done(struct twa_softc *sc)
|
|||
union twa_response_queue rq;
|
||||
struct twa_request *tr;
|
||||
int s, error = 0;
|
||||
u_int32_t status_reg;
|
||||
uint32_t status_reg;
|
||||
|
||||
for (;;) {
|
||||
status_reg = twa_inl(sc, TWA_STATUS_REGISTER_OFFSET);
|
||||
|
@ -1240,11 +1240,11 @@ twa_done(struct twa_softc *sc)
|
|||
static int
|
||||
twa_init_ctlr(struct twa_softc *sc)
|
||||
{
|
||||
u_int16_t fw_on_ctlr_srl = 0;
|
||||
u_int16_t fw_on_ctlr_arch_id = 0;
|
||||
u_int16_t fw_on_ctlr_branch = 0;
|
||||
u_int16_t fw_on_ctlr_build = 0;
|
||||
u_int32_t init_connect_result = 0;
|
||||
uint16_t fw_on_ctlr_srl = 0;
|
||||
uint16_t fw_on_ctlr_arch_id = 0;
|
||||
uint16_t fw_on_ctlr_branch = 0;
|
||||
uint16_t fw_on_ctlr_build = 0;
|
||||
uint32_t init_connect_result = 0;
|
||||
int error = 0;
|
||||
#if 0
|
||||
int8_t fw_flashed = FALSE;
|
||||
|
@ -1566,7 +1566,7 @@ twa_fillin_sgl(struct twa_sg *sgl, bus_dma_segment_t *segs, int nsegments)
|
|||
int i;
|
||||
for (i = 0; i < nsegments; i++) {
|
||||
sgl[i].address = segs[i].ds_addr;
|
||||
sgl[i].length = (u_int32_t)(segs[i].ds_len);
|
||||
sgl[i].length = (uint32_t)(segs[i].ds_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1608,7 +1608,7 @@ twa_setup_data_dmamap(void *arg, bus_dma_segment_t *segs, int nsegments,
|
|||
struct twa_command_packet *cmdpkt = tr->tr_command;
|
||||
struct twa_command_9k *cmd9k;
|
||||
union twa_command_7k *cmd7k;
|
||||
u_int8_t sgl_offset;
|
||||
uint8_t sgl_offset;
|
||||
|
||||
if (error == EFBIG) {
|
||||
tr->tr_error = error;
|
||||
|
@ -1624,7 +1624,7 @@ twa_setup_data_dmamap(void *arg, bus_dma_segment_t *segs, int nsegments,
|
|||
cmd7k = &(cmdpkt->command.cmd_pkt_7k);
|
||||
if ((sgl_offset = cmdpkt->command.cmd_pkt_7k.generic.sgl_offset))
|
||||
twa_fillin_sgl((struct twa_sg *)
|
||||
(((u_int32_t *)cmd7k) + sgl_offset),
|
||||
(((uint32_t *)cmd7k) + sgl_offset),
|
||||
segs, nsegments);
|
||||
/* Modify the size field, based on sg address size. */
|
||||
cmd7k->generic.size +=
|
||||
|
@ -1940,7 +1940,7 @@ twa_intr(void *arg)
|
|||
{
|
||||
int caught, rv;
|
||||
struct twa_softc *sc;
|
||||
u_int32_t status_reg;
|
||||
uint32_t status_reg;
|
||||
sc = (struct twa_softc *)arg;
|
||||
|
||||
caught = 0;
|
||||
|
@ -2043,7 +2043,7 @@ twaioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l)
|
|||
case TW_OSL_IOCTL_FIRMWARE_PASS_THROUGH:
|
||||
{
|
||||
struct twa_command_packet *cmdpkt;
|
||||
u_int32_t data_buf_size_adjusted;
|
||||
uint32_t data_buf_size_adjusted;
|
||||
|
||||
/* Get a request packet */
|
||||
tr = twa_get_request_wait(sc, 0);
|
||||
|
@ -2556,12 +2556,12 @@ out:
|
|||
* non-zero-- failure
|
||||
*/
|
||||
static int
|
||||
twa_init_connection(struct twa_softc *sc, u_int16_t message_credits,
|
||||
u_int32_t set_features, u_int16_t current_fw_srl,
|
||||
u_int16_t current_fw_arch_id, u_int16_t current_fw_branch,
|
||||
u_int16_t current_fw_build, u_int16_t *fw_on_ctlr_srl,
|
||||
u_int16_t *fw_on_ctlr_arch_id, u_int16_t *fw_on_ctlr_branch,
|
||||
u_int16_t *fw_on_ctlr_build, u_int32_t *init_connect_result)
|
||||
twa_init_connection(struct twa_softc *sc, uint16_t message_credits,
|
||||
uint32_t set_features, uint16_t current_fw_srl,
|
||||
uint16_t current_fw_arch_id, uint16_t current_fw_branch,
|
||||
uint16_t current_fw_build, uint16_t *fw_on_ctlr_srl,
|
||||
uint16_t *fw_on_ctlr_arch_id, uint16_t *fw_on_ctlr_branch,
|
||||
uint16_t *fw_on_ctlr_build, uint32_t *init_connect_result)
|
||||
{
|
||||
struct twa_request *tr;
|
||||
struct twa_command_init_connect *init_connect;
|
||||
|
@ -2669,7 +2669,7 @@ out:
|
|||
static int
|
||||
twa_soft_reset(struct twa_softc *sc)
|
||||
{
|
||||
u_int32_t status_reg;
|
||||
uint32_t status_reg;
|
||||
|
||||
twa_outl(sc, TWA_CONTROL_REGISTER_OFFSET,
|
||||
TWA_CONTROL_ISSUE_SOFT_RESET |
|
||||
|
@ -2714,11 +2714,11 @@ twa_soft_reset(struct twa_softc *sc)
|
|||
}
|
||||
|
||||
static int
|
||||
twa_wait_status(struct twa_softc *sc, u_int32_t status, u_int32_t timeout)
|
||||
twa_wait_status(struct twa_softc *sc, uint32_t status, uint32_t timeout)
|
||||
{
|
||||
struct timeval t1;
|
||||
time_t end_time;
|
||||
u_int32_t status_reg;
|
||||
uint32_t status_reg;
|
||||
|
||||
timeout = (timeout * 1000 * 100);
|
||||
|
||||
|
@ -2889,9 +2889,9 @@ twa_enqueue_aen(struct twa_softc *sc, struct twa_command_header *cmd_hdr)
|
|||
* non-zero-- failure
|
||||
*/
|
||||
static int
|
||||
twa_find_aen(struct twa_softc *sc, u_int16_t aen_code)
|
||||
twa_find_aen(struct twa_softc *sc, uint16_t aen_code)
|
||||
{
|
||||
u_int32_t last_index;
|
||||
uint32_t last_index;
|
||||
int s;
|
||||
int i;
|
||||
|
||||
|
@ -3035,7 +3035,7 @@ twa_describe_controller(struct twa_softc *sc)
|
|||
goto bail;
|
||||
}
|
||||
|
||||
ports = *(u_int8_t *)(p[0]->data);
|
||||
ports = *(uint8_t *)(p[0]->data);
|
||||
|
||||
aprint_normal("%s: %d ports, Firmware %.16s, BIOS %.16s\n",
|
||||
sc->twa_dv.dv_xname, ports,
|
||||
|
@ -3112,7 +3112,7 @@ bail:
|
|||
* non-zero-- errors
|
||||
*/
|
||||
static int
|
||||
twa_check_ctlr_state(struct twa_softc *sc, u_int32_t status_reg)
|
||||
twa_check_ctlr_state(struct twa_softc *sc, uint32_t status_reg)
|
||||
{
|
||||
int result = 0;
|
||||
struct timeval t1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: twareg.h,v 1.3 2006/07/11 00:17:34 simonb Exp $ */
|
||||
/* $NetBSD: twareg.h,v 1.4 2006/07/11 00:25:42 simonb Exp $ */
|
||||
/* $wasabi: twareg.h,v 1.11 2006/04/27 17:12:39 wrstuden Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -85,19 +85,19 @@
|
|||
|
||||
#if defined(_KERNEL)
|
||||
#define TWA_WRITE_REGISTER(sc, offset, val) \
|
||||
bus_space_write_4(sc->twa_bus_iot, sc->twa_bus_ioh, offset, (u_int32_t)val)
|
||||
bus_space_write_4(sc->twa_bus_iot, sc->twa_bus_ioh, offset, (uint32_t)val)
|
||||
|
||||
#define TWA_WRITE_COMMAND_QUEUE(sc, val) \
|
||||
do { \
|
||||
if (TWA_64BIT_ADDRESSES) { \
|
||||
/* First write the low 4 bytes, then the high 4. */ \
|
||||
TWA_WRITE_REGISTER(sc, TWA_COMMAND_QUEUE_OFFSET_LOW, \
|
||||
(u_int32_t)(val)); \
|
||||
(uint32_t)(val)); \
|
||||
TWA_WRITE_REGISTER(sc, TWA_COMMAND_QUEUE_OFFSET_HIGH,\
|
||||
(u_int32_t)(((u_int64_t)val)>>32)); \
|
||||
(uint32_t)(((uint64_t)val)>>32)); \
|
||||
} else \
|
||||
TWA_WRITE_REGISTER(sc, TWA_COMMAND_QUEUE_OFFSET,\
|
||||
(u_int32_t)(val)); \
|
||||
(uint32_t)(val)); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
@ -223,157 +223,157 @@ struct twa_sg {
|
|||
#if defined(_KERNEL)
|
||||
bus_addr_t address;
|
||||
#else
|
||||
u_int32_t xx_address_xx; /* Fail if userland tries to use this */
|
||||
uint32_t xx_address_xx; /* Fail if userland tries to use this */
|
||||
#endif
|
||||
u_int32_t length;
|
||||
uint32_t length;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* 7000 structures. */
|
||||
struct twa_command_init_connect {
|
||||
u_int8_t opcode:5; /* TWA_OP_INITCONNECTION */
|
||||
u_int8_t res1:3;
|
||||
u_int8_t size;
|
||||
u_int8_t request_id;
|
||||
u_int8_t res2;
|
||||
u_int8_t status;
|
||||
u_int8_t flags;
|
||||
u_int16_t message_credits;
|
||||
u_int32_t features;
|
||||
u_int16_t fw_srl;
|
||||
u_int16_t fw_arch_id;
|
||||
u_int16_t fw_branch;
|
||||
u_int16_t fw_build;
|
||||
u_int32_t result;
|
||||
uint8_t opcode:5; /* TWA_OP_INITCONNECTION */
|
||||
uint8_t res1:3;
|
||||
uint8_t size;
|
||||
uint8_t request_id;
|
||||
uint8_t res2;
|
||||
uint8_t status;
|
||||
uint8_t flags;
|
||||
uint16_t message_credits;
|
||||
uint32_t features;
|
||||
uint16_t fw_srl;
|
||||
uint16_t fw_arch_id;
|
||||
uint16_t fw_branch;
|
||||
uint16_t fw_build;
|
||||
uint32_t result;
|
||||
}__attribute__ ((packed));
|
||||
|
||||
struct twa_command_download_firmware {
|
||||
u_int8_t opcode:5; /* TWA_DOWNLOAD_FIRMWARE */
|
||||
u_int8_t sgl_offset:3;
|
||||
u_int8_t size;
|
||||
u_int8_t request_id;
|
||||
u_int8_t unit;
|
||||
u_int8_t status;
|
||||
u_int8_t flags;
|
||||
u_int16_t param;
|
||||
uint8_t opcode:5; /* TWA_DOWNLOAD_FIRMWARE */
|
||||
uint8_t sgl_offset:3;
|
||||
uint8_t size;
|
||||
uint8_t request_id;
|
||||
uint8_t unit;
|
||||
uint8_t status;
|
||||
uint8_t flags;
|
||||
uint16_t param;
|
||||
struct twa_sg sgl[TWA_MAX_SG_ELEMENTS];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct twa_command_reset_firmware {
|
||||
u_int8_t opcode:5; /* TWA_OP_RESET_FIRMWARE */
|
||||
u_int8_t res1:3;
|
||||
u_int8_t size;
|
||||
u_int8_t request_id;
|
||||
u_int8_t unit;
|
||||
u_int8_t status;
|
||||
u_int8_t flags;
|
||||
u_int8_t res2;
|
||||
u_int8_t param;
|
||||
uint8_t opcode:5; /* TWA_OP_RESET_FIRMWARE */
|
||||
uint8_t res1:3;
|
||||
uint8_t size;
|
||||
uint8_t request_id;
|
||||
uint8_t unit;
|
||||
uint8_t status;
|
||||
uint8_t flags;
|
||||
uint8_t res2;
|
||||
uint8_t param;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct twa_command_io {
|
||||
u_int8_t opcode:5; /* TWA_OP_READ/TWA_OP_WRITE */
|
||||
u_int8_t sgl_offset:3;
|
||||
u_int8_t size;
|
||||
u_int8_t request_id;
|
||||
u_int8_t unit:4;
|
||||
u_int8_t host_id:4;
|
||||
u_int8_t status;
|
||||
u_int8_t flags;
|
||||
u_int16_t block_count;
|
||||
u_int32_t lba;
|
||||
uint8_t opcode:5; /* TWA_OP_READ/TWA_OP_WRITE */
|
||||
uint8_t sgl_offset:3;
|
||||
uint8_t size;
|
||||
uint8_t request_id;
|
||||
uint8_t unit:4;
|
||||
uint8_t host_id:4;
|
||||
uint8_t status;
|
||||
uint8_t flags;
|
||||
uint16_t block_count;
|
||||
uint32_t lba;
|
||||
struct twa_sg sgl[TWA_MAX_SG_ELEMENTS];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct twa_command_hotswap {
|
||||
u_int8_t opcode:5; /* TWA_OP_HOTSWAP */
|
||||
u_int8_t res1:3;
|
||||
u_int8_t size;
|
||||
u_int8_t request_id;
|
||||
u_int8_t unit:4;
|
||||
u_int8_t host_id:4;
|
||||
u_int8_t status;
|
||||
u_int8_t flags;
|
||||
u_int8_t action;
|
||||
uint8_t opcode:5; /* TWA_OP_HOTSWAP */
|
||||
uint8_t res1:3;
|
||||
uint8_t size;
|
||||
uint8_t request_id;
|
||||
uint8_t unit:4;
|
||||
uint8_t host_id:4;
|
||||
uint8_t status;
|
||||
uint8_t flags;
|
||||
uint8_t action;
|
||||
#define TWA_OP_HOTSWAP_REMOVE 0x00 /* remove assumed-degraded unit */
|
||||
#define TWA_OP_HOTSWAP_ADD_CBOD 0x01 /* add CBOD to empty port */
|
||||
#define TWA_OP_HOTSWAP_ADD_SPARE 0x02 /* add spare to empty port */
|
||||
u_int8_t aport;
|
||||
uint8_t aport;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct twa_command_param {
|
||||
u_int8_t opcode:5; /* TWA_OP_GETPARAM, TWA_OP_SETPARAM */
|
||||
u_int8_t sgl_offset:3;
|
||||
u_int8_t size;
|
||||
u_int8_t request_id;
|
||||
u_int8_t unit:4;
|
||||
u_int8_t host_id:4;
|
||||
u_int8_t status;
|
||||
u_int8_t flags;
|
||||
u_int16_t param_count;
|
||||
uint8_t opcode:5; /* TWA_OP_GETPARAM, TWA_OP_SETPARAM */
|
||||
uint8_t sgl_offset:3;
|
||||
uint8_t size;
|
||||
uint8_t request_id;
|
||||
uint8_t unit:4;
|
||||
uint8_t host_id:4;
|
||||
uint8_t status;
|
||||
uint8_t flags;
|
||||
uint16_t param_count;
|
||||
struct twa_sg sgl[TWA_MAX_SG_ELEMENTS];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct twa_command_rebuildunit {
|
||||
u_int8_t opcode:5; /* TWA_OP_REBUILDUNIT */
|
||||
u_int8_t res1:3;
|
||||
u_int8_t size;
|
||||
u_int8_t request_id;
|
||||
u_int8_t src_unit:4;
|
||||
u_int8_t host_id:4;
|
||||
u_int8_t status;
|
||||
u_int8_t flags;
|
||||
u_int8_t action:7;
|
||||
uint8_t opcode:5; /* TWA_OP_REBUILDUNIT */
|
||||
uint8_t res1:3;
|
||||
uint8_t size;
|
||||
uint8_t request_id;
|
||||
uint8_t src_unit:4;
|
||||
uint8_t host_id:4;
|
||||
uint8_t status;
|
||||
uint8_t flags;
|
||||
uint8_t action:7;
|
||||
#define TWA_OP_REBUILDUNIT_NOP 0
|
||||
#define TWA_OP_REBUILDUNIT_STOP 2 /* stop all rebuilds */
|
||||
#define TWA_OP_REBUILDUNIT_START 4 /* start rebuild with lowest unit */
|
||||
#define TWA_OP_REBUILDUNIT_STARTUNIT 5 /* rebuild src_unit (not supported) */
|
||||
u_int8_t cs:1; /* request state change on src_unit */
|
||||
u_int8_t logical_subunit; /* for RAID10 rebuild of logical subunit */
|
||||
uint8_t cs:1; /* request state change on src_unit */
|
||||
uint8_t logical_subunit; /* for RAID10 rebuild of logical subunit */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct twa_command_ata {
|
||||
u_int8_t opcode:5; /* TWA_OP_ATA_PASSTHROUGH */
|
||||
u_int8_t sgl_offset:3;
|
||||
u_int8_t size;
|
||||
u_int8_t request_id;
|
||||
u_int8_t unit:4;
|
||||
u_int8_t host_id:4;
|
||||
u_int8_t status;
|
||||
u_int8_t flags;
|
||||
u_int16_t param;
|
||||
u_int16_t features;
|
||||
u_int16_t sector_count;
|
||||
u_int16_t sector_num;
|
||||
u_int16_t cylinder_lo;
|
||||
u_int16_t cylinder_hi;
|
||||
u_int8_t drive_head;
|
||||
u_int8_t command;
|
||||
uint8_t opcode:5; /* TWA_OP_ATA_PASSTHROUGH */
|
||||
uint8_t sgl_offset:3;
|
||||
uint8_t size;
|
||||
uint8_t request_id;
|
||||
uint8_t unit:4;
|
||||
uint8_t host_id:4;
|
||||
uint8_t status;
|
||||
uint8_t flags;
|
||||
uint16_t param;
|
||||
uint16_t features;
|
||||
uint16_t sector_count;
|
||||
uint16_t sector_num;
|
||||
uint16_t cylinder_lo;
|
||||
uint16_t cylinder_hi;
|
||||
uint8_t drive_head;
|
||||
uint8_t command;
|
||||
struct twa_sg sgl[TWA_MAX_ATA_SG_ELEMENTS];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct twa_command_generic {
|
||||
u_int8_t opcode:5;
|
||||
u_int8_t sgl_offset:3;
|
||||
u_int8_t size;
|
||||
u_int8_t request_id;
|
||||
u_int8_t unit:4;
|
||||
u_int8_t host_id:4;
|
||||
u_int8_t status;
|
||||
u_int8_t flags;
|
||||
uint8_t opcode:5;
|
||||
uint8_t sgl_offset:3;
|
||||
uint8_t size;
|
||||
uint8_t request_id;
|
||||
uint8_t unit:4;
|
||||
uint8_t host_id:4;
|
||||
uint8_t status;
|
||||
uint8_t flags;
|
||||
#define TWA_FLAGS_SUCCESS 0x00
|
||||
#define TWA_FLAGS_INFORMATIONAL 0x01
|
||||
#define TWA_FLAGS_WARNING 0x02
|
||||
#define TWA_FLAGS_FATAL 0x03
|
||||
#define TWA_FLAGS_PERCENTAGE (1<<8) /* bits 0-6 indicate completion percentage */
|
||||
u_int16_t count; /* block count, parameter count, message credits */
|
||||
uint16_t count; /* block count, parameter count, message credits */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
|
@ -396,39 +396,39 @@ union twa_command_7k {
|
|||
/* Command Packet. */
|
||||
struct twa_command_9k {
|
||||
struct {
|
||||
u_int8_t opcode:5;
|
||||
u_int8_t reserved:3;
|
||||
uint8_t opcode:5;
|
||||
uint8_t reserved:3;
|
||||
} command;
|
||||
u_int8_t unit;
|
||||
u_int16_t request_id;
|
||||
u_int8_t status;
|
||||
u_int8_t sgl_offset; /* offset (in bytes) to sg_list, from the end of sgl_entries */
|
||||
u_int16_t sgl_entries;
|
||||
u_int8_t cdb[16];
|
||||
uint8_t unit;
|
||||
uint16_t request_id;
|
||||
uint8_t status;
|
||||
uint8_t sgl_offset; /* offset (in bytes) to sg_list, from the end of sgl_entries */
|
||||
uint16_t sgl_entries;
|
||||
uint8_t cdb[16];
|
||||
struct twa_sg sg_list[TWA_MAX_SG_ELEMENTS];
|
||||
u_int8_t padding[32];
|
||||
uint8_t padding[32];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* Command packet header. */
|
||||
struct twa_command_header {
|
||||
u_int8_t sense_data[TWA_SENSE_DATA_LENGTH];
|
||||
uint8_t sense_data[TWA_SENSE_DATA_LENGTH];
|
||||
struct {
|
||||
int8_t reserved[4];
|
||||
u_int16_t error;
|
||||
u_int8_t padding;
|
||||
uint16_t error;
|
||||
uint8_t padding;
|
||||
struct {
|
||||
u_int8_t severity:3;
|
||||
u_int8_t reserved:5;
|
||||
uint8_t severity:3;
|
||||
uint8_t reserved:5;
|
||||
} substatus_block;
|
||||
} status_block;
|
||||
u_int8_t err_specific_desc[98];
|
||||
uint8_t err_specific_desc[98];
|
||||
struct {
|
||||
u_int8_t size_header;
|
||||
u_int16_t reserved;
|
||||
u_int8_t size_sense;
|
||||
uint8_t size_header;
|
||||
uint16_t reserved;
|
||||
uint8_t size_sense;
|
||||
} header_desc;
|
||||
u_int8_t reserved[2];
|
||||
uint8_t reserved[2];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
|
@ -445,11 +445,11 @@ struct twa_command_packet {
|
|||
/* Response queue entry. */
|
||||
union twa_response_queue {
|
||||
struct {
|
||||
u_int32_t undefined_1:4;
|
||||
u_int32_t response_id:8;
|
||||
u_int32_t undefined_2:20;
|
||||
uint32_t undefined_1:4;
|
||||
uint32_t response_id:8;
|
||||
uint32_t undefined_2:20;
|
||||
} u;
|
||||
u_int32_t value;
|
||||
uint32_t value;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
|
@ -492,12 +492,12 @@ union twa_response_queue {
|
|||
|
||||
|
||||
struct twa_param_9k {
|
||||
u_int16_t table_id;
|
||||
u_int8_t parameter_id;
|
||||
u_int8_t reserved;
|
||||
u_int16_t parameter_size_bytes;
|
||||
u_int16_t parameter_actual_size_bytes;
|
||||
u_int8_t data[1];
|
||||
uint16_t table_id;
|
||||
uint8_t parameter_id;
|
||||
uint8_t reserved;
|
||||
uint16_t parameter_size_bytes;
|
||||
uint16_t parameter_actual_size_bytes;
|
||||
uint8_t data[1];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#endif /* !_PCI_TWAREG_H_ */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: twavar.h,v 1.4 2006/07/11 00:17:34 simonb Exp $ */
|
||||
/* $NetBSD: twavar.h,v 1.5 2006/07/11 00:25:42 simonb Exp $ */
|
||||
/* $wasabi: twavar.h,v 1.12 2006/05/01 15:16:59 simonb Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -81,22 +81,22 @@ struct twa_softc {
|
|||
uint16_t working_srl; /* driver & firmware negotiated srl */
|
||||
uint16_t working_branch; /* branch # of the firmware that the driver is compatible with */
|
||||
uint16_t working_build; /* build # of the firmware that the driver is compatible with */
|
||||
u_int32_t twa_operating_mode; /* base mode/current mode */
|
||||
u_int32_t twa_aen_head; /* AEN queue head */
|
||||
u_int32_t twa_aen_tail; /* AEN queue tail */
|
||||
u_int32_t twa_current_sequence_id;/* index of the last event + 1 */
|
||||
u_int32_t twa_aen_queue_overflow; /* indicates if unretrieved events were overwritten */
|
||||
u_int32_t twa_aen_queue_wrapped; /* indicates if AEN queue ever wrapped */
|
||||
uint32_t twa_operating_mode; /* base mode/current mode */
|
||||
uint32_t twa_aen_head; /* AEN queue head */
|
||||
uint32_t twa_aen_tail; /* AEN queue tail */
|
||||
uint32_t twa_current_sequence_id;/* index of the last event + 1 */
|
||||
uint32_t twa_aen_queue_overflow; /* indicates if unretrieved events were overwritten */
|
||||
uint32_t twa_aen_queue_wrapped; /* indicates if AEN queue ever wrapped */
|
||||
/* Controller state. */
|
||||
u_int32_t twa_state;
|
||||
u_int32_t twa_sc_flags;
|
||||
uint32_t twa_state;
|
||||
uint32_t twa_sc_flags;
|
||||
#ifdef TWA_DEBUG
|
||||
struct twa_q_statistics twa_qstats[TWAQ_COUNT]; /* queue statistics */
|
||||
#endif /* TWA_DEBUG */
|
||||
|
||||
struct _twa_ioctl_lock{
|
||||
u_int32_t lock; /* lock state */
|
||||
u_int32_t timeout; /* time at which the lock
|
||||
uint32_t lock; /* lock state */
|
||||
uint32_t timeout; /* time at which the lock
|
||||
* will become available,
|
||||
* even if not released
|
||||
*/
|
||||
|
@ -150,7 +150,7 @@ struct twa_softc {
|
|||
struct twa_request {
|
||||
struct twa_command_packet *tr_command;
|
||||
/* ptr to cmd pkt submitted to controller */
|
||||
u_int32_t tr_request_id;
|
||||
uint32_t tr_request_id;
|
||||
/* request id for tracking with firmware */
|
||||
void *tr_data;
|
||||
/* ptr to data being passed to firmware */
|
||||
|
@ -167,13 +167,13 @@ struct twa_request {
|
|||
/* to link this request in a list */
|
||||
struct twa_softc *tr_sc;
|
||||
/* controller that owns us */
|
||||
u_int32_t tr_status;
|
||||
uint32_t tr_status;
|
||||
/* command status */
|
||||
u_int32_t tr_flags;
|
||||
uint32_t tr_flags;
|
||||
/* request flags */
|
||||
u_int32_t tr_error;
|
||||
uint32_t tr_error;
|
||||
/* error encountered before request submission */
|
||||
u_int32_t tr_cmd_pkt_type;
|
||||
uint32_t tr_cmd_pkt_type;
|
||||
/* request specific data to use during callback */
|
||||
void (*tr_callback)(struct twa_request *tr);
|
||||
/* callback handler */
|
||||
|
@ -215,7 +215,7 @@ void twa_release_request(struct twa_request *);
|
|||
|
||||
/* Error/AEN message structure. */
|
||||
struct twa_message {
|
||||
u_int32_t code;
|
||||
uint32_t code;
|
||||
const char *message;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue