Lines Matching refs:hsc
49 #include <sys/hsc.h>
130 * hsc-slot-map="/pci@1f,0/pci@1/pci@1","15","2",
139 * hsc-slot-map="/pci@1f,0/pci@1/pci@1","8","1"
194 hsc_state_t *hsc;
256 hsc = hsp->hsc;
257 hsc->hsp_last = hsp;
299 hsc_state_t *hsc;
338 hsc = hsp->hsc;
339 if (hsc->hsp_last == hsp)
340 hsc->hsp_last = NULL;
357 (scsb_enable_enum(hsp->hsc) == DDI_SUCCESS)) {
375 (scsb_disable_enum(hsp->hsc, SCSB_HSC_FORCE_REMOVE)
519 hsc_state_t *hsc = hsp->hsc;
537 if ((hsc->state & HSC_ATTACHED) == HSC_ATTACHED &&
552 if (hsc->hsp_last == hsp)
553 hsc->hsp_last = NULL;
564 if (((hsc->state & HSC_ENUM_ENABLED) &&
566 (((hsc->state & HSC_ENUM_ENABLED) != HSC_ENUM_ENABLED) &&
603 hsc->regDone == B_FALSE &&
604 scsb_hsc_numReg < hsc->n_registered_occupants) {
611 if (((hsc->state & HSC_ATTACHED) == HSC_ATTACHED) &&
612 (scsb_hsc_numReg == hsc->n_registered_occupants)) {
613 hsc->regDone = B_TRUE;
614 if (hsc->hotswap_mode == HSC_HOTSWAP_MODE_FULL) {
618 ddi_driver_name(hsc->dip),
619 ddi_get_instance(hsc->dip),
620 hsc->n_registered_occupants);
622 if (scsb_enable_enum(hsc) != DDI_SUCCESS) {
625 ddi_driver_name(hsc->dip),
626 ddi_get_instance(hsc->dip));
653 hsc_state_t *hsc;
661 (void) ddi_prop_update_string(DDI_DEV_T_NONE, hsp->hsc->dip,
663 if ((res = scsb_enable_enum(hsp->hsc)) == DDI_SUCCESS) {
668 (void) ddi_prop_update_string(DDI_DEV_T_NONE, hsp->hsc->dip,
671 hsc = hsp->hsc;
672 if (hsc->state & HSC_ATTACHED) {
675 for (i = 0; i < hsc->slot_table_size; i++) {
679 slotnum = hsc->slot_table_prop[i].pslotnum;
684 ddi_driver_name(hsc->dip),
685 ddi_get_instance(hsc->dip),
695 (void) scsb_disable_enum(hsc,
798 return (scsb_enable_enum(hsp->hsc));
801 return (scsb_disable_enum(hsp->hsc, 0));
822 (void) ddi_prop_update_string(DDI_DEV_T_NONE, hsp->hsc->dip,
843 (void) ddi_prop_remove(DDI_DEV_T_NONE, hsp->hsc->dip,
927 hsc_state_t *hsc,
949 hsp->hs_hpchandle = hsc->scsb_handle; /* handle for call backs */
950 hsp->hsc = hsc;
952 rc = scsb_hsc_init_slot_state(hsc, hsp);
957 if (hsc->hotswap_mode == HSC_HOTSWAP_MODE_FULL)
970 rc = hpc_slot_register(hsc->dip,
980 ddi_driver_name(hsc->dip), ddi_get_instance(hsc->dip),
1016 if ((hsp->hsc->state & HSC_ATTACHED) != HSC_ATTACHED &&
1018 hsp->hsc->n_registered_occupants--;
1027 scsb_hsc_init_slot_state(hsc_state_t *hsc, hsc_slot_t *hsp)
1031 scsb_state_t *scsb = (scsb_state_t *)hsc->scsb_handle;
1033 rc = scsb_get_slot_state(hsc->scsb_handle, slot_number, &rstate);
1050 (void) scsb_reset_slot(hsc->scsb_handle, slot_number,
1069 (void) scsb_reset_slot(hsc->scsb_handle,
1121 hsc_get_slot_info(hsc_state_t *hsc, int pci_devno)
1125 for (i = 0; i < hsc->slot_table_size; i++) {
1127 if (hsc->slot_table_prop[i].pci_devno == pci_devno)
1129 hsc->slot_table_prop[i].pslotnum));
1227 ddi_driver_name(hsp->hsc->dip),
1228 ddi_get_instance(hsp->hsc->dip),
1232 ddi_driver_name(hsp->hsc->dip),
1233 ddi_get_instance(hsp->hsc->dip));
1262 hsc_state_t *hsc;
1272 hsc = hsp->hsc;
1276 "empty slot %d", ddi_driver_name(hsc->dip),
1277 ddi_get_instance(hsc->dip),
1304 ddi_driver_name(hsc->dip),
1305 ddi_get_instance(hsc->dip), slot_number,
1316 ddi_driver_name(hsc->dip),
1317 ddi_get_instance(hsc->dip), slot_number,
1332 ddi_driver_name(hsc->dip),
1333 ddi_get_instance(hsc->dip),
1345 hsc_state_t *hsc = hsp->hsc;
1354 if (((hsc->state & HSC_ENUM_ENABLED) == HSC_ENUM_ENABLED) &&
1357 hsc->hsp_last = hsp;
1365 hsc->hsp_last = NULL;
1412 scsb_enable_enum(hsc_state_t *hsc)
1414 DEBUG0("hsc: Enable ENUM#\n");
1416 if ((hsc->state & HSC_ENUM_ENABLED) == HSC_ENUM_ENABLED)
1418 if ((hsc->state & HSC_ATTACHED) != HSC_ATTACHED)
1421 if (ddi_add_intr(hsc->dip, 1, NULL, NULL,
1422 hsc_enum_intr, (caddr_t)hsc) != DDI_SUCCESS) {
1424 ddi_driver_name(hsc->dip), ddi_get_instance(hsc->dip));
1428 "Full Hotswap Mode\n", ddi_driver_name(hsc->dip),
1429 ddi_get_instance(hsc->dip));
1430 hsc->state |= HSC_ENUM_ENABLED;
1431 (void) ddi_prop_update_string(DDI_DEV_T_NONE, hsc->dip,
1439 scsb_disable_enum(hsc_state_t *hsc, int op)
1442 DEBUG0("hsc: Disable ENUM#\n");
1454 if ((hsc->state & HSC_ENUM_ENABLED) == HSC_ENUM_ENABLED) {
1455 /* hsc_clear_all_enum(hsc); */
1456 ddi_remove_intr(hsc->dip, 1, NULL);
1457 hsc->state &= ~HSC_ENUM_ENABLED;
1460 ddi_driver_name(hsc->dip),
1461 ddi_get_instance(hsc->dip));
1463 (void) ddi_prop_update_string(DDI_DEV_T_NONE, hsc->dip,
1473 hsc_clear_all_enum(hsc_state_t *hsc)
1478 for (i = 0; i < hsc->slot_table_size; i++) {
1480 hsp = hsc_find_slot(hsc->slot_table_prop[i].pslotnum);
1489 hsc->slot_table_prop[i].pslotnum);
1502 hsc_state_t *hsc;
1513 * can override it with 'hsc-slot-map' property
1523 "hsc-slot-map", (caddr_t)&hpc_slot_table_data,
1541 hsc = (hsc_state_t *)ddi_get_soft_state(hsc_state, instance);
1542 hsc->scsb_handle = scsb_handle;
1543 hsc->dip = dip;
1544 hsc->instance = instance;
1545 hsc->n_registered_occupants = 0;
1546 hsc->regDone = B_FALSE;
1547 /* hsc->slot_info = hsc_slot_list; */
1555 hsc->hotswap_mode = HSC_HOTSWAP_MODE_FULL;
1557 hsc->hotswap_mode = HSC_HOTSWAP_MODE_BASIC;
1565 hsc->hotswap_mode = HSC_HOTSWAP_MODE_FULL;
1567 hsc->hotswap_mode = HSC_HOTSWAP_MODE_BASIC;
1595 hsc->slot_table_size = n / 4;
1597 hsc->slot_table_size = hpc_slot_table_size /
1615 hsc->slot_table_size -= 1;
1617 DEBUG1("hsc_attach: %d hotplug slots on bus\n", hsc->slot_table_size);
1622 hsc->slot_table_prop = (hsc_slot_table_t *)
1623 kmem_zalloc(hsc->slot_table_size *
1628 for (i = 0; i < hsc->slot_table_size; i++) {
1661 hsc->slot_table_prop[i].pslotnum = atoi(phys_slotname);
1662 hsc->slot_table_prop[i].ga = atoi(ga);
1663 hsc->slot_table_prop[i].pci_devno = atoi(pcidev);
1664 (void) strcpy(hsc->slot_table_prop[i].nexus, nexus);
1668 for (i = 0; i < hsc->slot_table_size; i++, hpstp++) {
1674 hsc->slot_table_prop[i].pslotnum = hpstp->pslotnum;
1675 hsc->slot_table_prop[i].ga = hpstp->ga;
1676 hsc->slot_table_prop[i].pci_devno = hpstp->pci_devno;
1679 hsc->slot_table_prop[i].nexus,
1680 sizeof (hsc->slot_table_prop[i].nexus))
1685 kmem_free(hsc->slot_table_prop,
1686 (hsc->slot_table_size *
1701 kmem_free(hsc->slot_table_prop,
1702 (hsc->slot_table_size *
1715 for (i = 0; i < hsc->slot_table_size; i++) {
1717 hsc->slot_table_prop[i].pslotnum, &rstate) !=
1721 hsc->n_registered_occupants++;
1724 mutex_init(&hsc->hsc_mutex, NULL, MUTEX_DRIVER, NULL);
1725 for (i = 0; i < hsc->slot_table_size; i++) {
1728 hsc->slot_table_prop[i].nexus,
1729 hsc->slot_table_prop[i].pci_devno);
1731 if (hsc_slot_register(hsc, hsc->slot_table_prop[i].nexus,
1732 hsc->slot_table_prop[i].pci_devno,
1733 hsc->slot_table_prop[i].pslotnum, B_FALSE) !=
1740 n = hsc->slot_table_prop[i].pslotnum;
1750 mutex_destroy(&hsc->hsc_mutex);
1751 kmem_free(hsc->slot_table_prop, (hsc->slot_table_size *
1759 hsc->hsp_last = NULL;
1760 hsc->hsc_intr_counter = 0;
1762 (void) ddi_prop_update_string(DDI_DEV_T_NONE, hsc->dip,
1764 hsc->state |= (HSC_ATTACHED|HSC_SCB_CONNECTED);
1769 if ((hsc->regDone == B_FALSE && hsc->n_registered_occupants == 0) ||
1770 scsb_hsc_numReg == hsc->n_registered_occupants) {
1771 hsc->regDone = B_TRUE;
1772 if (hsc->hotswap_mode == HSC_HOTSWAP_MODE_FULL) {
1773 if (scsb_enable_enum(hsc) != DDI_SUCCESS) {
1788 hsc_state_t *hsc;
1792 hsc = (hsc_state_t *)ddi_get_soft_state(hsc_state, instance);
1793 if (hsc == NULL) {
1799 if ((hsc->state & HSC_ATTACHED) != HSC_ATTACHED)
1804 for (i = 0; i < hsc->slot_table_size; i++) {
1808 hsp = hsc_find_slot(hsc->slot_table_prop[i].pslotnum);
1827 (void) ddi_prop_remove(DDI_DEV_T_NONE, hsc->dip,
1829 if (hsc_slot_unregister(hsc->slot_table_prop[i].pslotnum)
1834 hsc->slot_table_prop[i].pslotnum);
1838 kmem_free(hsc->slot_table_prop, (hsc->slot_table_size *
1840 if ((hsc->state & HSC_ENUM_ENABLED) == HSC_ENUM_ENABLED) {
1841 ddi_remove_intr(hsc->dip, 1, hsc->enum_iblock);
1842 hsc->state &= ~HSC_ENUM_ENABLED;
1844 mutex_destroy(&hsc->hsc_mutex);
1845 (void) ddi_prop_remove(DDI_DEV_T_NONE, hsc->dip, HOTSWAP_MODE_PROP);
1846 hsc->state &= ~(HSC_ATTACHED|HSC_SCB_CONNECTED);
1858 hsc_state_t *hsc;
1863 hsc = (hsc_state_t *)ddi_get_soft_state(hsc_state, instance);
1864 if (hsc == NULL) {
1869 if ((hsc->state & HSC_ATTACHED) != HSC_ATTACHED)
1871 hsc->state &= ~HSC_SCB_CONNECTED;
1873 for (i = 0; i < hsc->slot_table_size; i++) {
1874 hsp = hsc_find_slot(hsc->slot_table_prop[i].pslotnum);
1879 hsc->slot_table_prop[i].pslotnum);
1893 ddi_driver_name(hsc->dip),
1894 ddi_get_instance(hsc->dip),
1912 hsc_state_t *hsc;
1916 hsc = (hsc_state_t *)ddi_get_soft_state(hsc_state, instance);
1917 if (hsc == NULL) {
1923 if ((hsc->state & HSC_ATTACHED) != HSC_ATTACHED)
1925 hsc->state |= HSC_SCB_CONNECTED;
1926 for (i = 0; i < hsc->slot_table_size; i++) {
1927 hsp = hsc_find_slot(hsc->slot_table_prop[i].pslotnum);
1932 ddi_driver_name(hsc->dip),
1933 ddi_get_instance(hsc->dip),
1934 hsc->slot_table_prop[i].pslotnum);
1944 ddi_driver_name(hsc->dip),
1945 ddi_get_instance(hsc->dip),
1950 if (scsb_hsc_init_slot_state(hsc, hsp) != DDI_SUCCESS) {
1954 ddi_driver_name(hsc->dip),
1955 ddi_get_instance(hsc->dip),
1967 hsc_state_t *hsc;
1970 hsc = (hsc_state_t *)ddi_get_soft_state(hsc_state, instance);
1971 if (hsc == NULL) {
1976 if ((hsc->state & HSC_ATTACHED) != HSC_ATTACHED)
1989 hsc_state_t *hsc;
1991 hsc = (hsc_state_t *)ddi_get_soft_state(hsc_state, instance);
1992 if (hsc == NULL) {
1994 ddi_driver_name(hsc->dip), ddi_get_instance(hsc->dip));
2001 ddi_driver_name(hsc->dip), ddi_get_instance(hsc->dip));
2011 if (hsc->state & HSC_ENUM_ENABLED)
2028 hsc_state_t *hsc = (hsc_state_t *)iarg;
2032 if ((hsc->state & HSC_ATTACHED) == 0)
2035 hsp = hsc_find_slot(hsc->slot_table_prop[0].pslotnum);
2053 hsc->hsc_intr_counter, hsc->hsp_last);
2054 hsc->hsc_intr_counter ++;
2055 if (hsc->hsc_intr_counter == scsb_hsc_max_intr_count) {
2056 if (!hsc->hsp_last) {
2059 ddi_driver_name(hsc->dip),
2060 ddi_get_instance(hsc->dip));
2061 hsc->hsc_intr_counter = 0;
2064 hsp = hsc->hsp_last;
2067 ddi_driver_name(hsc->dip),
2068 ddi_get_instance(hsc->dip),
2084 ddi_driver_name(hsc->dip),
2085 ddi_get_instance(hsc->dip));
2089 hsc->hsc_intr_counter = 0;
2093 hsc->hsc_intr_counter = 0;
2098 hsp = hsc_get_slot_info(hsc, rc);
2101 "dev %x", ddi_driver_name(hsc->dip),
2102 ddi_get_instance(hsc->dip), rc);