Lines Matching refs:hp
930 struct bofi_shadow *hp; in bofi_ioctl() local
1505 for (hp = hhashp->hnext; hp != hhashp; hp = hp->hnext) { in bofi_ioctl()
1506 if (!driver_under_test(hp->dip)) in bofi_ioctl()
1508 if (ddi_name_to_major(ddi_get_name(hp->dip)) != in bofi_ioctl()
1511 if (hp->instance != get_handles.instance) in bofi_ioctl()
1518 " %s %d %s ", hp->name, hp->instance, in bofi_ioctl()
1519 (hp->type == BOFI_INT_HDL) ? "INTR" : in bofi_ioctl()
1520 (hp->type == BOFI_ACC_HDL) ? "PIO" : in bofi_ioctl()
1521 (hp->type == BOFI_DMA_HDL) ? "DMA" : in bofi_ioctl()
1522 (hp->hparrayp != NULL) ? "DVMA" : "DMA*"); in bofi_ioctl()
1524 if (hp->type == BOFI_ACC_HDL) { in bofi_ioctl()
1525 if (hp->len == INT_MAX - hp->offset) in bofi_ioctl()
1529 hp->rnumber, hp->offset); in bofi_ioctl()
1535 hp->rnumber, hp->offset, in bofi_ioctl()
1536 hp->len); in bofi_ioctl()
1537 } else if (hp->type == BOFI_DMA_HDL) in bofi_ioctl()
1541 " addr 0x%p\n", hp->rnumber, in bofi_ioctl()
1542 hp->len, (void *)hp->addr); in bofi_ioctl()
1543 else if (hp->type == BOFI_NULL && in bofi_ioctl()
1544 hp->hparrayp == NULL) in bofi_ioctl()
1547 "handle no %d\n", hp->rnumber); in bofi_ioctl()
1621 for (hp = hhashp->hnext; hp != hhashp; hp = hp->hnext) { in bofi_ioctl()
1622 if (!driver_under_test(hp->dip) || in bofi_ioctl()
1623 ddi_name_to_major(ddi_get_name(hp->dip)) != in bofi_ioctl()
1629 hdlip->instance = hp->instance; in bofi_ioctl()
1630 hdlip->rnumber = hp->rnumber; in bofi_ioctl()
1631 switch (hp->type) { in bofi_ioctl()
1634 hdlip->offset = hp->offset; in bofi_ioctl()
1635 hdlip->len = hp->len; in bofi_ioctl()
1639 if (hp->flags & DDI_DMA_WRITE) in bofi_ioctl()
1642 if (hp->flags & DDI_DMA_READ) in bofi_ioctl()
1645 hdlip->len = hp->len; in bofi_ioctl()
1647 (uint64_t)(uintptr_t)hp->addr; in bofi_ioctl()
1736 struct bofi_shadow *hp; in bofi_errdef_alloc() local
1778 for (hp = shadow_list.next; hp != &shadow_list; hp = hp->next) { in bofi_errdef_alloc()
1779 if (ddi_name_to_major(hp->name) == ddi_name_to_major(namep) && in bofi_errdef_alloc()
1780 hp->instance == errdefp->instance && in bofi_errdef_alloc()
1783 hp->rnumber == ep->errdef.rnumber) && in bofi_errdef_alloc()
1784 hp->type == BOFI_DMA_HDL && in bofi_errdef_alloc()
1785 (((uintptr_t)(hp->addr + ep->errdef.offset + in bofi_errdef_alloc()
1787 ((uintptr_t)((hp->addr + ep->errdef.offset) + in bofi_errdef_alloc()
1790 hp->type == BOFI_INT_HDL) || in bofi_errdef_alloc()
1792 hp->type == BOFI_ACC_HDL && in bofi_errdef_alloc()
1794 hp->rnumber == errdefp->rnumber) && in bofi_errdef_alloc()
1796 hp->offset < errdefp->offset + errdefp->len) && in bofi_errdef_alloc()
1797 hp->offset + hp->len > errdefp->offset))) { in bofi_errdef_alloc()
1802 lp->link = hp->link; in bofi_errdef_alloc()
1803 hp->link = lp; in bofi_errdef_alloc()
1824 struct bofi_shadow *hp; in bofi_errdef_free() local
1861 for (hp = shadow_list.next; hp != &shadow_list; hp = hp->next) { in bofi_errdef_free()
1863 for (lp = hp->link; lp != NULL; ) { in bofi_errdef_free()
1868 hp->link = lp->link; in bofi_errdef_free()
2293 do_dma_corrupt(struct bofi_shadow *hp, struct bofi_errent *ep, in do_dma_corrupt() argument
2322 logaddr = (caddr_t)((uintptr_t)(hp->addr + in do_dma_corrupt()
2325 log_acc_event(ep, atype, logaddr - hp->addr, in do_dma_corrupt()
2346 addr = (uint64_t *)((uintptr_t)((hp->addr + in do_dma_corrupt()
2348 endaddr = (uint64_t *)((uintptr_t)(hp->addr + min(hp->len, in do_dma_corrupt()
2352 hdlp = (ddi_dma_impl_t *)(hp->hdl.dma_handle); in do_dma_corrupt()
2361 ddi_fm_ereport_post(hp->dip, buf, ena, in do_dma_corrupt()
2407 do_pior_corrupt(struct bofi_shadow *hp, caddr_t addr, in do_pior_corrupt() argument
2424 for (lp = hp->link; lp != NULL; lp = lp->link) { in do_pior_corrupt()
2427 minlen = hp->len; in do_pior_corrupt()
2429 minlen = min(hp->len, ep->errdef.len); in do_pior_corrupt()
2430 base = addr - hp->addr - ep->errdef.offset + hp->offset; in do_pior_corrupt()
2441 gv = get_val = func(hp, addr); in do_pior_corrupt()
2445 addr - hp->addr, in do_pior_corrupt()
2465 gv = get_val = func(hp, addr); in do_pior_corrupt()
2470 addr - hp->addr, in do_pior_corrupt()
2473 hdlp = (ddi_acc_impl_t *)(hp->hdl.acc_handle); in do_pior_corrupt()
2483 ddi_fm_ereport_post(hp->dip, buf, ena, in do_pior_corrupt()
2509 return (func(hp, addr)); in do_pior_corrupt()
2525 do_piow_corrupt(struct bofi_shadow *hp, caddr_t addr, uint64_t *valuep, in do_piow_corrupt() argument
2540 for (lp = hp->link; lp != NULL; lp = lp->link) { in do_piow_corrupt()
2543 minlen = hp->len; in do_piow_corrupt()
2545 minlen = min(hp->len, ep->errdef.len); in do_piow_corrupt()
2546 base = (caddr_t)addr - hp->addr - ep->errdef.offset +hp->offset; in do_piow_corrupt()
2558 addr - hp->addr, size, in do_piow_corrupt()
2565 addr - hp->addr, size, in do_piow_corrupt()
2572 hdlp = (ddi_acc_impl_t *)(hp->hdl.acc_handle); in do_piow_corrupt()
2582 ddi_fm_ereport_post(hp->dip, buf, ena, in do_piow_corrupt()
2617 do_bofi_rd8(struct bofi_shadow *hp, caddr_t addr) in do_bofi_rd8() argument
2619 return (hp->save.acc.ahi_get8(&hp->save.acc, (uint8_t *)addr)); in do_bofi_rd8()
2624 addr = (type *)((uintptr_t)addr - 64 + hp->addr); \
2625 if (bofi_range_check && ((caddr_t)addr < hp->addr || \
2626 (caddr_t)addr - hp->addr >= hp->len)) { \
2629 (void *)addr, (void *)hp->addr, hp->len); \
2639 struct bofi_shadow *hp; in bofi_rd8() local
2642 hp = handle->ahi_common.ah_bus_private; in bofi_rd8()
2644 if (!hp->link || !mutex_tryenter(&bofi_mutex)) in bofi_rd8()
2645 return (hp->save.acc.ahi_get8(&hp->save.acc, addr)); in bofi_rd8()
2646 retval = (uint8_t)do_pior_corrupt(hp, (caddr_t)addr, do_bofi_rd8, 1, in bofi_rd8()
2654 do_bofi_rd16(struct bofi_shadow *hp, caddr_t addr) in do_bofi_rd16() argument
2656 return (hp->save.acc.ahi_get16(&hp->save.acc, (uint16_t *)addr)); in do_bofi_rd16()
2666 struct bofi_shadow *hp; in bofi_rd16() local
2669 hp = handle->ahi_common.ah_bus_private; in bofi_rd16()
2671 if (!hp->link || !mutex_tryenter(&bofi_mutex)) in bofi_rd16()
2672 return (hp->save.acc.ahi_get16(&hp->save.acc, addr)); in bofi_rd16()
2673 retval = (uint16_t)do_pior_corrupt(hp, (caddr_t)addr, do_bofi_rd16, 1, in bofi_rd16()
2681 do_bofi_rd32(struct bofi_shadow *hp, caddr_t addr) in do_bofi_rd32() argument
2683 return (hp->save.acc.ahi_get32(&hp->save.acc, (uint32_t *)addr)); in do_bofi_rd32()
2693 struct bofi_shadow *hp; in bofi_rd32() local
2696 hp = handle->ahi_common.ah_bus_private; in bofi_rd32()
2698 if (!hp->link || !mutex_tryenter(&bofi_mutex)) in bofi_rd32()
2699 return (hp->save.acc.ahi_get32(&hp->save.acc, addr)); in bofi_rd32()
2700 retval = (uint32_t)do_pior_corrupt(hp, (caddr_t)addr, do_bofi_rd32, 1, in bofi_rd32()
2708 do_bofi_rd64(struct bofi_shadow *hp, caddr_t addr) in do_bofi_rd64() argument
2710 return (hp->save.acc.ahi_get64(&hp->save.acc, (uint64_t *)addr)); in do_bofi_rd64()
2720 struct bofi_shadow *hp; in bofi_rd64() local
2723 hp = handle->ahi_common.ah_bus_private; in bofi_rd64()
2725 if (!hp->link || !mutex_tryenter(&bofi_mutex)) in bofi_rd64()
2726 return (hp->save.acc.ahi_get64(&hp->save.acc, addr)); in bofi_rd64()
2727 retval = (uint64_t)do_pior_corrupt(hp, (caddr_t)addr, do_bofi_rd64, 1, in bofi_rd64()
2735 addr = (type *)((uintptr_t)addr - 64 + hp->addr); \
2736 if (bofi_range_check && ((caddr_t)addr < hp->addr || \
2737 (caddr_t)addr - hp->addr >= hp->len)) { \
2740 (void *)addr, (void *)hp->addr, hp->len); \
2750 struct bofi_shadow *hp; in bofi_wr8() local
2753 hp = handle->ahi_common.ah_bus_private; in bofi_wr8()
2755 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_wr8()
2756 hp->save.acc.ahi_put8(&hp->save.acc, addr, (uint8_t)llvalue); in bofi_wr8()
2759 if (do_piow_corrupt(hp, (caddr_t)addr, &llvalue, 1, 1)) in bofi_wr8()
2760 hp->save.acc.ahi_put8(&hp->save.acc, addr, (uint8_t)llvalue); in bofi_wr8()
2771 struct bofi_shadow *hp; in bofi_wr16() local
2774 hp = handle->ahi_common.ah_bus_private; in bofi_wr16()
2776 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_wr16()
2777 hp->save.acc.ahi_put16(&hp->save.acc, addr, (uint16_t)llvalue); in bofi_wr16()
2780 if (do_piow_corrupt(hp, (caddr_t)addr, &llvalue, 2, 1)) in bofi_wr16()
2781 hp->save.acc.ahi_put16(&hp->save.acc, addr, (uint16_t)llvalue); in bofi_wr16()
2792 struct bofi_shadow *hp; in bofi_wr32() local
2795 hp = handle->ahi_common.ah_bus_private; in bofi_wr32()
2797 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_wr32()
2798 hp->save.acc.ahi_put32(&hp->save.acc, addr, (uint32_t)llvalue); in bofi_wr32()
2801 if (do_piow_corrupt(hp, (caddr_t)addr, &llvalue, 4, 1)) in bofi_wr32()
2802 hp->save.acc.ahi_put32(&hp->save.acc, addr, (uint32_t)llvalue); in bofi_wr32()
2813 struct bofi_shadow *hp; in bofi_wr64() local
2816 hp = handle->ahi_common.ah_bus_private; in bofi_wr64()
2818 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_wr64()
2819 hp->save.acc.ahi_put64(&hp->save.acc, addr, (uint64_t)llvalue); in bofi_wr64()
2822 if (do_piow_corrupt(hp, (caddr_t)addr, &llvalue, 8, 1)) in bofi_wr64()
2823 hp->save.acc.ahi_put64(&hp->save.acc, addr, (uint64_t)llvalue); in bofi_wr64()
2829 dev_addr = (type *)((uintptr_t)dev_addr - 64 + hp->addr); \
2830 if (bofi_range_check && ((caddr_t)dev_addr < hp->addr || \
2831 (caddr_t)(dev_addr + repcount) - hp->addr > hp->len)) { \
2834 (void *)dev_addr, (void *)hp->addr, hp->len); \
2835 if ((caddr_t)dev_addr < hp->addr || \
2836 (caddr_t)dev_addr - hp->addr >= hp->len) \
2838 repcount = (type *)(hp->addr + hp->len) - dev_addr; \
2848 struct bofi_shadow *hp; in bofi_rep_rd8() local
2852 hp = handle->ahi_common.ah_bus_private; in bofi_rep_rd8()
2854 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_rep_rd8()
2855 hp->save.acc.ahi_rep_get8(&hp->save.acc, host_addr, dev_addr, in bofi_rep_rd8()
2861 *(host_addr + i) = (uint8_t)do_pior_corrupt(hp, (caddr_t)addr, in bofi_rep_rd8()
2875 struct bofi_shadow *hp; in bofi_rep_rd16() local
2879 hp = handle->ahi_common.ah_bus_private; in bofi_rep_rd16()
2881 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_rep_rd16()
2882 hp->save.acc.ahi_rep_get16(&hp->save.acc, host_addr, dev_addr, in bofi_rep_rd16()
2888 *(host_addr + i) = (uint16_t)do_pior_corrupt(hp, (caddr_t)addr, in bofi_rep_rd16()
2902 struct bofi_shadow *hp; in bofi_rep_rd32() local
2906 hp = handle->ahi_common.ah_bus_private; in bofi_rep_rd32()
2908 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_rep_rd32()
2909 hp->save.acc.ahi_rep_get32(&hp->save.acc, host_addr, dev_addr, in bofi_rep_rd32()
2915 *(host_addr + i) = (uint32_t)do_pior_corrupt(hp, (caddr_t)addr, in bofi_rep_rd32()
2929 struct bofi_shadow *hp; in bofi_rep_rd64() local
2933 hp = handle->ahi_common.ah_bus_private; in bofi_rep_rd64()
2935 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_rep_rd64()
2936 hp->save.acc.ahi_rep_get64(&hp->save.acc, host_addr, dev_addr, in bofi_rep_rd64()
2942 *(host_addr + i) = (uint64_t)do_pior_corrupt(hp, (caddr_t)addr, in bofi_rep_rd64()
2950 dev_addr = (type *)((uintptr_t)dev_addr - 64 + hp->addr); \
2951 if (bofi_range_check && ((caddr_t)dev_addr < hp->addr || \
2952 (caddr_t)(dev_addr + repcount) - hp->addr > hp->len)) { \
2955 (void *)dev_addr, (void *)hp->addr, hp->len); \
2956 if ((caddr_t)dev_addr < hp->addr || \
2957 (caddr_t)dev_addr - hp->addr >= hp->len) \
2959 repcount = (type *)(hp->addr + hp->len) - dev_addr; \
2969 struct bofi_shadow *hp; in bofi_rep_wr8() local
2974 hp = handle->ahi_common.ah_bus_private; in bofi_rep_wr8()
2976 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_rep_wr8()
2977 hp->save.acc.ahi_rep_put8(&hp->save.acc, host_addr, dev_addr, in bofi_rep_wr8()
2984 if (do_piow_corrupt(hp, (caddr_t)addr, &llvalue, 1, i ? 0 : in bofi_rep_wr8()
2986 hp->save.acc.ahi_put8(&hp->save.acc, addr, in bofi_rep_wr8()
3000 struct bofi_shadow *hp; in bofi_rep_wr16() local
3005 hp = handle->ahi_common.ah_bus_private; in bofi_rep_wr16()
3007 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_rep_wr16()
3008 hp->save.acc.ahi_rep_put16(&hp->save.acc, host_addr, dev_addr, in bofi_rep_wr16()
3015 if (do_piow_corrupt(hp, (caddr_t)addr, &llvalue, 2, i ? 0 : in bofi_rep_wr16()
3017 hp->save.acc.ahi_put16(&hp->save.acc, addr, in bofi_rep_wr16()
3031 struct bofi_shadow *hp; in bofi_rep_wr32() local
3036 hp = handle->ahi_common.ah_bus_private; in bofi_rep_wr32()
3038 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_rep_wr32()
3039 hp->save.acc.ahi_rep_put32(&hp->save.acc, host_addr, dev_addr, in bofi_rep_wr32()
3046 if (do_piow_corrupt(hp, (caddr_t)addr, &llvalue, 4, i ? 0 : in bofi_rep_wr32()
3048 hp->save.acc.ahi_put32(&hp->save.acc, addr, in bofi_rep_wr32()
3062 struct bofi_shadow *hp; in bofi_rep_wr64() local
3067 hp = handle->ahi_common.ah_bus_private; in bofi_rep_wr64()
3069 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_rep_wr64()
3070 hp->save.acc.ahi_rep_put64(&hp->save.acc, host_addr, dev_addr, in bofi_rep_wr64()
3077 if (do_piow_corrupt(hp, (caddr_t)addr, &llvalue, 8, i ? 0 : in bofi_rep_wr64()
3079 hp->save.acc.ahi_put64(&hp->save.acc, addr, in bofi_rep_wr64()
3094 struct bofi_shadow *hp; in bofi_map() local
3124 hp = kmem_zalloc(sizeof (struct bofi_shadow), KM_SLEEP); in bofi_map()
3125 (void) strncpy(hp->name, ddi_get_name(ap->ahi_common.ah_dip), in bofi_map()
3127 hp->instance = ddi_get_instance(ap->ahi_common.ah_dip); in bofi_map()
3128 hp->dip = ap->ahi_common.ah_dip; in bofi_map()
3129 hp->addr = *vaddrp; in bofi_map()
3135 hp->rnumber = ((ddi_acc_hdl_t *)ap)->ah_rnumber; in bofi_map()
3136 hp->offset = offset; in bofi_map()
3138 hp->len = INT_MAX - offset; in bofi_map()
3140 hp->len = min(len, INT_MAX - offset); in bofi_map()
3141 hp->hdl.acc_handle = (ddi_acc_handle_t)ap; in bofi_map()
3142 hp->link = NULL; in bofi_map()
3143 hp->type = BOFI_ACC_HDL; in bofi_map()
3147 hp->save.acc = *ap; in bofi_map()
3172 ap->ahi_common.ah_bus_private = hp; in bofi_map()
3178 hp->next = shadow_list.next; in bofi_map()
3179 shadow_list.next->prev = hp; in bofi_map()
3180 hp->prev = &shadow_list; in bofi_map()
3181 shadow_list.next = hp; in bofi_map()
3183 hp->hnext = hhashp->hnext; in bofi_map()
3184 hhashp->hnext->hprev = hp; in bofi_map()
3185 hp->hprev = hhashp; in bofi_map()
3186 hhashp->hnext = hp; in bofi_map()
3187 dhashp = HDL_DHASH(hp->dip); in bofi_map()
3188 hp->dnext = dhashp->dnext; in bofi_map()
3189 dhashp->dnext->dprev = hp; in bofi_map()
3190 hp->dprev = dhashp; in bofi_map()
3191 dhashp->dnext = hp; in bofi_map()
3197 if (ddi_name_to_major(hp->name) == in bofi_map()
3199 hp->instance == ep->errdef.instance && in bofi_map()
3202 hp->rnumber == ep->errdef.rnumber) && in bofi_map()
3205 offset + hp->len > ep->errdef.offset) { in bofi_map()
3210 lp->link = hp->link; in bofi_map()
3211 hp->link = lp; in bofi_map()
3230 for (hp = hhashp->hnext; hp != hhashp; hp = hp->hnext) in bofi_map()
3231 if (hp->hdl.acc_handle == (ddi_acc_handle_t)ap) in bofi_map()
3233 if (hp == hhashp) { in bofi_map()
3241 *ap = hp->save.acc; in bofi_map()
3242 *vaddrp = hp->addr; in bofi_map()
3246 hp->hnext->hprev = hp->hprev; in bofi_map()
3247 hp->hprev->hnext = hp->hnext; in bofi_map()
3248 hp->dnext->dprev = hp->dprev; in bofi_map()
3249 hp->dprev->dnext = hp->dnext; in bofi_map()
3250 hp->next->prev = hp->prev; in bofi_map()
3251 hp->prev->next = hp->next; in bofi_map()
3255 for (lp = hp->link; lp != NULL; ) { in bofi_map()
3261 hp->link = NULL; in bofi_map()
3267 kmem_free(hp, sizeof (struct bofi_shadow)); in bofi_map()
3281 chain_on_errdefs(struct bofi_shadow *hp) in chain_on_errdefs() argument
3291 if (ddi_name_to_major(hp->name) == in chain_on_errdefs()
3293 hp->instance == ep->errdef.instance && in chain_on_errdefs()
3295 hp->rnumber == ep->errdef.rnumber) && in chain_on_errdefs()
3297 (((uintptr_t)(hp->addr + ep->errdef.offset + in chain_on_errdefs()
3299 ((uintptr_t)((hp->addr + ep->errdef.offset) + in chain_on_errdefs()
3308 lp->link = hp->link; in chain_on_errdefs()
3309 hp->link = lp; in chain_on_errdefs()
3311 (hp->flags & DDI_DMA_WRITE) && in chain_on_errdefs()
3313 do_dma_corrupt(hp, ep, in chain_on_errdefs()
3315 0, hp->len); in chain_on_errdefs()
3345 struct bofi_shadow *hp, *xhp; in bofi_dma_allochdl() local
3361 hp = kmem_zalloc(sizeof (struct bofi_shadow), in bofi_dma_allochdl()
3363 if (hp == NULL) { in bofi_dma_allochdl()
3371 (void) strncpy(hp->name, ddi_get_name(rdip), NAMESIZE); in bofi_dma_allochdl()
3372 hp->instance = ddi_get_instance(rdip); in bofi_dma_allochdl()
3373 hp->dip = rdip; in bofi_dma_allochdl()
3374 hp->link = NULL; in bofi_dma_allochdl()
3375 hp->type = BOFI_NULL; in bofi_dma_allochdl()
3382 kmem_free(hp, sizeof (struct bofi_shadow)); in bofi_dma_allochdl()
3388 hp->hdl.dma_handle = *handlep; in bofi_dma_allochdl()
3408 dhashp = HDL_DHASH(hp->dip); in bofi_dma_allochdl()
3411 ddi_name_to_major(hp->name) && in bofi_dma_allochdl()
3412 xhp->instance == hp->instance && in bofi_dma_allochdl()
3421 hp->rnumber = maxrnumber; in bofi_dma_allochdl()
3425 hp->next = shadow_list.next; in bofi_dma_allochdl()
3426 shadow_list.next->prev = hp; in bofi_dma_allochdl()
3427 hp->prev = &shadow_list; in bofi_dma_allochdl()
3428 shadow_list.next = hp; in bofi_dma_allochdl()
3430 hp->hnext = hhashp->hnext; in bofi_dma_allochdl()
3431 hhashp->hnext->hprev = hp; in bofi_dma_allochdl()
3432 hp->hprev = hhashp; in bofi_dma_allochdl()
3433 hhashp->hnext = hp; in bofi_dma_allochdl()
3434 dhashp = HDL_DHASH(hp->dip); in bofi_dma_allochdl()
3435 hp->dnext = dhashp->dnext; in bofi_dma_allochdl()
3436 dhashp->dnext->dprev = hp; in bofi_dma_allochdl()
3437 hp->dprev = dhashp; in bofi_dma_allochdl()
3438 dhashp->dnext = hp; in bofi_dma_allochdl()
3452 struct bofi_shadow *hp; in bofi_dma_freehdl() local
3461 for (hp = hhashp->hnext; hp != hhashp; hp = hp->hnext) in bofi_dma_freehdl()
3462 if (hp->hdl.dma_handle == handle) in bofi_dma_freehdl()
3476 if (hp == hhashp) in bofi_dma_freehdl()
3483 if (hp->type != BOFI_NULL) in bofi_dma_freehdl()
3488 hp->hnext->hprev = hp->hprev; in bofi_dma_freehdl()
3489 hp->hprev->hnext = hp->hnext; in bofi_dma_freehdl()
3490 hp->dnext->dprev = hp->dprev; in bofi_dma_freehdl()
3491 hp->dprev->dnext = hp->dnext; in bofi_dma_freehdl()
3492 hp->next->prev = hp->prev; in bofi_dma_freehdl()
3493 hp->prev->next = hp->next; in bofi_dma_freehdl()
3497 kmem_free(hp, sizeof (struct bofi_shadow)); in bofi_dma_freehdl()
3512 struct bofi_shadow *hp; in bofi_dma_bindhdl() local
3523 for (hp = hhashp->hnext; hp != hhashp; hp = hp->hnext) in bofi_dma_bindhdl()
3524 if (hp->hdl.dma_handle == handle) in bofi_dma_bindhdl()
3528 if (hp == hhashp) { in bofi_dma_bindhdl()
3538 if (hp->type != BOFI_NULL) in bofi_dma_bindhdl()
3541 hp->flags = dmareqp->dmar_flags; in bofi_dma_bindhdl()
3543 hp->map_flags = B_PAGEIO; in bofi_dma_bindhdl()
3544 hp->map_pp = dmareqp->dmar_object.dmao_obj.pp_obj.pp_pp; in bofi_dma_bindhdl()
3546 hp->map_flags = B_SHADOW; in bofi_dma_bindhdl()
3547 hp->map_pplist = dmareqp->dmar_object.dmao_obj.virt_obj.v_priv; in bofi_dma_bindhdl()
3549 hp->map_flags = 0; in bofi_dma_bindhdl()
3554 hp->addr = ddi_dmareq_mapin(dmareqp, &hp->mapaddr, &hp->len); in bofi_dma_bindhdl()
3555 if (hp->addr == NULL) in bofi_dma_bindhdl()
3565 hp->origaddr = hp->addr; in bofi_dma_bindhdl()
3566 hp->allocaddr = ddi_umem_alloc( in bofi_dma_bindhdl()
3567 ((uintptr_t)hp->addr & pagemask) + hp->len, in bofi_dma_bindhdl()
3569 &hp->umem_cookie); in bofi_dma_bindhdl()
3570 if (hp->allocaddr == NULL) in bofi_dma_bindhdl()
3572 hp->addr = hp->allocaddr + ((uintptr_t)hp->addr & pagemask); in bofi_dma_bindhdl()
3574 xbcopy(hp->origaddr, hp->addr, hp->len); in bofi_dma_bindhdl()
3576 dmareq.dmar_object.dmao_size = hp->len; in bofi_dma_bindhdl()
3579 dmareq.dmar_object.dmao_obj.virt_obj.v_addr = hp->addr; in bofi_dma_bindhdl()
3602 hp->type = BOFI_DMA_HDL; in bofi_dma_bindhdl()
3603 chain_on_errdefs(hp); in bofi_dma_bindhdl()
3617 if (hp) { in bofi_dma_bindhdl()
3618 ddi_dmareq_mapout(hp->mapaddr, hp->len, hp->map_flags, in bofi_dma_bindhdl()
3619 hp->map_pp, hp->map_pplist); in bofi_dma_bindhdl()
3620 if (bofi_sync_check && hp->allocaddr) in bofi_dma_bindhdl()
3621 ddi_umem_free(hp->umem_cookie); in bofi_dma_bindhdl()
3622 hp->mapaddr = NULL; in bofi_dma_bindhdl()
3623 hp->allocaddr = NULL; in bofi_dma_bindhdl()
3624 hp->origaddr = NULL; in bofi_dma_bindhdl()
3639 struct bofi_shadow *hp; in bofi_dma_unbindhdl() local
3654 for (hp = hhashp->hnext; hp != hhashp; hp = hp->hnext) in bofi_dma_unbindhdl()
3655 if (hp->hdl.dma_handle == handle) in bofi_dma_unbindhdl()
3657 if (hp == hhashp) { in bofi_dma_unbindhdl()
3665 if (hp->type == BOFI_NULL) in bofi_dma_unbindhdl()
3671 for (lp = hp->link; lp != NULL; ) { in bofi_dma_unbindhdl()
3679 (hp->flags & DDI_DMA_READ) && in bofi_dma_unbindhdl()
3681 do_dma_corrupt(hp, ep, DDI_DMA_SYNC_FORCPU, 0, hp->len); in bofi_dma_unbindhdl()
3687 hp->link = NULL; in bofi_dma_unbindhdl()
3688 hp->type = BOFI_NULL; in bofi_dma_unbindhdl()
3692 if (bofi_sync_check && (hp->flags & DDI_DMA_READ)) in bofi_dma_unbindhdl()
3696 if (hp->allocaddr) in bofi_dma_unbindhdl()
3697 xbcopy(hp->addr, hp->origaddr, hp->len); in bofi_dma_unbindhdl()
3698 ddi_dmareq_mapout(hp->mapaddr, hp->len, hp->map_flags, in bofi_dma_unbindhdl()
3699 hp->map_pp, hp->map_pplist); in bofi_dma_unbindhdl()
3700 if (bofi_sync_check && hp->allocaddr) in bofi_dma_unbindhdl()
3701 ddi_umem_free(hp->umem_cookie); in bofi_dma_unbindhdl()
3702 hp->mapaddr = NULL; in bofi_dma_unbindhdl()
3703 hp->allocaddr = NULL; in bofi_dma_unbindhdl()
3704 hp->origaddr = NULL; in bofi_dma_unbindhdl()
3718 struct bofi_shadow *hp; in bofi_dma_flush() local
3737 for (hp = hhashp->hnext; hp != hhashp; hp = hp->hnext) in bofi_dma_flush()
3738 if (hp->hdl.dma_handle == handle && in bofi_dma_flush()
3739 hp->type == BOFI_DMA_HDL) in bofi_dma_flush()
3743 if (hp != hhashp) { in bofi_dma_flush()
3748 if (hp->allocaddr) in bofi_dma_flush()
3749 xbcopy(hp->origaddr+off, hp->addr+off, in bofi_dma_flush()
3750 len ? len : (hp->len - off)); in bofi_dma_flush()
3756 for (lp = hp->link; lp != NULL; lp = lp->link) { in bofi_dma_flush()
3764 do_dma_corrupt(hp, ep, flags, off, in bofi_dma_flush()
3765 len ? len : (hp->len - off)); in bofi_dma_flush()
3775 if (hp->allocaddr) in bofi_dma_flush()
3776 xbcopy(hp->addr+off, hp->origaddr+off, in bofi_dma_flush()
3777 len ? len : (hp->len - off)); in bofi_dma_flush()
3797 struct bofi_shadow *hp; in bofi_dma_win() local
3815 for (hp = hhashp->hnext; hp != hhashp; hp = hp->hnext) in bofi_dma_win()
3816 if (hp->hdl.dma_handle == handle) in bofi_dma_win()
3818 if (hp != hhashp) { in bofi_dma_win()
3839 struct bofi_shadow *hp; in bofi_dma_ctl() local
3874 for (hp = hhashp->hnext; hp != hhashp; hp = hp->hnext) in bofi_dma_ctl()
3875 if (hp->hdl.dma_handle == handle) in bofi_dma_ctl()
3877 if (hp == hhashp) { in bofi_dma_ctl()
3890 dummyhp = hp; in bofi_dma_ctl()
3896 hp = dummyhp->hparrayp[i]; in bofi_dma_ctl()
3900 if (hp->type != BOFI_NULL) in bofi_dma_ctl()
3907 hp->dnext->dprev = hp->dprev; in bofi_dma_ctl()
3908 hp->dprev->dnext = hp->dnext; in bofi_dma_ctl()
3909 hp->next->prev = hp->prev; in bofi_dma_ctl()
3910 hp->prev->next = hp->next; in bofi_dma_ctl()
3914 if (bofi_sync_check && hp->allocaddr) in bofi_dma_ctl()
3915 ddi_umem_free(hp->umem_cookie); in bofi_dma_ctl()
3916 kmem_free(hp, sizeof (struct bofi_shadow)); in bofi_dma_ctl()
3937 struct bofi_shadow *hp; in bofi_dvma_reserve() local
3981 hp = kmem_zalloc(sizeof (*hp), KM_SLEEP); in bofi_dvma_reserve()
3982 (void) strncpy(hp->name, ddi_get_name(rdip), NAMESIZE); in bofi_dvma_reserve()
3983 hp->instance = ddi_get_instance(rdip); in bofi_dvma_reserve()
3984 hp->rnumber = -1; in bofi_dvma_reserve()
3985 hp->dip = rdip; in bofi_dvma_reserve()
3986 hp->hdl.dma_handle = 0; in bofi_dvma_reserve()
3987 hp->link = NULL; in bofi_dvma_reserve()
3988 hp->type = BOFI_NULL; in bofi_dvma_reserve()
3999 hp->allocaddr = ddi_umem_alloc( in bofi_dvma_reserve()
4000 ((int)(uintptr_t)hp->addr & pagemask) in bofi_dvma_reserve()
4002 KM_SLEEP, &hp->umem_cookie); in bofi_dvma_reserve()
4003 hp->addr = hp->allocaddr + in bofi_dvma_reserve()
4004 ((int)(uintptr_t)hp->addr & pagemask); in bofi_dvma_reserve()
4012 hp->next = shadow_list.next; in bofi_dvma_reserve()
4013 shadow_list.next->prev = hp; in bofi_dvma_reserve()
4014 hp->prev = &shadow_list; in bofi_dvma_reserve()
4015 shadow_list.next = hp; in bofi_dvma_reserve()
4016 dhashp = HDL_DHASH(hp->dip); in bofi_dvma_reserve()
4017 hp->dnext = dhashp->dnext; in bofi_dvma_reserve()
4018 dhashp->dnext->dprev = hp; in bofi_dvma_reserve()
4019 hp->dprev = dhashp; in bofi_dvma_reserve()
4020 dhashp->dnext = hp; in bofi_dvma_reserve()
4021 dummyhp->hparrayp[i] = hp; in bofi_dvma_reserve()
4047 struct bofi_shadow *hp; in bofi_dvma_kaddr_load() local
4074 hp = dummyhp->hparrayp[index]; in bofi_dvma_kaddr_load()
4078 if (hp->type != BOFI_NULL) in bofi_dvma_kaddr_load()
4086 if (bofi_sync_check && hp->allocaddr) { in bofi_dvma_kaddr_load()
4087 hp->origaddr = a; in bofi_dvma_kaddr_load()
4088 a = hp->addr; in bofi_dvma_kaddr_load()
4090 hp->addr = a; in bofi_dvma_kaddr_load()
4091 hp->len = len; in bofi_dvma_kaddr_load()
4102 hp->type = BOFI_DMA_HDL; in bofi_dvma_kaddr_load()
4104 if (ddi_name_to_major(hp->name) == in bofi_dvma_kaddr_load()
4106 hp->instance == ep->errdef.instance && in bofi_dvma_kaddr_load()
4108 hp->rnumber == ep->errdef.rnumber) && in bofi_dvma_kaddr_load()
4110 (((uintptr_t)(hp->addr + ep->errdef.offset + in bofi_dvma_kaddr_load()
4112 ((uintptr_t)((hp->addr + ep->errdef.offset) + in bofi_dvma_kaddr_load()
4118 lp->link = hp->link; in bofi_dvma_kaddr_load()
4119 hp->link = lp; in bofi_dvma_kaddr_load()
4136 struct bofi_shadow *hp; in bofi_dvma_unload() local
4161 hp = dummyhp->hparrayp[index]; in bofi_dvma_unload()
4165 if (hp->type == BOFI_NULL) in bofi_dvma_unload()
4173 for (lp = hp->link; lp != NULL; ) { in bofi_dvma_unload()
4180 do_dma_corrupt(hp, ep, view, 0, hp->len); in bofi_dvma_unload()
4186 hp->link = NULL; in bofi_dvma_unload()
4187 hp->type = BOFI_NULL; in bofi_dvma_unload()
4195 if (hp->allocaddr) in bofi_dvma_unload()
4196 xbcopy(hp->addr, hp->origaddr, hp->len); in bofi_dvma_unload()
4207 struct bofi_shadow *hp; in bofi_dvma_sync() local
4232 hp = dummyhp->hparrayp[index]; in bofi_dvma_sync()
4236 if (hp->type == BOFI_NULL) in bofi_dvma_sync()
4247 if (hp->allocaddr) in bofi_dvma_sync()
4248 xbcopy(hp->origaddr, hp->addr, hp->len); in bofi_dvma_sync()
4255 for (lp = hp->link; lp != NULL; lp = lp->link) { in bofi_dvma_sync()
4263 do_dma_corrupt(hp, ep, view, 0, hp->len); in bofi_dvma_sync()
4273 if (hp->allocaddr) in bofi_dvma_sync()
4274 xbcopy(hp->addr, hp->origaddr, hp->len); in bofi_dvma_sync()
4292 struct bofi_shadow *hp; in bofi_intercept_intr() local
4300 hp = (struct bofi_shadow *)xp; in bofi_intercept_intr()
4304 if (hp->link == NULL) in bofi_intercept_intr()
4305 return (hp->save.intr.int_handler in bofi_intercept_intr()
4306 (hp->save.intr.int_handler_arg1, arg2)); in bofi_intercept_intr()
4311 for (lp = hp->link; lp != NULL; lp = lp->link) { in bofi_intercept_intr()
4333 if (!hp->hilevel) { in bofi_intercept_intr()
4355 result = hp->save.intr.int_handler in bofi_intercept_intr()
4356 (hp->save.intr.int_handler_arg1, arg2); in bofi_intercept_intr()
4370 hp->name, hp->instance); in bofi_intercept_intr()
4385 struct bofi_shadow *hp; in bofi_check_acc_hdl() local
4389 hp = handle->ahi_common.ah_bus_private; in bofi_check_acc_hdl()
4390 if (!hp->link || !mutex_tryenter(&bofi_mutex)) { in bofi_check_acc_hdl()
4393 for (lp = hp->link; lp != NULL; lp = lp->link) { in bofi_check_acc_hdl()
4414 struct bofi_shadow *hp; in bofi_check_dma_hdl() local
4423 for (hp = hhashp->hnext; hp != hhashp; hp = hp->hnext) in bofi_check_dma_hdl()
4424 if (hp->hdl.dma_handle == (ddi_dma_handle_t)handle) in bofi_check_dma_hdl()
4426 if (hp == hhashp) { in bofi_check_dma_hdl()
4430 if (!hp->link) { in bofi_check_dma_hdl()
4434 for (lp = hp->link; lp != NULL; lp = lp->link) { in bofi_check_dma_hdl()
4457 struct bofi_shadow *hp; in bofi_post_event() local
4476 for (hp = dhashp->dnext; hp != dhashp; hp = hp->dnext) { in bofi_post_event()
4477 if (hp->dip == arg->f_dip) { in bofi_post_event()
4478 for (lp = hp->link; lp != NULL; lp = lp->link) { in bofi_post_event()
4508 struct bofi_shadow *hp; in bofi_fm_ereport_callback() local
4529 for (hp = shadow_list.next; hp != &shadow_list; hp = hp->next) { in bofi_fm_ereport_callback()
4530 (void) ddi_pathname(hp->dip, hppath); in bofi_fm_ereport_callback()
4533 for (lp = hp->link; lp != NULL; lp = lp->link) { in bofi_fm_ereport_callback()
4578 struct bofi_shadow *hp; in bofi_intr_ops() local
4595 hp = kmem_zalloc(sizeof (struct bofi_shadow), KM_SLEEP); in bofi_intr_ops()
4596 (void) strncpy(hp->name, ddi_get_name(rdip), NAMESIZE); in bofi_intr_ops()
4597 hp->instance = ddi_get_instance(rdip); in bofi_intr_ops()
4598 hp->save.intr.int_handler = hdlp->ih_cb_func; in bofi_intr_ops()
4599 hp->save.intr.int_handler_arg1 = hdlp->ih_cb_arg1; in bofi_intr_ops()
4601 hdlp->ih_cb_arg1 = (caddr_t)hp; in bofi_intr_ops()
4602 hp->bofi_inum = hdlp->ih_inum; in bofi_intr_ops()
4603 hp->dip = rdip; in bofi_intr_ops()
4604 hp->link = NULL; in bofi_intr_ops()
4605 hp->type = BOFI_INT_HDL; in bofi_intr_ops()
4611 hp->hilevel = 1; in bofi_intr_ops()
4613 hp->hilevel = 0; in bofi_intr_ops()
4622 kmem_free(hp, sizeof (struct bofi_shadow)); in bofi_intr_ops()
4630 hp->next = shadow_list.next; in bofi_intr_ops()
4631 shadow_list.next->prev = hp; in bofi_intr_ops()
4632 hp->prev = &shadow_list; in bofi_intr_ops()
4633 shadow_list.next = hp; in bofi_intr_ops()
4635 hp->hnext = hhashp->hnext; in bofi_intr_ops()
4636 hhashp->hnext->hprev = hp; in bofi_intr_ops()
4637 hp->hprev = hhashp; in bofi_intr_ops()
4638 hhashp->hnext = hp; in bofi_intr_ops()
4639 dhashp = HDL_DHASH(hp->dip); in bofi_intr_ops()
4640 hp->dnext = dhashp->dnext; in bofi_intr_ops()
4641 dhashp->dnext->dprev = hp; in bofi_intr_ops()
4642 hp->dprev = dhashp; in bofi_intr_ops()
4643 dhashp->dnext = hp; in bofi_intr_ops()
4649 if (ddi_name_to_major(hp->name) == in bofi_intr_ops()
4651 hp->instance == ep->errdef.instance && in bofi_intr_ops()
4657 lp->link = hp->link; in bofi_intr_ops()
4658 hp->link = lp; in bofi_intr_ops()
4677 for (hp = hhashp->hnext; hp != hhashp; hp = hp->hnext) { in bofi_intr_ops()
4678 if (hp->dip == rdip && in bofi_intr_ops()
4679 hp->type == BOFI_INT_HDL && in bofi_intr_ops()
4680 hp->bofi_inum == hdlp->ih_inum) { in bofi_intr_ops()
4684 if (hp == hhashp) { in bofi_intr_ops()
4692 hp->hnext->hprev = hp->hprev; in bofi_intr_ops()
4693 hp->hprev->hnext = hp->hnext; in bofi_intr_ops()
4694 hp->dnext->dprev = hp->dprev; in bofi_intr_ops()
4695 hp->dprev->dnext = hp->dnext; in bofi_intr_ops()
4696 hp->next->prev = hp->prev; in bofi_intr_ops()
4697 hp->prev->next = hp->next; in bofi_intr_ops()
4702 for (lp = hp->link; lp != NULL; ) { in bofi_intr_ops()
4708 hp->link = NULL; in bofi_intr_ops()
4711 kmem_free(hp, sizeof (struct bofi_shadow)); in bofi_intr_ops()