Lines Matching refs:state
99 static int ioat_chip_init(ioat_state_t *state);
100 static void ioat_chip_fini(ioat_state_t *state);
101 static int ioat_drv_init(ioat_state_t *state);
102 static void ioat_drv_fini(ioat_state_t *state);
104 static void ioat_intr_enable(ioat_state_t *state);
105 static void ioat_intr_disable(ioat_state_t *state);
106 void ioat_detach_finish(ioat_state_t *state);
184 ioat_state_t *state; in ioat_attach() local
195 state = ddi_get_soft_state(ioat_statep, instance); in ioat_attach()
196 if (state == NULL) { in ioat_attach()
199 e = ioat_channel_resume(state); in ioat_attach()
203 ioat_intr_enable(state); in ioat_attach()
215 state = ddi_get_soft_state(ioat_statep, instance); in ioat_attach()
216 if (state == NULL) { in ioat_attach()
220 state->is_dip = dip; in ioat_attach()
221 state->is_instance = instance; in ioat_attach()
224 e = ioat_chip_init(state); in ioat_attach()
230 e = ioat_drv_init(state); in ioat_attach()
243 ioat_intr_enable(state); in ioat_attach()
249 e = dcopy_device_register(state, &state->is_deviceinfo, in ioat_attach()
250 &state->is_device_handle); in ioat_attach()
258 ioat_intr_disable(state); in ioat_attach()
261 ioat_drv_fini(state); in ioat_attach()
263 ioat_chip_fini(state); in ioat_attach()
277 ioat_state_t *state; in ioat_detach() local
283 state = ddi_get_soft_state(ioat_statep, instance); in ioat_detach()
284 if (state == NULL) { in ioat_detach()
293 ioat_channel_suspend(state); in ioat_detach()
305 e = dcopy_device_unregister(&state->is_device_handle); in ioat_detach()
314 ioat_detach_finish(state); in ioat_detach()
326 ioat_state_t *state; in ioat_getinfo() local
337 state = ddi_get_soft_state(ioat_statep, instance); in ioat_getinfo()
338 if (state == NULL) { in ioat_getinfo()
341 *result = (void *)state->is_dip; in ioat_getinfo()
366 ioat_state_t *state; in ioat_open() local
370 state = ddi_get_soft_state(ioat_statep, instance); in ioat_open()
371 if (state == NULL) { in ioat_open()
394 ioat_chip_init(ioat_state_t *state) in ioat_chip_init() argument
404 e = ddi_regs_map_setup(state->is_dip, 1, (caddr_t *)&state->is_genregs, in ioat_chip_init()
405 0, 0, &attr, &state->is_reg_handle); in ioat_chip_init()
411 state->is_num_channels = (uint_t)ddi_get8(state->is_reg_handle, in ioat_chip_init()
412 &state->is_genregs[IOAT_CHANCNT]); in ioat_chip_init()
418 if (state->is_num_channels == 0) { in ioat_chip_init()
422 state->is_maxxfer = (uint_t)ddi_get8(state->is_reg_handle, in ioat_chip_init()
423 &state->is_genregs[IOAT_XFERCAP]); in ioat_chip_init()
424 state->is_chanoff = (uintptr_t)ddi_get16(state->is_reg_handle, in ioat_chip_init()
425 (uint16_t *)&state->is_genregs[IOAT_PERPORT_OFF]); in ioat_chip_init()
426 state->is_cbver = (uint_t)ddi_get8(state->is_reg_handle, in ioat_chip_init()
427 &state->is_genregs[IOAT_CBVER]); in ioat_chip_init()
428 state->is_intrdelay = (uint_t)ddi_get16(state->is_reg_handle, in ioat_chip_init()
429 (uint16_t *)&state->is_genregs[IOAT_INTRDELAY]); in ioat_chip_init()
430 state->is_status = (uint_t)ddi_get16(state->is_reg_handle, in ioat_chip_init()
431 (uint16_t *)&state->is_genregs[IOAT_CSSTATUS]); in ioat_chip_init()
432 state->is_capabilities = (uint_t)ddi_get32(state->is_reg_handle, in ioat_chip_init()
433 (uint32_t *)&state->is_genregs[IOAT_DMACAPABILITY]); in ioat_chip_init()
435 if (state->is_cbver & 0x10) { in ioat_chip_init()
436 state->is_ver = IOAT_CBv1; in ioat_chip_init()
437 } else if (state->is_cbver & 0x20) { in ioat_chip_init()
438 state->is_ver = IOAT_CBv2; in ioat_chip_init()
447 ddi_regs_map_free(&state->is_reg_handle); in ioat_chip_init()
457 ioat_chip_fini(ioat_state_t *state) in ioat_chip_fini() argument
459 ddi_regs_map_free(&state->is_reg_handle); in ioat_chip_fini()
467 ioat_drv_init(ioat_state_t *state) in ioat_drv_init() argument
473 mutex_init(&state->is_mutex, NULL, MUTEX_DRIVER, NULL); in ioat_drv_init()
475 state->is_deviceinfo.di_dip = state->is_dip; in ioat_drv_init()
476 state->is_deviceinfo.di_num_dma = state->is_num_channels; in ioat_drv_init()
477 state->is_deviceinfo.di_maxxfer = state->is_maxxfer; in ioat_drv_init()
478 state->is_deviceinfo.di_capabilities = state->is_capabilities; in ioat_drv_init()
479 state->is_deviceinfo.di_cb = &ioat_cb; in ioat_drv_init()
481 e = pci_config_setup(state->is_dip, &handle); in ioat_drv_init()
487 state->is_deviceinfo.di_id = (uint64_t)pci_config_get16(handle, 0); in ioat_drv_init()
488 state->is_deviceinfo.di_id = state->is_deviceinfo.di_id << 16; in ioat_drv_init()
491 state->is_deviceinfo.di_id |= (uint64_t)pci_config_get16(handle, 2); in ioat_drv_init()
492 state->is_deviceinfo.di_id = state->is_deviceinfo.di_id << 32; in ioat_drv_init()
495 state->is_deviceinfo.di_id |= (uint64_t)state->is_cbver; in ioat_drv_init()
498 e = ddi_intr_hilevel(state->is_dip, 0); in ioat_drv_init()
505 e = ddi_add_intr(state->is_dip, 0, NULL, NULL, ioat_isr, in ioat_drv_init()
506 (caddr_t)state); in ioat_drv_init()
511 e = ddi_get_iblock_cookie(state->is_dip, 0, &state->is_iblock_cookie); in ioat_drv_init()
516 e = ioat_channel_init(state); in ioat_drv_init()
525 ddi_remove_intr(state->is_dip, 0, state->is_iblock_cookie); in ioat_drv_init()
529 mutex_destroy(&state->is_mutex); in ioat_drv_init()
539 ioat_drv_fini(ioat_state_t *state) in ioat_drv_fini() argument
541 ioat_channel_fini(state); in ioat_drv_fini()
542 ddi_remove_intr(state->is_dip, 0, state->is_iblock_cookie); in ioat_drv_fini()
543 mutex_destroy(&state->is_mutex); in ioat_drv_fini()
553 ioat_state_t *state; in ioat_unregister_complete() local
556 state = device_private; in ioat_unregister_complete()
564 ioat_detach_finish(state); in ioat_unregister_complete()
572 ioat_detach_finish(ioat_state_t *state) in ioat_detach_finish() argument
574 ioat_intr_disable(state); in ioat_detach_finish()
575 ddi_remove_minor_node(state->is_dip, NULL); in ioat_detach_finish()
576 ioat_drv_fini(state); in ioat_detach_finish()
577 ioat_chip_fini(state); in ioat_detach_finish()
578 (void) ddi_soft_state_free(ioat_statep, state->is_instance); in ioat_detach_finish()
586 ioat_intr_enable(ioat_state_t *state) in ioat_intr_enable() argument
592 intr_status = ddi_get32(state->is_reg_handle, in ioat_intr_enable()
593 (uint32_t *)&state->is_genregs[IOAT_ATTNSTATUS]); in ioat_intr_enable()
595 ddi_put32(state->is_reg_handle, in ioat_intr_enable()
596 (uint32_t *)&state->is_genregs[IOAT_ATTNSTATUS], in ioat_intr_enable()
601 ddi_put8(state->is_reg_handle, &state->is_genregs[IOAT_INTRCTL], in ioat_intr_enable()
610 ioat_intr_disable(ioat_state_t *state) in ioat_intr_disable() argument
616 (void) ddi_get8(state->is_reg_handle, in ioat_intr_disable()
617 &state->is_genregs[IOAT_INTRCTL]); in ioat_intr_disable()
628 ioat_state_t *state; in ioat_isr() local
634 state = (ioat_state_t *)parm; in ioat_isr()
636 intrctrl = ddi_get8(state->is_reg_handle, in ioat_isr()
637 &state->is_genregs[IOAT_INTRCTL]); in ioat_isr()
644 ddi_put8(state->is_reg_handle, in ioat_isr()
645 &state->is_genregs[IOAT_INTRCTL], intrctrl); in ioat_isr()
650 intr_status = ddi_get32(state->is_reg_handle, in ioat_isr()
651 (uint32_t *)&state->is_genregs[IOAT_ATTNSTATUS]); in ioat_isr()
656 for (i = 0; i < state->is_num_channels; i++) { in ioat_isr()
658 ioat_channel_intr(&state->is_channel[i]); in ioat_isr()
671 ddi_put8(state->is_reg_handle, &state->is_genregs[IOAT_INTRCTL], in ioat_isr()
680 ioat_state_t *state; in ioat_quiesce() local
684 state = ddi_get_soft_state(ioat_statep, instance); in ioat_quiesce()
685 if (state == NULL) { in ioat_quiesce()
689 ioat_intr_disable(state); in ioat_quiesce()
690 ioat_channel_quiesce(state); in ioat_quiesce()