diff options
author | govinda <none@none> | 2005-10-13 17:45:09 -0700 |
---|---|---|
committer | govinda <none@none> | 2005-10-13 17:45:09 -0700 |
commit | a195726fa33097e56cf1c25c31feddb827e140f0 (patch) | |
tree | 0d8a7063eb794f6d3697cb8cae5649c1363118a0 /usr/src/uts | |
parent | 68ae3684389dbd334e0466478c9785b743f0b99b (diff) | |
download | illumos-joyent-a195726fa33097e56cf1c25c31feddb827e140f0.tar.gz |
PSARC/2005/561 Obsolete DDI Interrupt Interfaces
6330182 Implement PSARC/2005/561 changes
6255855 ddi_intr_get_nintrs() returns DDI_SUCCESS for type = -1
6255872 ddi_intr_get_cap() returns 0 for capability structure
6256554 process_intr_ops() should check for pdip value
6280180 memory leaks in ddi_add_intr /ddi_intr_alloc
6320326 interrupt state should not be touched during interrupt re-routing
6320368 default px driver configuration should be MSIX
6320374 px driver should call ndi_ra_alloc() with proper arguments
6323264 px_err_reg_disable() access fire regsiters with incorrect csrbase
6328321 update sparc.fdbg for new DDI interrupt data structures
--HG--
rename : usr/src/uts/common/sys/nexusintr.h => deleted_files/usr/src/uts/common/sys/nexusintr.h
rename : usr/src/uts/sun4/sys/nexusintr_impl.h => deleted_files/usr/src/uts/sun4/sys/nexusintr_impl.h
Diffstat (limited to 'usr/src/uts')
63 files changed, 860 insertions, 1303 deletions
diff --git a/usr/src/uts/common/io/1394/nx1394.c b/usr/src/uts/common/io/1394/nx1394.c index ddc89240e3..cc710b8417 100644 --- a/usr/src/uts/common/io/1394/nx1394.c +++ b/usr/src/uts/common/io/1394/nx1394.c @@ -267,12 +267,9 @@ nx1394_bus_ctl(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t op, void *arg, case DDI_CTLOPS_REPORTINT: case DDI_CTLOPS_REGSIZE: case DDI_CTLOPS_NREGS: - case DDI_CTLOPS_NINTRS: case DDI_CTLOPS_SIDDEV: case DDI_CTLOPS_SLAVEONLY: case DDI_CTLOPS_AFFINITY: - case DDI_CTLOPS_INTR_HILEVEL: - case DDI_CTLOPS_XLATE_INTRS: case DDI_CTLOPS_POKE: case DDI_CTLOPS_PEEK: { cmn_err(CE_CONT, "!%s(%d): invalid op (%d) from %s(%d)", diff --git a/usr/src/uts/common/io/bge/bge_main.c b/usr/src/uts/common/io/bge/bge_main.c index e1dcafecf9..4a7202904a 100644 --- a/usr/src/uts/common/io/bge/bge_main.c +++ b/usr/src/uts/common/io/bge/bge_main.c @@ -940,7 +940,7 @@ bge_init_buff_ring(bge_t *bgep, uint64_t ring) brp->cons_index_p = &bsp->buff_cons_index[buff_cons_xref[ring]]; brp->chip_mbx_reg = mailbox_regs[ring]; mutex_init(brp->rf_lock, NULL, MUTEX_DRIVER, - (void *)(uintptr_t)bgep->intr_pri); + DDI_INTR_PRI(bgep->intr_pri)); /* * Allocate the array of s/w Receive Buffer Descriptors @@ -1019,7 +1019,7 @@ bge_init_recv_ring(bge_t *bgep, uint64_t ring) rrp->prod_index_p = RECV_INDEX_P(bsp, ring); rrp->chip_mbx_reg = RECV_RING_CONS_INDEX_REG(ring); mutex_init(rrp->rx_lock, NULL, MUTEX_DRIVER, - (void *)(uintptr_t)bgep->intr_pri); + DDI_INTR_PRI(bgep->intr_pri)); } @@ -1086,7 +1086,7 @@ bge_init_send_ring(bge_t *bgep, uint64_t ring) rw_init(srp->tx_lock, NULL, RW_DRIVER, (void *)(uintptr_t)bgep->intr_pri); mutex_init(srp->tc_lock, NULL, MUTEX_DRIVER, - (void *)(uintptr_t)bgep->intr_pri); + DDI_INTR_PRI(bgep->intr_pri)); /* * Allocate the array of s/w Send Buffer Descriptors @@ -1145,9 +1145,9 @@ bge_init_rings(bge_t *bgep) BGE_TRACE(("bge_init_rings($%p)", (void *)bgep)); mutex_init(bgep->genlock, NULL, MUTEX_DRIVER, - (void *)(uintptr_t)bgep->intr_pri); + DDI_INTR_PRI(bgep->intr_pri)); rw_init(bgep->errlock, NULL, RW_DRIVER, - (void *)(uintptr_t)bgep->intr_pri); + DDI_INTR_PRI(bgep->intr_pri)); /* * Perform one-off initialisation of each ring ... diff --git a/usr/src/uts/common/io/i2o/pci_to_i2o.c b/usr/src/uts/common/io/i2o/pci_to_i2o.c index 7c05a4f6c6..7da3a13a48 100644 --- a/usr/src/uts/common/io/i2o/pci_to_i2o.c +++ b/usr/src/uts/common/io/i2o/pci_to_i2o.c @@ -330,14 +330,11 @@ i2o_bus_ctl(dev_info_t *dip, dev_info_t *rdip, * These functions shouldn't be called by the OSMs. Return error. */ case DDI_CTLOPS_DMAPMAPC: - case DDI_CTLOPS_INTR_HILEVEL: - case DDI_CTLOPS_XLATE_INTRS: case DDI_CTLOPS_SIDDEV: case DDI_CTLOPS_SLAVEONLY: case DDI_CTLOPS_AFFINITY: case DDI_CTLOPS_REGSIZE: case DDI_CTLOPS_NREGS: - case DDI_CTLOPS_NINTRS: case DDI_CTLOPS_POKE: case DDI_CTLOPS_PEEK: return (DDI_FAILURE); diff --git a/usr/src/uts/common/io/i8042.c b/usr/src/uts/common/io/i8042.c index f8a3494f76..e5884400ab 100644 --- a/usr/src/uts/common/io/i8042.c +++ b/usr/src/uts/common/io/i8042.c @@ -865,17 +865,9 @@ i8042_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, *(int *)result = DDI_INTR_TYPE_FIXED; break; case DDI_INTROP_GETCAP: -#if defined(__sparc) - /* - * For sparc, there is concern to pass to its parent, - * so just hard code it to 0 - */ - *(int *)result = 0; -#else if (i_ddi_intr_ops(dip, rdip, intr_op, hdlp, result) == DDI_FAILURE) *(int *)result = 0; -#endif /* defined(__sparc) */ break; case DDI_INTROP_NINTRS: *(int *)result = 1; diff --git a/usr/src/uts/common/io/ib/ibnex/ibnex.c b/usr/src/uts/common/io/ib/ibnex/ibnex.c index 85e190248c..a62c669f83 100644 --- a/usr/src/uts/common/io/ib/ibnex/ibnex.c +++ b/usr/src/uts/common/io/ib/ibnex/ibnex.c @@ -905,11 +905,8 @@ ibnex_busctl(dev_info_t *dip, dev_info_t *rdip, case DDI_CTLOPS_REPORTINT: case DDI_CTLOPS_REGSIZE: case DDI_CTLOPS_NREGS: - case DDI_CTLOPS_NINTRS: case DDI_CTLOPS_SLAVEONLY: case DDI_CTLOPS_AFFINITY: - case DDI_CTLOPS_INTR_HILEVEL: - case DDI_CTLOPS_XLATE_INTRS: case DDI_CTLOPS_POKE: case DDI_CTLOPS_PEEK: IBTF_DPRINTF_L2("ibnex", diff --git a/usr/src/uts/common/io/pci_intr_lib.c b/usr/src/uts/common/io/pci_intr_lib.c index eaf8b6d761..b204daad70 100644 --- a/usr/src/uts/common/io/pci_intr_lib.c +++ b/usr/src/uts/common/io/pci_intr_lib.c @@ -947,11 +947,13 @@ pci_intx_get_cap(dev_info_t *dip, int *flagsp) DDI_INTR_NEXDBG((CE_CONT, "pci_intx_get_cap: " "command register is now 0x%x\n", cmdreg)); + *flagsp = DDI_INTR_FLAG_LEVEL; + if (cmdreg & PCI_COMM_INTX_DISABLE) { DDI_INTR_NEXDBG((CE_CONT, "pci_intx_get_cap: " "masking supported\n")); - *flagsp = (DDI_INTR_FLAG_MASKABLE | - DDI_INTR_FLAG_PENDING | DDI_INTR_FLAG_LEVEL); + *flagsp |= (DDI_INTR_FLAG_MASKABLE | + DDI_INTR_FLAG_PENDING); } /* Restore the device back to the original state and return */ diff --git a/usr/src/uts/common/io/pci_pci/pci_pci.c b/usr/src/uts/common/io/pci_pci/pci_pci.c index 092bfb9599..76512618ee 100644 --- a/usr/src/uts/common/io/pci_pci/pci_pci.c +++ b/usr/src/uts/common/io/pci_pci/pci_pci.c @@ -378,16 +378,6 @@ ppb_ctlops(dev_info_t *dip, dev_info_t *rdip, ppb_removechild((dev_info_t *)arg); return (DDI_SUCCESS); - case DDI_CTLOPS_NINTRS: - if (ddi_get_parent_data(rdip)) - *(int *)result = 1; - else - *(int *)result = 0; - return (DDI_SUCCESS); - - case DDI_CTLOPS_XLATE_INTRS: - return (DDI_SUCCESS); - case DDI_CTLOPS_SIDDEV: return (DDI_SUCCESS); diff --git a/usr/src/uts/common/io/pseudonex.c b/usr/src/uts/common/io/pseudonex.c index 29aee96fa4..52ffd77c39 100644 --- a/usr/src/uts/common/io/pseudonex.c +++ b/usr/src/uts/common/io/pseudonex.c @@ -503,12 +503,9 @@ pseudonex_ctl(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t ctlop, case DDI_CTLOPS_REPORTINT: case DDI_CTLOPS_REGSIZE: case DDI_CTLOPS_NREGS: - case DDI_CTLOPS_NINTRS: case DDI_CTLOPS_SIDDEV: case DDI_CTLOPS_SLAVEONLY: case DDI_CTLOPS_AFFINITY: - case DDI_CTLOPS_INTR_HILEVEL: - case DDI_CTLOPS_XLATE_INTRS: case DDI_CTLOPS_POKE: case DDI_CTLOPS_PEEK: /* diff --git a/usr/src/uts/common/io/pshot.c b/usr/src/uts/common/io/pshot.c index bdd7e47638..81047bf9fb 100644 --- a/usr/src/uts/common/io/pshot.c +++ b/usr/src/uts/common/io/pshot.c @@ -1102,12 +1102,9 @@ pshot_ctl(dev_info_t *dip, dev_info_t *rdip, case DDI_CTLOPS_REPORTINT: case DDI_CTLOPS_REGSIZE: case DDI_CTLOPS_NREGS: - case DDI_CTLOPS_NINTRS: case DDI_CTLOPS_SIDDEV: case DDI_CTLOPS_SLAVEONLY: case DDI_CTLOPS_AFFINITY: - case DDI_CTLOPS_INTR_HILEVEL: - case DDI_CTLOPS_XLATE_INTRS: case DDI_CTLOPS_POKE: case DDI_CTLOPS_PEEK: /* diff --git a/usr/src/uts/common/io/scsi/impl/scsi_hba.c b/usr/src/uts/common/io/scsi/impl/scsi_hba.c index bf6de3cd65..8974f1e144 100644 --- a/usr/src/uts/common/io/scsi/impl/scsi_hba.c +++ b/usr/src/uts/common/io/scsi/impl/scsi_hba.c @@ -819,11 +819,8 @@ failure: case DDI_CTLOPS_REPORTINT: case DDI_CTLOPS_REGSIZE: case DDI_CTLOPS_NREGS: - case DDI_CTLOPS_NINTRS: case DDI_CTLOPS_SLAVEONLY: case DDI_CTLOPS_AFFINITY: - case DDI_CTLOPS_INTR_HILEVEL: - case DDI_CTLOPS_XLATE_INTRS: case DDI_CTLOPS_POKE: case DDI_CTLOPS_PEEK: cmn_err(CE_CONT, "%s%d: invalid op (%d) from %s%d\n", diff --git a/usr/src/uts/common/io/tphci.c b/usr/src/uts/common/io/tphci.c index a1159c3349..5c577ebdeb 100644 --- a/usr/src/uts/common/io/tphci.c +++ b/usr/src/uts/common/io/tphci.c @@ -411,12 +411,9 @@ tphci_ctl(dev_info_t *dip, dev_info_t *rdip, case DDI_CTLOPS_REPORTINT: case DDI_CTLOPS_REGSIZE: case DDI_CTLOPS_NREGS: - case DDI_CTLOPS_NINTRS: case DDI_CTLOPS_SIDDEV: case DDI_CTLOPS_SLAVEONLY: case DDI_CTLOPS_AFFINITY: - case DDI_CTLOPS_INTR_HILEVEL: - case DDI_CTLOPS_XLATE_INTRS: case DDI_CTLOPS_POKE: case DDI_CTLOPS_PEEK: /* diff --git a/usr/src/uts/common/io/tvhci.c b/usr/src/uts/common/io/tvhci.c index 382e4df2ac..e5fa627530 100644 --- a/usr/src/uts/common/io/tvhci.c +++ b/usr/src/uts/common/io/tvhci.c @@ -468,12 +468,9 @@ tvhci_ctl(dev_info_t *dip, dev_info_t *rdip, case DDI_CTLOPS_REPORTINT: case DDI_CTLOPS_REGSIZE: case DDI_CTLOPS_NREGS: - case DDI_CTLOPS_NINTRS: case DDI_CTLOPS_SIDDEV: case DDI_CTLOPS_SLAVEONLY: case DDI_CTLOPS_AFFINITY: - case DDI_CTLOPS_INTR_HILEVEL: - case DDI_CTLOPS_XLATE_INTRS: case DDI_CTLOPS_POKE: case DDI_CTLOPS_PEEK: /* diff --git a/usr/src/uts/common/io/usb/hcd/ehci/ehci_polled.c b/usr/src/uts/common/io/usb/hcd/ehci/ehci_polled.c index aeca13e929..47202d472e 100644 --- a/usr/src/uts/common/io/usb/hcd/ehci/ehci_polled.c +++ b/usr/src/uts/common/io/usb/hcd/ehci/ehci_polled.c @@ -416,7 +416,7 @@ ehci_polled_init( * uint64_t typecast to make sure amd64 can compile */ mutex_init(&ehci_polledp->ehci_polled_input_pipe_handle->p_mutex, - NULL, MUTEX_DRIVER, (void *)(uintptr_t)ehcip->ehci_intr_pri); + NULL, MUTEX_DRIVER, DDI_INTR_PRI(ehcip->ehci_intr_pri)); /* * Create a new ehci pipe private structure diff --git a/usr/src/uts/common/io/usb/hcd/ehci/ehci_util.c b/usr/src/uts/common/io/usb/hcd/ehci/ehci_util.c index faba74e896..97621391af 100644 --- a/usr/src/uts/common/io/usb/hcd/ehci/ehci_util.c +++ b/usr/src/uts/common/io/usb/hcd/ehci/ehci_util.c @@ -715,7 +715,7 @@ ehci_register_intrs_and_init_mutex(ehci_state_t *ehcip) /* Initialize the mutex */ mutex_init(&ehcip->ehci_int_mutex, NULL, MUTEX_DRIVER, - (void *)(uintptr_t)ehcip->ehci_intr_pri); + DDI_INTR_PRI(ehcip->ehci_intr_pri)); if (ddi_intr_add_handler(ehcip->ehci_htable[0], (ddi_intr_handler_t *)ehci_intr, (caddr_t)ehcip, NULL) != diff --git a/usr/src/uts/common/io/usb/hcd/openhci/ohci.c b/usr/src/uts/common/io/usb/hcd/openhci/ohci.c index 1579aaa48b..3bb67a0951 100644 --- a/usr/src/uts/common/io/usb/hcd/openhci/ohci.c +++ b/usr/src/uts/common/io/usb/hcd/openhci/ohci.c @@ -1257,7 +1257,7 @@ ohci_register_intrs_and_init_mutex(ohci_state_t *ohcip) /* Initialize the mutex */ mutex_init(&ohcip->ohci_int_mutex, NULL, MUTEX_DRIVER, - (void *)(uintptr_t)ohcip->ohci_intr_pri); + DDI_INTR_PRI(ohcip->ohci_intr_pri)); if (ddi_intr_add_handler(ohcip->ohci_htable[0], (ddi_intr_handler_t *)ohci_intr, (caddr_t)ohcip, NULL)) { diff --git a/usr/src/uts/common/io/usb/hcd/openhci/ohci_polled.c b/usr/src/uts/common/io/usb/hcd/openhci/ohci_polled.c index 576bbb66f4..b427962fdf 100644 --- a/usr/src/uts/common/io/usb/hcd/openhci/ohci_polled.c +++ b/usr/src/uts/common/io/usb/hcd/openhci/ohci_polled.c @@ -404,7 +404,7 @@ ohci_polled_init( * uint64_t typecast to make sure amd64 can compile */ mutex_init(&ohci_polledp->ohci_polled_input_pipe_handle->p_mutex, - NULL, MUTEX_DRIVER, (void *)(uintptr_t)ohcip->ohci_intr_pri); + NULL, MUTEX_DRIVER, DDI_INTR_PRI(ohcip->ohci_intr_pri)); /* Create a new ohci pipe private structure */ pp = (ohci_pipe_private_t *) diff --git a/usr/src/uts/common/io/usb/hcd/uhci/uhci.c b/usr/src/uts/common/io/usb/hcd/uhci/uhci.c index 6791ff8b1d..0190ed2fe2 100644 --- a/usr/src/uts/common/io/usb/hcd/uhci/uhci.c +++ b/usr/src/uts/common/io/usb/hcd/uhci/uhci.c @@ -316,7 +316,7 @@ uhci_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) /* Initialize the mutex */ mutex_init(&uhcip->uhci_int_mutex, NULL, MUTEX_DRIVER, - (void *)(uintptr_t)intr_pri); + DDI_INTR_PRI(intr_pri)); /* Create prototype condition variable */ cv_init(&uhcip->uhci_cv_SOF, NULL, CV_DRIVER, NULL); diff --git a/usr/src/uts/common/io/usb/usba/usba.c b/usr/src/uts/common/io/usb/usba/usba.c index d74a32dfca..d25ed5bf22 100644 --- a/usr/src/uts/common/io/usb/usba/usba.c +++ b/usr/src/uts/common/io/usb/usba/usba.c @@ -384,12 +384,9 @@ usba_bus_ctl(dev_info_t *dip, case DDI_CTLOPS_REPORTINT: case DDI_CTLOPS_REGSIZE: case DDI_CTLOPS_NREGS: - case DDI_CTLOPS_NINTRS: case DDI_CTLOPS_SIDDEV: case DDI_CTLOPS_SLAVEONLY: case DDI_CTLOPS_AFFINITY: - case DDI_CTLOPS_INTR_HILEVEL: - case DDI_CTLOPS_XLATE_INTRS: case DDI_CTLOPS_POKE: case DDI_CTLOPS_PEEK: cmn_err(CE_CONT, "%s%d: invalid op (%d) from %s%d", diff --git a/usr/src/uts/common/os/ddi_intr.c b/usr/src/uts/common/os/ddi_intr.c index 17d9b6b5c1..160d704b7d 100644 --- a/usr/src/uts/common/os/ddi_intr.c +++ b/usr/src/uts/common/os/ddi_intr.c @@ -73,7 +73,7 @@ ddi_intr_get_supported_types(dev_info_t *dip, int *typesp) bzero(&hdl, sizeof (ddi_intr_handle_impl_t)); hdl.ih_dip = dip; - ret = i_ddi_handle_intr_ops(dip, dip, DDI_INTROP_SUPPORTED_TYPES, &hdl, + ret = i_ddi_intr_ops(dip, dip, DDI_INTROP_SUPPORTED_TYPES, &hdl, (void *)typesp); if (ret != DDI_SUCCESS) @@ -98,14 +98,18 @@ ddi_intr_get_nintrs(dev_info_t *dip, int type, int *nintrsp) int ret; ddi_intr_handle_impl_t hdl; - if (dip == NULL) - return (DDI_EINVAL); + DDI_INTR_APIDBG((CE_CONT, "ddi_intr_get_nintrs: dip %p, type: %d\n", + (void *)dip, type)); - DDI_INTR_APIDBG((CE_CONT, "ddi_intr_get_nintrs: dip %p\n", - (void *)dip)); + if ((dip == NULL) || (type & ~(DDI_INTR_SUP_TYPES))) { + *nintrsp = 0; + return (DDI_EINVAL); + } - if (!(i_ddi_intr_get_supported_types(dip) & type)) + if (!(i_ddi_intr_get_supported_types(dip) & type)) { + *nintrsp = 0; return (DDI_EINVAL); + } if (*nintrsp = i_ddi_intr_get_supported_nintrs(dip, type)) return (DDI_SUCCESS); @@ -114,7 +118,7 @@ ddi_intr_get_nintrs(dev_info_t *dip, int type, int *nintrsp) hdl.ih_dip = dip; hdl.ih_type = type; - ret = i_ddi_handle_intr_ops(dip, dip, DDI_INTROP_NINTRS, &hdl, + ret = i_ddi_intr_ops(dip, dip, DDI_INTROP_NINTRS, &hdl, (void *)nintrsp); DDI_INTR_APIDBG((CE_CONT, "ddi_intr_get_nintrs:: nintrs %x\n", @@ -139,14 +143,18 @@ ddi_intr_get_navail(dev_info_t *dip, int type, int *navailp) int ret; ddi_intr_handle_impl_t hdl; - DDI_INTR_APIDBG((CE_CONT, "ddi_intr_get_navail: dip %p\n", - (void *)dip)); + DDI_INTR_APIDBG((CE_CONT, "ddi_intr_get_navail: dip %p, type: %d\n", + (void *)dip, type)); - if (dip == NULL) + if ((dip == NULL) || (type & ~(DDI_INTR_SUP_TYPES))) { + *navailp = 0; return (DDI_EINVAL); + } - if (!(i_ddi_intr_get_supported_types(dip) & type)) + if (!(i_ddi_intr_get_supported_types(dip) & type)) { + *navailp = 0; return (DDI_EINVAL); + } /* * In future, this interface implementation will change @@ -156,8 +164,8 @@ ddi_intr_get_navail(dev_info_t *dip, int type, int *navailp) hdl.ih_dip = dip; hdl.ih_type = type; - ret = i_ddi_handle_intr_ops(dip, dip, - DDI_INTROP_NAVAIL, &hdl, (void *)navailp); + ret = i_ddi_intr_ops(dip, dip, DDI_INTROP_NAVAIL, &hdl, + (void *)navailp); return (ret == DDI_SUCCESS ? DDI_SUCCESS : DDI_INTR_NOTFOUND); } @@ -273,14 +281,14 @@ ddi_intr_alloc(dev_info_t *dip, ddi_intr_handle_t *h_array, int type, int inum, tmp_hdl.ih_scratch2 = behavior; tmp_hdl.ih_dip = dip; - if (i_ddi_handle_intr_ops(dip, dip, DDI_INTROP_ALLOC, + if (i_ddi_intr_ops(dip, dip, DDI_INTROP_ALLOC, &tmp_hdl, (void *)actualp) != DDI_SUCCESS) { DDI_INTR_APIDBG((CE_CONT, "ddi_intr_alloc: allocation " "failed\n")); return (*actualp ? DDI_EAGAIN : DDI_INTR_NOTFOUND); } - if ((ret = i_ddi_handle_intr_ops(dip, dip, DDI_INTROP_GETPRI, + if ((ret = i_ddi_intr_ops(dip, dip, DDI_INTROP_GETPRI, &tmp_hdl, (void *)&pri)) != DDI_SUCCESS) { DDI_INTR_APIDBG((CE_CONT, "ddi_intr_alloc: get priority " "failed\n")); @@ -289,7 +297,7 @@ ddi_intr_alloc(dev_info_t *dip, ddi_intr_handle_t *h_array, int type, int inum, DDI_INTR_APIDBG((CE_CONT, "ddi_intr_alloc: getting capability\n")); - if ((ret = i_ddi_handle_intr_ops(dip, dip, DDI_INTROP_GETCAP, + if ((ret = i_ddi_intr_ops(dip, dip, DDI_INTROP_GETCAP, &tmp_hdl, (void *)&cap)) != DDI_SUCCESS) { DDI_INTR_APIDBG((CE_CONT, "ddi_intr_alloc: get capability " "failed\n")); @@ -344,21 +352,21 @@ ddi_intr_free(ddi_intr_handle_t h) return (DDI_EINVAL); } - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_FREE, hdlp, NULL); rw_exit(&hdlp->ih_rwlock); if (ret == DDI_SUCCESS) { - if ((i_ddi_intr_get_current_nintrs(hdlp->ih_dip) - 1) == 0) - /* Reset current interrupt type and count used */ - i_ddi_intr_set_current_type(hdlp->ih_dip, 0); - i_ddi_intr_set_current_nintrs(hdlp->ih_dip, i_ddi_intr_get_current_nintrs(hdlp->ih_dip) - 1); - if (hdlp->ih_type & DDI_INTR_TYPE_FIXED) - i_ddi_set_intr_handle(hdlp->ih_dip, - hdlp->ih_inum, NULL); + if (i_ddi_intr_get_current_nintrs(hdlp->ih_dip) == 0) { + i_ddi_intr_devi_fini(hdlp->ih_dip); + } else { + if (hdlp->ih_type & DDI_INTR_TYPE_FIXED) + i_ddi_set_intr_handle(hdlp->ih_dip, + hdlp->ih_inum, NULL); + } rw_destroy(&hdlp->ih_rwlock); kmem_free(hdlp, sizeof (ddi_intr_handle_impl_t)); @@ -426,7 +434,7 @@ ddi_intr_get_cap(ddi_intr_handle_t h, int *flagsp) return (DDI_SUCCESS); } - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_GETCAP, hdlp, (void *)flagsp); if (ret == DDI_SUCCESS) { @@ -475,7 +483,7 @@ ddi_intr_set_cap(ddi_intr_handle_t h, int flags) return (DDI_ENOTSUP); } - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_SETCAP, hdlp, &flags); rw_exit(&hdlp->ih_rwlock); @@ -519,7 +527,7 @@ ddi_intr_get_pri(ddi_intr_handle_t h, uint_t *prip) return (DDI_SUCCESS); } - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_GETPRI, hdlp, (void *)prip); if (ret == DDI_SUCCESS) @@ -559,7 +567,7 @@ ddi_intr_set_pri(ddi_intr_handle_t h, uint_t pri) return (DDI_SUCCESS); } - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_SETPRI, hdlp, &pri); if (ret == DDI_SUCCESS) @@ -595,7 +603,7 @@ ddi_intr_add_handler(ddi_intr_handle_t h, ddi_intr_handler_t inthandler, hdlp->ih_cb_arg1 = arg1; hdlp->ih_cb_arg2 = arg2; - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_ADDISR, hdlp, NULL); if (ret != DDI_SUCCESS) { @@ -632,7 +640,7 @@ ddi_intr_dup_handler(ddi_intr_handle_t org, int vector, ddi_intr_handle_t *dup) return (DDI_EINVAL); } - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_DUPVEC, hdlp, (void *)&vector); if (ret == DDI_SUCCESS) { @@ -679,7 +687,7 @@ ddi_intr_remove_handler(ddi_intr_handle_t h) return (DDI_EINVAL); } - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_REMISR, hdlp, NULL); if (ret == DDI_SUCCESS) { @@ -716,7 +724,7 @@ ddi_intr_enable(ddi_intr_handle_t h) return (DDI_EINVAL); } - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_ENABLE, hdlp, NULL); if (ret == DDI_SUCCESS) @@ -746,7 +754,7 @@ ddi_intr_disable(ddi_intr_handle_t h) return (DDI_EINVAL); } - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_DISABLE, hdlp, NULL); if (ret == DDI_SUCCESS) @@ -785,7 +793,7 @@ ddi_intr_block_enable(ddi_intr_handle_t *h_array, int count) rw_enter(&hdlp->ih_rwlock, RW_WRITER); hdlp->ih_scratch1 = count; - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_BLOCKENABLE, hdlp, NULL); rw_exit(&hdlp->ih_rwlock); @@ -830,7 +838,7 @@ ddi_intr_block_disable(ddi_intr_handle_t *h_array, int count) rw_enter(&hdlp->ih_rwlock, RW_WRITER); hdlp->ih_scratch1 = count; - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_BLOCKDISABLE, hdlp, NULL); rw_exit(&hdlp->ih_rwlock); @@ -868,7 +876,7 @@ ddi_intr_set_mask(ddi_intr_handle_t h) return (DDI_EINVAL); } - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_SETMASK, hdlp, NULL); rw_exit(&hdlp->ih_rwlock); @@ -893,7 +901,7 @@ ddi_intr_clr_mask(ddi_intr_handle_t h) return (DDI_EINVAL); } - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_CLRMASK, hdlp, NULL); rw_exit(&hdlp->ih_rwlock); @@ -921,7 +929,7 @@ ddi_intr_get_pending(ddi_intr_handle_t h, int *pendingp) return (DDI_EINVAL); } - ret = i_ddi_handle_intr_ops(hdlp->ih_dip, hdlp->ih_dip, + ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip, DDI_INTROP_GETPENDING, hdlp, (void *)pendingp); rw_exit(&hdlp->ih_rwlock); @@ -1093,6 +1101,9 @@ ddi_intr_set_softint_pri(ddi_softint_handle_t h, uint_t soft_pri) /* * Old DDI interrupt framework + * + * The following DDI interrupt interfaces are obsolete. + * Use the above new DDI interrupt interfaces instead. */ int @@ -1264,9 +1275,6 @@ ddi_add_intr(dev_info_t *dip, uint_t inumber, idevice_cookiep->idev_priority = pri; } - /* this line may be removed in near future */ - i_ddi_set_intr_handle(dip, inumber, hdl_p); - return (DDI_SUCCESS); } @@ -1320,9 +1328,6 @@ ddi_remove_intr(dev_info_t *dip, uint_t inum, ddi_iblock_cookie_t iblock_cookie) } kmem_free(hdl_p, sizeof (ddi_intr_handle_t)); - - /* this line may be removed in near future */ - i_ddi_set_intr_handle(dip, inum, NULL); } /* ARGSUSED */ diff --git a/usr/src/uts/common/os/ddi_intr_impl.c b/usr/src/uts/common/os/ddi_intr_impl.c index 674a7c4b81..b01dd99890 100644 --- a/usr/src/uts/common/os/ddi_intr_impl.c +++ b/usr/src/uts/common/os/ddi_intr_impl.c @@ -67,6 +67,12 @@ i_ddi_intr_devi_fini(dev_info_t *dip) { devinfo_intr_t *intr_p = DEVI(dip)->devi_intr_p; + DDI_INTR_APIDBG((CE_CONT, "i_ddi_intr_devi_fini: dip %p\n", + (void *)dip)); + + if (DEVI(dip)->devi_intr_p == NULL) + return; + /* * devi_intr_handle_p will only be used for devices * which are using the legacy DDI Interrupt interfaces. @@ -79,6 +85,7 @@ i_ddi_intr_devi_fini(dev_info_t *dip) sizeof (ddi_intr_handle_t)); } } + kmem_free(DEVI(dip)->devi_intr_p, sizeof (devinfo_intr_t)); DEVI(dip)->devi_intr_p = NULL; } @@ -96,7 +103,7 @@ i_ddi_intr_get_supported_types(dev_info_t *dip) bzero(&hdl, sizeof (ddi_intr_handle_impl_t)); hdl.ih_dip = dip; - ret = i_ddi_handle_intr_ops(dip, dip, DDI_INTROP_SUPPORTED_TYPES, &hdl, + ret = i_ddi_intr_ops(dip, dip, DDI_INTROP_SUPPORTED_TYPES, &hdl, (void *)&intr_types); return ((ret == DDI_SUCCESS) ? intr_types : 0); @@ -129,7 +136,7 @@ i_ddi_intr_get_supported_nintrs(dev_info_t *dip, int intr_type) hdl.ih_dip = dip; hdl.ih_type = intr_type; - ret = i_ddi_handle_intr_ops(dip, dip, DDI_INTROP_NINTRS, &hdl, + ret = i_ddi_intr_ops(dip, dip, DDI_INTROP_NINTRS, &hdl, (void *)&nintrs); return ((ret == DDI_SUCCESS) ? nintrs : 0); @@ -241,7 +248,7 @@ i_ddi_set_intr_handle(dev_info_t *dip, int inum, if ((inum < 0) || (inum >= intr_p->devi_intr_sup_nintrs)) return; - if (intr_p->devi_intr_handle_p == NULL) { + if (intr_hdlp && (intr_p->devi_intr_handle_p == NULL)) { /* nintrs could be zero; so check for it first */ if (intr_p->devi_intr_sup_nintrs) intr_p->devi_intr_handle_p = kmem_zalloc( @@ -249,7 +256,8 @@ i_ddi_set_intr_handle(dev_info_t *dip, int inum, intr_p->devi_intr_sup_nintrs, KM_SLEEP); } - intr_p->devi_intr_handle_p[inum] = intr_hdlp; + if (intr_p->devi_intr_handle_p) + intr_p->devi_intr_handle_p[inum] = intr_hdlp; } /* @@ -307,8 +315,8 @@ i_ddi_get_intrspec(dev_info_t *dip, dev_info_t *rdip, uint_t inumber) cmn_err(CE_WARN, "Failed to process interrupt " "for %s%d due to down-rev nexus driver %s%d", - ddi_get_name(rdip), ddi_get_instance(rdip), - ddi_get_name(pdip), ddi_get_instance(pdip)); + ddi_driver_name(rdip), ddi_get_instance(rdip), + ddi_driver_name(pdip), ddi_get_instance(pdip)); return (NULL); } @@ -325,8 +333,8 @@ i_ddi_add_intrspec(dev_info_t *dip, dev_info_t *rdip, ddi_intrspec_t intrspec, cmn_err(CE_WARN, "Failed to process interrupt " "for %s%d due to down-rev nexus driver %s%d", - ddi_get_name(rdip), ddi_get_instance(rdip), - ddi_get_name(pdip), ddi_get_instance(pdip)); + ddi_driver_name(rdip), ddi_get_instance(rdip), + ddi_driver_name(pdip), ddi_get_instance(pdip)); return (DDI_ENOTSUP); } @@ -340,8 +348,8 @@ i_ddi_remove_intrspec(dev_info_t *dip, dev_info_t *rdip, cmn_err(CE_WARN, "Failed to process interrupt " "for %s%d due to down-rev nexus driver %s%d", - ddi_get_name(rdip), ddi_get_instance(rdip), - ddi_get_name(pdip), ddi_get_instance(pdip)); + ddi_driver_name(rdip), ddi_get_instance(rdip), + ddi_driver_name(pdip), ddi_get_instance(pdip)); } /* ARGSUSED */ @@ -353,8 +361,8 @@ i_ddi_intr_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_ctlop_t op, cmn_err(CE_WARN, "Failed to process interrupt " "for %s%d due to down-rev nexus driver %s%d", - ddi_get_name(rdip), ddi_get_instance(rdip), - ddi_get_name(pdip), ddi_get_instance(pdip)); + ddi_driver_name(rdip), ddi_get_instance(rdip), + ddi_driver_name(pdip), ddi_get_instance(pdip)); return (DDI_ENOTSUP); } diff --git a/usr/src/uts/common/os/devcfg.c b/usr/src/uts/common/os/devcfg.c index ba29a2e6d1..c11cbcdf86 100644 --- a/usr/src/uts/common/os/devcfg.c +++ b/usr/src/uts/common/os/devcfg.c @@ -337,9 +337,6 @@ i_ddi_free_node(dev_info_t *dip) ASSERT(devi->devi_node_state == DS_PROTO); ASSERT(devi->devi_child == NULL); - if (devi->devi_intr_p) - i_ddi_intr_devi_fini((dev_info_t *)devi); - /* free devi_addr_buf allocated by ddi_set_name_addr() */ if (devi->devi_addr_buf) kmem_free(devi->devi_addr_buf, 2 * MAXNAMELEN); diff --git a/usr/src/uts/common/pcmcia/nexus/pcmcia.c b/usr/src/uts/common/pcmcia/nexus/pcmcia.c index 58e6869ca7..20a16203b2 100644 --- a/usr/src/uts/common/pcmcia/nexus/pcmcia.c +++ b/usr/src/uts/common/pcmcia/nexus/pcmcia.c @@ -73,7 +73,6 @@ #include <pcmcia/sys/cs_priv.h> #ifdef sparc -#include <sys/nexusintr_impl.h> #include <sys/ddi_subrdefs.h> #endif @@ -673,15 +672,6 @@ pcmcia_ctlops(dev_info_t *dip, dev_info_t *rdip, /* in general this is true. */ return (DDI_SUCCESS); - case DDI_CTLOPS_NINTRS: - ppd = (struct pcmcia_parent_private *) - ddi_get_parent_data(rdip); - if (ppd != NULL && ppd->ppd_intr) - *((uint32_t *)result) = 1; - else - *((uint32_t *)result) = 0; - return (DDI_SUCCESS); /* if a memory card */ - case DDI_CTLOPS_NREGS: ppd = (struct pcmcia_parent_private *) ddi_get_parent_data(rdip); @@ -700,11 +690,6 @@ pcmcia_ctlops(dev_info_t *dip, dev_info_t *rdip, *((off_t *)result) = 0; return (DDI_SUCCESS); - case DDI_CTLOPS_INTR_HILEVEL: - /* Should probably allow low level when they are possible */ - *((uint32_t *)result) = 1; - return (DDI_SUCCESS); - case DDI_CTLOPS_POWER: ppd = (struct pcmcia_parent_private *) ddi_get_parent_data(rdip); @@ -764,7 +749,6 @@ pcmcia_ctlops(dev_info_t *dip, dev_info_t *rdip, return (DDI_FAILURE); /* These CTLOPS will need to be implemented for new form */ /* let CardServices know about this */ - case DDI_CTLOPS_XLATE_INTRS: default: /* if we don't understand, pass up the tree */ @@ -4798,8 +4782,6 @@ pcmcia_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, clear_irq_handler_t handler; struct intrspec *pispec; int socket; - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; - #if defined(PCMCIA_DEBUG) if (pcmcia_debug) { @@ -4825,8 +4807,7 @@ pcmcia_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, /* first handle the multifunction case since it is simple */ mutex_enter(&sockp->ls_ilock); - if (sockp->ls_inthandlers != NULL && - (struct intrspec *)ip != &sockp->ls_intrspec) { + if (sockp->ls_inthandlers != NULL) { /* we must be MFC */ inthandler_t *intr; int remhandler = 0; @@ -4870,16 +4851,12 @@ pcmcia_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, mutex_exit(&sockp->ls_ilock); return; } - /* need to remove the real handler in MFC case */ - hdlp->ih_private = (ddi_intrspec_t)&sockp->ls_intrspec; /* need to get the dip that was used to add the handler */ rdip = sockp->ls_mfintr_dip; } - mutex_exit(&sockp->ls_ilock); - if ((struct intrspec *)ip == &sockp->ls_intrspec) - pispec = (struct intrspec *)ip; + mutex_exit(&sockp->ls_ilock); #if defined(PCMCIA_DEBUG) if (pcmcia_debug) { @@ -4902,8 +4879,7 @@ int pcmcia_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, ddi_intr_handle_impl_t *hdlp, void *result) { - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; - int ret = DDI_SUCCESS; + int ret = DDI_SUCCESS; #if defined(PCMCIA_DEBUG) if (pcmcia_debug) { @@ -4914,7 +4890,7 @@ pcmcia_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, switch (intr_op) { case DDI_INTROP_GETCAP: - *(int *)result = 0; + *(int *)result = DDI_INTR_FLAG_LEVEL; break; case DDI_INTROP_SETCAP: ret = DDI_ENOTSUP; @@ -4931,16 +4907,11 @@ pcmcia_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, pcmcia_remove_intr_impl(dip, rdip, hdlp); break; case DDI_INTROP_SETPRI: - ip->is_pil = (*(int *)result); break; case DDI_INTROP_ADDISR: - hdlp->ih_vector = *ip->is_intr; - ret = pcmcia_add_intr_impl(dip, rdip, hdlp); break; case DDI_INTROP_REMISR: - hdlp->ih_vector = *ip->is_intr; - pcmcia_remove_intr_impl(dip, rdip, hdlp); break; case DDI_INTROP_ENABLE: @@ -5422,7 +5393,7 @@ pcmcia_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, *(int *)result = DDI_INTR_TYPE_FIXED; break; case DDI_INTROP_GETCAP: - *(int *)result = 0; + *(int *)result = DDI_INTR_FLAG_LEVEL; break; case DDI_INTROP_NINTRS: case DDI_INTROP_NAVAIL: diff --git a/usr/src/uts/common/sys/Makefile b/usr/src/uts/common/sys/Makefile index 0a9b39a113..cdcb39b19e 100644 --- a/usr/src/uts/common/sys/Makefile +++ b/usr/src/uts/common/sys/Makefile @@ -329,7 +329,6 @@ CHKHDRS= \ ndi_impldefs.h \ netconfig.h \ nexusdefs.h \ - nexusintr.h \ note.h \ nvpair.h \ nvpair_impl.h \ diff --git a/usr/src/uts/common/sys/ddi_implfuncs.h b/usr/src/uts/common/sys/ddi_implfuncs.h index 5a63a91588..033ae7c93c 100644 --- a/usr/src/uts/common/sys/ddi_implfuncs.h +++ b/usr/src/uts/common/sys/ddi_implfuncs.h @@ -67,12 +67,6 @@ ddi_regspec_t i_ddi_get_regspec(dev_info_t *dip, dev_info_t *rdip, uint_t rnumber, off_t offset, off_t len); -void -i_ddi_set_parent_private(dev_info_t *dip, caddr_t data); - -caddr_t -i_ddi_get_parent_private(dev_info_t *dip); - /* * Implementation specific memory allocation and de-allocation routines. */ diff --git a/usr/src/uts/common/sys/ddi_intr.h b/usr/src/uts/common/sys/ddi_intr.h index d80ba7e330..33b23ce3ea 100644 --- a/usr/src/uts/common/sys/ddi_intr.h +++ b/usr/src/uts/common/sys/ddi_intr.h @@ -91,6 +91,12 @@ extern "C" { #define DDI_INTR_FLAG_MSI64 0x0200 /* (R0) MSI/X supports 64 bit addr */ /* + * Macro to be used while passing interrupt priority + * for lock initialization. + */ +#define DDI_INTR_PRI(pri) (void *)((uintptr_t)(pri)) + +/* * Typedef for interrupt handles */ typedef struct __ddi_intr_handle *ddi_intr_handle_t; @@ -205,6 +211,9 @@ int ddi_intr_set_softint_pri(ddi_softint_handle_t h, uint_t soft_pri); /* * Old DDI interrupt interfaces. + * + * The following DDI interrupt interfaces are obsolete. + * Use the above new DDI interrupt interfaces instead. */ /* diff --git a/usr/src/uts/common/sys/ddi_intr_impl.h b/usr/src/uts/common/sys/ddi_intr_impl.h index f741709d09..554eb32da1 100644 --- a/usr/src/uts/common/sys/ddi_intr_impl.h +++ b/usr/src/uts/common/sys/ddi_intr_impl.h @@ -76,7 +76,7 @@ typedef struct ddi_intr_handle_impl { dev_info_t *ih_dip; /* dip associated with handle */ uint16_t ih_type; /* interrupt type being used */ ushort_t ih_inum; /* interrupt number */ - ushort_t ih_vector; /* vector number */ + uint32_t ih_vector; /* vector number */ uint16_t ih_ver; /* Version */ uint_t ih_state; /* interrupt handle state */ uint_t ih_cap; /* interrupt capabilities */ @@ -115,6 +115,9 @@ typedef struct ddi_intr_handle_impl { #define DDI_INTR_IS_MSI_OR_MSIX(type) \ ((type) == DDI_INTR_TYPE_MSI || (type) == DDI_INTR_TYPE_MSIX) +#define DDI_INTR_SUP_TYPES DDI_INTR_TYPE_FIXED|DDI_INTR_TYPE_MSI|\ + DDI_INTR_TYPE_MSIX + /* * One such data structure is allocated per ddi_soft_intr_handle * This is the incore copy of the softint info. @@ -190,8 +193,6 @@ typedef struct devinfo_intr { (DEVI(dip)->devi_ops->devo_bus_ops->busops_rev >= BUSO_REV_9) && \ (DEVI(dip)->devi_ops->devo_bus_ops->bus_intr_op)) -int i_ddi_handle_intr_ops(dev_info_t *dip, dev_info_t *rdip, - ddi_intr_op_t op, ddi_intr_handle_impl_t *hdlp, void *result); int i_ddi_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t op, ddi_intr_handle_impl_t *hdlp, void *result); @@ -212,9 +213,9 @@ void i_ddi_intr_set_supported_nintrs(dev_info_t *dip, int nintrs); uint_t i_ddi_intr_get_current_nintrs(dev_info_t *dip); void i_ddi_intr_set_current_nintrs(dev_info_t *dip, int nintrs); +ddi_intr_handle_t *i_ddi_get_intr_handle(dev_info_t *dip, int inum); void i_ddi_set_intr_handle(dev_info_t *dip, int inum, ddi_intr_handle_t *hdlp); -ddi_intr_handle_t *i_ddi_get_intr_handle(dev_info_t *dip, int inum); ddi_intr_msix_t *i_ddi_get_msix(dev_info_t *dip); void i_ddi_set_msix(dev_info_t *dip, ddi_intr_msix_t *msix_p); @@ -222,8 +223,6 @@ void i_ddi_set_msix(dev_info_t *dip, ddi_intr_msix_t *msix_p); int32_t i_ddi_get_intr_weight(dev_info_t *); int32_t i_ddi_set_intr_weight(dev_info_t *, int32_t); -int i_ddi_get_nintrs(dev_info_t *dip); - #define DDI_INTR_ASSIGN_HDLR_N_ARGS(hdlp, func, arg1, arg2) \ hdlp->ih_cb_func = func; \ hdlp->ih_cb_arg1 = arg1; \ @@ -252,15 +251,6 @@ struct intrspec { }; #ifdef _KERNEL -/* - * This structure is allocated by i_ddi_add_softintr and its address is used - * as a cookie passed back to the caller to be used later by - * i_ddi_remove_softintr - */ -struct soft_intrspec { - struct dev_info *si_devi; /* records dev_info of caller */ - struct intrspec si_intrspec; /* and the intrspec */ -}; /* * NOTE: diff --git a/usr/src/uts/common/sys/dditypes.h b/usr/src/uts/common/sys/dditypes.h index c99d4c89c4..98850cf9c0 100644 --- a/usr/src/uts/common/sys/dditypes.h +++ b/usr/src/uts/common/sys/dditypes.h @@ -102,6 +102,9 @@ typedef struct { */ /* + * Both ddi_iblock_cookie_t and ddi_idevice_cookie_t are + * obsolete data structures. + * * lock initialization type */ typedef struct __ddi_iblock_cookie *ddi_iblock_cookie_t; @@ -126,6 +129,8 @@ typedef struct __ddi_regspec *ddi_regspec_t; typedef struct __ddi_intrspec *ddi_intrspec_t; /* + * ddi_softintr_t is an obsolete data structure. + * * soft interrupt id */ typedef struct __ddi_softintr *ddi_softintr_t; diff --git a/usr/src/uts/common/sys/nexusdefs.h b/usr/src/uts/common/sys/nexusdefs.h index c872009c08..e05df8e4f0 100644 --- a/usr/src/uts/common/sys/nexusdefs.h +++ b/usr/src/uts/common/sys/nexusdefs.h @@ -45,7 +45,7 @@ typedef enum { DDI_CTLOPS_REPORTINT, DDI_CTLOPS_REGSIZE, DDI_CTLOPS_NREGS, - DDI_CTLOPS_NINTRS, + DDI_CTLOPS_RESERVED0, /* Originally DDI_CTLOPS_NINTRS, obsolete */ DDI_CTLOPS_SIDDEV, DDI_CTLOPS_SLAVEONLY, DDI_CTLOPS_AFFINITY, @@ -56,8 +56,8 @@ typedef enum { DDI_CTLOPS_RESERVED1, /* Originally DDI_CTLOPS_POKE_INIT, obsolete */ DDI_CTLOPS_RESERVED2, /* Originally DDI_CTLOPS_POKE_FLUSH, obsolete */ DDI_CTLOPS_RESERVED3, /* Originally DDI_CTLOPS_POKE_FINI, obsolete */ - DDI_CTLOPS_INTR_HILEVEL, - DDI_CTLOPS_XLATE_INTRS, + DDI_CTLOPS_RESERVED4, /* Originally DDI_CTLOPS_INTR_HILEVEL, obsolete */ + DDI_CTLOPS_RESERVED5, /* Originally DDI_CTLOPS_XLATE_INTRS, obsolete */ DDI_CTLOPS_DVMAPAGESIZE, DDI_CTLOPS_POWER, DDI_CTLOPS_ATTACH, diff --git a/usr/src/uts/common/sys/nexusintr.h b/usr/src/uts/common/sys/nexusintr.h deleted file mode 100644 index f3d33e51dd..0000000000 --- a/usr/src/uts/common/sys/nexusintr.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1999 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _SYS_NEXUSINTR_H -#define _SYS_NEXUSINTR_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/dditypes.h> - -/* - * The consolidated interrupt op definition. - * The following ops are processed at the first nexus who claims ownership of - * the interrupt domain. (i.e. usually it's parent) - * DDI_INTR_CTLOPS_ALLOC_ISPEC: - * This op is used to allocate a platform specific interrupt - * specification. - * - * note: SPARC platforms will use this op to also set the bus interrupt - * value taken from the IEEE 1275 "interrupts" property. A processor - * interrupt level may also be calculated during this call. - * - * DDI_INTR_CTLOPS_FREE_ISPEC: - * This op is used to free an interrupt specification. - * - * DDI_INTR_CTLOPS_NINTRS: - * This op is used to determine the number of interrupts that a device - * supports. - * - * The following ops are processed up through the device tree terminating at - * the root nexus. - * DDI_INTR_CTLOPS_ADD: - * This op is used to add an interrupt handler into the system for a given - * device Any interrupt translation should be done now before passing the - * ADD call up the device tree. Any nexus specific programming for the - * interrupt should be done too. - * - * DDI_INTR_CTLOPS_REMOVE: - * This op is used to remove an interrupt handler from the system - * for a given device. Any interrupt translation should be done now - * before passing the REMOVE call up the device tree. Any nexus - * specific programming for the interrupt should be done too. - * - * DDI_INTR_CTLOPS_HILEVEL: - * This op is used to determine if a device has a high level interrupt. - * Any interrupt translation should be done now before passing the - * HILEVEL call up the device tree. - * - * Note: - * 1) There is no XLATE intr ctlop. This is due to the fact that all the ops - * which percolate up through the ddi device tree, must have a translation - * performed dynamically at each nexus where a translation is meaningful. - * 2) The sun4u PCI bus nexus drivers can be used to see how the - * intr_ctlop bus op should be implemented. - */ -typedef enum { - DDI_INTR_CTLOPS_ALLOC_ISPEC = 0, - DDI_INTR_CTLOPS_FREE_ISPEC, - DDI_INTR_CTLOPS_ADD, - DDI_INTR_CTLOPS_REMOVE, - DDI_INTR_CTLOPS_NINTRS, - DDI_INTR_CTLOPS_HILEVEL -} ddi_intr_ctlop_t; - -typedef struct ddi_intr_info { - ddi_intrspec_t ii_ispec; /* Stacked interrupt specification */ - ddi_iblock_cookie_t *ii_iblock_cookiep; - ddi_idevice_cookie_t *ii_idevice_cookiep; - uint_t (*ii_int_handler)(caddr_t ii_int_handler_arg); - caddr_t ii_int_handler_arg; - int32_t ii_kind; /* kind of interrupt spec */ - uint32_t ii_inum; /* Interrupt index of interrupt spec. */ -} ddi_intr_info_t; - - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_NEXUSINTR_H */ diff --git a/usr/src/uts/i86pc/io/pci/pci.c b/usr/src/uts/i86pc/io/pci/pci.c index 848862edfe..9c511549ff 100644 --- a/usr/src/uts/i86pc/io/pci/pci.c +++ b/usr/src/uts/i86pc/io/pci/pci.c @@ -1107,16 +1107,6 @@ pci_ctlops(dev_info_t *dip, dev_info_t *rdip, case DDI_CTLOPS_UNINITCHILD: return (pci_removechild((dev_info_t *)arg)); - case DDI_CTLOPS_NINTRS: - if (ddi_get_parent_data(rdip)) - *(int *)result = 1; - else - *(int *)result = 0; - return (DDI_SUCCESS); - - case DDI_CTLOPS_XLATE_INTRS: - return (DDI_SUCCESS); - case DDI_CTLOPS_SIDDEV: return (DDI_SUCCESS); diff --git a/usr/src/uts/i86pc/io/rootnex.c b/usr/src/uts/i86pc/io/rootnex.c index 6d9767e50a..66bf0ebccd 100644 --- a/usr/src/uts/i86pc/io/rootnex.c +++ b/usr/src/uts/i86pc/io/rootnex.c @@ -285,8 +285,6 @@ static int rootnex_dma_init(); static void rootnex_add_props(dev_info_t *); static int rootnex_ctl_reportdev(dev_info_t *dip); static struct intrspec *rootnex_get_ispec(dev_info_t *rdip, int inum); -static int rootnex_xlate_intrs(dev_info_t *dip, dev_info_t *rdip, int *in, - struct ddi_parent_private_data *pdptr); static int rootnex_ctlops_poke(peekpoke_ctlops_t *in_args); static int rootnex_ctlops_peek(peekpoke_ctlops_t *in_args, void *result); static int rootnex_map_regspec(ddi_map_req_t *mp, caddr_t *vaddrp); @@ -507,6 +505,7 @@ rootnex_add_props(dev_info_t *dip) * rootnex_ctlops() * */ +/*ARGSUSED*/ static int rootnex_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t ctlop, void *arg, void *result) @@ -514,7 +513,6 @@ rootnex_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t ctlop, int n, *ptr; struct ddi_parent_private_data *pdp; - switch (ctlop) { case DDI_CTLOPS_DMAPMAPC: /* @@ -572,7 +570,6 @@ rootnex_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t ctlop, case DDI_CTLOPS_REGSIZE: case DDI_CTLOPS_NREGS: - case DDI_CTLOPS_NINTRS: break; case DDI_CTLOPS_SIDDEV: @@ -582,26 +579,15 @@ rootnex_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t ctlop, return (DDI_SUCCESS); return (DDI_FAILURE); - case DDI_CTLOPS_INTR_HILEVEL: - /* - * Indicate whether the interrupt specified is to be handled - * above lock level. In other words, above the level that - * cv_signal and default type mutexes can be used. - */ - *(int *)result = - (INT_IPL(((struct intrspec *)arg)->intrspec_pri) - > LOCK_LEVEL); - return (DDI_SUCCESS); - - case DDI_CTLOPS_XLATE_INTRS: - return (rootnex_xlate_intrs(dip, rdip, arg, result)); - case DDI_CTLOPS_POWER: return ((*pm_platform_power)((power_req_t *)arg)); + case DDI_CTLOPS_RESERVED0: /* Was DDI_CTLOPS_NINTRS, obsolete */ case DDI_CTLOPS_RESERVED1: /* Was DDI_CTLOPS_POKE_INIT, obsolete */ case DDI_CTLOPS_RESERVED2: /* Was DDI_CTLOPS_POKE_FLUSH, obsolete */ case DDI_CTLOPS_RESERVED3: /* Was DDI_CTLOPS_POKE_FINI, obsolete */ + case DDI_CTLOPS_RESERVED4: /* Was DDI_CTLOPS_INTR_HILEVEL, obsolete */ + case DDI_CTLOPS_RESERVED5: /* Was DDI_CTLOPS_XLATE_INTRS, obsolete */ if (!rootnex_state->r_reserved_msg_printed) { rootnex_state->r_reserved_msg_printed = B_TRUE; cmn_err(CE_WARN, "Failing ddi_ctlops call(s) for " @@ -621,9 +607,6 @@ rootnex_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t ctlop, if (ctlop == DDI_CTLOPS_NREGS) { ptr = (int *)result; *ptr = pdp->par_nreg; - } else if (ctlop == DDI_CTLOPS_NINTRS) { - ptr = (int *)result; - *ptr = pdp->par_nintr; } else { off_t *size = (off_t *)result; @@ -1593,149 +1576,6 @@ rootnex_get_ispec(dev_info_t *rdip, int inum) /* - * rootnex_xlate_intrs() - * For the x86 rootnexus, we're prepared to claim that the interrupt string - * is in the form of a list of <ipl,vec> specifications. - */ -static int -rootnex_xlate_intrs(dev_info_t *dip, dev_info_t *rdip, int *in, - struct ddi_parent_private_data *pdptr) -{ - size_t size; - int n; - struct intrspec *new; - caddr_t got_prop; - int *inpri; - int got_len; - - static char bad_intr_fmt[] = - "rootnex: bad interrupt spec from %s%d - ipl %d, irq %d\n"; - -#ifdef lint - dip = dip; -#endif - /* - * determine if the driver is expecting the new style "interrupts" - * property which just contains the IRQ, or the old style which - * contains pairs of <IPL,IRQ>. if it is the new style, we always - * assign IPL 5 unless an "interrupt-priorities" property exists. - * in that case, the "interrupt-priorities" property contains the - * IPL values that match, one for one, the IRQ values in the - * "interrupts" property. - */ - inpri = NULL; - if ((ddi_getprop(DDI_DEV_T_ANY, rdip, DDI_PROP_DONTPASS, - "ignore-hardware-nodes", -1) != -1) || - ignore_hardware_nodes) { - /* the old style "interrupts" property... */ - - /* - * The list consists of <ipl,vec> elements - */ - if ((n = (*in++ >> 1)) < 1) - return (DDI_FAILURE); - - pdptr->par_nintr = n; - size = n * sizeof (struct intrspec); - new = pdptr->par_intr = kmem_zalloc(size, KM_SLEEP); - - while (n--) { - int level = *in++; - int vec = *in++; - - if (level < 1 || level > MAXIPL || - vec < VEC_MIN || vec > VEC_MAX) { - cmn_err(CE_CONT, bad_intr_fmt, - DEVI(rdip)->devi_name, - DEVI(rdip)->devi_instance, level, vec); - goto broken; - } - new->intrspec_pri = level; - if (vec != 2) - new->intrspec_vec = vec; - else - /* - * irq 2 on the PC bus is tied to irq 9 - * on ISA, EISA and MicroChannel - */ - new->intrspec_vec = 9; - new++; - } - - return (DDI_SUCCESS); - } else { - /* the new style "interrupts" property... */ - - /* - * The list consists of <vec> elements - */ - if ((n = (*in++)) < 1) - return (DDI_FAILURE); - - pdptr->par_nintr = n; - size = n * sizeof (struct intrspec); - new = pdptr->par_intr = kmem_zalloc(size, KM_SLEEP); - - /* XXX check for "interrupt-priorities" property... */ - if (ddi_getlongprop(DDI_DEV_T_ANY, rdip, DDI_PROP_DONTPASS, - "interrupt-priorities", (caddr_t)&got_prop, &got_len) - == DDI_PROP_SUCCESS) { - if (n != (got_len / sizeof (int))) { - cmn_err(CE_CONT, - "rootnex: bad interrupt-priorities length" - " from %s%d: expected %d, got %d\n", - DEVI(rdip)->devi_name, - DEVI(rdip)->devi_instance, n, - (int)(got_len / sizeof (int))); - goto broken; - } - inpri = (int *)got_prop; - } - - while (n--) { - int level; - int vec = *in++; - - if (inpri == NULL) - level = 5; - else - level = *inpri++; - - if (level < 1 || level > MAXIPL || - vec < VEC_MIN || vec > VEC_MAX) { - cmn_err(CE_CONT, bad_intr_fmt, - DEVI(rdip)->devi_name, - DEVI(rdip)->devi_instance, level, vec); - goto broken; - } - new->intrspec_pri = level; - if (vec != 2) - new->intrspec_vec = vec; - else - /* - * irq 2 on the PC bus is tied to irq 9 - * on ISA, EISA and MicroChannel - */ - new->intrspec_vec = 9; - new++; - } - - if (inpri != NULL) - kmem_free(got_prop, got_len); - return (DDI_SUCCESS); - } - -broken: - kmem_free(pdptr->par_intr, size); - pdptr->par_intr = NULL; - pdptr->par_nintr = 0; - if (inpri != NULL) - kmem_free(got_prop, got_len); - return (DDI_FAILURE); -} - - -/* * ****************** * dma related code * ****************** diff --git a/usr/src/uts/i86pc/os/ddi_impl.c b/usr/src/uts/i86pc/os/ddi_impl.c index 8ee094c97a..748b2c968b 100644 --- a/usr/src/uts/i86pc/os/ddi_impl.c +++ b/usr/src/uts/i86pc/os/ddi_impl.c @@ -389,6 +389,149 @@ struct prop_ispec { }; /* + * For the x86, we're prepared to claim that the interrupt string + * is in the form of a list of <ipl,vec> specifications. + */ + +#define VEC_MIN 1 +#define VEC_MAX 255 + +static int +impl_xlate_intrs(dev_info_t *child, int *in, + struct ddi_parent_private_data *pdptr) +{ + size_t size; + int n; + struct intrspec *new; + caddr_t got_prop; + int *inpri; + int got_len; + extern int ignore_hardware_nodes; /* force flag from ddi_impl.c */ + + static char bad_intr_fmt[] = + "bad interrupt spec from %s%d - ipl %d, irq %d\n"; + + /* + * determine if the driver is expecting the new style "interrupts" + * property which just contains the IRQ, or the old style which + * contains pairs of <IPL,IRQ>. if it is the new style, we always + * assign IPL 5 unless an "interrupt-priorities" property exists. + * in that case, the "interrupt-priorities" property contains the + * IPL values that match, one for one, the IRQ values in the + * "interrupts" property. + */ + inpri = NULL; + if ((ddi_getprop(DDI_DEV_T_ANY, child, DDI_PROP_DONTPASS, + "ignore-hardware-nodes", -1) != -1) || ignore_hardware_nodes) { + /* the old style "interrupts" property... */ + + /* + * The list consists of <ipl,vec> elements + */ + if ((n = (*in++ >> 1)) < 1) + return (DDI_FAILURE); + + pdptr->par_nintr = n; + size = n * sizeof (struct intrspec); + new = pdptr->par_intr = kmem_zalloc(size, KM_SLEEP); + + while (n--) { + int level = *in++; + int vec = *in++; + + if (level < 1 || level > MAXIPL || + vec < VEC_MIN || vec > VEC_MAX) { + cmn_err(CE_CONT, bad_intr_fmt, + DEVI(child)->devi_name, + DEVI(child)->devi_instance, level, vec); + goto broken; + } + new->intrspec_pri = level; + if (vec != 2) + new->intrspec_vec = vec; + else + /* + * irq 2 on the PC bus is tied to irq 9 + * on ISA, EISA and MicroChannel + */ + new->intrspec_vec = 9; + new++; + } + + return (DDI_SUCCESS); + } else { + /* the new style "interrupts" property... */ + + /* + * The list consists of <vec> elements + */ + if ((n = (*in++)) < 1) + return (DDI_FAILURE); + + pdptr->par_nintr = n; + size = n * sizeof (struct intrspec); + new = pdptr->par_intr = kmem_zalloc(size, KM_SLEEP); + + /* XXX check for "interrupt-priorities" property... */ + if (ddi_getlongprop(DDI_DEV_T_ANY, child, DDI_PROP_DONTPASS, + "interrupt-priorities", (caddr_t)&got_prop, &got_len) + == DDI_PROP_SUCCESS) { + if (n != (got_len / sizeof (int))) { + cmn_err(CE_CONT, + "bad interrupt-priorities length" + " from %s%d: expected %d, got %d\n", + DEVI(child)->devi_name, + DEVI(child)->devi_instance, n, + (int)(got_len / sizeof (int))); + goto broken; + } + inpri = (int *)got_prop; + } + + while (n--) { + int level; + int vec = *in++; + + if (inpri == NULL) + level = 5; + else + level = *inpri++; + + if (level < 1 || level > MAXIPL || + vec < VEC_MIN || vec > VEC_MAX) { + cmn_err(CE_CONT, bad_intr_fmt, + DEVI(child)->devi_name, + DEVI(child)->devi_instance, level, vec); + goto broken; + } + new->intrspec_pri = level; + if (vec != 2) + new->intrspec_vec = vec; + else + /* + * irq 2 on the PC bus is tied to irq 9 + * on ISA, EISA and MicroChannel + */ + new->intrspec_vec = 9; + new++; + } + + if (inpri != NULL) + kmem_free(got_prop, got_len); + return (DDI_SUCCESS); + } + +broken: + kmem_free(pdptr->par_intr, size); + pdptr->par_intr = NULL; + pdptr->par_nintr = 0; + if (inpri != NULL) + kmem_free(got_prop, got_len); + + return (DDI_FAILURE); +} + +/* * Create a ddi_parent_private_data structure from the ddi properties of * the dev_info node. * @@ -517,8 +660,7 @@ make_ddi_ppd(dev_info_t *child, struct ddi_parent_private_data **ppd) *out = n / sizeof (int); bcopy(irupts_prop, out + 1, (size_t)n); ddi_prop_free((void *)irupts_prop); - if (ddi_ctlops(child, child, DDI_CTLOPS_XLATE_INTRS, - out, pdptr) != DDI_SUCCESS) { + if (impl_xlate_intrs(child, out, pdptr) != DDI_SUCCESS) { cmn_err(CE_CONT, "Unable to translate 'interrupts' for %s%d\n", DEVI(child)->devi_binding_name, @@ -661,16 +803,6 @@ static struct impl_bus_promops *impl_busp; */ /* - * i_ddi_handle_intr_ops: - */ -int -i_ddi_handle_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t op, - ddi_intr_handle_impl_t *hdlp, void * result) -{ - return (i_ddi_intr_ops(dip, rdip, op, hdlp, result)); -} - -/* * i_ddi_intr_ops: * * This is the interrupt operator function wrapper for the bus function diff --git a/usr/src/uts/sun4/io/ebus.c b/usr/src/uts/sun4/io/ebus.c index b474d12b27..9210fbdf0b 100644 --- a/usr/src/uts/sun4/io/ebus.c +++ b/usr/src/uts/sun4/io/ebus.c @@ -764,11 +764,10 @@ ebus_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, #ifdef DEBUG ebus_devstate_t *ebus_p = get_ebus_soft_state(ddi_get_instance(dip)); #endif - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; - int32_t i, max_children, max_device_types, len; - char *name_p, *device_type_p; + int32_t i, max_children, max_device_types, len; + char *name_p, *device_type_p; - DBG1(D_INTR, ebus_p, "ip 0x%p\n", ip); + DBG1(D_INTR, ebus_p, "ebus_p 0x%p\n", ebus_p); /* * NOTE: These ops below will never be supported in this nexus @@ -776,7 +775,7 @@ ebus_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, */ switch (intr_op) { case DDI_INTROP_GETCAP: - *(int *)result = 0; + *(int *)result = DDI_INTR_FLAG_LEVEL; return (DDI_SUCCESS); case DDI_INTROP_SETCAP: case DDI_INTROP_SETMASK: @@ -787,7 +786,7 @@ ebus_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, break; } - if ((intr_op == DDI_INTROP_SUPPORTED_TYPES) || ip->is_pil) + if ((intr_op == DDI_INTROP_SUPPORTED_TYPES) || hdlp->ih_pri) goto done; /* @@ -806,7 +805,7 @@ ebus_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, ebus_name_to_pil[i].string, ebus_name_to_pil[i].pil); - ip->is_pil = ebus_name_to_pil[i].pil; + hdlp->ih_pri = ebus_name_to_pil[i].pil; goto done; } } @@ -824,7 +823,7 @@ ebus_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, "PIL %d\n", ebus_device_type_to_pil[i]. string, ebus_device_type_to_pil[i].pil); - ip->is_pil = ebus_device_type_to_pil[i].pil; + hdlp->ih_pri = ebus_device_type_to_pil[i].pil; break; } } @@ -836,12 +835,13 @@ ebus_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, * If we get here, we need to set a default value * for the PIL. */ - if (ip->is_pil == 0) { - ip->is_pil = 1; + if (hdlp->ih_pri == 0) { + hdlp->ih_pri = 1; cmn_err(CE_WARN, "%s%d assigning default interrupt level %d " - "for device %s%d", ddi_get_name(dip), ddi_get_instance(dip), - ip->is_pil, ddi_get_name(rdip), ddi_get_instance(rdip)); + "for device %s%d", ddi_driver_name(dip), + ddi_get_instance(dip), hdlp->ih_pri, ddi_driver_name(rdip), + ddi_get_instance(rdip)); } done: diff --git a/usr/src/uts/sun4/io/px/px.c b/usr/src/uts/sun4/io/px/px.c index 7e94f8bf52..fc10e652d6 100644 --- a/usr/src/uts/sun4/io/px/px.c +++ b/usr/src/uts/sun4/io/px/px.c @@ -528,11 +528,11 @@ px_pwr_setup(dev_info_t *dip) pwr_p->pwr_func_lvl = PM_LEVEL_D0; mutex_init(&px_p->px_l23ready_lock, NULL, MUTEX_DRIVER, - (void *)(uintptr_t)px_pwr_pil); + DDI_INTR_PRI(px_pwr_pil)); cv_init(&px_p->px_l23ready_cv, NULL, CV_DRIVER, NULL); mutex_init(&px_p->px_lup_lock, NULL, MUTEX_DRIVER, - (void *)PX_ERR_PIL); + DDI_INTR_PRI(PX_ERR_PIL)); cv_init(&px_p->px_lup_cv, NULL, CV_DRIVER, NULL); if (ddi_get_soft_iblock_cookie(dip, DDI_SOFTINT_HIGH, @@ -540,8 +540,10 @@ px_pwr_setup(dev_info_t *dip) DBG(DBG_PWR, dip, "px_pwr_setup: couldn't get iblock cookie\n"); goto pwr_setup_err1; } + mutex_init(&px_p->px_lupsoft_lock, NULL, MUTEX_DRIVER, (void *)iblk_cookie); + if (ddi_add_softintr(dip, DDI_SOFTINT_HIGH, &px_p->px_lupsoft_id, NULL, NULL, px_lup_softintr, (caddr_t)px_p) != DDI_SUCCESS) { DBG(DBG_PWR, dip, "px_pwr_setup: couldn't add soft intr \n"); @@ -1149,11 +1151,9 @@ px_dma_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_dma_handle_t handle, * DDI_CTLOPS_INITCHILD see init_child() for details * DDI_CTLOPS_UNINITCHILD * DDI_CTLOPS_REPORTDEV see report_dev() for details - * DDI_CTLOPS_XLATE_INTRS nothing to do * DDI_CTLOPS_IOMIN cache line size if streaming otherwise 1 * DDI_CTLOPS_REGSIZE * DDI_CTLOPS_NREGS - * DDI_CTLOPS_NINTRS * DDI_CTLOPS_DVMAPAGESIZE * DDI_CTLOPS_POKE * DDI_CTLOPS_PEEK diff --git a/usr/src/uts/sun4/io/px/px_ib.c b/usr/src/uts/sun4/io/px/px_ib.c index 0897a817bb..53f123e80d 100644 --- a/usr/src/uts/sun4/io/px/px_ib.c +++ b/usr/src/uts/sun4/io/px/px_ib.c @@ -135,6 +135,7 @@ px_ib_intr_enable(px_t *px_p, cpuid_t cpu_id, devino_t ino) } PX_INTR_ENABLE(px_p->px_dip, sysino, cpu_id); + px_lib_intr_setstate(px_p->px_dip, sysino, INTR_IDLE_STATE); mutex_exit(&ib_p->ib_intr_lock); } diff --git a/usr/src/uts/sun4/io/px/px_ib.h b/usr/src/uts/sun4/io/px/px_ib.h index efc277de9f..d08a695e50 100644 --- a/usr/src/uts/sun4/io/px/px_ib.h +++ b/usr/src/uts/sun4/io/px/px_ib.h @@ -104,7 +104,6 @@ struct px_ib_ino_info { #define PX_INTR_ENABLE(dip, sysino, cpuid) \ (void) px_lib_intr_settarget(dip, sysino, cpuid); \ - (void) px_lib_intr_setstate(dip, sysino, INTR_IDLE_STATE); \ (void) px_lib_intr_setvalid(dip, sysino, INTR_VALID); #define PX_INTR_DISABLE(dip, sysino) \ diff --git a/usr/src/uts/sun4/io/px/px_intr.c b/usr/src/uts/sun4/io/px/px_intr.c index de5082362e..e311967cca 100644 --- a/usr/src/uts/sun4/io/px/px_intr.c +++ b/usr/src/uts/sun4/io/px/px_intr.c @@ -116,7 +116,7 @@ warn: extern uint64_t intr_get_time(void); /* - * px_intx_intr (legacy or intx interrupt handler) + * px_intx_intr (INTx or legacy interrupt handler) * * This routine is used as wrapper around interrupt handlers installed by child * device drivers. This routine invokes the driver interrupt handlers and @@ -206,7 +206,7 @@ px_intx_intr(caddr_t arg) } /* - * px_msiq_intr (MSI/MSIX/MSG interrupt handler) + * px_msiq_intr (MSI/X or PCIe MSG interrupt handler) * * This routine is used as wrapper around interrupt handlers installed by child * device drivers. This routine invokes the driver interrupt handlers and @@ -530,9 +530,8 @@ int px_intx_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, ddi_intr_handle_impl_t *hdlp, void *result) { - px_t *px_p = DIP_TO_STATE(dip); - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; - int ret = DDI_SUCCESS; + px_t *px_p = DIP_TO_STATE(dip); + int ret = DDI_SUCCESS; DBG(DBG_INTROPS, dip, "px_intx_ops: dip=%x rdip=%x intr_op=%x " "handle=%p\n", dip, rdip, intr_op, hdlp); @@ -551,29 +550,24 @@ px_intx_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, case DDI_INTROP_FREE: break; case DDI_INTROP_GETPRI: - *(int *)result = ip->is_pil ? - ip->is_pil : px_class_to_pil(rdip); + *(int *)result = hdlp->ih_pri ? + hdlp->ih_pri : px_class_to_pil(rdip); break; case DDI_INTROP_SETPRI: - ip->is_pil = (*(int *)result); break; case DDI_INTROP_ADDISR: - hdlp->ih_vector = *ip->is_intr; - ret = px_add_intx_intr(dip, rdip, hdlp); break; case DDI_INTROP_REMISR: - hdlp->ih_vector = *ip->is_intr; - ret = px_rem_intx_intr(dip, rdip, hdlp); break; case DDI_INTROP_ENABLE: ret = px_ib_update_intr_state(px_p, rdip, hdlp->ih_inum, - *ip->is_intr, PX_INTR_STATE_ENABLE); + hdlp->ih_vector, PX_INTR_STATE_ENABLE); break; case DDI_INTROP_DISABLE: ret = px_ib_update_intr_state(px_p, rdip, hdlp->ih_inum, - *ip->is_intr, PX_INTR_STATE_DISABLE); + hdlp->ih_vector, PX_INTR_STATE_DISABLE); break; case DDI_INTROP_SETMASK: ret = pci_intx_set_mask(rdip); @@ -881,6 +875,12 @@ px_create_intr_kstats(px_ih_t *ih_p) } } +/* + * px_add_intx_intr: + * + * This function is called to register INTx and legacy hardware + * interrupt pins interrupts. + */ int px_add_intx_intr(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp) @@ -987,6 +987,12 @@ fail1: return (ret); } +/* + * px_rem_intx_intr: + * + * This function is called to unregister INTx and legacy hardware + * interrupt pins interrupts. + */ int px_rem_intx_intr(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp) @@ -1031,12 +1037,7 @@ px_rem_intx_intr(dev_info_t *dip, dev_info_t *rdip, kmem_free(ino_p, sizeof (px_ib_ino_info_t)); } else { /* Re-enable interrupt only if mapping regsiter still shared */ - if ((ret = px_lib_intr_settarget(px_p->px_dip, - ino_p->ino_sysino, curr_cpu)) != DDI_SUCCESS) - goto fail; - - ret = px_lib_intr_setvalid(px_p->px_dip, ino_p->ino_sysino, - INTR_VALID); + PX_INTR_ENABLE(px_p->px_dip, ino_p->ino_sysino, curr_cpu); } fail: @@ -1044,6 +1045,11 @@ fail: return (ret); } +/* + * px_add_msiq_intr: + * + * This function is called to register MSI/Xs and PCIe message interrupts. + */ int px_add_msiq_intr(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp, msiq_rec_type_t rec_type, @@ -1162,6 +1168,11 @@ fail1: return (ret); } +/* + * px_rem_msiq_intr: + * + * This function is called to unregister MSI/Xs and PCIe message interrupts. + */ int px_rem_msiq_intr(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp, msiq_rec_type_t rec_type, @@ -1211,12 +1222,7 @@ px_rem_msiq_intr(dev_info_t *dip, dev_info_t *rdip, kmem_free(ino_p, sizeof (px_ib_ino_info_t)); } else { /* Re-enable interrupt only if mapping regsiter still shared */ - if ((ret = px_lib_intr_settarget(px_p->px_dip, - ino_p->ino_sysino, curr_cpu)) != DDI_SUCCESS) - goto fail; - - ret = px_lib_intr_setvalid(px_p->px_dip, ino_p->ino_sysino, - INTR_VALID); + PX_INTR_ENABLE(px_p->px_dip, ino_p->ino_sysino, curr_cpu); } fail: diff --git a/usr/src/uts/sun4/io/px/px_msi.c b/usr/src/uts/sun4/io/px/px_msi.c index fb386ace06..057f80d4a7 100644 --- a/usr/src/uts/sun4/io/px/px_msi.c +++ b/usr/src/uts/sun4/io/px/px_msi.c @@ -408,10 +408,10 @@ px_msi_get_props(px_t *px_p) * Reserve PCI MEM 32 resources to perform 32 bit MSI transactions. */ bzero((caddr_t)&request, sizeof (ndi_ra_request_t)); - request.ra_flags = (NDI_RA_ALLOC_BOUNDED | NDI_RA_ALLOC_PARTIAL_OK); + request.ra_flags = NDI_RA_ALLOC_BOUNDED; request.ra_boundbase = 0; - request.ra_boundlen = 0xFFFFFFFFUL; - request.ra_len = 0x10000; /* 64K bytes */ + request.ra_boundlen = PX_MSI_4GIG_LIMIT; + request.ra_len = PX_MSI_ADDR_LEN; request.ra_align_mask = 0; if (ndi_ra_alloc(dip, &request, &mem_answer, &mem_alen, @@ -430,12 +430,18 @@ px_msi_get_props(px_t *px_p) /* * Reserve PCI MEM 64 resources to perform 64 bit MSI transactions. + * + * NOTE: + * + * Currently OBP do not export any "available" property or range in + * the MEM64 space. Hence ndi_ra_alloc() request will return failure. + * So, for time being ignore this failure. */ bzero((caddr_t)&request, sizeof (ndi_ra_request_t)); - request.ra_flags = (NDI_RA_ALLOC_BOUNDED | NDI_RA_ALLOC_PARTIAL_OK); - request.ra_boundbase = 0; - request.ra_boundlen = 0xFFFFFFFFFFFFFFFFUL; - request.ra_len = 0x10000; /* 64K bytes */ + request.ra_flags = NDI_RA_ALLOC_BOUNDED; + request.ra_boundbase = PX_MSI_4GIG_LIMIT + 1; + request.ra_boundlen = PX_MSI_4GIG_LIMIT; + request.ra_len = PX_MSI_ADDR_LEN; request.ra_align_mask = 0; if (ndi_ra_alloc(dip, &request, &mem_answer, &mem_alen, @@ -443,7 +449,7 @@ px_msi_get_props(px_t *px_p) DBG(DBG_MSIQ, dip, "px_msi_getprops: Failed to allocate " "64KB mem\n"); - return (DDI_FAILURE); + return (DDI_SUCCESS); } msi_state_p->msi_addr64 = mem_answer; diff --git a/usr/src/uts/sun4/io/px/px_msi.h b/usr/src/uts/sun4/io/px/px_msi.h index ae813cdfa6..e1d09b7e1c 100644 --- a/usr/src/uts/sun4/io/px/px_msi.h +++ b/usr/src/uts/sun4/io/px/px_msi.h @@ -86,16 +86,19 @@ typedef struct px_msi_address_ranges { uint32_t msi_addr64_len; } px_msi_address_ranges_t; +#define PX_MSI_WIDTH 16 +#define PX_MSIX_WIDTH 32 + /* * Default MSI configurations */ #define PX_DEFAULT_MSI_CNT 256 #define PX_DEFAULT_MSI_1ST_MSINUM 0 #define PX_DEFAULT_MSI_DATA_MASK 0xff -#define PX_DEFAULT_MSI_DATA_WIDTH 16 +#define PX_DEFAULT_MSI_DATA_WIDTH PX_MSIX_WIDTH -#define PX_MSI_WIDTH 16 -#define PX_MSIX_WIDTH 32 +#define PX_MSI_4GIG_LIMIT 0xFFFFFFFFUL +#define PX_MSI_ADDR_LEN 0x10000 /* 64K bytes */ extern int px_msi_attach(px_t *px_p); extern void px_msi_detach(px_t *px_p); diff --git a/usr/src/uts/sun4/io/px/px_pci.c b/usr/src/uts/sun4/io/px/px_pci.c index cada2a11a1..c3f6ac5e0b 100644 --- a/usr/src/uts/sun4/io/px/px_pci.c +++ b/usr/src/uts/sun4/io/px/px_pci.c @@ -625,11 +625,10 @@ static int pxb_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, ddi_intr_handle_impl_t *hdlp, void *result) { - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; - dev_info_t *cdip = rdip; - pci_regspec_t *pci_rp; - int reglen, len; - uint32_t d, intr; + dev_info_t *cdip = rdip; + pci_regspec_t *pci_rp; + int reglen, len; + uint32_t d, intr; if (hdlp->ih_type != DDI_INTR_TYPE_FIXED) goto done; @@ -654,12 +653,12 @@ pxb_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, "reg", (caddr_t)&pci_rp, ®len) != DDI_SUCCESS) return (DDI_FAILURE); - intr = *ip->is_intr; + intr = hdlp->ih_vector; /* spin the interrupt */ d = PCI_REG_DEV_G(pci_rp[0].pci_phys_hi); if ((intr >= PCI_INTA) && (intr <= PCI_INTD)) - *ip->is_intr = ((intr - 1 + (d % 4)) % 4 + 1); + hdlp->ih_vector = ((intr - 1 + (d % 4)) % 4 + 1); else cmn_err(CE_WARN, "%s%d: %s: PCI intr=%x out of range", ddi_driver_name(rdip), ddi_get_instance(rdip), diff --git a/usr/src/uts/sun4/io/rootnex.c b/usr/src/uts/sun4/io/rootnex.c index 7199c853e1..efcccd5a25 100644 --- a/usr/src/uts/sun4/io/rootnex.c +++ b/usr/src/uts/sun4/io/rootnex.c @@ -88,7 +88,7 @@ int rootnex_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp); #pragma weak rootnex_remove_intr_impl -void rootnex_get_intr_pri(dev_info_t *dip, dev_info_t *rdip, +int rootnex_get_intr_pri(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp); #pragma weak rootnex_get_intr_pri @@ -645,8 +645,7 @@ static int rootnex_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, ddi_intr_handle_impl_t *hdlp, void *result) { - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; - int ret = DDI_SUCCESS; + int ret = DDI_SUCCESS; DPRINTF(ROOTNEX_INTR_DEBUG, ("rootnex_intr_ops: rdip=%s%d " "intr_op 0x%x hdlp 0x%p\n", ddi_driver_name(rdip), @@ -654,7 +653,7 @@ rootnex_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, switch (intr_op) { case DDI_INTROP_GETCAP: - *(int *)result = 0; + *(int *)result = DDI_INTR_FLAG_LEVEL; break; case DDI_INTROP_SETCAP: ret = DDI_ENOTSUP; @@ -665,11 +664,9 @@ rootnex_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, case DDI_INTROP_FREE: break; case DDI_INTROP_GETPRI: - rootnex_get_intr_pri(dip, rdip, hdlp); - *(int *)result = ip->is_pil; + *(int *)result = rootnex_get_intr_pri(dip, rdip, hdlp); break; case DDI_INTROP_SETPRI: - ip->is_pil = (*(int *)result); break; case DDI_INTROP_ADDISR: ret = rootnex_add_intr_impl(dip, rdip, hdlp); @@ -911,9 +908,12 @@ rootnex_ctlops(dev_info_t *dip, dev_info_t *rdip, return ((*pm_platform_power)((power_req_t *)arg)); } + case DDI_CTLOPS_RESERVED0: /* Was DDI_CTLOPS_NINTRS, obsolete */ case DDI_CTLOPS_RESERVED1: /* Was DDI_CTLOPS_POKE_INIT, obsolete */ case DDI_CTLOPS_RESERVED2: /* Was DDI_CTLOPS_POKE_FLUSH, obsolete */ case DDI_CTLOPS_RESERVED3: /* Was DDI_CTLOPS_POKE_FINI, obsolete */ + case DDI_CTLOPS_RESERVED4: /* Was DDI_CTLOPS_INTR_HILEVEL, obsolete */ + case DDI_CTLOPS_RESERVED5: /* Was DDI_CTLOPS_XLATE_INTRS, obsolete */ if (!reserved_msg_printed) { reserved_msg_printed = B_TRUE; cmn_err(CE_WARN, "Failing ddi_ctlops call(s) for " @@ -939,8 +939,6 @@ rootnex_ctlops(dev_info_t *dip, dev_info_t *rdip, if (ctlop == DDI_CTLOPS_NREGS) { ptr = (int *)result; *ptr = pdp->par_nreg; - } else if (ctlop == DDI_CTLOPS_NINTRS) { - return (DDI_FAILURE); } else { /* ctlop == DDI_CTLOPS_REGSIZE */ off_t *size = (off_t *)result; diff --git a/usr/src/uts/sun4/os/ddi_impl.c b/usr/src/uts/sun4/os/ddi_impl.c index 4ae424e12c..da2931ba5b 100644 --- a/usr/src/uts/sun4/os/ddi_impl.c +++ b/usr/src/uts/sun4/os/ddi_impl.c @@ -55,7 +55,7 @@ #include <sys/ddi_isa.h> dev_info_t *get_intr_parent(dev_info_t *, dev_info_t *, - ddi_ispec_t *, ddi_ispec_t **); + ddi_intr_handle_impl_t *); #pragma weak get_intr_parent int process_intr_ops(dev_info_t *, dev_info_t *, ddi_intr_op_t, @@ -394,48 +394,349 @@ cells_1275_cmp(prop_1275_cell_t *cell1, prop_1275_cell_t *cell2, int32_t len) } /* - * Wrapper functions used by New DDI interrupt framework. + * get_intr_parent() is a generic routine that process a 1275 interrupt + * map (imap) property. This function returns a dev_info_t structure + * which claims ownership of the interrupt domain. + * It also returns the new interrupt translation within this new domain. + * If an interrupt-parent or interrupt-map property are not found, + * then we fallback to using the device tree's parent. + * + * imap entry format: + * <reg>,<interrupt>,<phandle>,<translated interrupt> + * reg - The register specification in the interrupts domain + * interrupt - The interrupt specification + * phandle - PROM handle of the device that owns the xlated interrupt domain + * translated interrupt - interrupt specifier in the parents domain + * note: <reg>,<interrupt> - The reg and interrupt can be combined to create + * a unique entry called a unit interrupt specifier. + * + * Here's the processing steps: + * step1 - If the interrupt-parent property exists, create the ispec and + * return the dip of the interrupt parent. + * step2 - Extract the interrupt-map property and the interrupt-map-mask + * If these don't exist, just return the device tree parent. + * step3 - build up the unit interrupt specifier to match against the + * interrupt map property + * step4 - Scan the interrupt-map property until a match is found + * step4a - Extract the interrupt parent + * step4b - Compare the unit interrupt specifier */ +dev_info_t * +get_intr_parent(dev_info_t *pdip, dev_info_t *dip, ddi_intr_handle_impl_t *hdlp) +{ + prop_1275_cell_t *imap, *imap_mask, *scan, *reg_p, *match_req; + int32_t imap_sz, imap_cells, imap_scan_cells, imap_mask_sz, + addr_cells, intr_cells, reg_len, i, j; + int32_t match_found = 0; + dev_info_t *intr_parent_dip = NULL; + uint32_t *intr = &hdlp->ih_vector; + uint32_t nodeid; +#ifdef DEBUG + static int debug = 0; +#endif + + /* + * step1 + * If we have an interrupt-parent property, this property represents + * the nodeid of our interrupt parent. + */ + if ((nodeid = ddi_getprop(DDI_DEV_T_ANY, dip, 0, + "interrupt-parent", -1)) != -1) { + intr_parent_dip = e_ddi_nodeid_to_dip(nodeid); + ASSERT(intr_parent_dip); + + /* + * Attach the interrupt parent. + * + * N.B. e_ddi_nodeid_to_dip() isn't safe under DR. + * Also, interrupt parent isn't held. This needs + * to be revisited if DR-capable platforms implement + * interrupt redirection. + */ + if (i_ddi_attach_node_hierarchy(intr_parent_dip) + != DDI_SUCCESS) { + ndi_rele_devi(intr_parent_dip); + return (NULL); + } + + return (intr_parent_dip); + } + + /* + * step2 + * Get interrupt map structure from PROM property + */ + if (ddi_getlongprop(DDI_DEV_T_ANY, pdip, DDI_PROP_DONTPASS, + "interrupt-map", (caddr_t)&imap, &imap_sz) + != DDI_PROP_SUCCESS) { + /* + * If we don't have an imap property, default to using the + * device tree. + */ + + ndi_hold_devi(pdip); + return (pdip); + } + + /* Get the interrupt mask property */ + if (ddi_getlongprop(DDI_DEV_T_ANY, pdip, DDI_PROP_DONTPASS, + "interrupt-map-mask", (caddr_t)&imap_mask, &imap_mask_sz) + != DDI_PROP_SUCCESS) { + /* + * If we don't find this property, we have to fail the request + * because the 1275 imap property wasn't defined correctly. + */ + ASSERT(intr_parent_dip == NULL); + goto exit2; + } + + /* Get the address cell size */ + addr_cells = ddi_getprop(DDI_DEV_T_ANY, pdip, 0, + "#address-cells", 2); + + /* Get the interrupts cell size */ + intr_cells = ddi_getprop(DDI_DEV_T_ANY, pdip, 0, + "#interrupt-cells", 1); + + /* + * step3 + * Now lets build up the unit interrupt specifier e.g. reg,intr + * and apply the imap mask. match_req will hold this when we're + * through. + */ + if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, "reg", + (caddr_t)®_p, ®_len) != DDI_SUCCESS) { + ASSERT(intr_parent_dip == NULL); + goto exit3; + } + + match_req = kmem_alloc(CELLS_1275_TO_BYTES(addr_cells) + + CELLS_1275_TO_BYTES(intr_cells), KM_SLEEP); + + for (i = 0; i < addr_cells; i++) + match_req[i] = (reg_p[i] & imap_mask[i]); + + for (j = 0; j < intr_cells; i++, j++) + match_req[i] = (intr[j] & imap_mask[i]); + + /* Calculate the imap size in cells */ + imap_cells = BYTES_TO_1275_CELLS(imap_sz); + +#ifdef DEBUG + if (debug) + prom_printf("reg cell size 0x%x, intr cell size 0x%x, " + "match_request 0x%p, imap 0x%p\n", addr_cells, intr_cells, + match_req, imap); +#endif + + /* + * Scan the imap property looking for a match of the interrupt unit + * specifier. This loop is rather complex since the data within the + * imap property may vary in size. + */ + for (scan = imap, imap_scan_cells = i = 0; + imap_scan_cells < imap_cells; scan += i, imap_scan_cells += i) { + int new_intr_cells; + + /* Set the index to the nodeid field */ + i = addr_cells + intr_cells; + + /* + * step4a + * Translate the nodeid field to a dip + */ + ASSERT(intr_parent_dip == NULL); + intr_parent_dip = e_ddi_nodeid_to_dip((uint_t)scan[i++]); + + ASSERT(intr_parent_dip != 0); +#ifdef DEBUG + if (debug) + prom_printf("scan 0x%p\n", scan); +#endif + /* + * The tmp_dip describes the new domain, get it's interrupt + * cell size + */ + new_intr_cells = ddi_getprop(DDI_DEV_T_ANY, intr_parent_dip, 0, + "#interrupts-cells", 1); + + /* + * step4b + * See if we have a match on the interrupt unit specifier + */ + if (cells_1275_cmp(match_req, scan, addr_cells + intr_cells) + == 0) { + uint32_t *intr; + + match_found = 1; + + /* + * If we have an imap parent whose not in our device + * tree path, we need to hold and install that driver. + */ + if (i_ddi_attach_node_hierarchy(intr_parent_dip) + != DDI_SUCCESS) { + ndi_rele_devi(intr_parent_dip); + intr_parent_dip = (dev_info_t *)NULL; + goto exit4; + } + + /* + * We need to handcraft an ispec along with a bus + * interrupt value, so we can dup it into our + * standard ispec structure. + */ + /* Extract the translated interrupt information */ + intr = kmem_alloc( + CELLS_1275_TO_BYTES(new_intr_cells), KM_SLEEP); + + for (j = 0; j < new_intr_cells; j++, i++) + intr[j] = scan[i]; + + cells_1275_copy(intr, &hdlp->ih_vector, new_intr_cells); + + kmem_free(intr, CELLS_1275_TO_BYTES(new_intr_cells)); + +#ifdef DEBUG + if (debug) + prom_printf("dip 0x%p\n", intr_parent_dip); +#endif + break; + } else { +#ifdef DEBUG + if (debug) + prom_printf("dip 0x%p\n", intr_parent_dip); +#endif + ndi_rele_devi(intr_parent_dip); + intr_parent_dip = NULL; + i += new_intr_cells; + } + } + + /* + * If we haven't found our interrupt parent at this point, fallback + * to using the device tree. + */ + if (!match_found) { + ndi_hold_devi(pdip); + ASSERT(intr_parent_dip == NULL); + intr_parent_dip = pdip; + } + + ASSERT(intr_parent_dip != NULL); + +exit4: + kmem_free(reg_p, reg_len); + kmem_free(match_req, CELLS_1275_TO_BYTES(addr_cells) + + CELLS_1275_TO_BYTES(intr_cells)); + +exit3: + kmem_free(imap_mask, imap_mask_sz); + +exit2: + kmem_free(imap, imap_sz); + + return (intr_parent_dip); +} /* - * i_ddi_handle_intr_ops: + * process_intr_ops: + * + * Process the interrupt op via the interrupt parent. */ int -i_ddi_handle_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t op, +process_intr_ops(dev_info_t *pdip, dev_info_t *rdip, ddi_intr_op_t op, ddi_intr_handle_impl_t *hdlp, void *result) { - ddi_intrspec_t ispec; - int ret; + int ret = DDI_FAILURE; - if (hdlp->ih_type != DDI_INTR_TYPE_FIXED) - return (i_ddi_intr_ops(dip, rdip, op, hdlp, result)); + if (NEXUS_HAS_INTR_OP(pdip)) { + ret = (*(DEVI(pdip)->devi_ops->devo_bus_ops-> + bus_intr_op)) (pdip, rdip, op, hdlp, result); + } else { + cmn_err(CE_WARN, "Failed to process interrupt " + "for %s%d due to down-rev nexus driver %s%d", + ddi_get_name(rdip), ddi_get_instance(rdip), + ddi_get_name(pdip), ddi_get_instance(pdip)); + } - i_ddi_alloc_ispec(dip, hdlp->ih_inum, &ispec); - if ((ddi_ispec_t *)ispec == NULL) - return (DDI_FAILURE); + return (ret); +} - hdlp->ih_private = (void *)ispec; - ret = i_ddi_intr_ops(dip, rdip, op, hdlp, result); - hdlp->ih_private = NULL; +/*ARGSUSED*/ +uint_t +softlevel1(caddr_t arg) +{ + softint(); + return (1); +} - i_ddi_free_ispec(ispec); - return (ret); +/* + * indirection table, to save us some large switch statements + * NOTE: This must agree with "INTLEVEL_foo" constants in + * <sys/avintr.h> + */ +struct autovec *const vectorlist[] = { 0 }; + +/* + * This value is exported here for the functions in avintr.c + */ +const uint_t maxautovec = (sizeof (vectorlist) / sizeof (vectorlist[0])); + +/* + * Check for machine specific interrupt levels which cannot be reassigned by + * settrap(), sun4u version. + * + * sun4u does not support V8 SPARC "fast trap" handlers. + */ +/*ARGSUSED*/ +int +exclude_settrap(int lvl) +{ + return (1); } /* + * Check for machine specific interrupt levels which cannot have interrupt + * handlers added. We allow levels 1 through 15; level 0 is nonsense. + */ +/*ARGSUSED*/ +int +exclude_level(int lvl) +{ + return ((lvl < 1) || (lvl > 15)); +} + +/* + * Wrapper functions used by New DDI interrupt framework. + */ + +/* * i_ddi_intr_ops: */ int i_ddi_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t op, ddi_intr_handle_impl_t *hdlp, void *result) { - ddi_ispec_t *sav_ip, *ip = NULL; dev_info_t *pdip = ddi_get_parent(dip); int ret = DDI_FAILURE; + /* + * The following check is required to address + * one of the test case of ADDI test suite. + */ + if (pdip == NULL) + return (DDI_FAILURE); + if (hdlp->ih_type != DDI_INTR_TYPE_FIXED) return (process_intr_ops(pdip, rdip, op, hdlp, result)); + if (hdlp->ih_vector == 0) + hdlp->ih_vector = i_ddi_get_inum(rdip, hdlp->ih_inum); + + if (hdlp->ih_pri == 0) + hdlp->ih_pri = i_ddi_get_intr_pri(rdip, hdlp->ih_inum); + switch (op) { case DDI_INTROP_ADDISR: case DDI_INTROP_REMISR: @@ -443,18 +744,11 @@ i_ddi_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t op, case DDI_INTROP_DISABLE: case DDI_INTROP_BLOCKENABLE: case DDI_INTROP_BLOCKDISABLE: - /* Save the ispec */ - sav_ip = (ddi_ispec_t *)hdlp->ih_private; - /* - * If we have an ispec struct, try and determine our - * parent and possibly an interrupt translation. - * intr parent dip returned held + * Try and determine our parent and possibly an interrupt + * translation. intr parent dip returned held */ - if ((pdip = get_intr_parent(pdip, dip, sav_ip, &ip)) != NULL) { - /* Insert the interrupt info structure */ - hdlp->ih_private = (void *)ip; - } else + if ((pdip = get_intr_parent(pdip, dip, hdlp)) == NULL) goto done; } @@ -471,42 +765,9 @@ done: /* Release hold acquired in get_intr_parent() */ if (pdip) ndi_rele_devi(pdip); - - if (ip) { - /* Set the PIL according to what the parent did */ - sav_ip->is_pil = ip->is_pil; - - /* Free the stacked ispec structure */ - i_ddi_free_ispec((ddi_intrspec_t)ip); - } - - /* Restore the interrupt info */ - hdlp->ih_private = (void *)sav_ip; } - return (ret); -} - -/* - * process_intr_ops: - * - * Process the interrupt op via the interrupt parent. - */ -int -process_intr_ops(dev_info_t *pdip, dev_info_t *rdip, ddi_intr_op_t op, - ddi_intr_handle_impl_t *hdlp, void *result) -{ - int ret = DDI_FAILURE; - - if (NEXUS_HAS_INTR_OP(pdip)) { - ret = (*(DEVI(pdip)->devi_ops->devo_bus_ops-> - bus_intr_op)) (pdip, rdip, op, hdlp, result); - } else { - cmn_err(CE_WARN, "Failed to process interrupt " - "for %s%d due to down-rev nexus driver %s%d", - ddi_get_name(rdip), ddi_get_instance(rdip), - ddi_get_name(pdip), ddi_get_instance(pdip)); - } + hdlp->ih_vector = 0; return (ret); } @@ -548,6 +809,98 @@ i_ddi_rem_ivintr(ddi_intr_handle_impl_t *hdlp) } /* + * i_ddi_get_inum - Get the interrupt number property from the + * specified device. Note that this function is called only for + * the FIXED interrupt type. + */ +uint32_t +i_ddi_get_inum(dev_info_t *dip, uint_t inumber) +{ + int32_t intrlen, intr_cells, max_intrs; + prop_1275_cell_t *ip, intr_sz; + uint32_t intr = 0; + + if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS | + DDI_PROP_CANSLEEP, + "interrupts", (caddr_t)&ip, &intrlen) == DDI_SUCCESS) { + + intr_cells = ddi_getprop(DDI_DEV_T_ANY, dip, 0, + "#interrupt-cells", 1); + + /* adjust for number of bytes */ + intr_sz = CELLS_1275_TO_BYTES(intr_cells); + + /* Calculate the number of interrupts */ + max_intrs = intrlen / intr_sz; + + if (inumber < max_intrs) { + prop_1275_cell_t *intrp = ip; + + /* Index into interrupt property */ + intrp += (inumber * intr_cells); + + cells_1275_copy(intrp, &intr, intr_cells); + } + + kmem_free(ip, intrlen); + } + + return (intr); +} + +/* + * i_ddi_get_intr_pri - Get the interrupt-priorities property from + * the specified device. Note that this function is called only for + * the FIXED interrupt type. + */ +uint32_t +i_ddi_get_intr_pri(dev_info_t *dip, uint_t inumber) +{ + uint32_t *intr_prio_p; + uint32_t pri = 0; + int32_t i; + + /* + * Use the "interrupt-priorities" property to determine the + * the pil/ipl for the interrupt handler. + */ + if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, + "interrupt-priorities", (caddr_t)&intr_prio_p, + &i) == DDI_SUCCESS) { + if (inumber < (i / sizeof (int32_t))) + pri = intr_prio_p[inumber]; + kmem_free(intr_prio_p, i); + } + + return (pri); +} + +int +i_ddi_get_nintrs(dev_info_t *dip) +{ + int32_t intrlen; + prop_1275_cell_t intr_sz; + prop_1275_cell_t *ip; + int32_t ret = 0; + + if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS | + DDI_PROP_CANSLEEP, + "interrupts", (caddr_t)&ip, &intrlen) == DDI_SUCCESS) { + + intr_sz = ddi_getprop(DDI_DEV_T_ANY, dip, 0, + "#interrupt-cells", 1); + /* adjust for number of bytes */ + intr_sz = CELLS_1275_TO_BYTES(intr_sz); + + ret = intrlen / intr_sz; + + kmem_free(ip, intrlen); + } + + return (ret); +} + +/* * i_ddi_add_softint - allocate and add a soft interrupt to the system */ int @@ -574,8 +927,10 @@ i_ddi_remove_softint(ddi_softint_hdl_impl_t *hdlp) /* disable */ ASSERT(hdlp->ih_private != NULL); + /* use uintptr_t to suppress the gcc warning */ intr_id = (uint_t)(uintptr_t)hdlp->ih_private; + rem_softintr(intr_id); hdlp->ih_private = NULL; } @@ -618,96 +973,6 @@ i_ddi_set_softint_pri(ddi_softint_hdl_impl_t *hdlp, uint_t old_pri) } /* - * Support routine for allocating and initializing an interrupt specification. - * The bus interrupt value will be allocated at the end of this structure, so - * the corresponding routine i_ddi_free_ispec() should be used to free the - * interrupt specification. - */ -void -i_ddi_alloc_ispec(dev_info_t *dip, uint_t inumber, ddi_intrspec_t *intrspecp) -{ - int32_t intrlen, intr_cells, max_intrs; - prop_1275_cell_t *ip; - prop_1275_cell_t intr_sz; - ddi_ispec_t **ispecp = (ddi_ispec_t **)intrspecp; - - *ispecp = NULL; - if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS | - DDI_PROP_CANSLEEP, - "interrupts", (caddr_t)&ip, &intrlen) == DDI_SUCCESS) { - - intr_cells = ddi_getprop(DDI_DEV_T_ANY, dip, 0, - "#interrupt-cells", 1); - - /* adjust for number of bytes */ - intr_sz = CELLS_1275_TO_BYTES(intr_cells); - - /* Calculate the number of interrupts */ - max_intrs = intrlen / intr_sz; - - if (inumber < max_intrs) { - prop_1275_cell_t *intrp = ip; - - *ispecp = kmem_zalloc( - (sizeof (ddi_ispec_t) + intr_sz), KM_SLEEP); - - (*ispecp)->is_intr = - (uint32_t *)(*ispecp + 1); - - /* Index into interrupt property */ - intrp += (inumber * intr_cells); - - cells_1275_copy(intrp, - (*ispecp)->is_intr, intr_cells); - - (*ispecp)->is_intr_sz = intr_sz; - - (*ispecp)->is_pil = i_ddi_get_intr_pri(dip, inumber); - } - - kmem_free(ip, intrlen); - } -} - -/* - * Analog routine to i_ddi_alloc_ispec() used to free the interrupt - * specification and the associated bus interrupt value. - */ -void -i_ddi_free_ispec(ddi_intrspec_t intrspecp) -{ - ddi_ispec_t *ispecp = (ddi_ispec_t *)intrspecp; - - kmem_free(ispecp, sizeof (ddi_ispec_t) + (ispecp->is_intr_sz)); -} - -/* - * i_ddi_get_intr_pri - Get the interrupt-priorities property from - * the specified device. - */ -uint32_t -i_ddi_get_intr_pri(dev_info_t *dip, uint_t inumber) -{ - uint32_t *intr_prio_p; - uint32_t pri = 0; - int32_t i; - - /* - * Use the "interrupt-priorities" property to determine the - * the pil/ipl for the interrupt handler. - */ - if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, - "interrupt-priorities", (caddr_t)&intr_prio_p, - &i) == DDI_SUCCESS) { - if (inumber < (i / sizeof (int32_t))) - pri = intr_prio_p[inumber]; - kmem_free(intr_prio_p, i); - } - - return (pri); -} - -/* * SECTION: DDI Memory/DMA */ @@ -1369,379 +1634,6 @@ impl_fix_props(dev_info_t *dip, dev_info_t *ch_dip, char *name, int len, } /* - * SECTION: DDI Interrupt - */ - -/* - * get_intr_parent() is a generic routine that process a 1275 interrupt - * map (imap) property. This function returns a dev_info_t structure - * which claims ownership of the interrupt domain. - * It also returns the new interrupt translation within this new domain. - * If an interrupt-parent or interrupt-map property are not found, - * then we fallback to using the device tree's parent. - * - * imap entry format: - * <reg>,<interrupt>,<phandle>,<translated interrupt> - * reg - The register specification in the interrupts domain - * interrupt - The interrupt specification - * phandle - PROM handle of the device that owns the xlated interrupt domain - * translated interrupt - interrupt specifier in the parents domain - * note: <reg>,<interrupt> - The reg and interrupt can be combined to create - * a unique entry called a unit interrupt specifier. - * - * Here's the processing steps: - * step1 - If the interrupt-parent property exists, create the ispec and - * return the dip of the interrupt parent. - * step2 - Extract the interrupt-map property and the interrupt-map-mask - * If these don't exist, just return the device tree parent. - * step3 - build up the unit interrupt specifier to match against the - * interrupt map property - * step4 - Scan the interrupt-map property until a match is found - * step4a - Extract the interrupt parent - * step4b - Compare the unit interrupt specifier - */ -dev_info_t * -get_intr_parent(dev_info_t *pdip, dev_info_t *dip, - ddi_ispec_t *child_ispecp, ddi_ispec_t **new_ispecp) -{ - prop_1275_cell_t *imap, *imap_mask, *scan, *reg_p, *match_req; - int32_t imap_sz, imap_cells, imap_scan_cells, imap_mask_sz, - addr_cells, intr_cells, reg_len, i, j; - int32_t match_found = 0; - dev_info_t *intr_parent_dip = NULL; - ddi_ispec_t *ispecp; - uint32_t *intr = child_ispecp->is_intr; - uint32_t nodeid; - static ddi_ispec_t *dup_ispec(ddi_ispec_t *ispecp); -#ifdef DEBUG - static int debug = 0; -#endif - - *new_ispecp = (ddi_ispec_t *)NULL; - - /* - * step1 - * If we have an interrupt-parent property, this property represents - * the nodeid of our interrupt parent. - */ - if ((nodeid = ddi_getprop(DDI_DEV_T_ANY, dip, 0, - "interrupt-parent", -1)) != -1) { - intr_parent_dip = e_ddi_nodeid_to_dip(nodeid); - ASSERT(intr_parent_dip); - /* - * Attach the interrupt parent. - * - * N.B. e_ddi_nodeid_to_dip() isn't safe under DR. - * Also, interrupt parent isn't held. This needs - * to be revisited if DR-capable platforms implement - * interrupt redirection. - */ - if (i_ddi_attach_node_hierarchy(intr_parent_dip) - != DDI_SUCCESS) { - ndi_rele_devi(intr_parent_dip); - return (NULL); - } - - /* Create a new interrupt info struct and initialize it. */ - ispecp = dup_ispec(child_ispecp); - - *new_ispecp = ispecp; - return (intr_parent_dip); - } - - /* - * step2 - * Get interrupt map structure from PROM property - */ - if (ddi_getlongprop(DDI_DEV_T_ANY, pdip, DDI_PROP_DONTPASS, - "interrupt-map", (caddr_t)&imap, &imap_sz) - != DDI_PROP_SUCCESS) { - /* - * If we don't have an imap property, default to using the - * device tree. - */ - /* Create a new interrupt info struct and initialize it. */ - ispecp = dup_ispec(child_ispecp); - - *new_ispecp = ispecp; - ndi_hold_devi(pdip); - return (pdip); - } - - /* Get the interrupt mask property */ - if (ddi_getlongprop(DDI_DEV_T_ANY, pdip, DDI_PROP_DONTPASS, - "interrupt-map-mask", (caddr_t)&imap_mask, &imap_mask_sz) - != DDI_PROP_SUCCESS) { - /* - * If we don't find this property, we have to fail the request - * because the 1275 imap property wasn't defined correctly. - */ - ASSERT(intr_parent_dip == NULL); - goto exit2; - } - - /* Get the address cell size */ - addr_cells = ddi_getprop(DDI_DEV_T_ANY, pdip, 0, - "#address-cells", 2); - - /* Get the interrupts cell size */ - intr_cells = ddi_getprop(DDI_DEV_T_ANY, pdip, 0, - "#interrupt-cells", 1); - - /* - * step3 - * Now lets build up the unit interrupt specifier e.g. reg,intr - * and apply the imap mask. match_req will hold this when we're - * through. - */ - if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, "reg", - (caddr_t)®_p, ®_len) != DDI_SUCCESS) { - ASSERT(intr_parent_dip == NULL); - goto exit3; - } - - match_req = kmem_alloc(CELLS_1275_TO_BYTES(addr_cells) + - CELLS_1275_TO_BYTES(intr_cells), KM_SLEEP); - - for (i = 0; i < addr_cells; i++) - match_req[i] = (reg_p[i] & imap_mask[i]); - - for (j = 0; j < intr_cells; i++, j++) - match_req[i] = (intr[j] & imap_mask[i]); - - /* Calculate the imap size in cells */ - imap_cells = BYTES_TO_1275_CELLS(imap_sz); - -#ifdef DEBUG - if (debug) - prom_printf("reg cell size 0x%x, intr cell size 0x%x, " - "match_request 0x%p, imap 0x%p\n", addr_cells, intr_cells, - match_req, imap); -#endif - - /* - * Scan the imap property looking for a match of the interrupt unit - * specifier. This loop is rather complex since the data within the - * imap property may vary in size. - */ - for (scan = imap, imap_scan_cells = i = 0; - imap_scan_cells < imap_cells; scan += i, imap_scan_cells += i) { - int new_intr_cells; - - /* Set the index to the nodeid field */ - i = addr_cells + intr_cells; - - /* - * step4a - * Translate the nodeid field to a dip - */ - ASSERT(intr_parent_dip == NULL); - intr_parent_dip = e_ddi_nodeid_to_dip((uint_t)scan[i++]); - - ASSERT(intr_parent_dip != 0); -#ifdef DEBUG - if (debug) - prom_printf("scan 0x%p\n", scan); -#endif - /* - * The tmp_dip describes the new domain, get it's interrupt - * cell size - */ - new_intr_cells = ddi_getprop(DDI_DEV_T_ANY, intr_parent_dip, 0, - "#interrupts-cells", 1); - - /* - * step4b - * See if we have a match on the interrupt unit specifier - */ - if (cells_1275_cmp(match_req, scan, addr_cells + intr_cells) - == 0) { - ddi_ispec_t ispec; - uint32_t *intr; - - /* - * Copy The childs ispec info excluding the interrupt - */ - ispec = *child_ispecp; - - match_found = 1; - - /* - * If we have an imap parent whose not in our device - * tree path, we need to hold and install that driver. - */ - if (i_ddi_attach_node_hierarchy(intr_parent_dip) - != DDI_SUCCESS) { - ndi_rele_devi(intr_parent_dip); - intr_parent_dip = (dev_info_t *)NULL; - goto exit4; - } - - /* - * We need to handcraft an ispec along with a bus - * interrupt value, so we can dup it into our - * standard ispec structure. - */ - /* Extract the translated interrupt information */ - intr = kmem_alloc( - CELLS_1275_TO_BYTES(new_intr_cells), KM_SLEEP); - - for (j = 0; j < new_intr_cells; j++, i++) - intr[j] = scan[i]; - - ispec.is_intr_sz = - CELLS_1275_TO_BYTES(new_intr_cells); - ispec.is_intr = intr; - - ispecp = dup_ispec(&ispec); - - kmem_free(intr, CELLS_1275_TO_BYTES(new_intr_cells)); - -#ifdef DEBUG - if (debug) - prom_printf("dip 0x%p, intr info 0x%p\n", - intr_parent_dip, ispecp); -#endif - - break; - } else { -#ifdef DEBUG - if (debug) - prom_printf("dip 0x%p\n", intr_parent_dip); -#endif - ndi_rele_devi(intr_parent_dip); - intr_parent_dip = NULL; - i += new_intr_cells; - } - } - - /* - * If we haven't found our interrupt parent at this point, fallback - * to using the device tree. - */ - if (!match_found) { - /* Create a new interrupt info struct and initialize it. */ - ispecp = dup_ispec(child_ispecp); - - ndi_hold_devi(pdip); - ASSERT(intr_parent_dip == NULL); - intr_parent_dip = pdip; - } - - ASSERT(ispecp != NULL); - ASSERT(intr_parent_dip != NULL); - *new_ispecp = ispecp; - -exit4: - kmem_free(reg_p, reg_len); - kmem_free(match_req, CELLS_1275_TO_BYTES(addr_cells) + - CELLS_1275_TO_BYTES(intr_cells)); - -exit3: - kmem_free(imap_mask, imap_mask_sz); - -exit2: - kmem_free(imap, imap_sz); - - return (intr_parent_dip); -} - -/* - * Support routine for duplicating and initializing an interrupt specification. - * The bus interrupt value will be allocated at the end of this structure, so - * the corresponding routine i_ddi_free_ispec() should be used to free the - * interrupt specification. - */ -static ddi_ispec_t * -dup_ispec(ddi_ispec_t *ispecp) -{ - ddi_ispec_t *new_ispecp; - - new_ispecp = kmem_alloc(sizeof (ddi_ispec_t) + ispecp->is_intr_sz, - KM_SLEEP); - - /* Copy the contents of the ispec */ - *new_ispecp = *ispecp; - - /* Reset the intr pointer to the one just created */ - new_ispecp->is_intr = (uint32_t *)(new_ispecp + 1); - - cells_1275_copy(ispecp->is_intr, new_ispecp->is_intr, - BYTES_TO_1275_CELLS(ispecp->is_intr_sz)); - - return (new_ispecp); -} - -int -i_ddi_get_nintrs(dev_info_t *dip) -{ - int32_t intrlen; - prop_1275_cell_t intr_sz; - prop_1275_cell_t *ip; - int32_t ret = 0; - - if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS | - DDI_PROP_CANSLEEP, - "interrupts", (caddr_t)&ip, &intrlen) == DDI_SUCCESS) { - - intr_sz = ddi_getprop(DDI_DEV_T_ANY, dip, 0, - "#interrupt-cells", 1); - /* adjust for number of bytes */ - intr_sz = CELLS_1275_TO_BYTES(intr_sz); - - ret = intrlen / intr_sz; - - kmem_free(ip, intrlen); - } - - return (ret); -} - -/*ARGSUSED*/ -uint_t -softlevel1(caddr_t arg) -{ - softint(); - return (1); -} - -/* - * indirection table, to save us some large switch statements - * NOTE: This must agree with "INTLEVEL_foo" constants in - * <sys/avintr.h> - */ -struct autovec *const vectorlist[] = { 0 }; - -/* - * This value is exported here for the functions in avintr.c - */ -const uint_t maxautovec = (sizeof (vectorlist) / sizeof (vectorlist[0])); - -/* - * Check for machine specific interrupt levels which cannot be reassigned by - * settrap(), sun4u version. - * - * sun4u does not support V8 SPARC "fast trap" handlers. - */ -/*ARGSUSED*/ -int -exclude_settrap(int lvl) -{ - return (1); -} - -/* - * Check for machine specific interrupt levels which cannot have interrupt - * handlers added. We allow levels 1 through 15; level 0 is nonsense. - */ -/*ARGSUSED*/ -int -exclude_level(int lvl) -{ - return ((lvl < 1) || (lvl > 15)); -} - -/* * The following functions ready a cautious request to go up to the nexus * driver. It is up to the nexus driver to decide how to process the request. * It may choose to call i_ddi_do_caut_get/put in this file, or do it diff --git a/usr/src/uts/sun4/sys/ddi_subrdefs.h b/usr/src/uts/sun4/sys/ddi_subrdefs.h index ec9f4ce904..d90a955f81 100644 --- a/usr/src/uts/sun4/sys/ddi_subrdefs.h +++ b/usr/src/uts/sun4/sys/ddi_subrdefs.h @@ -35,7 +35,6 @@ #include <sys/ddi.h> #include <sys/sunddi.h> -#include <sys/nexusintr_impl.h> #ifdef __cplusplus extern "C" { @@ -43,11 +42,9 @@ extern "C" { #ifdef _KERNEL +uint32_t i_ddi_get_inum(dev_info_t *dip, uint_t inumber); uint32_t i_ddi_get_intr_pri(dev_info_t *dip, uint_t inumber); - -void i_ddi_alloc_ispec(dev_info_t *dip, uint_t inumber, - ddi_intrspec_t *ispecp); -void i_ddi_free_ispec(ddi_intrspec_t ispecp); +int i_ddi_get_nintrs(dev_info_t *dip); int i_ddi_add_ivintr(ddi_intr_handle_impl_t *hdlp); void i_ddi_rem_ivintr(ddi_intr_handle_impl_t *hdlp); diff --git a/usr/src/uts/sun4/sys/nexusintr_impl.h b/usr/src/uts/sun4/sys/nexusintr_impl.h deleted file mode 100644 index a23250a326..0000000000 --- a/usr/src/uts/sun4/sys/nexusintr_impl.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_NEXUSINTR_IMPL_H -#define _SYS_NEXUSINTR_IMPL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/dditypes.h> - -/* This is a sun4 specific interrupt specification structure (ispec) */ -typedef struct ddi_ispec { - uint32_t *is_intr; /* Interrupt spec at a given bus node */ - int32_t is_intr_sz; /* Size in bytes of interrupt spec */ - uint32_t is_pil; /* Hint of the PIL for this interrupt spec */ -} ddi_ispec_t; - -/* This is a soft interrupt specification */ -typedef struct ddi_softispec { - dev_info_t *sis_rdip; /* Interrupt requestors dip */ - uint32_t sis_softint_id; /* Soft interrupt id */ - uint32_t sis_pil; /* Hint of the PIL for this interrupt spec */ -} ddi_softispec_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_NEXUSINTR_IMPL_H */ diff --git a/usr/src/uts/sun4u/io/i2c/nexus/pcf8584.c b/usr/src/uts/sun4u/io/i2c/nexus/pcf8584.c index 56f07636a9..a5554eeac2 100644 --- a/usr/src/uts/sun4u/io/i2c/nexus/pcf8584.c +++ b/usr/src/uts/sun4u/io/i2c/nexus/pcf8584.c @@ -583,8 +583,6 @@ pcf8584_bus_ctl(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t op, case DDI_CTLOPS_PTOB: case DDI_CTLOPS_BTOP: case DDI_CTLOPS_BTOPR: - case DDI_CTLOPS_INTR_HILEVEL: - case DDI_CTLOPS_XLATE_INTRS: case DDI_CTLOPS_DVMAPAGESIZE: return (DDI_FAILURE); diff --git a/usr/src/uts/sun4u/io/i2c/nexus/smbus.c b/usr/src/uts/sun4u/io/i2c/nexus/smbus.c index 5f787d5974..2cd081bdb4 100644 --- a/usr/src/uts/sun4u/io/i2c/nexus/smbus.c +++ b/usr/src/uts/sun4u/io/i2c/nexus/smbus.c @@ -477,8 +477,6 @@ smbus_bus_ctl(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t op, case DDI_CTLOPS_PTOB: case DDI_CTLOPS_BTOP: case DDI_CTLOPS_BTOPR: - case DDI_CTLOPS_INTR_HILEVEL: - case DDI_CTLOPS_XLATE_INTRS: case DDI_CTLOPS_DVMAPAGESIZE: return (DDI_FAILURE); diff --git a/usr/src/uts/sun4u/io/mach_rootnex.c b/usr/src/uts/sun4u/io/mach_rootnex.c index dfec28126a..2563b01621 100644 --- a/usr/src/uts/sun4u/io/mach_rootnex.c +++ b/usr/src/uts/sun4u/io/mach_rootnex.c @@ -62,7 +62,7 @@ int rootnex_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp); -void +int rootnex_get_intr_pri(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp); @@ -76,7 +76,6 @@ int rootnex_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp) { - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; volatile uint64_t *intr_mapping_reg; volatile uint64_t mondo_vector; int32_t r_upaid = -1; @@ -90,15 +89,14 @@ rootnex_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, "upa-interrupt-slave", 0) != 0) { /* Give slave devices pri of 5. e.g. fb's */ - ip->is_pil = 5; - hdlp->ih_pri = ip->is_pil; + hdlp->ih_pri = 5; } /* * Translate the interrupt property by stuffing in the * portid for those devices which have a upa-portid. */ - *ip->is_intr |= (UPAID_TO_IGN(upa_portid) << 6); + hdlp->ih_vector |= (UPAID_TO_IGN(upa_portid) << 6); } /* @@ -122,7 +120,6 @@ rootnex_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, return (DDI_FAILURE); } - hdlp->ih_vector = *ip->is_intr; if ((ret = i_ddi_add_ivintr(hdlp)) != DDI_SUCCESS) return (ret); @@ -139,7 +136,7 @@ rootnex_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, * running under load. */ mondo_vector = cpu0.cpu_id << IMR_TID_SHIFT; - mondo_vector |= (IMR_VALID | (uint64_t)*ip->is_intr); + mondo_vector |= (IMR_VALID | (uint64_t)hdlp->ih_vector); /* Set the mapping register */ *intr_mapping_reg = mondo_vector; @@ -159,7 +156,6 @@ int rootnex_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp) { - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; int32_t upa_portid; int len; @@ -169,7 +165,7 @@ rootnex_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, * Translate the interrupt property by stuffing in the * portid for those devices which have a upa-portid. */ - *ip->is_intr |= (UPAID_TO_IGN(upa_portid) << 6); + hdlp->ih_vector |= (UPAID_TO_IGN(upa_portid) << 6); } /* @@ -203,7 +199,6 @@ rootnex_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, } } - hdlp->ih_vector = *ip->is_intr; i_ddi_rem_ivintr(hdlp); return (DDI_SUCCESS); @@ -213,11 +208,11 @@ rootnex_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, * rootnex_get_intr_pri: */ /*ARGSUSED*/ -void +int rootnex_get_intr_pri(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp) { - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; + int pri = hdlp->ih_pri; if (ddi_prop_get_int(DDI_DEV_T_ANY, rdip, DDI_PROP_DONTPASS, "upa-portid", -1) != -1) { @@ -225,9 +220,11 @@ rootnex_get_intr_pri(dev_info_t *dip, dev_info_t *rdip, "upa-interrupt-slave", 0) != 0) { /* Give slave devices pri of 5. e.g. fb's */ - ip->is_pil = 5; + pri = 5; } } + + return (pri); } int diff --git a/usr/src/uts/sun4u/io/pci/db21554.c b/usr/src/uts/sun4u/io/pci/db21554.c index aa761a72cb..941b4fa86f 100644 --- a/usr/src/uts/sun4u/io/pci/db21554.c +++ b/usr/src/uts/sun4u/io/pci/db21554.c @@ -2062,7 +2062,7 @@ char *db_ctlop_name[] = { "DDI_CTLOPS_REPORTINT", "DDI_CTLOPS_REGSIZE", "DDI_CTLOPS_NREGS", - "DDI_CTLOPS_NINTRS", + "DDI_CTLOPS_RESERVED0", "DDI_CTLOPS_SIDDEV", "DDI_CTLOPS_SLAVEONLY", "DDI_CTLOPS_AFFINITY", @@ -2073,8 +2073,8 @@ char *db_ctlop_name[] = { "DDI_CTLOPS_RESERVED1", "DDI_CTLOPS_RESERVED2", "DDI_CTLOPS_RESERVED3", - "DDI_CTLOPS_INTR_HILEVEL", - "DDI_CTLOPS_XLATE_INTRS", + "DDI_CTLOPS_RESERVED4", + "DDI_CTLOPS_RESERVED5", "DDI_CTLOPS_DVMAPAGESIZE", "DDI_CTLOPS_POWER", "DDI_CTLOPS_ATTACH", @@ -2143,7 +2143,6 @@ static int db_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, ddi_intr_handle_impl_t *hdlp, void *result) { - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; dev_info_t *cdip = rdip; pci_regspec_t *pci_rp; int reglen, len; @@ -2175,20 +2174,20 @@ db_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, "reg", (caddr_t)&pci_rp, ®len) != DDI_SUCCESS) return (DDI_FAILURE); - intr = *ip->is_intr; + intr = hdlp->ih_vector; /* Spin the interrupt */ d = PCI_REG_DEV_G(pci_rp[0].pci_phys_hi); if ((intr >= PCI_INTA) && (intr <= PCI_INTD)) - *ip->is_intr = ((intr - 1 + (d % 4)) % 4 + 1); + hdlp->ih_vector = ((intr - 1 + (d % 4)) % 4 + 1); else cmn_err(CE_WARN, "%s#%d: %s: PCI intr=%x out of range", ddi_driver_name(rdip), ddi_get_instance(rdip), ddi_driver_name(dip), intr); DB_DEBUG3(DB_INTR_OPS, dip, "intr=%d, d=%d, is_intr=%d\n", - intr, d, *ip->is_intr); + intr, d, hdlp->ih_vector); kmem_free(pci_rp, reglen); diff --git a/usr/src/uts/sun4u/io/pci/pci.c b/usr/src/uts/sun4u/io/pci/pci.c index da7ff40b14..3e813546d1 100644 --- a/usr/src/uts/sun4u/io/pci/pci.c +++ b/usr/src/uts/sun4u/io/pci/pci.c @@ -1240,11 +1240,9 @@ get_reg_set_size(dev_info_t *child, int rnumber) * DDI_CTLOPS_INITCHILD see init_child() for details * DDI_CTLOPS_UNINITCHILD * DDI_CTLOPS_REPORTDEV see report_dev() for details - * DDI_CTLOPS_XLATE_INTRS nothing to do * DDI_CTLOPS_IOMIN cache line size if streaming otherwise 1 * DDI_CTLOPS_REGSIZE * DDI_CTLOPS_NREGS - * DDI_CTLOPS_NINTRS * DDI_CTLOPS_DVMAPAGESIZE * DDI_CTLOPS_POKE * DDI_CTLOPS_PEEK @@ -1333,7 +1331,6 @@ pci_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, { pci_t *pci_p = get_pci_soft_state( ddi_get_instance(dip)); - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; int ret = DDI_SUCCESS; switch (intr_op) { @@ -1350,20 +1347,15 @@ pci_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, case DDI_INTROP_FREE: break; case DDI_INTROP_GETPRI: - *(int *)result = ip->is_pil ? - ip->is_pil : pci_class_to_pil(rdip); + *(int *)result = hdlp->ih_pri ? + hdlp->ih_pri : pci_class_to_pil(rdip); break; case DDI_INTROP_SETPRI: - ip->is_pil = (*(int *)result); break; case DDI_INTROP_ADDISR: - hdlp->ih_vector = *ip->is_intr; - ret = pci_add_intr(dip, rdip, hdlp); break; case DDI_INTROP_REMISR: - hdlp->ih_vector = *ip->is_intr; - ret = pci_remove_intr(dip, rdip, hdlp); break; case DDI_INTROP_ENABLE: diff --git a/usr/src/uts/sun4u/io/pci/pci_ib.c b/usr/src/uts/sun4u/io/pci/pci_ib.c index 3a17c742c3..df9771ba85 100644 --- a/usr/src/uts/sun4u/io/pci/pci_ib.c +++ b/usr/src/uts/sun4u/io/pci/pci_ib.c @@ -775,7 +775,6 @@ ib_update_intr_state(pci_t *pci_p, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp, uint_t new_intr_state) { ib_t *ib_p = pci_p->pci_ib_p; - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; ib_ino_info_t *ino_p; ib_mondo_t mondo; ih_t *ih_p; @@ -784,7 +783,7 @@ ib_update_intr_state(pci_t *pci_p, dev_info_t *rdip, mutex_enter(&ib_p->ib_ino_lst_mutex); if ((mondo = pci_xlate_intr(pci_p->pci_dip, rdip, pci_p->pci_ib_p, - IB_MONDO_TO_INO(*ip->is_intr))) == 0) { + IB_MONDO_TO_INO(hdlp->ih_vector))) == 0) { mutex_exit(&ib_p->ib_ino_lst_mutex); return (ret); } diff --git a/usr/src/uts/sun4u/io/pci/pci_pci.c b/usr/src/uts/sun4u/io/pci/pci_pci.c index 37d0795ef8..2bd052f2b0 100644 --- a/usr/src/uts/sun4u/io/pci/pci_pci.c +++ b/usr/src/uts/sun4u/io/pci/pci_pci.c @@ -630,11 +630,10 @@ static int ppb_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, ddi_intr_handle_impl_t *hdlp, void *result) { - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; - dev_info_t *cdip = rdip; - pci_regspec_t *pci_rp; - int reglen, len; - uint32_t d, intr; + dev_info_t *cdip = rdip; + pci_regspec_t *pci_rp; + int reglen, len; + uint32_t d, intr; if (hdlp->ih_type != DDI_INTR_TYPE_FIXED) goto done; @@ -659,13 +658,13 @@ ppb_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, "reg", (caddr_t)&pci_rp, ®len) != DDI_SUCCESS) return (DDI_FAILURE); - intr = *ip->is_intr; + intr = hdlp->ih_vector; /* Spin the interrupt */ d = PCI_REG_DEV_G(pci_rp[0].pci_phys_hi); if ((intr >= PCI_INTA) && (intr <= PCI_INTD)) - *ip->is_intr = ((intr - 1 + (d % 4)) % 4 + 1); + hdlp->ih_vector = ((intr - 1 + (d % 4)) % 4 + 1); else cmn_err(CE_WARN, "%s%d: %s: PCI intr=%x out of range", ddi_driver_name(rdip), ddi_get_instance(rdip), diff --git a/usr/src/uts/sun4u/io/pci/pcipsy.c b/usr/src/uts/sun4u/io/pci/pcipsy.c index a655f0e170..a486d3623d 100644 --- a/usr/src/uts/sun4u/io/pci/pcipsy.c +++ b/usr/src/uts/sun4u/io/pci/pcipsy.c @@ -1978,8 +1978,6 @@ pci_thermal_rem_intr(dev_info_t *rdip, uint_t inum) { pci_t *pci_p; dev_info_t *pdip; - ddi_intrspec_t ispec; - ddi_ispec_t *ip; uint32_t dev_mondo, pci_mondo; int instance; @@ -1997,10 +1995,8 @@ pci_thermal_rem_intr(dev_info_t *rdip, uint_t inum) pci_p = get_pci_soft_state(instance); /* Calculate the requesting device's mondo */ - i_ddi_alloc_ispec(rdip, inum, &ispec); - ip = (ddi_ispec_t *)ispec; dev_mondo = pci_xlate_intr(pci_p->pci_dip, rdip, pci_p->pci_ib_p, - IB_MONDO_TO_INO(*ip->is_intr)); + IB_MONDO_TO_INO(i_ddi_get_inum(rdip, inum))); /* get pci's thermal mondo */ pci_mondo = ((pci_p->pci_cb_p->cb_ign << PCI_INO_BITS) | @@ -2013,6 +2009,4 @@ pci_thermal_rem_intr(dev_info_t *rdip, uint_t inum) ddi_get_instance(rdip)); rem_ivintr(pci_mondo, NULL); } - - i_ddi_free_ispec(ispec); } diff --git a/usr/src/uts/sun4u/io/pci/simba.c b/usr/src/uts/sun4u/io/pci/simba.c index 65d26cc84f..ec02e6b3bf 100644 --- a/usr/src/uts/sun4u/io/pci/simba.c +++ b/usr/src/uts/sun4u/io/pci/simba.c @@ -564,7 +564,7 @@ static char *ops[] = "DDI_CTLOPS_REPORTINT", "DDI_CTLOPS_REGSIZE", "DDI_CTLOPS_NREGS", - "DDI_CTLOPS_NINTRS", + "DDI_CTLOPS_RESERVED0", "DDI_CTLOPS_SIDDEV", "DDI_CTLOPS_SLAVEONLY", "DDI_CTLOPS_AFFINITY", @@ -575,8 +575,8 @@ static char *ops[] = "DDI_CTLOPS_RESERVED1", "DDI_CTLOPS_RESERVED2", "DDI_CTLOPS_RESERVED3", - "DDI_CTLOPS_INTR_HILEVEL", - "DDI_CTLOPS_XLATE_INTRS", + "DDI_CTLOPS_RESERVED4", + "DDI_CTLOPS_RESERVED5", "DDI_CTLOPS_DVMAPAGESIZE", "DDI_CTLOPS_POWER", "DDI_CTLOPS_ATTACH", diff --git a/usr/src/uts/sun4u/io/px/px_err.c b/usr/src/uts/sun4u/io/px/px_err.c index 36b9410d64..59bb8611d2 100644 --- a/usr/src/uts/sun4u/io/px/px_err.c +++ b/usr/src/uts/sun4u/io/px/px_err.c @@ -639,11 +639,12 @@ px_err_reg_disable(px_t *px_p, px_err_id_t id) { px_err_reg_desc_t *reg_desc = &px_err_reg_tbl[id]; caddr_t csr_base; + pxu_t *pxu_p = (pxu_t *)px_p->px_plat_p; if (id == PX_ERR_JBC) - csr_base = (caddr_t)(uintptr_t)px_p->px_inos[PX_INTR_XBC]; + csr_base = (caddr_t)(uintptr_t)pxu_p->px_address[PX_REG_XBC]; else - csr_base = (caddr_t)(uintptr_t)px_p->px_inos[PX_INTR_PEC]; + csr_base = (caddr_t)(uintptr_t)pxu_p->px_address[PX_REG_CSR]; reg_desc->enabled = B_FALSE; diff --git a/usr/src/uts/sun4u/io/sbbc.c b/usr/src/uts/sun4u/io/sbbc.c index 9b8dce1142..08a0aa9367 100644 --- a/usr/src/uts/sun4u/io/sbbc.c +++ b/usr/src/uts/sun4u/io/sbbc.c @@ -39,7 +39,6 @@ #include <sys/ddi_impldefs.h> #include <sys/ddi_subrdefs.h> #include <sys/pci.h> -#include <sys/nexusintr_impl.h> #include <sys/pci/pci_nexus.h> #include <sys/autoconf.h> #include <sys/cmn_err.h> @@ -617,12 +616,11 @@ static int sbbc_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, ddi_intr_handle_impl_t *hdlp, void *result) { - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; - int ret = DDI_SUCCESS; + int ret = DDI_SUCCESS; switch (intr_op) { case DDI_INTROP_GETCAP: - *(int *)result = 0; + *(int *)result = DDI_INTR_FLAG_LEVEL; break; case DDI_INTROP_ALLOC: *(int *)result = hdlp->ih_scratch1; @@ -630,16 +628,17 @@ sbbc_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, case DDI_INTROP_FREE: break; case DDI_INTROP_GETPRI: - if (ip->is_pil == 0) { - ip->is_pil = 0x1; + if (hdlp->ih_pri == 0) { + hdlp->ih_pri = 0x1; cmn_err(CE_WARN, "%s%d assigning default interrupt " - "level %d for device %s%d", ddi_get_name(dip), - ddi_get_instance(dip), ip->is_pil, - ddi_get_name(rdip), ddi_get_instance(rdip)); + "level %d for device %s%d", ddi_driver_name(dip), + ddi_get_instance(dip), hdlp->ih_pri, + ddi_driver_name(rdip), ddi_get_instance(rdip)); } - *(int *)result = ip->is_pil; + *(int *)result = hdlp->ih_pri; + break; case DDI_INTROP_ADDISR: ret = sbbc_add_intr_impl(dip, rdip, intr_op, hdlp, result); diff --git a/usr/src/uts/sun4u/io/sysiosbus.c b/usr/src/uts/sun4u/io/sysiosbus.c index ee47cb84a0..3f6297da67 100644 --- a/usr/src/uts/sun4u/io/sysiosbus.c +++ b/usr/src/uts/sun4u/io/sysiosbus.c @@ -218,8 +218,8 @@ sbus_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, ddi_intr_handle_impl_t *hdlp, void *result); static int -sbus_xlate_intrs(dev_info_t *dip, dev_info_t *rdip, ddi_ispec_t *ispecp, - int32_t ign); +sbus_xlate_intrs(dev_info_t *dip, dev_info_t *rdip, uint32_t *intr, + uint32_t *pil, int32_t ign); static int sbus_attach(dev_info_t *devi, ddi_attach_cmd_t cmd); @@ -1491,8 +1491,7 @@ sbus_ctlops(dev_info_t *dip, dev_info_t *rdip, } for (i = 0, n = i_ddi_get_nintrs(rdip); i < n; i++) { - ddi_ispec_t *ispecp; - uint32_t sbuslevel, pri; + uint32_t sbuslevel, inum, pri; if (i != 0) { f_len += snprintf(msgbuf + len, @@ -1500,15 +1499,11 @@ sbus_ctlops(dev_info_t *dip, dev_info_t *rdip, len = strlen(msgbuf); } - i_ddi_alloc_ispec(rdip, i, - (ddi_intrspec_t *)&ispecp); + sbuslevel = inum = i_ddi_get_inum(rdip, i); + pri = i_ddi_get_intr_pri(rdip, i); - sbuslevel = *ispecp->is_intr; - - (void) sbus_xlate_intrs(dip, rdip, ispecp, - softsp->intr_mapping_ign); - - pri = ispecp->is_pil; + (void) sbus_xlate_intrs(dip, rdip, &inum, + &pri, softsp->intr_mapping_ign); if (sbuslevel > MAX_SBUS_LEVEL) f_len += snprintf(msgbuf + len, @@ -1523,8 +1518,6 @@ sbus_ctlops(dev_info_t *dip, dev_info_t *rdip, f_len += snprintf(msgbuf + len, REPORTDEV_BUFSIZE - len, "sparc9 ipl %d", pri); len = strlen(msgbuf); - - i_ddi_free_ispec((ddi_intrspec_t)ispecp); } #ifdef DEBUG if (f_len + 1 >= REPORTDEV_BUFSIZE) { @@ -1689,7 +1682,6 @@ sbus_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, { struct sbus_soft_state *softsp = (struct sbus_soft_state *) ddi_get_soft_state(sbusp, ddi_get_instance(dip)); - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; volatile uint64_t *mondo_vec_reg; volatile uint64_t tmp_mondo_vec; volatile uint64_t *intr_state_reg; @@ -1713,19 +1705,19 @@ sbus_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, } DPRINTF(SBUS_INTERRUPT_DEBUG, ("Add intr: sbus interrupt %d " - "for device %s%d\n", hdlp->ih_vector, ddi_get_name(rdip), + "for device %s%d\n", hdlp->ih_vector, ddi_driver_name(rdip), ddi_get_instance(rdip))); /* Xlate the interrupt */ - if (sbus_xlate_intrs(dip, rdip, ip, - softsp->intr_mapping_ign) == DDI_FAILURE) { + if (sbus_xlate_intrs(dip, rdip, (uint32_t *)&hdlp->ih_vector, + &hdlp->ih_pri, softsp->intr_mapping_ign) == DDI_FAILURE) { cmn_err(CE_WARN, "Can't xlate SBUS devices %s interrupt.\n", - ddi_get_name(rdip)); + ddi_driver_name(rdip)); return (DDI_FAILURE); } /* get the ino number */ - ino = (*ip->is_intr) & SBUS_MAX_INO; + ino = hdlp->ih_vector & SBUS_MAX_INO; mondo_vec_reg = (softsp->intr_mapping_reg + ino_table[ino]->mapping_reg); @@ -1752,7 +1744,7 @@ sbus_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, intr_handler->inum = hdlp->ih_inum; DPRINTF(SBUS_INTERRUPT_DEBUG, ("Add intr: xlated interrupt 0x%x " - "intr_handler 0x%x\n", *ip->is_intr, intr_handler)); + "intr_handler 0x%x\n", hdlp->ih_vector, intr_handler)); /* * Grab this lock here. So it will protect the poll list. @@ -1798,8 +1790,6 @@ sbus_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, sbus_arg->softsp = softsp; sbus_arg->handler_list = intr_handler; - hdlp->ih_vector = *ip->is_intr; - /* * No handler added yet in the interrupt vector * table for this ino. @@ -1934,7 +1924,6 @@ sbus_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, #endif /* !lint */ struct sbus_soft_state *softsp = (struct sbus_soft_state *) ddi_get_soft_state(sbusp, ddi_get_instance(dip)); - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; int start_bit, ino, slot; struct sbus_wrapper_arg *sbus_arg; @@ -1942,14 +1931,14 @@ sbus_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, mutex_enter(&softsp->intr_poll_list_lock); /* Xlate the interrupt */ - if (sbus_xlate_intrs(dip, rdip, ip, - softsp->intr_mapping_ign) == DDI_FAILURE) { + if (sbus_xlate_intrs(dip, rdip, (uint32_t *)&hdlp->ih_vector, + &hdlp->ih_pri, softsp->intr_mapping_ign) == DDI_FAILURE) { cmn_err(CE_WARN, "Can't xlate SBUS devices %s interrupt.\n", - ddi_get_name(rdip)); + ddi_driver_name(rdip)); goto done; } - ino = ((int32_t)*ip->is_intr) & SBUS_MAX_INO; + ino = ((int32_t)hdlp->ih_vector) & SBUS_MAX_INO; mondo_vec_reg = (softsp->intr_mapping_reg + ino_table[ino]->mapping_reg); @@ -1987,17 +1976,15 @@ sbus_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, DPRINTF(SBUS_INTERRUPT_DEBUG, ("Rem intr: Softsp 0x%x, Mondo 0x%x, " "ino 0x%x, sbus_arg 0x%x intr cntr %d\n", softsp, - *ip->is_intr, ino, sbus_arg, softsp->intr_hndlr_cnt[slot])); + hdlp->ih_vector, ino, sbus_arg, softsp->intr_hndlr_cnt[slot])); ASSERT(sbus_arg != NULL); ASSERT(sbus_arg->handler_list != NULL); sbus_free_handler(rdip, hdlp->ih_inum, sbus_arg); /* If we still have a list, we're done. */ - if (sbus_arg->handler_list == NULL) { - hdlp->ih_vector = *ip->is_intr; + if (sbus_arg->handler_list == NULL) i_ddi_rem_ivintr(hdlp); - } /* * If other devices are still installed for this slot, we need to @@ -2039,10 +2026,10 @@ done: * Translate the sbus levels or mondos into sysiointrspecs. */ static int -sbus_xlate_intrs(dev_info_t *dip, dev_info_t *rdip, ddi_ispec_t *ispecp, - int32_t ign) +sbus_xlate_intrs(dev_info_t *dip, dev_info_t *rdip, uint32_t *intr, + uint32_t *pil, int32_t ign) { - uint32_t ino, slot, level = *ispecp->is_intr; + uint32_t ino, slot, level = *intr; int ret = DDI_SUCCESS; /* @@ -2059,14 +2046,14 @@ sbus_xlate_intrs(dev_info_t *dip, dev_info_t *rdip, ddi_ispec_t *ispecp, /* Construct ino from slot and interrupts */ if ((slot = find_sbus_slot(dip, rdip)) == -1) { cmn_err(CE_WARN, "Can't determine sbus slot " - "of %s device\n", ddi_get_name(rdip)); + "of %s device\n", ddi_driver_name(rdip)); ret = DDI_FAILURE; goto done; } if (slot >= MAX_SBUS_SLOT_ADDR) { cmn_err(CE_WARN, "Invalid sbus slot 0x%x" - "in %s device\n", slot, ddi_get_name(rdip)); + "in %s device\n", slot, ddi_driver_name(rdip)); ret = DDI_FAILURE; goto done; } @@ -2088,29 +2075,28 @@ sbus_xlate_intrs(dev_info_t *dip, dev_info_t *rdip, ddi_ispec_t *ispecp, goto done; } - if (ispecp->is_pil == 0) { + if (*pil == 0) { #define SOC_PRIORITY 5 /* The sunfire i/o board has a soc in the printer slot */ if ((ino_table[ino]->clear_reg == PP_CLEAR) && ((strcmp(ddi_get_name(rdip), "soc") == 0) || (strcmp(ddi_get_name(rdip), "SUNW,soc") == 0))) { - ispecp->is_pil = SOC_PRIORITY; + *pil = SOC_PRIORITY; } else { /* Figure out the pil associated with this interrupt */ - ispecp->is_pil = interrupt_priorities[ino]; + *pil = interrupt_priorities[ino]; } } /* Or in the upa_id into the interrupt group number field */ - *ispecp->is_intr = (uint32_t)(ino | ign); + *intr = (uint32_t)(ino | ign); DPRINTF(SBUS_INTERRUPT_DEBUG, ("Xlate intr: Interrupt info for " "device %s Mondo: 0x%x, ino: 0x%x, Pil: 0x%x, sbus level: 0x%x\n", - ddi_get_name(rdip), *ispecp->is_intr, ino, ispecp->is_pil, level)); + ddi_driver_name(rdip), *intr, ino, *pil, level)); done: return (ret); - } /* new intr_ops structure */ @@ -2120,13 +2106,12 @@ sbus_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, { struct sbus_soft_state *softsp = (struct sbus_soft_state *) ddi_get_soft_state(sbusp, ddi_get_instance(dip)); - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; int ret = DDI_SUCCESS; switch (intr_op) { case DDI_INTROP_GETCAP: - *(int *)result = 0; + *(int *)result = DDI_INTR_FLAG_LEVEL; break; case DDI_INTROP_ALLOC: *(int *)result = hdlp->ih_scratch1; @@ -2134,23 +2119,21 @@ sbus_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, case DDI_INTROP_FREE: break; case DDI_INTROP_GETPRI: - if (ip->is_pil == 0) { + if (hdlp->ih_vector == 0) { /* Xlate the interrupt */ (void) sbus_xlate_intrs(dip, rdip, - ip, softsp->intr_mapping_ign); + (uint32_t *)&hdlp->ih_vector, &hdlp->ih_pri, + softsp->intr_mapping_ign); } - *(int *)result = ip->is_pil; + *(int *)result = hdlp->ih_pri; break; case DDI_INTROP_SETPRI: - ip->is_pil = (*(int *)result); break; case DDI_INTROP_ADDISR: - hdlp->ih_vector = *ip->is_intr; ret = sbus_add_intr_impl(dip, rdip, hdlp); break; case DDI_INTROP_REMISR: - hdlp->ih_vector = *ip->is_intr; sbus_remove_intr_impl(dip, rdip, hdlp); break; case DDI_INTROP_ENABLE: @@ -2619,17 +2602,16 @@ sbus_update_intr_state(dev_info_t *dip, dev_info_t *rdip, int ino; struct sbus_wrapper_arg *sbus_arg; struct sbus_intr_handler *intr_handler; - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; /* Xlate the interrupt */ - if (sbus_xlate_intrs(dip, rdip, ip, - softsp->intr_mapping_ign) == DDI_FAILURE) { + if (sbus_xlate_intrs(dip, rdip, (uint32_t *)&hdlp->ih_vector, + &hdlp->ih_pri, softsp->intr_mapping_ign) == DDI_FAILURE) { cmn_err(CE_WARN, "sbus_update_intr_state() can't xlate SBUS " - "devices %s interrupt.", ddi_get_name(rdip)); + "devices %s interrupt.", ddi_driver_name(rdip)); return (DDI_FAILURE); } - ino = ((int32_t)*ip->is_intr) & SBUS_MAX_INO; + ino = ((int32_t)hdlp->ih_vector) & SBUS_MAX_INO; sbus_arg = softsp->intr_list[ino]; ASSERT(sbus_arg != NULL); diff --git a/usr/src/uts/sun4u/io/upa64s.c b/usr/src/uts/sun4u/io/upa64s.c index 1f122af7a0..98c6914863 100644 --- a/usr/src/uts/sun4u/io/upa64s.c +++ b/usr/src/uts/sun4u/io/upa64s.c @@ -574,13 +574,13 @@ upa64s_map(dev_info_t *dip, dev_info_t *rdip, ddi_map_req_t *mp, #define UPA_BASE_INO 0x2a static int -upa64s_xlate_intr(dev_info_t *rdip, int32_t safariport, ddi_ispec_t *ispecp) +upa64s_xlate_intr(dev_info_t *rdip, int32_t safariport, uint32_t *intr) { uint32_t ino = UPA_BASE_INO; int32_t portid; /* Clear the ffb's interrupts property, it's meaningless */ - *ispecp->is_intr = 0; + *intr = 0; if ((portid = ddi_getprop(DDI_DEV_T_ANY, rdip, DDI_PROP_DONTPASS, "upa-portid", -1)) == -1) @@ -588,11 +588,11 @@ upa64s_xlate_intr(dev_info_t *rdip, int32_t safariport, ddi_ispec_t *ispecp) ino += portid; - *ispecp->is_intr = UPA64S_MAKE_MONDO(safariport, ino); + *intr = UPA64S_MAKE_MONDO(safariport, ino); DBG5(D_A_ISPEC, rdip, "upa64s_xlate_intr: rdip=%s%d: upa portid %d " "ino=%x mondo 0x%x\n", ddi_get_name(rdip), ddi_get_instance(rdip), - portid, ino, *ispecp->is_intr); + portid, ino, *intr); return (portid); } @@ -610,18 +610,18 @@ upa64s_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, uint_t (*int_handler)(caddr_t, caddr_t) = hdlp->ih_cb_func; caddr_t int_handler_arg1 = hdlp->ih_cb_arg1; #endif /* DEBUG */ - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; uint_t cpu_id; volatile uint64_t imr_data; - upaport = upa64s_xlate_intr(rdip, upa64s_p->safari_id, ip); + upaport = upa64s_xlate_intr(rdip, upa64s_p->safari_id, + (uint32_t *)&hdlp->ih_vector); - if (*ip->is_intr == 0) + if (hdlp->ih_vector == 0) return (DDI_FAILURE); DBG3(D_A_ISPEC, dip, "rdip=%s%d - IDDI_INTR_TYPE_NORMAL, mondo=%x\n", - ddi_get_name(rdip), ddi_get_instance(rdip), *ip->is_intr); + ddi_driver_name(rdip), ddi_get_instance(rdip), hdlp->ih_vector); /* * Make sure an interrupt handler isn't already installed. @@ -637,7 +637,6 @@ upa64s_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, DBG2(D_A_ISPEC, dip, "i_ddi_add_ivintr: hdlr=%p arg=%p\n", int_handler, int_handler_arg1); #endif - hdlp->ih_vector = *ip->is_intr; if (i_ddi_add_ivintr(hdlp) != DDI_SUCCESS) return (DDI_FAILURE); @@ -657,7 +656,7 @@ upa64s_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, imr_data = ddi_get64(upa64s_p->imr_ah[upaport], upa64s_p->imr[upaport]); upa64s_p->ino_state[upaport] = INO_INUSE; - DBG(D_A_ISPEC, dip, "add_intrspec success!\n"); + DBG(D_A_ISPEC, dip, "add_intr success!\n"); return (DDI_SUCCESS); } @@ -671,7 +670,6 @@ upa64s_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, { upa64s_devstate_t *upa64s_p = get_upa64s_soft_state(ddi_get_instance(dip)); - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; int upaport; #ifndef lint volatile uint64_t tmp; @@ -680,21 +678,21 @@ upa64s_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, /* * Make sure the mondo is valid. */ - upaport = upa64s_xlate_intr(rdip, upa64s_p->safari_id, ip); + upaport = upa64s_xlate_intr(rdip, upa64s_p->safari_id, + (uint32_t *)&hdlp->ih_vector); - if (*ip->is_intr == 0) + if (hdlp->ih_vector == 0) return (DDI_FAILURE); DBG3(D_R_ISPEC, dip, "rdip=%s%d - IDDI_INTR_TYPE_NORMAL, mondo=%x\n", - ddi_get_name(rdip), ddi_get_instance(rdip), *ip->is_intr); + ddi_driver_name(rdip), ddi_get_instance(rdip), hdlp->ih_vector); if (upa64s_p->ino_state[upaport] != INO_INUSE) { return (DDI_FAILURE); } /* Call up to our parent to handle the removal */ - hdlp->ih_vector = *ip->is_intr; i_ddi_rem_ivintr(hdlp); ddi_put64(upa64s_p->imr_ah[upaport], upa64s_p->imr[upaport], 0); @@ -713,12 +711,11 @@ static int upa64_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, ddi_intr_handle_impl_t *hdlp, void *result) { - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; - int ret = DDI_SUCCESS; + int ret = DDI_SUCCESS; switch (intr_op) { case DDI_INTROP_GETCAP: - *(int *)result = 0; + *(int *)result = DDI_INTR_FLAG_EDGE; break; case DDI_INTROP_ALLOC: *(int *)result = hdlp->ih_scratch1; @@ -732,19 +729,14 @@ upa64_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, * had their PILs set to 5. Only do it if the PIL is not * being preset. */ - *(int *)result = ip->is_pil ? ip->is_pil : 5; + *(int *)result = hdlp->ih_pri ? hdlp->ih_pri : 5; break; case DDI_INTROP_SETPRI: - ip->is_pil = (*(int *)result); break; case DDI_INTROP_ADDISR: - hdlp->ih_vector = *ip->is_intr; - ret = upa64s_add_intr_impl(dip, rdip, hdlp); break; case DDI_INTROP_REMISR: - hdlp->ih_vector = *ip->is_intr; - ret = upa64s_remove_intr_impl(dip, rdip, hdlp); break; case DDI_INTROP_ENABLE: @@ -786,10 +778,8 @@ extern void prom_printf(const char *, ...); * DDI_CTLOPS_INITCHILD see init_child() for details * DDI_CTLOPS_UNINITCHILD * DDI_CTLOPS_REPORTDEV see report_dev() for details - * DDI_CTLOPS_XLATE_INTRS nothing to do * DDI_CTLOPS_REGSIZE * DDI_CTLOPS_NREGS - * DDI_CTLOPS_NINTRS * * All others passed to parent. */ @@ -821,9 +811,6 @@ upa64s_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_get_name(rdip), ddi_get_instance(rdip)); return (report_dev(rdip)); - case DDI_CTLOPS_XLATE_INTRS: - return (DDI_FAILURE); - case DDI_CTLOPS_REGSIZE: DBG2(D_CTLOPS, dip, "DDI_CTLOPS_REGSIZE: rdip=%s%d\n", ddi_get_name(rdip), ddi_get_instance(rdip)); @@ -835,9 +822,6 @@ upa64s_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_get_name(rdip), ddi_get_instance(rdip)); *((uint_t *)result) = get_nreg_set(rdip); return (DDI_SUCCESS); - - case DDI_CTLOPS_NINTRS: - return (DDI_FAILURE); } /* diff --git a/usr/src/uts/sun4u/io/wrsm/wrsm_intr.c b/usr/src/uts/sun4u/io/wrsm/wrsm_intr.c index 15937d041c..f4c21b99de 100644 --- a/usr/src/uts/sun4u/io/wrsm/wrsm_intr.c +++ b/usr/src/uts/sun4u/io/wrsm/wrsm_intr.c @@ -44,7 +44,6 @@ #include <sys/param.h> #include <sys/sysconf.h> #include <sys/machsystm.h> -#include <sys/nexusintr_impl.h> #include <sys/errno.h> #include <sys/ivintr.h> #include <sys/promif.h> diff --git a/usr/src/uts/sun4u/sys/Makefile b/usr/src/uts/sun4u/sys/Makefile index b4936fa561..2ba0d40f93 100644 --- a/usr/src/uts/sun4u/sys/Makefile +++ b/usr/src/uts/sun4u/sys/Makefile @@ -58,7 +58,6 @@ SUN4_HDRS= \ memnode.h \ memtestio.h \ nexusdebug.h \ - nexusintr_impl.h \ prom_debug.h \ scb.h \ sun4asi.h \ diff --git a/usr/src/uts/sun4u/sys/sysiosbus.h b/usr/src/uts/sun4u/sys/sysiosbus.h index d72c1c0aa3..22a21bc5e2 100644 --- a/usr/src/uts/sun4u/sys/sysiosbus.h +++ b/usr/src/uts/sun4u/sys/sysiosbus.h @@ -374,7 +374,6 @@ struct sysio_parent_private_data { int par_nreg; /* number of regs */ struct regspec *par_reg; /* array of regs */ int par_nintr; /* number of interrupts */ - struct sysiointrspec *par_intr; /* array of possible interrupts */ int par_nrng; /* number of ranges */ struct rangespec *par_rng; /* array of ranges */ uint_t slot; /* Slot number, on this sbus */ diff --git a/usr/src/uts/sun4v/io/mach_rootnex.c b/usr/src/uts/sun4v/io/mach_rootnex.c index 0daec86d97..3a31aeb474 100644 --- a/usr/src/uts/sun4v/io/mach_rootnex.c +++ b/usr/src/uts/sun4v/io/mach_rootnex.c @@ -68,7 +68,7 @@ int rootnex_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp); -void +int rootnex_get_intr_pri(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp); @@ -82,10 +82,6 @@ int rootnex_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp) { - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; - - hdlp->ih_vector = *ip->is_intr; - return (i_ddi_add_ivintr(hdlp)); } @@ -97,9 +93,6 @@ int rootnex_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp) { - ddi_ispec_t *ip = (ddi_ispec_t *)hdlp->ih_private; - - hdlp->ih_vector = *ip->is_intr; i_ddi_rem_ivintr(hdlp); return (DDI_SUCCESS); @@ -109,10 +102,11 @@ rootnex_remove_intr_impl(dev_info_t *dip, dev_info_t *rdip, * rootnex_get_intr_pri: */ /*ARGSUSED*/ -void +int rootnex_get_intr_pri(dev_info_t *dip, dev_info_t *rdip, ddi_intr_handle_impl_t *hdlp) { + return (hdlp->ih_pri); } int diff --git a/usr/src/uts/sun4v/io/vnex.c b/usr/src/uts/sun4v/io/vnex.c index 3c2367e090..388ddd2f59 100644 --- a/usr/src/uts/sun4v/io/vnex.c +++ b/usr/src/uts/sun4v/io/vnex.c @@ -36,7 +36,6 @@ #include <sys/ddi.h> #include <sys/sunddi.h> #include <sys/ddi_subrdefs.h> -#include <sys/nexusintr_impl.h> #include <sys/promif.h> #include <sys/machsystm.h> #include <sys/ddi_intr_impl.h> @@ -344,15 +343,12 @@ vnex_ctl(dev_info_t *dip, dev_info_t *rdip, kmem_free((caddr_t)vnex_regspec, reglen); return (DDI_SUCCESS); } - case DDI_CTLOPS_NINTRS: case DDI_CTLOPS_SIDDEV: case DDI_CTLOPS_SLAVEONLY: case DDI_CTLOPS_AFFINITY: case DDI_CTLOPS_IOMIN: case DDI_CTLOPS_POKE: case DDI_CTLOPS_PEEK: - case DDI_CTLOPS_INTR_HILEVEL: - case DDI_CTLOPS_XLATE_INTRS: cmn_err(CE_CONT, "%s%d: invalid op (%d) from %s%d\n", ddi_get_name(dip), ddi_get_instance(dip), ctlop, ddi_get_name(rdip), ddi_get_instance(rdip)); @@ -514,39 +510,33 @@ static int vnex_intr_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, ddi_intr_handle_impl_t *hdlp, void *result) { - ddi_ispec_t *ispecp = (ddi_ispec_t *)hdlp->ih_private; - int ret = DDI_SUCCESS; + int ret = DDI_SUCCESS; switch (intr_op) { case DDI_INTROP_GETCAP: - *(int *)result = 0; + *(int *)result = DDI_INTR_FLAG_LEVEL; break; case DDI_INTROP_ALLOC: *(int *)result = hdlp->ih_scratch1; break; case DDI_INTROP_GETPRI: - *(int *)result = ispecp->is_pil ? - ispecp->is_pil : vnex_get_pil(rdip); + *(int *)result = hdlp->ih_pri ? + hdlp->ih_pri : vnex_get_pil(rdip); break; case DDI_INTROP_FREE: break; case DDI_INTROP_SETPRI: - ispecp->is_pil = (*(int *)result); break; case DDI_INTROP_ADDISR: - hdlp->ih_vector = *ispecp->is_intr; ret = vnex_add_intr(dip, rdip, hdlp); break; case DDI_INTROP_REMISR: - hdlp->ih_vector = *ispecp->is_intr; ret = vnex_remove_intr(rdip, hdlp); break; case DDI_INTROP_ENABLE: - hdlp->ih_vector = *ispecp->is_intr; ret = vnex_enable_intr(rdip, hdlp); break; case DDI_INTROP_DISABLE: - hdlp->ih_vector = *ispecp->is_intr; ret = vnex_disable_intr(rdip, hdlp); break; case DDI_INTROP_NINTRS: diff --git a/usr/src/uts/sun4v/sys/Makefile b/usr/src/uts/sun4v/sys/Makefile index a7c8c57314..a8a0834a3b 100644 --- a/usr/src/uts/sun4v/sys/Makefile +++ b/usr/src/uts/sun4v/sys/Makefile @@ -58,7 +58,6 @@ SUN4_HDRS= \ memnode.h \ memtestio.h \ nexusdebug.h \ - nexusintr_impl.h \ prom_debug.h \ scb.h \ sun4asi.h \ |