pcihp.c (fa9e4066) pcihp.c (70025d76)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *

--- 953 unchanged lines hidden (view full) ---

962 break;
963
964 case DEVCTL_AP_CONFIGURE:
965 /*
966 * **************************************
967 * CONFIGURE the occupant in the slot.
968 * **************************************
969 */
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *

--- 953 unchanged lines hidden (view full) ---

962 break;
963
964 case DEVCTL_AP_CONFIGURE:
965 /*
966 * **************************************
967 * CONFIGURE the occupant in the slot.
968 * **************************************
969 */
970 slotinfop = &pcihp_p->slotinfo[pci_dev];
970
971
972 mutex_enter(&slotinfop->slot_mutex);
973
971 rv = pcihp_configure_ap(pcihp_p, pci_dev);
972 if (rv == HPC_SUCCESS) {
974 rv = pcihp_configure_ap(pcihp_p, pci_dev);
975 if (rv == HPC_SUCCESS) {
973 slotinfop = &pcihp_p->slotinfo[pci_dev];
974 pcihp_gen_sysevent(slotinfop->name,
975 PCIHP_DR_AP_STATE_CHANGE,
976 SE_NO_HINT, pcihp_p->dip, KM_SLEEP);
977 pcihp_create_occupant_props(self, dev, pci_dev);
978 }
976 pcihp_gen_sysevent(slotinfop->name,
977 PCIHP_DR_AP_STATE_CHANGE,
978 SE_NO_HINT, pcihp_p->dip, KM_SLEEP);
979 pcihp_create_occupant_props(self, dev, pci_dev);
980 }
981 mutex_exit(&slotinfop->slot_mutex);
979
980 break;
981
982 case DEVCTL_AP_UNCONFIGURE:
983 /*
984 * **************************************
985 * UNCONFIGURE the occupant in the slot.
986 * **************************************
987 */
982
983 break;
984
985 case DEVCTL_AP_UNCONFIGURE:
986 /*
987 * **************************************
988 * UNCONFIGURE the occupant in the slot.
989 * **************************************
990 */
991 slotinfop = &pcihp_p->slotinfo[pci_dev];
988
992
993 mutex_enter(&slotinfop->slot_mutex);
994
989 rv = pcihp_unconfigure_ap(pcihp_p, pci_dev);
990
991 if (rv == HPC_SUCCESS) {
995 rv = pcihp_unconfigure_ap(pcihp_p, pci_dev);
996
997 if (rv == HPC_SUCCESS) {
992
993 slotinfop = &pcihp_p->slotinfo[pci_dev];
994 pcihp_gen_sysevent(slotinfop->name,
995 PCIHP_DR_AP_STATE_CHANGE,
996 SE_NO_HINT, pcihp_p->dip, KM_SLEEP);
997 pcihp_delete_occupant_props(pcihp_p->dip, dev);
998 }
998 pcihp_gen_sysevent(slotinfop->name,
999 PCIHP_DR_AP_STATE_CHANGE,
1000 SE_NO_HINT, pcihp_p->dip, KM_SLEEP);
1001 pcihp_delete_occupant_props(pcihp_p->dip, dev);
1002 }
1003 mutex_exit(&slotinfop->slot_mutex);
999
1000 break;
1001
1002 case DEVCTL_AP_GETSTATE:
1003 {
1004 int mutex_held;
1005
1006 /*

--- 449 unchanged lines hidden (view full) ---

1456
1457 /*
1458 * check for valid request:
1459 * 1. It is a hotplug slot.
1460 * 2. The receptacle is in the CONNECTED state.
1461 */
1462 slotinfop = &pcihp_p->slotinfo[pci_dev];
1463
1004
1005 break;
1006
1007 case DEVCTL_AP_GETSTATE:
1008 {
1009 int mutex_held;
1010
1011 /*

--- 449 unchanged lines hidden (view full) ---

1461
1462 /*
1463 * check for valid request:
1464 * 1. It is a hotplug slot.
1465 * 2. The receptacle is in the CONNECTED state.
1466 */
1467 slotinfop = &pcihp_p->slotinfo[pci_dev];
1468
1464 mutex_enter(&slotinfop->slot_mutex);
1465
1469
1470
1466 if ((pci_dev >= PCI_MAX_DEVS) || (slotinfop->slot_hdl == NULL) ||
1467 (slotinfop->slot_flags & PCIHP_SLOT_DISABLED)) {
1471 if ((pci_dev >= PCI_MAX_DEVS) || (slotinfop->slot_hdl == NULL) ||
1472 (slotinfop->slot_flags & PCIHP_SLOT_DISABLED)) {
1468 mutex_exit(&slotinfop->slot_mutex);
1473
1469 return (ENXIO);
1470 }
1471
1472 /*
1473 * If the occupant is already in (partially?) configured
1474 * state then call the ndi_devi_online() on the device
1475 * subtree(s) for this attachment point.
1476 */

--- 26 unchanged lines hidden (view full) ---

1503 (void) hpc_nexus_control(slotinfop->slot_hdl,
1504 HPC_CTRL_DEV_CONFIGURED, NULL);
1505
1506 if (drv_getparm(TIME, (void *)&time) != DDI_SUCCESS)
1507 slotinfop->last_change = (time_t)-1;
1508 else
1509 slotinfop->last_change = (time32_t)time;
1510
1474 return (ENXIO);
1475 }
1476
1477 /*
1478 * If the occupant is already in (partially?) configured
1479 * state then call the ndi_devi_online() on the device
1480 * subtree(s) for this attachment point.
1481 */

--- 26 unchanged lines hidden (view full) ---

1508 (void) hpc_nexus_control(slotinfop->slot_hdl,
1509 HPC_CTRL_DEV_CONFIGURED, NULL);
1510
1511 if (drv_getparm(TIME, (void *)&time) != DDI_SUCCESS)
1512 slotinfop->last_change = (time_t)-1;
1513 else
1514 slotinfop->last_change = (time32_t)time;
1515
1511 mutex_exit(&slotinfop->slot_mutex);
1516
1512 return (rv);
1513 }
1514
1515 /*
1516 * Occupant is in the UNCONFIGURED state.
1517 */
1518
1519 /* Check if the receptacle is in the CONNECTED state. */
1520 if (hpc_nexus_control(slotinfop->slot_hdl,
1521 HPC_CTRL_GET_SLOT_STATE, (caddr_t)&rstate) != 0) {
1517 return (rv);
1518 }
1519
1520 /*
1521 * Occupant is in the UNCONFIGURED state.
1522 */
1523
1524 /* Check if the receptacle is in the CONNECTED state. */
1525 if (hpc_nexus_control(slotinfop->slot_hdl,
1526 HPC_CTRL_GET_SLOT_STATE, (caddr_t)&rstate) != 0) {
1522 mutex_exit(&slotinfop->slot_mutex);
1527
1523 return (ENXIO);
1524 }
1525
1526 if (rstate == HPC_SLOT_EMPTY) {
1527 /* error. slot is empty */
1528 return (ENXIO);
1529 }
1530
1531 if (rstate == HPC_SLOT_EMPTY) {
1532 /* error. slot is empty */
1528 mutex_exit(&slotinfop->slot_mutex);
1533
1529 return (ENXIO);
1530 }
1531
1532 if (rstate != HPC_SLOT_CONNECTED) {
1533 /* error. either the slot is empty or connect failed */
1534 return (ENXIO);
1535 }
1536
1537 if (rstate != HPC_SLOT_CONNECTED) {
1538 /* error. either the slot is empty or connect failed */
1534 mutex_exit(&slotinfop->slot_mutex);
1539
1535 return (ENXIO);
1536 }
1537
1538 slotinfop->rstate = AP_RSTATE_CONNECTED; /* record rstate */
1539
1540 /* Turn INS and LED off, and start configuration. */
1541 if (slotinfop->slot_type & HPC_SLOT_TYPE_CPCI) {
1542 pcihp_hs_csr_op(pcihp_p, pci_dev,

--- 16 unchanged lines hidden (view full) ---

1559 pcihp_hs_csr_op(pcihp_p, pci_dev,
1560 HPC_EVENT_SLOT_BLUE_LED_ON);
1561 pcihp_hs_csr_op(pcihp_p, pci_dev,
1562 HPC_EVENT_SLOT_UNCONFIGURE);
1563 }
1564 /* tell HPC driver occupant configure Error */
1565 (void) hpc_nexus_control(slotinfop->slot_hdl,
1566 HPC_CTRL_DEV_CONFIG_FAILURE, NULL);
1540 return (ENXIO);
1541 }
1542
1543 slotinfop->rstate = AP_RSTATE_CONNECTED; /* record rstate */
1544
1545 /* Turn INS and LED off, and start configuration. */
1546 if (slotinfop->slot_type & HPC_SLOT_TYPE_CPCI) {
1547 pcihp_hs_csr_op(pcihp_p, pci_dev,

--- 16 unchanged lines hidden (view full) ---

1564 pcihp_hs_csr_op(pcihp_p, pci_dev,
1565 HPC_EVENT_SLOT_BLUE_LED_ON);
1566 pcihp_hs_csr_op(pcihp_p, pci_dev,
1567 HPC_EVENT_SLOT_UNCONFIGURE);
1568 }
1569 /* tell HPC driver occupant configure Error */
1570 (void) hpc_nexus_control(slotinfop->slot_hdl,
1571 HPC_CTRL_DEV_CONFIG_FAILURE, NULL);
1567 mutex_exit(&slotinfop->slot_mutex);
1572
1568 return (EIO);
1569 }
1570
1571 /* record the occupant state as CONFIGURED */
1572 slotinfop->ostate = AP_OSTATE_CONFIGURED;
1573 slotinfop->condition = AP_COND_OK;
1574
1575 /* now, online all the devices in the AP */

--- 26 unchanged lines hidden (view full) ---

1602 /* store HS_CSR location. No events, jut a read operation. */
1603 if (slotinfop->slot_type & HPC_SLOT_TYPE_CPCI)
1604 pcihp_hs_csr_op(pcihp_p, pci_dev, -1);
1605
1606 /* tell HPC driver that the occupant is configured */
1607 (void) hpc_nexus_control(slotinfop->slot_hdl,
1608 HPC_CTRL_DEV_CONFIGURED, NULL);
1609
1573 return (EIO);
1574 }
1575
1576 /* record the occupant state as CONFIGURED */
1577 slotinfop->ostate = AP_OSTATE_CONFIGURED;
1578 slotinfop->condition = AP_COND_OK;
1579
1580 /* now, online all the devices in the AP */

--- 26 unchanged lines hidden (view full) ---

1607 /* store HS_CSR location. No events, jut a read operation. */
1608 if (slotinfop->slot_type & HPC_SLOT_TYPE_CPCI)
1609 pcihp_hs_csr_op(pcihp_p, pci_dev, -1);
1610
1611 /* tell HPC driver that the occupant is configured */
1612 (void) hpc_nexus_control(slotinfop->slot_hdl,
1613 HPC_CTRL_DEV_CONFIGURED, NULL);
1614
1610 mutex_exit(&slotinfop->slot_mutex);
1615
1611 return (rv);
1612}
1613
1614/*
1615 * **************************************
1616 * UNCONFIGURE the occupant in the slot.
1617 * **************************************
1618 */

--- 9 unchanged lines hidden (view full) ---

1628
1629 /*
1630 * check for valid request:
1631 * 1. It is a hotplug slot.
1632 * 2. The occupant is in the CONFIGURED state.
1633 */
1634 slotinfop = &pcihp_p->slotinfo[pci_dev];
1635
1616 return (rv);
1617}
1618
1619/*
1620 * **************************************
1621 * UNCONFIGURE the occupant in the slot.
1622 * **************************************
1623 */

--- 9 unchanged lines hidden (view full) ---

1633
1634 /*
1635 * check for valid request:
1636 * 1. It is a hotplug slot.
1637 * 2. The occupant is in the CONFIGURED state.
1638 */
1639 slotinfop = &pcihp_p->slotinfo[pci_dev];
1640
1636 mutex_enter(&slotinfop->slot_mutex);
1637
1641
1642
1638 if ((pci_dev >= PCI_MAX_DEVS) || (slotinfop->slot_hdl == NULL) ||
1639 (slotinfop->slot_flags & PCIHP_SLOT_DISABLED)) {
1643 if ((pci_dev >= PCI_MAX_DEVS) || (slotinfop->slot_hdl == NULL) ||
1644 (slotinfop->slot_flags & PCIHP_SLOT_DISABLED)) {
1640 mutex_exit(&slotinfop->slot_mutex);
1645
1641 return (ENXIO);
1642 }
1643 /*
1644 * The following may not need to be there, as we should
1645 * support unconfiguring of boards and free resources
1646 * even when the board is not hotswappable. But this is
1647 * the only way, we may be able to tell the system
1648 * administrator that it is not a hotswap board since
1649 * disconnect operation is never called.
1650 * This way we help the system administrator from not
1651 * accidentally removing a non hotswap board and
1652 * possibly destroying it. May be this behavior can
1653 * be a default, and can be enabled or disabled via
1654 * a global flag.
1655 */
1656 if (slotinfop->slot_type & HPC_SLOT_TYPE_CPCI) {
1657 if (slotinfop->slot_flags &
1658 PCIHP_SLOT_DEV_NON_HOTPLUG) {
1659 /* Operation unsupported if no HS board/slot */
1646 return (ENXIO);
1647 }
1648 /*
1649 * The following may not need to be there, as we should
1650 * support unconfiguring of boards and free resources
1651 * even when the board is not hotswappable. But this is
1652 * the only way, we may be able to tell the system
1653 * administrator that it is not a hotswap board since
1654 * disconnect operation is never called.
1655 * This way we help the system administrator from not
1656 * accidentally removing a non hotswap board and
1657 * possibly destroying it. May be this behavior can
1658 * be a default, and can be enabled or disabled via
1659 * a global flag.
1660 */
1661 if (slotinfop->slot_type & HPC_SLOT_TYPE_CPCI) {
1662 if (slotinfop->slot_flags &
1663 PCIHP_SLOT_DEV_NON_HOTPLUG) {
1664 /* Operation unsupported if no HS board/slot */
1660 mutex_exit(&slotinfop->slot_mutex);
1665
1661 return (ENOTSUP);
1662 }
1663 }
1664
1665 /*
1666 * If the occupant is in the CONFIGURED state then
1667 * call the configurator to unconfigure the slot.
1668 */

--- 85 unchanged lines hidden (view full) ---

1754 }
1755 }
1756
1757 if (drv_getparm(TIME, (void *)&time) != DDI_SUCCESS)
1758 slotinfop->last_change = (time_t)-1;
1759 else
1760 slotinfop->last_change = (time32_t)time;
1761
1666 return (ENOTSUP);
1667 }
1668 }
1669
1670 /*
1671 * If the occupant is in the CONFIGURED state then
1672 * call the configurator to unconfigure the slot.
1673 */

--- 85 unchanged lines hidden (view full) ---

1759 }
1760 }
1761
1762 if (drv_getparm(TIME, (void *)&time) != DDI_SUCCESS)
1763 slotinfop->last_change = (time_t)-1;
1764 else
1765 slotinfop->last_change = (time32_t)time;
1766
1762 mutex_exit(&slotinfop->slot_mutex);
1763
1767
1768
1764 /* unmask enum events again */
1765 if ((slotinfop->slot_flags & PCIHP_SLOT_AUTO_CFG_EN) == 0) {
1766 pcihp_hs_csr_op(pcihp_p, pci_dev, HPC_EVENT_ENABLE_ENUM);
1767 }
1768
1769 return (rv);
1770}
1771

--- 520 unchanged lines hidden (view full) ---

2292 dev_info_t *self;
2293 pcihp_t *pcihp_p;
2294 int pci_dev;
2295 int rv = HPC_EVENT_CLAIMED;
2296 struct pcihp_slotinfo *slotinfop;
2297 struct pcihp_config_ctrl ctrl;
2298 int circular_count;
2299 int rval;
1769 /* unmask enum events again */
1770 if ((slotinfop->slot_flags & PCIHP_SLOT_AUTO_CFG_EN) == 0) {
1771 pcihp_hs_csr_op(pcihp_p, pci_dev, HPC_EVENT_ENABLE_ENUM);
1772 }
1773
1774 return (rv);
1775}
1776

--- 520 unchanged lines hidden (view full) ---

2297 dev_info_t *self;
2298 pcihp_t *pcihp_p;
2299 int pci_dev;
2300 int rv = HPC_EVENT_CLAIMED;
2301 struct pcihp_slotinfo *slotinfop;
2302 struct pcihp_config_ctrl ctrl;
2303 int circular_count;
2304 int rval;
2305 int hint;
2306 hpc_slot_state_t rstate;
2300
2301 /*
2302 * Get the soft state structure.
2303 */
2304 if (pcihp_info(NULL, DDI_INFO_DEVT2DEVINFO, (void *)ap_dev,
2305 (void **)&self) != DDI_SUCCESS)
2306 return (ENXIO);
2307

--- 40 unchanged lines hidden (view full) ---

2348
2349 return (rv);
2350 default:
2351 break;
2352 }
2353
2354 mutex_enter(&slotinfop->slot_mutex);
2355
2307
2308 /*
2309 * Get the soft state structure.
2310 */
2311 if (pcihp_info(NULL, DDI_INFO_DEVT2DEVINFO, (void *)ap_dev,
2312 (void **)&self) != DDI_SUCCESS)
2313 return (ENXIO);
2314

--- 40 unchanged lines hidden (view full) ---

2355
2356 return (rv);
2357 default:
2358 break;
2359 }
2360
2361 mutex_enter(&slotinfop->slot_mutex);
2362
2363 if (hpc_nexus_control(slotinfop->slot_hdl,
2364 HPC_CTRL_GET_SLOT_STATE, (caddr_t)&rstate) != 0)
2365 rv = HPC_ERR_FAILED;
2366
2367 slotinfop->rstate = (ap_rstate_t)rstate;
2368
2356 switch (event_mask) {
2357
2358 case HPC_EVENT_SLOT_INSERTION:
2359 /*
2360 * A card is inserted in the slot. Just report this
2361 * event and return.
2362 */
2363 cmn_err(CE_NOTE, "pcihp (%s%d): card is inserted"

--- 272 unchanged lines hidden (view full) ---

2636 break;
2637
2638 case HPC_EVENT_SLOT_REMOVAL:
2639 /*
2640 * Card is removed from the slot. The card must have been
2641 * unconfigured before this event.
2642 */
2643 if (slotinfop->ostate != AP_OSTATE_UNCONFIGURED) {
2369 switch (event_mask) {
2370
2371 case HPC_EVENT_SLOT_INSERTION:
2372 /*
2373 * A card is inserted in the slot. Just report this
2374 * event and return.
2375 */
2376 cmn_err(CE_NOTE, "pcihp (%s%d): card is inserted"

--- 272 unchanged lines hidden (view full) ---

2649 break;
2650
2651 case HPC_EVENT_SLOT_REMOVAL:
2652 /*
2653 * Card is removed from the slot. The card must have been
2654 * unconfigured before this event.
2655 */
2656 if (slotinfop->ostate != AP_OSTATE_UNCONFIGURED) {
2644 panic("pcihp (%s%d): card is removed from"
2645 " the slot %s before doing unconfigure!!",
2657 slotinfop->condition = AP_COND_FAILED;
2658 cmn_err(CE_WARN, "pcihp (%s%d): card is removed"
2659 " from the slot %s",
2646 ddi_driver_name(pcihp_p->dip),
2647 ddi_get_instance(pcihp_p->dip),
2648 slotinfop->name);
2660 ddi_driver_name(pcihp_p->dip),
2661 ddi_get_instance(pcihp_p->dip),
2662 slotinfop->name);
2649 /*NOTREACHED*/
2650 }
2663 }
2664 else
2665 cmn_err(CE_NOTE, "pcihp (%s%d): card is removed"
2666 " from the slot %s",
2667 ddi_driver_name(pcihp_p->dip),
2668 ddi_get_instance(pcihp_p->dip),
2669 slotinfop->name);
2651
2670
2652 cmn_err(CE_NOTE, "pcihp (%s%d): card is removed"
2653 " from the slot %s",
2654 ddi_driver_name(pcihp_p->dip),
2655 ddi_get_instance(pcihp_p->dip),
2656 slotinfop->name);
2671 slotinfop->rstate = AP_RSTATE_EMPTY;
2657
2658 /* +++ HOOK for RCM to report this hotplug event? +++ */
2659
2660 break;
2661
2662 case HPC_EVENT_SLOT_POWER_ON:
2663 /*
2664 * Slot is connected to the bus. i.e the card is powered

--- 195 unchanged lines hidden (view full) ---

2860 /* update the state in slot_flags field */
2861 slotinfop->slot_flags &= ~PCIHP_SLOT_NOT_HEALTHY;
2862 slotinfop->condition = AP_COND_OK;
2863
2864 /* +++ HOOK for RCM to report this hotplug event? +++ */
2865
2866 break;
2867
2672
2673 /* +++ HOOK for RCM to report this hotplug event? +++ */
2674
2675 break;
2676
2677 case HPC_EVENT_SLOT_POWER_ON:
2678 /*
2679 * Slot is connected to the bus. i.e the card is powered

--- 195 unchanged lines hidden (view full) ---

2875 /* update the state in slot_flags field */
2876 slotinfop->slot_flags &= ~PCIHP_SLOT_NOT_HEALTHY;
2877 slotinfop->condition = AP_COND_OK;
2878
2879 /* +++ HOOK for RCM to report this hotplug event? +++ */
2880
2881 break;
2882
2883 case HPC_EVENT_SLOT_ATTN:
2884 /*
2885 * Attention button is pressed.
2886 */
2887 if (((slotinfop->slot_flags & PCIHP_SLOT_AUTO_CFG_EN) == 0) ||
2888 (slotinfop->slot_flags & PCIHP_SLOT_DISABLED)) {
2889 /*
2890 * either auto-conifiguration or the slot is disabled,
2891 * ignore this event.
2892 */
2893 break;
2894 }
2895
2896 if (slotinfop->ostate == AP_OSTATE_UNCONFIGURED)
2897 hint = SE_INCOMING_RES;
2898 else
2899 hint = SE_OUTGOING_RES;
2900
2901 if (ddi_getprop(DDI_DEV_T_ANY, pcihp_p->dip, DDI_PROP_DONTPASS,
2902 "inkernel-autoconfig", 0) == 0) {
2903 pcihp_gen_sysevent(slotinfop->name, PCIHP_DR_REQ, hint,
2904 pcihp_p->dip, KM_SLEEP);
2905 break;
2906 }
2907
2908 if ((slotinfop->ostate == AP_OSTATE_UNCONFIGURED) &&
2909 (slotinfop->rstate != AP_RSTATE_EMPTY) &&
2910 (slotinfop->condition != AP_COND_FAILED)) {
2911 if (slotinfop->rstate == AP_RSTATE_DISCONNECTED) {
2912 rv = hpc_nexus_connect(slotinfop->slot_hdl,
2913 NULL, 0);
2914 if (rv == HPC_SUCCESS)
2915 slotinfop->rstate = AP_RSTATE_CONNECTED;
2916 else
2917 break;
2918 }
2919
2920 rv = pcihp_configure_ap(pcihp_p, pci_dev);
2921
2922 } else if ((slotinfop->ostate == AP_OSTATE_CONFIGURED) &&
2923 (slotinfop->rstate == AP_RSTATE_CONNECTED) &&
2924 (slotinfop->condition != AP_COND_FAILED)) {
2925 rv = pcihp_unconfigure_ap(pcihp_p, pci_dev);
2926
2927 if (rv != HPC_SUCCESS)
2928 break;
2929
2930 rv = hpc_nexus_disconnect(slotinfop->slot_hdl,
2931 NULL, 0);
2932 if (rv == HPC_SUCCESS)
2933 slotinfop->rstate = AP_RSTATE_DISCONNECTED;
2934 }
2935
2936 break;
2937
2938 case HPC_EVENT_SLOT_POWER_FAULT:
2939 /*
2940 * Power fault is detected.
2941 */
2942 cmn_err(CE_NOTE, "pcihp (%s%d): power-fault"
2943 " for this slot %s",
2944 ddi_driver_name(pcihp_p->dip),
2945 ddi_get_instance(pcihp_p->dip),
2946 slotinfop->name);
2947
2948 slotinfop->condition = AP_COND_FAILED;
2949
2950 pcihp_gen_sysevent(slotinfop->name, PCIHP_DR_AP_STATE_CHANGE,
2951 SE_NO_HINT, pcihp_p->dip, KM_SLEEP);
2952
2953 break;
2954
2868 default:
2869 cmn_err(CE_NOTE, "pcihp (%s%d): unknown event %x"
2870 " for this slot %s",
2871 ddi_driver_name(pcihp_p->dip),
2872 ddi_get_instance(pcihp_p->dip), event_mask,
2873 slotinfop->name);
2874
2875 /* +++ HOOK for RCM to report this hotplug event? +++ */

--- 366 unchanged lines hidden (view full) ---

3242 * ENUM# back again from this slot.
3243 */
3244 pcihp_hs_csr_op(pcihp_p, pci_dev, HPC_EVENT_DISABLE_ENUM);
3245 if (opcode == PCIHP_CLEAR_ENUM) {
3246 slotinfop->slot_flags |= PCIHP_SLOT_ENUM_EXT_PENDING;
3247 return (PCIHP_SUCCESS);
3248 }
3249
2955 default:
2956 cmn_err(CE_NOTE, "pcihp (%s%d): unknown event %x"
2957 " for this slot %s",
2958 ddi_driver_name(pcihp_p->dip),
2959 ddi_get_instance(pcihp_p->dip), event_mask,
2960 slotinfop->name);
2961
2962 /* +++ HOOK for RCM to report this hotplug event? +++ */

--- 366 unchanged lines hidden (view full) ---

3329 * ENUM# back again from this slot.
3330 */
3331 pcihp_hs_csr_op(pcihp_p, pci_dev, HPC_EVENT_DISABLE_ENUM);
3332 if (opcode == PCIHP_CLEAR_ENUM) {
3333 slotinfop->slot_flags |= PCIHP_SLOT_ENUM_EXT_PENDING;
3334 return (PCIHP_SUCCESS);
3335 }
3336
3337 mutex_enter(&slotinfop->slot_mutex);
3250 rv = pcihp_unconfigure_ap(pcihp_p, pci_dev);
3338 rv = pcihp_unconfigure_ap(pcihp_p, pci_dev);
3339 mutex_exit(&slotinfop->slot_mutex);
3251 if (rv != HPC_SUCCESS && rv != EBUSY) {
3252 cmn_err(CE_NOTE, "%s%d: PCI device %x Failed on Unconfigure",
3253 ddi_driver_name(pcihp_p->dip),
3254 ddi_get_instance(pcihp_p->dip), pci_dev);
3255 }
3256 if (rv == EBUSY)
3257 cmn_err(CE_NOTE, "%s%d: PCI device %x Busy",
3258 ddi_driver_name(pcihp_p->dip),

--- 56 unchanged lines hidden (view full) ---

3315 pcihp_hs_csr_op(pcihp_p, pci_dev, HPC_EVENT_DISABLE_ENUM);
3316 if (opcode == PCIHP_CLEAR_ENUM) {
3317 slotinfop->slot_flags |= PCIHP_SLOT_ENUM_INS_PENDING;
3318 return (PCIHP_SUCCESS);
3319 }
3320
3321 if ((slotinfop->slot_flags & PCIHP_SLOT_AUTO_CFG_EN) ==
3322 PCIHP_SLOT_AUTO_CFG_EN) {
3340 if (rv != HPC_SUCCESS && rv != EBUSY) {
3341 cmn_err(CE_NOTE, "%s%d: PCI device %x Failed on Unconfigure",
3342 ddi_driver_name(pcihp_p->dip),
3343 ddi_get_instance(pcihp_p->dip), pci_dev);
3344 }
3345 if (rv == EBUSY)
3346 cmn_err(CE_NOTE, "%s%d: PCI device %x Busy",
3347 ddi_driver_name(pcihp_p->dip),

--- 56 unchanged lines hidden (view full) ---

3404 pcihp_hs_csr_op(pcihp_p, pci_dev, HPC_EVENT_DISABLE_ENUM);
3405 if (opcode == PCIHP_CLEAR_ENUM) {
3406 slotinfop->slot_flags |= PCIHP_SLOT_ENUM_INS_PENDING;
3407 return (PCIHP_SUCCESS);
3408 }
3409
3410 if ((slotinfop->slot_flags & PCIHP_SLOT_AUTO_CFG_EN) ==
3411 PCIHP_SLOT_AUTO_CFG_EN) {
3412 mutex_enter(&slotinfop->slot_mutex);
3323 rv = pcihp_configure_ap(pcihp_p, pci_dev);
3413 rv = pcihp_configure_ap(pcihp_p, pci_dev);
3414 mutex_exit(&slotinfop->slot_mutex);
3324 if (rv != HPC_SUCCESS) { /* configure failed */
3325 cmn_err(CE_NOTE, "%s%d: PCI device %x Failed on"
3326 " Configure", ddi_driver_name(pcihp_p->dip),
3327 ddi_get_instance(pcihp_p->dip), pci_dev);
3328 if (pcihp_cpci_blue_led)
3329 pcihp_hs_csr_op(pcihp_p, pci_dev,
3330 HPC_EVENT_SLOT_BLUE_LED_ON);
3331 }

--- 181 unchanged lines hidden (view full) ---

3513 int bus, len, rc = DDI_SUCCESS;
3514 struct pcihp_slotinfo *slotinfop;
3515 hpc_slot_state_t rstate;
3516 ddi_acc_hdl_t *hp;
3517 struct bus_range {
3518 uint32_t lo;
3519 uint32_t hi;
3520 } pci_bus_range;
3415 if (rv != HPC_SUCCESS) { /* configure failed */
3416 cmn_err(CE_NOTE, "%s%d: PCI device %x Failed on"
3417 " Configure", ddi_driver_name(pcihp_p->dip),
3418 ddi_get_instance(pcihp_p->dip), pci_dev);
3419 if (pcihp_cpci_blue_led)
3420 pcihp_hs_csr_op(pcihp_p, pci_dev,
3421 HPC_EVENT_SLOT_BLUE_LED_ON);
3422 }

--- 181 unchanged lines hidden (view full) ---

3604 int bus, len, rc = DDI_SUCCESS;
3605 struct pcihp_slotinfo *slotinfop;
3606 hpc_slot_state_t rstate;
3607 ddi_acc_hdl_t *hp;
3608 struct bus_range {
3609 uint32_t lo;
3610 uint32_t hi;
3611 } pci_bus_range;
3521 int flags = 0;
3522
3523 slotinfop = &pcihp_p->slotinfo[pci_dev];
3524
3525 /*
3526 * If declared failed, don't allow Config operations.
3527 * Otherwise, if good or failing, it is assumed Ok
3528 * to get config data.
3529 */

--- 53 unchanged lines hidden (view full) ---

3583 */
3584 if (pci_config_setup(*dip, handle) != DDI_SUCCESS) {
3585 cmn_err(CE_WARN, "Cannot set config space map for"
3586 " pci device number %d", pci_dev);
3587 (void) ndi_devi_free(*dip);
3588 return (PCIHP_FAILURE);
3589 }
3590
3612
3613 slotinfop = &pcihp_p->slotinfo[pci_dev];
3614
3615 /*
3616 * If declared failed, don't allow Config operations.
3617 * Otherwise, if good or failing, it is assumed Ok
3618 * to get config data.
3619 */

--- 53 unchanged lines hidden (view full) ---

3673 */
3674 if (pci_config_setup(*dip, handle) != DDI_SUCCESS) {
3675 cmn_err(CE_WARN, "Cannot set config space map for"
3676 " pci device number %d", pci_dev);
3677 (void) ndi_devi_free(*dip);
3678 return (PCIHP_FAILURE);
3679 }
3680
3591 if (pcihp_indirect_map(*dip) == DDI_SUCCESS)
3592 flags |= PCICFG_CONF_INDIRECT_MAP;
3593
3594 /*
3595 * See if there is any PCI HW at this location
3596 * by reading the Vendor ID. If it returns with 0xffff
3597 * then there is no hardware at this location.
3598 */
3681 /*
3682 * See if there is any PCI HW at this location
3683 * by reading the Vendor ID. If it returns with 0xffff
3684 * then there is no hardware at this location.
3685 */
3599 if (flags & PCICFG_CONF_INDIRECT_MAP) {
3600
3686 if (pcihp_indirect_map(*dip) == DDI_SUCCESS) {
3601 if (pci_config_get16(*handle, 0) == 0xffff) {
3602 pci_config_teardown(handle);
3603 (void) ndi_devi_free(*dip);
3604 return (PCIHP_FAILURE);
3605 }
3606 } else {
3607 /* Check if mapping is OK */
3608 hp = impl_acc_hdl_get(*handle);

--- 272 unchanged lines hidden (view full) ---

3881/*ARGSUSED*/
3882static int
3883pcihp_indirect_map(dev_info_t *dip)
3884{
3885#if defined(__sparc)
3886 int rc = DDI_FAILURE;
3887
3888 if (ddi_prop_get_int(DDI_DEV_T_ANY, ddi_get_parent(dip), 0,
3687 if (pci_config_get16(*handle, 0) == 0xffff) {
3688 pci_config_teardown(handle);
3689 (void) ndi_devi_free(*dip);
3690 return (PCIHP_FAILURE);
3691 }
3692 } else {
3693 /* Check if mapping is OK */
3694 hp = impl_acc_hdl_get(*handle);

--- 272 unchanged lines hidden (view full) ---

3967/*ARGSUSED*/
3968static int
3969pcihp_indirect_map(dev_info_t *dip)
3970{
3971#if defined(__sparc)
3972 int rc = DDI_FAILURE;
3973
3974 if (ddi_prop_get_int(DDI_DEV_T_ANY, ddi_get_parent(dip), 0,
3889 PCICFG_DEV_CONF_MAP_PROP, DDI_FAILURE) != DDI_FAILURE)
3975 PCI_DEV_CONF_MAP_PROP, DDI_FAILURE) != DDI_FAILURE)
3890 rc = DDI_SUCCESS;
3891 else
3892 if (ddi_prop_get_int(DDI_DEV_T_ANY, ddi_get_parent(dip),
3976 rc = DDI_SUCCESS;
3977 else
3978 if (ddi_prop_get_int(DDI_DEV_T_ANY, ddi_get_parent(dip),
3893 0, PCICFG_BUS_CONF_MAP_PROP,
3979 0, PCI_BUS_CONF_MAP_PROP,
3894 DDI_FAILURE) != DDI_FAILURE)
3895 rc = DDI_SUCCESS;
3896 return (rc);
3897#else
3898 return (DDI_SUCCESS);
3899#endif
3900}
3980 DDI_FAILURE) != DDI_FAILURE)
3981 rc = DDI_SUCCESS;
3982 return (rc);
3983#else
3984 return (DDI_SUCCESS);
3985#endif
3986}