Lines Matching defs:state
71 struct fsc_state *state;
77 state = (struct fsc_state *) cmd->device->host->hostdata;
79 if (state->request_q == NULL)
80 state->request_q = cmd;
82 state->request_qtail->host_scribble = (void *) cmd;
83 state->request_qtail = cmd;
85 if (state->phase == idle)
86 mac53c94_start(state);
93 struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata;
94 struct mac53c94_regs __iomem *regs = state->regs;
95 struct dbdma_regs __iomem *dma = state->dma;
105 mac53c94_init(state);
112 static void mac53c94_init(struct fsc_state *state)
114 struct mac53c94_regs __iomem *regs = state->regs;
115 struct dbdma_regs __iomem *dma = state->dma;
118 writeb(state->host->this_id | CF1_PAR_ENABLE, ®s->config1);
120 writeb(CLKF_VAL(state->clk_freq), ®s->clk_factor);
133 static void mac53c94_start(struct fsc_state *state)
136 struct mac53c94_regs __iomem *regs = state->regs;
139 if (state->phase != idle || state->current_req != NULL)
140 panic("inappropriate mac53c94_start (state=%p)", state);
141 if (state->request_q == NULL)
143 state->current_req = cmd = state->request_q;
144 state->request_q = (struct scsi_cmnd *) cmd->host_scribble;
163 state->phase = selecting;
165 set_dma_cmds(state, cmd);
181 struct fsc_state *state = (struct fsc_state *) dev_id;
182 struct mac53c94_regs __iomem *regs = state->regs;
183 struct dbdma_regs __iomem *dma = state->dma;
184 struct scsi_cmnd *cmd = state->current_req;
202 cmd_done(state, DID_RESET << 16);
207 intr, stat, seq, state->phase);
208 cmd_done(state, DID_ERROR << 16);
221 cmd_done(state, DID_PARITY << 16);
224 switch (state->phase) {
228 cmd_done(state, DID_BAD_TARGET << 16);
233 cmd_done(state, DID_ERROR << 16);
238 cmd_done(state, DID_ERROR << 16);
252 writel(virt_to_phys(state->dma_cmds), &dma->cmdptr);
255 state->phase = dataing;
260 state->phase = completing;
264 cmd_done(state, DID_ERROR << 16);
272 cmd_done(state, DID_ERROR << 16);
295 state->phase = completing;
300 cmd_done(state, DID_ERROR << 16);
307 state->phase = busfreeing;
313 cmd_done(state, (DID_OK << 16) + (cmd->SCp.Message << 8)
317 printk(KERN_DEBUG "don't know about phase %d\n", state->phase);
321 static void cmd_done(struct fsc_state *state, int result)
325 cmd = state->current_req;
329 state->current_req = NULL;
331 state->phase = idle;
332 mac53c94_start(state);
338 static void set_dma_cmds(struct fsc_state *state, struct scsi_cmnd *cmd)
353 dcmds = state->dma_cmds;
391 struct fsc_state *state;
416 state = (struct fsc_state *) host->hostdata;
417 macio_set_drvdata(mdev, state);
418 state->host = host;
419 state->pdev = pdev;
420 state->mdev = mdev;
422 state->regs = (struct mac53c94_regs __iomem *)
424 state->intr = macio_irq(mdev, 0);
425 state->dma = (struct dbdma_regs __iomem *)
427 state->dmaintr = macio_irq(mdev, 1);
428 if (state->regs == NULL || state->dma == NULL) {
438 state->clk_freq = 25000000;
440 state->clk_freq = *(int *)clkprop;
450 state->dma_cmds = (struct dbdma_cmd *)DBDMA_ALIGN(dma_cmd_space);
451 memset(state->dma_cmds, 0, (host->sg_tablesize + 1)
453 state->dma_cmd_space = dma_cmd_space;
455 mac53c94_init(state);
457 if (request_irq(state->intr, do_mac53c94_interrupt, 0, "53C94",state)) {
459 state->intr, node->full_name);
471 free_irq(state->intr, state);
473 kfree(state->dma_cmd_space);
475 if (state->dma != NULL)
476 iounmap(state->dma);
477 if (state->regs != NULL)
478 iounmap(state->regs);