Lines Matching refs:state

71 	struct fsc_state *state;  in mac53c94_queue_lck()  local
88 state = (struct fsc_state *) cmd->device->host->hostdata; in mac53c94_queue_lck()
90 if (state->request_q == NULL) in mac53c94_queue_lck()
91 state->request_q = cmd; in mac53c94_queue_lck()
93 state->request_qtail->host_scribble = (void *) cmd; in mac53c94_queue_lck()
94 state->request_qtail = cmd; in mac53c94_queue_lck()
96 if (state->phase == idle) in mac53c94_queue_lck()
97 mac53c94_start(state); in mac53c94_queue_lck()
106 struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata; in DEF_SCSI_QCMD() local
107 struct mac53c94_regs __iomem *regs = state->regs; in DEF_SCSI_QCMD()
108 struct dbdma_regs __iomem *dma = state->dma; in DEF_SCSI_QCMD()
118 mac53c94_init(state); in DEF_SCSI_QCMD()
125 static void mac53c94_init(struct fsc_state *state) in mac53c94_init() argument
127 struct mac53c94_regs __iomem *regs = state->regs; in mac53c94_init()
128 struct dbdma_regs __iomem *dma = state->dma; in mac53c94_init()
131 writeb(state->host->this_id | CF1_PAR_ENABLE, &regs->config1); in mac53c94_init()
133 writeb(CLKF_VAL(state->clk_freq), &regs->clk_factor); in mac53c94_init()
146 static void mac53c94_start(struct fsc_state *state) in mac53c94_start() argument
149 struct mac53c94_regs __iomem *regs = state->regs; in mac53c94_start()
152 if (state->phase != idle || state->current_req != NULL) in mac53c94_start()
153 panic("inappropriate mac53c94_start (state=%p)", state); in mac53c94_start()
154 if (state->request_q == NULL) in mac53c94_start()
156 state->current_req = cmd = state->request_q; in mac53c94_start()
157 state->request_q = (struct scsi_cmnd *) cmd->host_scribble; in mac53c94_start()
177 state->phase = selecting; in mac53c94_start()
179 set_dma_cmds(state, cmd); in mac53c94_start()
195 struct fsc_state *state = (struct fsc_state *) dev_id; in mac53c94_interrupt() local
196 struct mac53c94_regs __iomem *regs = state->regs; in mac53c94_interrupt()
197 struct dbdma_regs __iomem *dma = state->dma; in mac53c94_interrupt()
198 struct scsi_cmnd *cmd = state->current_req; in mac53c94_interrupt()
212 intr, stat, seq, state->phase); in mac53c94_interrupt()
220 cmd_done(state, DID_RESET << 16); in mac53c94_interrupt()
225 intr, stat, seq, state->phase); in mac53c94_interrupt()
226 cmd_done(state, DID_ERROR << 16); in mac53c94_interrupt()
233 intr, stat, seq, state->phase); in mac53c94_interrupt()
244 cmd_done(state, DID_PARITY << 16); in mac53c94_interrupt()
247 switch (state->phase) { in mac53c94_interrupt()
251 cmd_done(state, DID_BAD_TARGET << 16); in mac53c94_interrupt()
256 cmd_done(state, DID_ERROR << 16); in mac53c94_interrupt()
261 cmd_done(state, DID_ERROR << 16); in mac53c94_interrupt()
275 writel(virt_to_phys(state->dma_cmds), &dma->cmdptr); in mac53c94_interrupt()
278 state->phase = dataing; in mac53c94_interrupt()
283 state->phase = completing; in mac53c94_interrupt()
287 cmd_done(state, DID_ERROR << 16); in mac53c94_interrupt()
295 cmd_done(state, DID_ERROR << 16); in mac53c94_interrupt()
318 state->phase = completing; in mac53c94_interrupt()
323 cmd_done(state, DID_ERROR << 16); in mac53c94_interrupt()
330 state->phase = busfreeing; in mac53c94_interrupt()
336 cmd_done(state, (DID_OK << 16) + (cmd->SCp.Message << 8) in mac53c94_interrupt()
340 printk(KERN_DEBUG "don't know about phase %d\n", state->phase); in mac53c94_interrupt()
344 static void cmd_done(struct fsc_state *state, int result) in cmd_done() argument
348 cmd = state->current_req; in cmd_done()
352 state->current_req = NULL; in cmd_done()
354 state->phase = idle; in cmd_done()
355 mac53c94_start(state); in cmd_done()
361 static void set_dma_cmds(struct fsc_state *state, struct scsi_cmnd *cmd) in set_dma_cmds() argument
376 dcmds = state->dma_cmds; in set_dma_cmds()
414 struct fsc_state *state; in mac53c94_probe() local
439 state = (struct fsc_state *) host->hostdata; in mac53c94_probe()
440 macio_set_drvdata(mdev, state); in mac53c94_probe()
441 state->host = host; in mac53c94_probe()
442 state->pdev = pdev; in mac53c94_probe()
443 state->mdev = mdev; in mac53c94_probe()
445 state->regs = (struct mac53c94_regs __iomem *) in mac53c94_probe()
447 state->intr = macio_irq(mdev, 0); in mac53c94_probe()
448 state->dma = (struct dbdma_regs __iomem *) in mac53c94_probe()
450 state->dmaintr = macio_irq(mdev, 1); in mac53c94_probe()
451 if (state->regs == NULL || state->dma == NULL) { in mac53c94_probe()
461 state->clk_freq = 25000000; in mac53c94_probe()
463 state->clk_freq = *(int *)clkprop; in mac53c94_probe()
477 state->dma_cmds = (struct dbdma_cmd *)DBDMA_ALIGN(dma_cmd_space); in mac53c94_probe()
478 memset(state->dma_cmds, 0, (host->sg_tablesize + 1) in mac53c94_probe()
480 state->dma_cmd_space = dma_cmd_space; in mac53c94_probe()
482 mac53c94_init(state); in mac53c94_probe()
484 if (request_irq(state->intr, do_mac53c94_interrupt, 0, "53C94",state)) { in mac53c94_probe()
486 state->intr, node->full_name); in mac53c94_probe()
498 free_irq(state->intr, state); in mac53c94_probe()
500 kfree(state->dma_cmd_space); in mac53c94_probe()
502 if (state->dma != NULL) in mac53c94_probe()
503 iounmap(state->dma); in mac53c94_probe()
504 if (state->regs != NULL) in mac53c94_probe()
505 iounmap(state->regs); in mac53c94_probe()