Fix args for contigmalloc, cosmetics.

This commit is contained in:
Søren Schmidt 2002-08-18 12:20:33 +00:00
parent e3ffd6e93f
commit 1652b7bde4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=102058
3 changed files with 87 additions and 84 deletions

View File

@ -154,31 +154,32 @@ iop_intr(void *data)
struct i2o_single_reply *reply;
u_int32_t mfa;
if ((mfa = sc->reg->oqueue) == 0xffffffff) {
if ((mfa = sc->reg->oqueue) == 0xffffffff) {
printf("pstiop: no mfa on interrupt ?\n");
/* we might get more than one finished request pr interrupt */
while (1) {
if ((mfa = sc->reg->oqueue) == 0xffffffff)
if ((mfa = sc->reg->oqueue) == 0xffffffff)
return;
reply = (struct i2o_single_reply *)(sc->obase + (mfa - sc->phys_obase));
/* if this is a event register reply, shout! */
if (reply->function == I2O_UTIL_EVENT_REGISTER) {
struct i2o_util_event_reply_message *event =
(struct i2o_util_event_reply_message *)reply;
printf("pstiop: EVENT!! idx=%08x data=%08x\n",
event->event_mask, event->event_data[0]);
return;
}
/* if reply is a failurenotice we need to free the original mfa */
if (reply->message_flags & I2O_MESSAGE_FLAGS_FAIL)
iop_free_mfa(sc,((struct i2o_fault_reply *)(reply))->preserved_mfa);
/* reply->initiator_context points to the service routine */
((void (*)(struct iop_softc *, u_int32_t, struct i2o_single_reply *))
(reply->initiator_context))(sc, mfa, reply);
}
reply = (struct i2o_single_reply *)(sc->obase + (mfa - sc->phys_obase));
/* if this is a event register reply, shout! */
if (reply->function == I2O_UTIL_EVENT_REGISTER) {
struct i2o_util_event_reply_message *event =
(struct i2o_util_event_reply_message *)reply;
printf("pstiop: EVENT!! idx=%08x data=%08x\n",
event->event_mask, event->event_data[0]);
return;
}
/* if reply is a failurenotice we need to free the original mfa */
if (reply->message_flags & I2O_MESSAGE_FLAGS_FAIL)
iop_free_mfa(sc,((struct i2o_fault_reply *)(reply))->preserved_mfa);
/* reply->initiator_context points to the service routine */
((void (*)(struct iop_softc *, u_int32_t, struct i2o_single_reply *))
(reply->initiator_context))(sc, mfa, reply);
}
int
@ -186,7 +187,7 @@ iop_reset(struct iop_softc *sc)
{
struct i2o_exec_iop_reset_message *msg;
int mfa, timeout = 5000;
u_int32_t reply = 0;
volatile u_int32_t reply = 0;
mfa = iop_get_mfa(sc);
msg = (struct i2o_exec_iop_reset_message *)(sc->ibase + mfa);
@ -209,8 +210,8 @@ iop_reset(struct iop_softc *sc)
timeout = 10000;
while ((mfa = sc->reg->iqueue) == 0xffffffff && --timeout)
DELAY(1000);
iop_free_mfa(sc, mfa);
iop_free_mfa(sc, mfa);
return reply;
}
@ -219,12 +220,13 @@ iop_init_outqueue(struct iop_softc *sc)
{
struct i2o_exec_init_outqueue_message *msg;
int i, mfa, timeout = 5000;
u_int32_t reply = 0;
volatile u_int32_t reply = 0;
if (!(sc->obase = contigmalloc(I2O_IOP_OUTBOUND_FRAME_COUNT *
I2O_IOP_OUTBOUND_FRAME_SIZE,
M_PSTIOP, M_NOWAIT,
0, 0xFFFFFFFF, sizeof(u_int32_t), 0))) {
0x00010000, 0xFFFFFFFF,
sizeof(u_int32_t), 0))) {
printf("pstiop: contigmalloc of outqueue buffers failed!\n");
return 0;
}
@ -279,7 +281,7 @@ iop_get_lct(struct iop_softc *sc)
#define ALLOCSIZE (PAGE_SIZE + (256 * sizeof(struct i2o_lct_entry)))
if (!(reply = contigmalloc(ALLOCSIZE, M_PSTIOP, M_NOWAIT | M_ZERO,
0, 0xFFFFFFFF, sizeof(u_int32_t), 0)))
0x00010000, 0xFFFFFFFF, sizeof(u_int32_t), 0)))
return 0;
mfa = iop_get_mfa(sc);
@ -323,11 +325,11 @@ iop_get_util_params(struct iop_softc *sc, int target, int operation, int group)
int mfa;
if (!(param = contigmalloc(PAGE_SIZE, M_PSTIOP, M_NOWAIT | M_ZERO,
0, 0xFFFFFFFF, sizeof(u_int32_t), 0)))
0x00010000, 0xFFFFFFFF, sizeof(u_int32_t), 0)))
return NULL;
if (!(reply = contigmalloc(PAGE_SIZE, M_PSTIOP, M_NOWAIT | M_ZERO,
0, 0xFFFFFFFF, sizeof(u_int32_t), 0)))
0x00010000, 0xFFFFFFFF, sizeof(u_int32_t), 0)))
return NULL;
mfa = iop_get_mfa(sc);

View File

@ -39,19 +39,19 @@ struct out_mfa_buf {
};
struct iop_softc {
struct resource *r_mem;
struct resource *r_irq;
caddr_t ibase;
u_int32_t phys_ibase;
caddr_t obase;
u_int32_t phys_obase;
struct i2o_registers *reg;
struct i2o_status_get_reply *status;
int lct_count;
struct i2o_lct_entry *lct;
device_t dev;
void *handle;
struct intr_config_hook *iop_delayed_attach;
struct resource *r_mem;
struct resource *r_irq;
caddr_t ibase;
u_int32_t phys_ibase;
caddr_t obase;
u_int32_t phys_obase;
struct i2o_registers *reg;
struct i2o_status_get_reply *status;
int lct_count;
struct i2o_lct_entry *lct;
device_t dev;
void *handle;
struct intr_config_hook *iop_delayed_attach;
};
/* structure at start of IOP shared mem */
@ -70,10 +70,10 @@ struct i2o_registers {
volatile u_int32_t oqueue_event;
volatile u_int32_t oqueue_intr_status;
volatile u_int32_t oqueue_intr_mask;
#define I2O_OUT_INTR_QUEUE 0x08
#define I2O_OUT_INTR_BELL 0x04
#define I2O_OUT_INTR_MSG1 0x02
#define I2O_OUT_INTR_MSG0 0x01
#define I2O_OUT_INTR_QUEUE 0x08
#define I2O_OUT_INTR_BELL 0x04
#define I2O_OUT_INTR_MSG1 0x02
#define I2O_OUT_INTR_MSG0 0x01
volatile u_int64_t reserved2;
volatile u_int32_t iqueue;
@ -86,41 +86,41 @@ struct i2o_registers {
/* Scatter/Gather List management */
struct i2o_sgl {
u_int32_t count:24;
#define I2O_SGL_CNT_MASK 0xffffff
u_int32_t count:24;
#define I2O_SGL_CNT_MASK 0xffffff
u_int32_t flags:8;
#define I2O_SGL_SIMPLE 0x10
#define I2O_SGL_PAGELIST 0x20
#define I2O_SGL_CHAIN 0x30
#define I2O_SGL_ATTRIBUTE 0x7c
#define I2O_SGL_BC0 0x01
#define I2O_SGL_BC1 0x02
#define I2O_SGL_DIR 0x04
#define I2O_SGL_LA 0x08
#define I2O_SGL_EOB 0x40
#define I2O_SGL_END 0x80
u_int32_t flags:8;
#define I2O_SGL_SIMPLE 0x10
#define I2O_SGL_PAGELIST 0x20
#define I2O_SGL_CHAIN 0x30
#define I2O_SGL_ATTRIBUTE 0x7c
#define I2O_SGL_BC0 0x01
#define I2O_SGL_BC1 0x02
#define I2O_SGL_DIR 0x04
#define I2O_SGL_LA 0x08
#define I2O_SGL_EOB 0x40
#define I2O_SGL_END 0x80
u_int32_t phys_addr[1];
u_int32_t phys_addr[1];
} __attribute__((packed));
#define I2O_SGL_MAX_SEGS ((I2O_IOP_OUTBOUND_FRAME_SIZE - (8 + 2)) + 1)
/* i2o command codes */
#define I2O_UTIL_NOP 0x00
#define I2O_UTIL_PARAMS_GET 0x06
#define I2O_UTIL_CLAIM 0x09
#define I2O_UTIL_CONFIG_DIALOG 0x10
#define I2O_UTIL_EVENT_REGISTER 0x13
#define I2O_BSA_BLOCK_READ 0x30
#define I2O_BSA_BLOCK_WRITE 0x31
#define I2O_BSA_CACHE_FLUSH 0x37
#define I2O_EXEC_STATUS_GET 0xa0
#define I2O_EXEC_OUTBOUND_INIT 0xa1
#define I2O_EXEC_LCT_NOTIFY 0xa2
#define I2O_EXEC_SYSTAB_SET 0xa3
#define I2O_EXEC_IOP_RESET 0xbd
#define I2O_EXEC_SYS_ENABLE 0xd1
#define I2O_UTIL_NOP 0x00
#define I2O_UTIL_PARAMS_GET 0x06
#define I2O_UTIL_CLAIM 0x09
#define I2O_UTIL_CONFIG_DIALOG 0x10
#define I2O_UTIL_EVENT_REGISTER 0x13
#define I2O_BSA_BLOCK_READ 0x30
#define I2O_BSA_BLOCK_WRITE 0x31
#define I2O_BSA_CACHE_FLUSH 0x37
#define I2O_EXEC_STATUS_GET 0xa0
#define I2O_EXEC_OUTBOUND_INIT 0xa1
#define I2O_EXEC_LCT_NOTIFY 0xa2
#define I2O_EXEC_SYSTAB_SET 0xa3
#define I2O_EXEC_IOP_RESET 0xbd
#define I2O_EXEC_SYS_ENABLE 0xd1
/* basic message layout */
struct i2o_basic_message {
@ -132,6 +132,7 @@ struct i2o_basic_message {
u_int32_t initiator_address:12;
u_int32_t function:8;
u_int32_t initiator_context;
u_int32_t transaction_context;
} __attribute__((packed));
/* basic reply layout */

View File

@ -72,15 +72,15 @@ static struct cdevsw pst_cdevsw = {
static struct cdevsw pstdisk_cdevsw;
struct pst_softc {
struct iop_softc *iop;
struct i2o_lct_entry *lct;
struct i2o_bsa_device *info;
dev_t device;
struct devstat stats;
struct disk disk;
struct bio_queue_head queue;
struct mtx mtx;
int outstanding;
struct iop_softc *iop;
struct i2o_lct_entry *lct;
struct i2o_bsa_device *info;
dev_t device;
struct devstat stats;
struct disk disk;
struct bio_queue_head queue;
struct mtx mtx;
int outstanding;
};
struct pst_request {
@ -254,7 +254,7 @@ pst_start(struct pst_softc *psc)
request->timeout_handle.callout = NULL;
else
request->timeout_handle =
timeout((timeout_t*)pst_timeout, request, 20 * hz);
timeout((timeout_t*)pst_timeout, request, 10 * hz);
bioq_remove(&psc->queue, bp);
devstat_start_transaction(&psc->stats);
if (pst_rw(request)) {