Lines Matching defs:state

72 	struct fsc_state *state;
89 state = (struct fsc_state *) cmd->device->host->hostdata;
91 if (state->request_q == NULL)
92 state->request_q = cmd;
94 state->request_qtail->host_scribble = (void *) cmd;
95 state->request_qtail = cmd;
97 if (state->phase == idle)
98 mac53c94_start(state);
107 struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata;
108 struct mac53c94_regs __iomem *regs = state->regs;
109 struct dbdma_regs __iomem *dma = state->dma;
119 mac53c94_init(state);
126 static void mac53c94_init(struct fsc_state *state)
128 struct mac53c94_regs __iomem *regs = state->regs;
129 struct dbdma_regs __iomem *dma = state->dma;
132 writeb(state->host->this_id | CF1_PAR_ENABLE, &regs->config1);
134 writeb(CLKF_VAL(state->clk_freq), &regs->clk_factor);
147 static void mac53c94_start(struct fsc_state *state)
150 struct mac53c94_regs __iomem *regs = state->regs;
153 if (state->phase != idle || state->current_req != NULL)
154 panic("inappropriate mac53c94_start (state=%p)", state);
155 if (state->request_q == NULL)
157 state->current_req = cmd = state->request_q;
158 state->request_q = (struct scsi_cmnd *) cmd->host_scribble;
178 state->phase = selecting;
180 set_dma_cmds(state, cmd);
196 struct fsc_state *state = (struct fsc_state *) dev_id;
197 struct mac53c94_regs __iomem *regs = state->regs;
198 struct dbdma_regs __iomem *dma = state->dma;
199 struct scsi_cmnd *cmd = state->current_req;
213 intr, stat, seq, state->phase);
221 cmd_done(state, DID_RESET << 16);
226 intr, stat, seq, state->phase);
227 cmd_done(state, DID_ERROR << 16);
234 intr, stat, seq, state->phase);
245 cmd_done(state, DID_PARITY << 16);
248 switch (state->phase) {
252 cmd_done(state, DID_BAD_TARGET << 16);
257 cmd_done(state, DID_ERROR << 16);
262 cmd_done(state, DID_ERROR << 16);
276 writel(virt_to_phys(state->dma_cmds), &dma->cmdptr);
279 state->phase = dataing;
284 state->phase = completing;
288 cmd_done(state, DID_ERROR << 16);
296 cmd_done(state, DID_ERROR << 16);
319 state->phase = completing;
324 cmd_done(state, DID_ERROR << 16);
331 state->phase = busfreeing;
337 cmd_done(state, (DID_OK << 16) + (cmd->SCp.Message << 8)
341 printk(KERN_DEBUG "don't know about phase %d\n", state->phase);
345 static void cmd_done(struct fsc_state *state, int result)
349 cmd = state->current_req;
353 state->current_req = NULL;
355 state->phase = idle;
356 mac53c94_start(state);
362 static void set_dma_cmds(struct fsc_state *state, struct scsi_cmnd *cmd)
377 dcmds = state->dma_cmds;
414 struct fsc_state *state;
439 state = (struct fsc_state *) host->hostdata;
440 macio_set_drvdata(mdev, state);
441 state->host = host;
442 state->pdev = pdev;
443 state->mdev = mdev;
445 state->regs = (struct mac53c94_regs __iomem *)
447 state->intr = macio_irq(mdev, 0);
448 state->dma = (struct dbdma_regs __iomem *)
450 state->dmaintr = macio_irq(mdev, 1);
451 if (state->regs == NULL || state->dma == NULL) {
460 state->clk_freq = 25000000;
462 state->clk_freq = *(int *)clkprop;
477 state->dma_cmds = (struct dbdma_cmd *)DBDMA_ALIGN(dma_cmd_space);
478 memset(state->dma_cmds, 0, (host->sg_tablesize + 1)
480 state->dma_cmd_space = dma_cmd_space;
482 mac53c94_init(state);
484 if (request_irq(state->intr, do_mac53c94_interrupt, 0, "53C94",state)) {
486 state->intr, node);
498 free_irq(state->intr, state);
500 kfree(state->dma_cmd_space);
502 if (state->dma != NULL)
503 iounmap(state->dma);
504 if (state->regs != NULL)
505 iounmap(state->regs);