Lines Matching defs:pcic

29  *	The "pcic" driver handles the Intel 82365SL, Cirrus Logic
343 static boolean_t pcic_load_cardbus(pcicdev_t *pcic, const pcic_socket_t *sockp);
344 static void pcic_unload_cardbus(pcicdev_t *pcic, const pcic_socket_t *sockp);
345 static uint32_t pcic_getcb(pcicdev_t *pcic, int reg);
346 static void pcic_putcb(pcicdev_t *pcic, int reg, uint32_t value);
349 static void pcic_enable_io_intr(pcicdev_t *pcic, int socket, int irq);
350 static void pcic_disable_io_intr(pcicdev_t *pcic, int socket);
357 static int pcic_exca_powerctl(pcicdev_t *pcic, int socket, int powerlevel);
358 static int pcic_cbus_powerctl(pcicdev_t *pcic, int socket);
628 pcicdev_t *pcic = anp->an_private;
631 for (i = 0; i < pcic->pc_numsockets; i++) {
632 pcic_putb(pcic, i, PCIC_MANAGEMENT_INT, 0);
633 pcic_putb(pcic, i, PCIC_CARD_DETECT, 0);
634 pcic_putb(pcic, i, PCIC_MAPPING_ENABLE, 0);
636 pcic_putb(pcic, i, PCIC_INTERRUPT, 0);
638 pcic_putb(pcic, i, PCIC_POWER_CONTROL, 0);
639 pcic_putcb(pcic, CB_CONTROL, 0);
658 pcicdev_t *pcic;
678 pcic = anp->an_private;
683 if (pcic != NULL && pcic->pc_flags & PCF_SUSPENDED) {
684 mutex_enter(&pcic->pc_lock);
686 pcic_setup_adapter(pcic);
687 pcic->pc_flags &= ~PCF_SUSPENDED;
688 mutex_exit(&pcic->pc_lock);
691 pcic_do_resume(pcic);
712 cmn_err(CE_CONT, "pcic%d: Unable to alloc state\n",
720 pcic = kmem_zalloc(sizeof (pcicdev_t), KM_SLEEP);
722 pcic->dip = dip;
725 pcic_nexus->an_private = pcic;
726 pcic->pc_numpower = sizeof (pcic_power)/sizeof (pcic_power[0]);
727 pcic->pc_power = pcic_power;
737 * pcic->pc_irq is really the IPL level we want to run at
740 pcic->pc_irq = ddi_getprop(DDI_DEV_T_ANY, dip, DDI_PROP_CANSLEEP,
743 if (pcic->pc_irq == -1) {
752 pcic->pc_irq = pri;
754 pcic->pc_irq = LOCK_LEVEL + 1;
758 pcic_nexus->an_ipl = pcic->pc_irq;
774 "pcic%d: can't find parent bus type\n",
777 kmem_free(pcic, sizeof (pcicdev_t));
786 pcic->pc_flags = PCF_PCIBUS;
788 cmn_err(CE_WARN, "!pcic%d: non-pci mode (%s) not supported, "
791 kmem_free(pcic, sizeof (pcicdev_t));
797 if ((pcic->bus_speed = ddi_getprop(DDI_DEV_T_ANY, ddi_get_parent(dip),
800 if (pcic->pc_flags & PCF_PCIBUS)
801 pcic->bus_speed = PCIC_PCI_DEF_SYSCLK;
803 pcic->bus_speed = PCIC_ISA_DEF_SYSCLK;
808 if (pcic->bus_speed > 1000000)
809 pcic->bus_speed /= 1000000;
812 pcic->pc_io_type = PCIC_IO_TYPE_82365SL; /* default mode */
817 "pcic%d: parent bus type = [%s], speed = %d MHz\n",
819 bus_type, pcic->bus_speed);
829 if (pcic->pc_flags & PCF_PCIBUS) {
832 pcic->pc_base = 0x1000000;
833 pcic->pc_bound = (uint32_t)~0;
834 pcic->pc_iobase = 0x1000;
835 pcic->pc_iobound = 0xefff;
837 pcic->pc_base = 0x0;
838 pcic->pc_bound = (uint32_t)~0;
839 pcic->pc_iobase = 0x00000;
840 pcic->pc_iobound = 0xffff;
849 (caddr_t *)&pcic->cfgaddr,
853 &pcic->cfg_handle) !=
856 "pcic%d: unable to map config space"
860 kmem_free(pcic, sizeof (pcicdev_t));
876 pcic->pc_flags |= PCF_CARDBUS;
877 pcic->pc_io_type = PCIC_IO_TYPE_YENTA;
890 (void *)pcic->cfgaddr,
891 (void *)pcic->cfg_handle, nr);
905 (caddr_t *)&pcic->ioaddr,
908 &attr, &pcic->handle) !=
911 "pcic%d: unable to map PCI regs\n",
913 ddi_regs_map_free(&pcic->cfg_handle);
914 kmem_free(pcic, sizeof (pcicdev_t));
923 * it needs a valid mapped pcic->handle to
927 if (pcic_find_pci_type(pcic) != DDI_SUCCESS) {
928 ddi_regs_map_free(&pcic->handle);
929 ddi_regs_map_free(&pcic->cfg_handle);
930 kmem_free(pcic, sizeof (pcicdev_t));
931 cmn_err(CE_WARN, "pcic: %s: unsupported "
956 (caddr_t *)&pcic->ioaddr,
960 &pcic->handle) != DDI_SUCCESS) {
962 "pcic%d: unable to map PCI regs\n",
964 ddi_regs_map_free(&pcic->cfg_handle);
965 kmem_free(pcic, sizeof (pcicdev_t));
974 * it needs a valid mapped pcic->handle to
978 if (pcic_find_pci_type(pcic) != DDI_SUCCESS) {
979 ddi_regs_map_free(&pcic->handle);
980 ddi_regs_map_free(&pcic->cfg_handle);
981 kmem_free(pcic, sizeof (pcicdev_t));
982 cmn_err(CE_WARN, "pcic: %s: unsupported "
992 * re-map pcic->handle to be large enough to
995 switch (pcic->pc_type) {
997 ddi_regs_map_free(&pcic->handle);
1001 (caddr_t *)&pcic->ioaddr,
1005 &pcic->handle) != DDI_SUCCESS) {
1007 "pcic%d: unable to map "
1010 ddi_regs_map_free(&pcic->cfg_handle);
1011 kmem_free(pcic, sizeof (pcicdev_t));
1017 } /* switch (pcic->pc_type) */
1029 pcic->mem_reg_num = PCIC_ISA_MEM_REG_NUM;
1030 pcic->io_reg_num = PCIC_ISA_IO_REG_NUM;
1033 (caddr_t *)&pcic->ioaddr,
1037 &pcic->handle) != DDI_SUCCESS) {
1039 "pcic%d: unable to map ISA registers\n",
1042 kmem_free(pcic, sizeof (pcicdev_t));
1047 pcic->pc_base = 0xd0000;
1048 pcic->pc_bound = (uint32_t)~0;
1049 pcic->pc_iobase = 0x1000;
1050 pcic->pc_iobound = 0xefff;
1056 pcic->pc_flags, pcic->pc_type);
1064 if (pcic->pc_flags & PCF_PCIBUS) {
1069 iline = cardbus_validate_iline(dip, pcic->cfg_handle);
1073 switch (pcic->pc_type) {
1076 cfg = ddi_get8(pcic->cfg_handle,
1077 pcic->cfgaddr + PCIC_82092_PCICON);
1080 pcic->pc_numsockets = 4;
1081 pcic->pc_type = PCIC_INTEL_i82092;
1083 pcic->pc_intr_mode =
1086 pcic->pc_intr_mode = PCIC_INTR_MODE_ISA;
1089 "pcic%d: Intel 82092 adapter "
1091 ddi_get_instance(pcic->dip), cfg);
1092 pcic->pc_numsockets = 0;
1097 pcic->pc_intr_mode = PCIC_INTR_MODE_PCI_1;
1103 pcic->pc_intr_mode = PCIC_INTR_MODE_ISA;
1111 pcic->pc_intr_mode = PCIC_INTR_MODE_PCI_1;
1113 pcic->pc_numsockets = 2;
1114 pcic->pc_flags |= PCF_IO_REMAP;
1118 pcic->pc_flags &= ~PCF_CARDBUS;
1121 pcic->pc_flags |= PCF_IO_REMAP;
1124 pcic->pc_flags |= PCF_DMA | PCF_ZV;
1126 pcic->pc_flags |= (PCF_VPPX|PCF_33VCAP);
1127 pcic->pc_flags |= pcic_use_cbpwrctl;
1129 pcic->pc_numsockets = 1; /* one per function */
1132 pcic->pc_intr_mode = PCIC_INTR_MODE_PCI_1;
1134 cfg = ddi_get8(pcic->cfg_handle,
1135 (pcic->cfgaddr + PCIC_BRIDGE_CTL_REG));
1137 ddi_put8(pcic->cfg_handle, (pcic->cfgaddr +
1141 pcic->pc_intr_mode = PCIC_INTR_MODE_ISA;
1142 pcic->pc_io_type = PCIC_IOTYPE_YENTA;
1158 pcic_putb(pcic, 0, PCIC_CHIP_INFO, 0);
1159 value = pcic_getb(pcic, 0, PCIC_CHIP_INFO);
1162 pcic->pc_type = PCIC_I82365SL;
1163 pcic->pc_chipname = PCIC_TYPE_I82365SL;
1166 if (pcic_ci_funcs[value](pcic))
1171 switch (pcic->pc_type) {
1173 pcic->pc_flags |= PCF_DMA;
1184 pcic_putb(pcic, i, PCIC_MAPPING_ENABLE, 0);
1185 value = pcic_getb(pcic, i, PCIC_MAPPING_ENABLE);
1200 value = pcic_getb(pcic, i, PCIC_CHIP_REVISION) &
1206 pcic_putb(pcic, i, PCIC_SYSMEM_0_STARTLOW, 0xaa);
1207 pcic_putb(pcic, i, PCIC_SYSMEM_1_STARTLOW, 0x55);
1208 value = pcic_getb(pcic, i, PCIC_SYSMEM_0_STARTLOW);
1210 j = pcic_getb(pcic, i, PCIC_SYSMEM_1_STARTLOW);
1222 j = pcic->pc_numsockets++;
1223 pcic->pc_sockets[j].pcs_flags = 0;
1224 pcic->pc_sockets[j].pcs_io = pcic->ioaddr;
1225 pcic->pc_sockets[j].pcs_socket = i;
1228 value = pcic_getb(pcic, i, PCIC_INTERRUPT);
1229 pcic_putb(pcic, i, PCIC_INTERRUPT,
1236 pcic->pc_numsockets);
1238 if (pcic->pc_numsockets == 0) {
1239 ddi_regs_map_free(&pcic->handle);
1240 kmem_free(pcic, sizeof (pcicdev_t));
1252 if (pcic->pc_numsockets > 2) {
1253 int count = pcic->pc_numsockets / 4;
1256 pcic_putb(pcic, i,
1260 pcic_putb(pcic, i + 2,
1264 value = pcic_getb(pcic, i,
1268 j = pcic_getb(pcic, i + 2,
1271 pcic->pc_numsockets -= 2;
1281 pcic->pc_flags |= PCF_MULT_IRQ;
1293 typename = pcic->pc_chipname;
1306 "pcic%d: %d register sets, %d interrupts\n",
1320 (pcic->pc_io_type == PCIC_IO_TYPE_82365SL ?
1325 (void *)pcic->ioaddr);
1339 cv_init(&pcic->pm_cv, NULL, CV_DRIVER, NULL);
1343 pcic->pc_flags |= PCF_AUDIO;
1347 pcic->pc_flags &= ~PCF_CARDBUS;
1356 pcic->pc_sockets[i].pcs_smi = 0;
1357 pcic->pc_sockets[i].pcs_debounce_id = 0;
1358 pcic->pc_sockets[i].pcs_pcic = pcic;
1360 pcic->pc_lastreg = -1; /* just to make sure we are in sync */
1365 switch (pcic->pc_intr_mode) {
1386 for (i = 0; i < pcic->pc_numsockets; i++)
1387 pcic->pc_sockets[i].pcs_smi = smi;
1389 if (pcic->pc_flags & PCF_MULT_IRQ) {
1390 for (i = 2; i < pcic->pc_numsockets; i++) {
1405 pcic->pc_sockets[i].pcs_smi = smi;
1408 pcic->pc_intr_htblp = kmem_alloc(pcic->pc_numsockets *
1410 for (i = 0, irqlevel = -1; i < pcic->pc_numsockets; i++) {
1414 if (irqlevel == pcic->pc_sockets[i].pcs_smi)
1417 irqlevel = pcic->pc_sockets[i].pcs_smi;
1430 if (ddi_intr_alloc(dip, &pcic->pc_intr_htblp[i],
1447 * it is part of pcic struct.
1455 ispecp->intrspec_pri = pcic->pc_irq;
1458 pcic->pc_pri = (ddi_iblock_cookie_t)
1459 (uintptr_t)pcic->pc_irq;
1460 pcic->pc_dcookie.idev_priority =
1461 (uintptr_t)pcic->pc_pri;
1462 pcic->pc_dcookie.idev_vector = (ushort_t)irqlevel;
1464 (void) ddi_intr_set_pri(pcic->pc_intr_htblp[i],
1465 pcic->pc_irq);
1468 mutex_init(&pcic->intr_lock, NULL, MUTEX_DRIVER,
1469 DDI_INTR_PRI(pcic->pc_irq));
1470 mutex_init(&pcic->pc_lock, NULL, MUTEX_DRIVER,
1474 if (ddi_intr_add_handler(pcic->pc_intr_htblp[i],
1475 pcic_intr, (caddr_t)pcic, NULL)) {
1482 if (ddi_intr_enable(pcic->pc_intr_htblp[i])) {
1487 pcic->pc_intr_htblp[j]);
1499 pcic->pc_pci_intr_hdlp = kmem_alloc(sizeof (ddi_intr_handle_t),
1501 if (ddi_intr_alloc(dip, pcic->pc_pci_intr_hdlp,
1506 if (ddi_intr_get_pri(pcic->pc_pci_intr_hdlp[0],
1508 (void) ddi_intr_free(pcic->pc_pci_intr_hdlp[0]);
1512 pcic->pc_pri = (void *)(uintptr_t)pri;
1513 mutex_init(&pcic->intr_lock, NULL, MUTEX_DRIVER, pcic->pc_pri);
1514 mutex_init(&pcic->pc_lock, NULL, MUTEX_DRIVER, NULL);
1516 if (ddi_intr_add_handler(pcic->pc_pci_intr_hdlp[0],
1517 pcic_intr, (caddr_t)pcic, NULL))
1520 if (ddi_intr_enable(pcic->pc_pci_intr_hdlp[0])) {
1522 pcic->pc_pci_intr_hdlp[0]);
1527 pcic->pc_dcookie.idev_priority = (ushort_t)pri;
1530 for (i = 0; i < pcic->pc_numsockets; i++)
1531 pcic->pc_sockets[i].pcs_smi = 0xF; /* any valid */
1538 mutex_enter(&pcic->pc_lock);
1540 pcic->pc_flags |= PCF_ATTACHED;
1541 pcic_setup_adapter(pcic);
1543 for (j = 0; j < pcic->pc_numsockets; j++)
1545 &pcic->pc_sockets[j].pcs_cd_softint_hdl,
1547 (caddr_t)&pcic->pc_sockets[j]) != DDI_SUCCESS)
1553 pcic->pc_numsockets);
1556 pcic_nexus->an_iblock = &pcic->pc_pri;
1557 pcic_nexus->an_idev = &pcic->pc_dcookie;
1559 mutex_exit(&pcic->pc_lock);
1574 if (pcic->pc_flags & PCF_CARDBUS)
1602 for (j = 0; j < pcic->pc_numsockets; j++) {
1603 pcic->pc_sockets[j].pcs_debounce_id =
1604 pcic_add_debqueue(&pcic->pc_sockets[j],
1611 mutex_destroy(&pcic->intr_lock);
1612 mutex_destroy(&pcic->pc_lock);
1614 (void) ddi_intr_free(pcic->pc_intr_htblp[j]);
1616 (void) pcmcia_return_intr(dip, pcic->pc_sockets[i].pcs_smi);
1617 ddi_regs_map_free(&pcic->handle);
1618 if (pcic->pc_flags & PCF_PCIBUS)
1619 ddi_regs_map_free(&pcic->cfg_handle);
1620 kmem_free(pcic->pc_intr_htblp, pcic->pc_numsockets *
1622 kmem_free(pcic, sizeof (pcicdev_t));
1626 mutex_destroy(&pcic->intr_lock);
1627 mutex_destroy(&pcic->pc_lock);
1628 (void) ddi_intr_free(pcic->pc_pci_intr_hdlp[0]);
1630 ddi_regs_map_free(&pcic->handle);
1631 if (pcic->pc_flags & PCF_PCIBUS)
1632 ddi_regs_map_free(&pcic->cfg_handle);
1633 kmem_free(pcic->pc_pci_intr_hdlp, sizeof (ddi_intr_handle_t));
1634 kmem_free(pcic, sizeof (pcicdev_t));
1646 pcicdev_t *pcic = anp->an_private;
1652 if (pcic->pc_callback != NULL)
1656 if (pcic->pc_pmtimer)
1657 (void) untimeout(pcic->pc_pmtimer);
1660 for (i = 0; i < pcic->pc_numsockets; i++) {
1661 if (pcic->pc_sockets[i].pcs_debounce_id)
1663 pcic->pc_sockets[i].pcs_debounce_id);
1664 pcic->pc_sockets[i].pcs_debounce_id = 0;
1666 pcic_putb(pcic, i, PCIC_MANAGEMENT_INT, 0);
1667 pcic_putb(pcic, i, PCIC_CARD_DETECT, 0);
1668 pcic_putb(pcic, i, PCIC_MAPPING_ENABLE, 0);
1670 pcic_putb(pcic, i, PCIC_INTERRUPT, 0);
1672 (void) ddi_intr_disable(pcic->pc_pci_intr_hdlp[0]);
1673 (void) ddi_intr_remove_handler(pcic->pc_pci_intr_hdlp[0]);
1674 (void) ddi_intr_free(pcic->pc_pci_intr_hdlp[0]);
1675 kmem_free(pcic->pc_pci_intr_hdlp, sizeof (ddi_intr_handle_t));
1676 pcic->pc_flags = 0;
1677 mutex_destroy(&pcic->pc_lock);
1678 mutex_destroy(&pcic->intr_lock);
1679 cv_destroy(&pcic->pm_cv);
1680 if (pcic->pc_flags & PCF_PCIBUS)
1681 ddi_regs_map_free(&pcic->cfg_handle);
1682 if (pcic->handle)
1683 ddi_regs_map_free(&pcic->handle);
1684 kmem_free(pcic, sizeof (pcicdev_t));
1695 mutex_enter(&pcic->pc_lock);
1697 if (pcic->pc_flags & PCF_CARDBUS) {
1698 for (i = 0; i < pcic->pc_numsockets; i++) {
1699 if ((pcic->pc_sockets[i].pcs_flags &
1704 pcic->pc_sockets[i].pcs_socket);
1712 for (i = 0; i < pcic->pc_numsockets; i++) {
1713 if (pcic->pc_sockets[i].pcs_debounce_id)
1715 pcic->pc_sockets[i].pcs_debounce_id);
1716 pcic->pc_sockets[i].pcs_debounce_id = 0;
1718 pcic_putb(pcic, i, PCIC_MANAGEMENT_INT, 0);
1719 pcic_putb(pcic, i, PCIC_CARD_DETECT, 0);
1720 pcic_putb(pcic, i, PCIC_MAPPING_ENABLE, 0);
1722 pcic_putb(pcic, i, PCIC_INTERRUPT, 0);
1723 pcic_putb(pcic, i, PCIC_POWER_CONTROL, 0);
1724 if (pcic->pc_flags & PCF_CBPWRCTL)
1725 pcic_putcb(pcic, CB_CONTROL, 0);
1727 if (pcic->pc_sockets[i].pcs_flags & PCS_CARD_PRESENT) {
1728 pcic->pc_sockets[i].pcs_flags = PCS_STARTING;
1736 pcic->pc_callback) {
1737 PC_CALLBACK(pcic->dip, pcic->pc_cb_arg,
1739 pcic->pc_sockets[i].pcs_socket);
1744 pcic->pc_flags |= PCF_SUSPENDED;
1745 mutex_exit(&pcic->pc_lock);
1764 pcic_setup_adapter(pcicdev_t *pcic)
1776 if (pcic->pc_flags & PCF_PCIBUS) {
1781 pcic_iomem_pci_ctl(pcic->cfg_handle, pcic->cfgaddr, flags);
1784 for (i = 0; i < pcic->pc_numsockets; i++) {
1785 pcic->pc_sockets[i].pcs_flags = 0;
1787 value = pcic_getb(pcic, i,
1790 pcic->pc_sockets[i].pcs_flags |= PCS_SOCKET_IO;
1793 pcic_putb(pcic, i, PCIC_MAPPING_ENABLE, 0);
1795 switch (pcic->pc_type) {
1811 pcic_putb(pcic, 0, PCIC_MISC_CTL_2, PCIC_LED_ENABLE);
1820 switch (pcic->pc_intr_mode) {
1822 clext_reg_write(pcic, i, PCIC_CLEXT_MISC_CTL_3,
1823 ((clext_reg_read(pcic, i,
1827 clext_reg_write(pcic, i, PCIC_CLEXT_EXT_CTL_1,
1831 pcic_putb(pcic, i, PCIC_MISC_CTL_2, cfg);
1843 switch (pcic->pc_intr_mode) {
1845 clext_reg_write(pcic, i, PCIC_CLEXT_EXT_CTL_1,
1853 if (pcic->bus_speed > PCIC_PCI_25MHZ && i == 0) {
1856 pcic_putb(pcic, i, PCIC_MISC_CTL_2, cfg);
1861 if (pcic->bus_speed < PCIC_SYSCLK_33MHZ)
1863 ddi_put8(pcic->cfg_handle, pcic->cfgaddr +
1870 cfg = ddi_get8(pcic->cfg_handle,
1871 pcic->cfgaddr + PCIC_DEVCTL_REG);
1873 switch (pcic->pc_intr_mode) {
1885 ddi_put8(pcic->cfg_handle,
1886 pcic->cfgaddr + PCIC_DEVCTL_REG,
1889 cfg = ddi_get8(pcic->cfg_handle,
1890 pcic->cfgaddr + PCIC_CRDCTL_REG);
1893 switch (pcic->pc_intr_mode) {
1898 pcic->pc_flags |= PCF_USE_SMI;
1908 ddi_put8(pcic->cfg_handle,
1909 pcic->cfgaddr + PCIC_CRDCTL_REG,
1914 cfg = ddi_get8(pcic->cfg_handle,
1915 pcic->cfgaddr + PCIC_DEVCTL_REG);
1924 ddi_put8(pcic->cfg_handle,
1925 pcic->cfgaddr + PCIC_DEVCTL_REG, cfg);
1927 cfg = ddi_get8(pcic->cfg_handle,
1928 pcic->cfgaddr + PCIC_DIAG_REG);
1929 if (pcic->pc_type == PCIC_TI_PCI1225) {
1934 pcic->pc_flags |= PCF_USE_SMI;
1942 ddi_put8(pcic->cfg_handle,
1943 pcic->cfgaddr + PCIC_DIAG_REG, cfg);
1948 if (pcic->pc_intr_mode == PCIC_INTR_MODE_ISA) {
1950 cfg = ddi_get8(pcic->cfg_handle,
1951 pcic->cfgaddr + PCIC_BRIDGE_CTL_REG);
1953 ddi_put8(pcic->cfg_handle,
1954 pcic->cfgaddr + PCIC_BRIDGE_CTL_REG,
1958 cfg = ddi_get8(pcic->cfg_handle,
1959 pcic->cfgaddr + PCIC_DEVCTL_REG);
1962 ddi_put8(pcic->cfg_handle,
1963 pcic->cfgaddr + PCIC_DEVCTL_REG,
1969 cfg = ddi_get8(pcic->cfg_handle,
1970 pcic->cfgaddr + PCIC_DIAG_REG);
1972 ddi_put8(pcic->cfg_handle,
1973 pcic->cfgaddr + PCIC_DIAG_REG, cfg);
1985 if (ddi_getlongprop(DDI_DEV_T_ANY, pcic->dip,
2012 cfg = ddi_get8(pcic->cfg_handle,
2013 pcic->cfgaddr + PCIC_DEVCTL_REG);
2015 ddi_put8(pcic->cfg_handle,
2016 pcic->cfgaddr + PCIC_DEVCTL_REG,
2020 cfg = ddi_get8(pcic->cfg_handle,
2021 (pcic->cfgaddr + PCIC_SYSCTL_REG + 3));
2023 ddi_put8(pcic->cfg_handle, (pcic->cfgaddr +
2029 cfg = ddi_get8(pcic->cfg_handle,
2030 pcic->cfgaddr + PCIC_DIAG_REG);
2032 ddi_put8(pcic->cfg_handle,
2033 pcic->cfgaddr + PCIC_DIAG_REG, cfg);
2038 cfg = ddi_get8(pcic->cfg_handle, pcic->cfgaddr +
2044 ddi_put8(pcic->cfg_handle, pcic->cfgaddr +
2046 cfg = ddi_get8(pcic->cfg_handle, pcic->cfgaddr +
2048 switch (pcic->pc_intr_mode) {
2051 ddi_put8(pcic->cfg_handle,
2052 pcic->cfgaddr +
2055 cfg = ddi_get8(pcic->cfg_handle,
2056 pcic->cfgaddr + PCIC_BRIDGE_CTL_REG);
2058 ddi_put8(pcic->cfg_handle,
2059 pcic->cfgaddr + PCIC_BRIDGE_CTL_REG,
2066 ddi_put8(pcic->cfg_handle,
2067 pcic->cfgaddr +
2073 cfg32 = ddi_get32(pcic->cfg_handle,
2074 (uint32_t *)(pcic->cfgaddr +
2076 switch (pcic->pc_intr_mode) {
2080 ddi_put32(pcic->cfg_handle,
2081 (uint32_t *)(pcic->cfgaddr +
2084 cfg = ddi_get8(pcic->cfg_handle,
2085 pcic->cfgaddr + PCIC_BRIDGE_CTL_REG);
2087 ddi_put8(pcic->cfg_handle,
2088 pcic->cfgaddr + PCIC_BRIDGE_CTL_REG,
2094 ddi_put32(pcic->cfg_handle,
2095 (uint32_t *)(pcic->cfgaddr +
2102 if (pcic->pc_intr_mode == PCIC_INTR_MODE_ISA) {
2103 cfg16 = ddi_get16(pcic->cfg_handle,
2104 (uint16_t *)(pcic->cfgaddr +
2108 ddi_put16(pcic->cfg_handle,
2109 (uint16_t *)(pcic->cfgaddr +
2113 cfg16 = ddi_get16(pcic->cfg_handle,
2114 (uint16_t *)(pcic->cfgaddr +
2117 ddi_put16(pcic->cfg_handle,
2118 (uint16_t *)(pcic->cfgaddr +
2122 cfg = ddi_get8(pcic->cfg_handle,
2123 pcic->cfgaddr + PCIC_BRIDGE_CTL_REG);
2125 ddi_put8(pcic->cfg_handle,
2126 pcic->cfgaddr + PCIC_BRIDGE_CTL_REG,
2140 if ((pcic->pc_type >> 16) == PCIC_TI_VENDORID &&
2141 pcic->pc_intr_mode == PCIC_INTR_MODE_PCI_1) {
2142 value = ddi_get32(pcic->cfg_handle,
2143 (uint32_t *)(pcic->cfgaddr + PCIC_MFROUTE_REG));
2145 ddi_put32(pcic->cfg_handle, (uint32_t *)(pcic->cfgaddr +
2150 switch (pcic->pc_type) {
2156 pcic_putb(pcic, i, PCIC_MANAGEMENT_INT,
2160 if (pcic->pc_intr_mode ==
2162 pcic_putb(pcic, i, PCIC_MANAGEMENT_INT,
2166 pcic_putb(pcic, i, PCIC_MANAGEMENT_INT,
2168 (pcic->pc_sockets[i].pcs_smi << 4));
2173 pcic->pc_flags |= PCF_INTRENAB;
2176 pcic_putb(pcic, i, PCIC_INTERRUPT, PCIC_RESET);
2178 pcic_putb(pcic, i, PCIC_POWER_CONTROL, 0);
2181 switch (pcic->pc_type) {
2183 pcic_putb(pcic, i, PCIC_VG_CONTROL,
2185 pcic->pc_flags |= PCF_DEBOUNCE;
2188 pcic_putb(pcic, i, PCIC_GLOBAL_CONTROL,
2191 value = pcic_getb(pcic, i, PCIC_CARD_STATUS_CHANGE);
2192 pcic_putb(pcic, i, PCIC_CARD_STATUS_CHANGE, value);
2196 pcic_82092_smiirq_ctl(pcic, i, PCIC_82092_CTL_SMI,
2200 if (pcic->bus_speed >= PCIC_PCI_DEF_SYSCLK && i == 0) {
2201 value = pcic_getb(pcic, i, PCIC_MISC_CTL_2);
2202 pcic_putb(pcic, i, PCIC_MISC_CTL_2,
2212 i, value, pcic->pc_sockets[i].pcs_flags,
2213 (pcic->pc_sockets[i].pcs_flags &
2234 pcicdev_t *pcic = (pcicdev_t *)arg1;
2240 pcic_err(pcic->dip, 0xf,
2243 pcic->pc_flags, PCF_ATTACHED, pcic->pc_numsockets);
2246 if (!(pcic->pc_flags & PCF_ATTACHED))
2249 mutex_enter(&pcic->intr_lock);
2251 if (pcic->pc_flags & PCF_SUSPENDED) {
2252 mutex_exit(&pcic->intr_lock);
2269 io_ints = (1 << pcic->pc_numsockets) - 1;
2271 for (i = 0; i < pcic->pc_numsockets; i++) {
2276 sockp = &pcic->pc_sockets[i];
2289 if (pcic->pc_io_type == PCIC_IO_TYPE_YENTA)
2290 value_cb = pcic_getcb(pcic, CB_STATUS_EVENT);
2292 value = pcic_change(pcic, i);
2295 int x = pcic->pc_cb_arg;
2300 pcic_err(pcic->dip, 0x9,
2304 pcic_getcb(pcic, CB_STATUS_EVENT));
2311 status = pcic_getb(pcic, i, PCIC_INTERFACE_STATUS);
2315 pcic_putcb(pcic, CB_STATUS_EVENT, value_cb);
2318 pcic_putb(pcic, i, PCIC_CARD_STATUS_CHANGE,
2321 if (pcic->pc_callback == NULL) {
2345 irq = pcic_getb(pcic, sockp->pcs_socket,
2348 pcic_putb(pcic, sockp->pcs_socket,
2351 pcic_putcb(pcic, CB_STATUS_MASK, 0x0);
2373 PC_CALLBACK(pcic->dip, x, PCE_CARD_READY, i);
2381 PC_CALLBACK(pcic->dip, x,
2394 PC_CALLBACK(pcic->dip, x,
2402 PC_CALLBACK(pcic->dip, x,
2423 pcic_err(pcic->dip, 0xf,
2425 pcic->pc_intr_mode, pcic->pc_type, io_ints);
2429 if (pcic_do_io_intr(pcic, io_ints) == DDI_INTR_CLAIMED)
2433 mutex_exit(&pcic->intr_lock);
2436 pcic_err(pcic->dip, 0xf,
2450 pcic_change(pcicdev_t *pcic, int socket)
2452 return (pcic_getb(pcic, socket, PCIC_CARD_STATUS_CHANGE));
2459 pcic_do_io_intr(pcicdev_t *pcic, uint32_t sockets)
2465 pcic_err(pcic->dip, 0xf,
2466 "pcic_do_io_intr: pcic=%p sockets=%d irq_top=%p\n",
2467 (void *)pcic, (int)sockets, (void *)pcic->irq_top);
2470 if (pcic->irq_top != NULL) {
2471 tmp = pcic->irq_current;
2474 int cur = pcic->irq_current->socket;
2476 &pcic->pc_sockets[cur];
2479 pcic_err(pcic->dip, 0xf,
2482 pcic_err(pcic->dip, 0xf,
2485 sockets, cur, (void *)pcic->irq_current->intr,
2486 pcic->irq_current->arg1,
2487 pcic->irq_current->arg2);
2493 if ((*pcic->irq_current->intr)(pcic->irq_current->arg1,
2494 pcic->irq_current->arg2) == DDI_INTR_CLAIMED)
2498 pcic_err(pcic->dip, 0xf,
2505 if ((pcic->irq_current = pcic->irq_current->next) == NULL)
2506 pcic->irq_current = pcic->irq_top;
2508 } while (pcic->irq_current != tmp);
2510 if ((pcic->irq_current = pcic->irq_current->next) == NULL)
2511 pcic->irq_current = pcic->irq_top;
2518 pcic_err(pcic->dip, 0xf,
2537 pcicdev_t *pcic = anp->an_private;
2539 config->NumSockets = pcic->pc_numsockets;
2540 config->NumWindows = pcic->pc_numsockets * PCIC_NUMWINSOCK;
2545 config->NumPower = pcic->pc_numpower;
2546 config->power_entry = pcic->pc_power; /* until we resolve this */
2555 switch (pcic->pc_intr_mode) {
2575 pcicdev_t *pcic = anp->an_private;
2578 pcic->pc_callback = handler;
2579 pcic->pc_cb_arg = arg;
2580 pcic->pc_flags |= PCF_CALLBACK;
2582 pcic->pc_callback = NULL;
2583 pcic->pc_cb_arg = 0;
2584 pcic->pc_flags &= ~PCF_CALLBACK;
2595 * pcic_calc_speed (pcicdev_t *pcic, uint32_t speed)
2601 pcic_calc_speed(pcicdev_t *pcic, uint32_t speed)
2606 switch (pcic->pc_type) {
2680 pcic_set_cdtimers(pcicdev_t *pcic, int socket, uint32_t speed, int tset)
2690 clk_pulse = mhztons(pcic->bus_speed);
2710 pcic_err(pcic->dip, 8, "pcic_set_cdtimers(%d, Timer Set %d)\n"
2716 pcic_putb(pcic, socket, PCIC_TIME_COMMAND_0 + offset, cmd);
2717 pcic_putb(pcic, socket, PCIC_TIME_SETUP_0 + offset, set);
2718 pcic_putb(pcic, socket, PCIC_TIME_RECOVER_0 + offset, rec);
2727 * dip pcic driver's device information
2734 pcicdev_t *pcic = anp->an_private;
2737 pcic_socket_t *sockp = &pcic->pc_sockets[window->socket];
2797 mutex_enter(&pcic->pc_lock); /* protect the registers */
2842 req.ra_boundbase = pcic->pc_base;
2843 req.ra_boundlen = pcic->pc_bound;
2864 mutex_exit(&pcic->pc_lock);
2880 which = pcmcia_map_reg(pcic->dip,
2900 mutex_exit(&pcic->pc_lock);
2954 pcic_putb(pcic, socket,
2957 pcic_putb(pcic, socket,
2965 switch (pcic->pc_type) {
2967 pcic_putb(pcic, socket,
2973 clext_reg_write(pcic, socket,
2988 if (pcic->pc_bound == 0xffffffff) {
2989 pcic_putb(pcic, socket,
2992 pcic->pc_base = SYSMEM_EXT(base) << 24;
2993 pcic->pc_bound = 0x1000000;
3017 pcic_putb(pcic, socket,
3024 pcic->pc_type);
3025 pcic_putb(pcic, socket,
3042 switch (pcic->pc_type) {
3048 pcic_set_cdtimers(pcic, socket,
3055 wspeed = pcic_calc_speed(pcic, window->speed);
3067 pcic_putb(pcic, socket, PCIC_SYSMEM_0_STOPLOW + select,
3072 pcic_putb(pcic, socket, PCIC_SYSMEM_0_STOPHI + select,
3081 pcic_putb(pcic, socket,
3085 pcic_putb(pcic, socket,
3094 select = pcic_getb(pcic, socket,
3097 pcic_putb(pcic, socket, PCIC_MAPPING_ENABLE, select);
3115 select = pcic_getb(pcic, socket, PCIC_MAPPING_ENABLE);
3117 pcic_putb(pcic, socket, PCIC_MAPPING_ENABLE, select);
3124 xxdmp_all_regs(pcic, window->socket, -1);
3149 mutex_enter(&pcic->pc_lock); /* protect the registers */
3202 ((pcic->pc_flags & PCF_IO_REMAP) ? 0 : base);
3208 req.ra_boundbase = pcic->pc_iobase;
3209 req.ra_boundlen = pcic->pc_iobound;
3233 mutex_exit(&pcic->pc_lock);
3260 if ((which = pcmcia_map_reg(pcic->dip,
3279 mutex_exit(&pcic->pc_lock);
3310 pcic_putb(pcic, socket,
3313 pcic_putb(pcic, socket,
3317 pcic_putb(pcic, socket,
3321 pcic_putb(pcic, socket,
3334 if (pcic->pc_flags & PCF_IO_REMAP) {
3345 pcic_putb(pcic, socket,
3349 pcic_putb(pcic, socket,
3371 switch (pcic->pc_type) {
3385 pcic_set_cdtimers(pcic, socket,
3406 mhztons(pcic->bus_speed) * 3)
3410 mhztons(pcic->bus_speed) * 6)
3419 select = pcic_getb(pcic, socket, PCIC_IO_CONTROL);
3422 pcic_putb(pcic, socket, PCIC_IO_CONTROL, select);
3427 select = pcic_getb(pcic, socket, PCIC_MAPPING_ENABLE);
3428 pcic_putb(pcic, socket, PCIC_MAPPING_ENABLE,
3439 xxdmp_all_regs(pcic, window->socket * 0x40, 24);
3456 select = pcic_getb(pcic, socket,
3458 pcic_putb(pcic, socket, PCIC_MAPPING_ENABLE,
3469 pcic_putb(pcic, socket,
3471 pcic_putb(pcic, socket,
3473 pcic_putb(pcic, socket,
3475 pcic_putb(pcic, socket,
3479 mutex_exit(&pcic->pc_lock);
3489 pcic_card_state(pcicdev_t *pcic, pcic_socket_t *sockp)
3496 mutex_enter(&pcic->pc_lock); /* protect the registers */
3498 value = pcic_getb(pcic, sockp->pcs_socket, PCIC_INTERFACE_STATUS);
3533 mutex_exit(&pcic->pc_lock);
3536 pcic_err(pcic->dip, 8,
3557 pcicdev_t *pcic = anp->an_private;
3582 mutex_enter(&pcic->pc_lock); /* protect the registers */
3584 memp = &pcic->pc_sockets[socket].pcs_windows[window].mem;
3640 pcic_putb(pcic, socket, PCIC_CARDMEM_0_LOW + select,
3642 (void) pcic_getb(pcic, socket, PCIC_CARDMEM_0_LOW + select);
3643 pcic_putb(pcic, socket, PCIC_CARDMEM_0_HI + select,
3645 (void) pcic_getb(pcic, socket, PCIC_CARDMEM_0_HI + select);
3651 which = pcic_getb(pcic, socket, PCIC_MAPPING_ENABLE);
3653 pcic_putb(pcic, socket, PCIC_MAPPING_ENABLE, which);
3654 (void) pcic_getb(pcic, socket, PCIC_MAPPING_ENABLE);
3664 xxdmp_all_regs(pcic, socket, -1);
3673 pcic_mswait(pcic, socket, 2);
3675 mutex_exit(&pcic->pc_lock);
3691 pcic_set_vcc_level(pcicdev_t *pcic, set_socket_t *socket)
3698 "pcic_set_vcc_level(pcic=%p, VccLevel=%d)\n",
3699 (void *)pcic, socket->VccLevel);
3715 if (socket->VccLevel >= pcic->pc_numpower) {
3719 switch (pcic->pc_io_type) {
3732 ddi_get32(pcic->handle, (uint32_t *)(pcic->ioaddr +
3759 return ((unsigned)ddi_get8(pcic->handle,
3760 pcic->ioaddr + CB_R2_OFFSET +
3788 pcicdev_t *pcic = anp->an_private;
3789 pcic_socket_t *sockp = &pcic->pc_sockets[socket->socket];
3826 if (socket->VccLevel >= pcic->pc_numpower)
3832 if (!(pcic->pc_flags & PCF_33VCAP)) {
3836 ddi_get_name(pcic->dip),
3837 ddi_get_instance(pcic->dip));
3842 if ((pcic->pc_io_type == PCIC_IO_TYPE_YENTA) &&
3843 pcic_getcb(pcic, CB_PRESENT_STATE) &
3873 socket->Vpp1Level < pcic->pc_numpower) {
3883 socket->Vpp2Level < pcic->pc_numpower) {
3893 if (pcic->pc_flags & PCF_VPPX) {
3906 ddi_get_name(pcic->dip),
3907 ddi_get_instance(pcic->dip));
3921 mutex_enter(&pcic->pc_lock); /* protect the registers */
3924 interrupt = pcic_getb(pcic, socket->socket, PCIC_INTERRUPT);
3926 if (pcic->pc_flags & PCF_USE_SMI)
3928 pcic_putb(pcic, socket->socket, PCIC_INTERRUPT, interrupt);
3930 switch (pcic->pc_type) {
3932 pcic_82092_smiirq_ctl(pcic, socket->socket, PCIC_82092_CTL_IRQ,
3940 mirq = pcic_getb(pcic, socket->socket, PCIC_MANAGEMENT_INT);
3949 pcic_putb(pcic, socket->socket, PCIC_MANAGEMENT_INT,
3984 pcic_mswait(pcic, socket->socket, 10);
3993 switch (pcic->pc_type) {
4002 irq = pcic_getb(pcic, socket->socket, PCIC_CARD_DETECT);
4004 pcic->pc_flags & PCF_GPI_EJECT) {
4009 pcic_putb(pcic, socket->socket, PCIC_CARD_DETECT, irq);
4014 pcic_putb(pcic, socket->socket, PCIC_MISC_CTL_2, 0x0);
4015 value = pcic_getb(pcic, socket->socket,
4017 if (pcic->pc_flags & PCF_AUDIO)
4019 pcic_putb(pcic, socket->socket, PCIC_MISC_CTL_1,
4022 value = pcic_getb(pcic, socket->socket,
4025 pcic_putb(pcic, socket->socket, PCIC_MISC_CTL_1,
4032 value = pcic_getb(pcic, socket->socket, PCIC_MISC_CTL_1);
4033 if ((socket->IFType == IF_IO) && (pcic->pc_flags & PCF_AUDIO)) {
4044 pcic_putb(pcic, socket->socket, PCIC_MISC_CTL_1, value);
4048 value = pcic_getcb(pcic, CB_MISCCTRL);
4049 if ((socket->IFType == IF_IO) && (pcic->pc_flags & PCF_AUDIO))
4053 pcic_putcb(pcic, CB_MISCCTRL, value);
4067 value = ddi_get8(pcic->cfg_handle,
4068 pcic->cfgaddr + PCIC_CRDCTL_REG);
4069 if ((socket->IFType == IF_IO) && (pcic->pc_flags & PCF_AUDIO)) {
4074 ddi_put8(pcic->cfg_handle,
4075 pcic->cfgaddr + PCIC_CRDCTL_REG, value);
4093 orig_pwrctl = pcic_getb(pcic, socket->socket, PCIC_POWER_CONTROL);
4096 pcic_putb(pcic, socket->socket,
4098 (void) pcic_getb(pcic, socket->socket, PCIC_POWER_CONTROL);
4101 if (pcic->pc_flags & PCF_CBPWRCTL) {
4102 value = pcic_cbus_powerctl(pcic, socket->socket);
4105 value = pcic_exca_powerctl(pcic, socket->socket, powerlevel);
4108 mutex_exit(&pcic->pc_lock);
4117 orig_pwrctl = pcic_getb(pcic, socket->socket,
4120 pcic_putb(pcic, socket->socket,
4122 (void) pcic_getb(pcic, socket->socket, PCIC_POWER_CONTROL);
4129 pcic_putb(pcic, socket->socket, PCIC_MANAGEMENT_INT, mirq);
4134 mirq, pcic_getb(pcic, socket->socket, PCIC_POWER_CONTROL),
4135 pcic_getcb(pcic, CB_CONTROL));
4142 value = pcic_getb(pcic, socket->socket, PCIC_INTERRUPT);
4158 pcic_putb(pcic, socket->socket, PCIC_INTERRUPT, value);
4160 pcic_enable_io_intr(pcic, socket->socket, irq);
4163 pcic_disable_io_intr(pcic, socket->socket);
4172 xxdmp_all_regs(pcic, socket->socket, 20);
4180 value = pcic_getb(pcic, socket->socket, PCIC_INTERRUPT);
4182 pcic_putb(pcic, socket->socket, PCIC_INTERRUPT, value);
4183 pcic_disable_io_intr(pcic, socket->socket);
4189 mutex_exit(&pcic->pc_lock);
4203 pcicdev_t *pcic = anp->an_private;
4209 value = pcic->pc_sockets[socket->socket].pcs_flags;
4292 pcicdev_t *pcic = anp->an_private;
4294 if (pcic->pc_flags & PCF_INTRENAB)
4310 pcicdev_t *pcic = anp->an_private;
4318 if (window < PCIC_IOWINDOWS || socket >= pcic->pc_numsockets) {
4322 winp = &pcic->pc_sockets[socket].pcs_windows[window].mem;
4350 pcicdev_t *pcic = anp->an_private;
4355 sockp = &pcic->pc_sockets[socknum];
4358 sockp->pcs_state = pcic_card_state(pcic, sockp);
4393 pcicdev_t *pcic = anp->an_private;
4398 sockp = &pcic->pc_sockets[socknum];
4400 status->CardState = pcic_card_state(pcic, sockp);
4423 switch (pcic->pc_type) {
4435 present_state = pcic_getcb(pcic, CB_PRESENT_STATE);
4462 pcicdev_t *pcic = anp->an_private;
4476 if (socket > pcic->pc_numsockets)
4479 sockp = &pcic->pc_sockets[socket];
4524 pcic_ll_reset(pcicdev_t *pcic, int socket)
4530 windowbits = pcic_getb(pcic, socket, PCIC_MAPPING_ENABLE);
4534 pcic_putb(pcic, socket, PCIC_MAPPING_ENABLE, 0);
4537 pcic_err(pcic->dip, 6,
4539 socket, pcic_getb(pcic, socket, PCIC_POWER_CONTROL),
4540 pcic_getcb(pcic, CB_CONTROL),
4541 pcic_getcb(pcic, CB_PRESENT_STATE));
4550 if (pcic->pc_flags & PCF_CBPWRCTL) {
4551 pwr = pcic_getcb(pcic, CB_CONTROL);
4552 pcic_putcb(pcic, CB_CONTROL, (pwr&~CB_C_VPPMASK)|CB_C_VPPVCC);
4553 (void) pcic_getcb(pcic, CB_CONTROL);
4555 pwr = pcic_getb(pcic, socket, PCIC_POWER_CONTROL);
4556 pcic_putb(pcic, socket, PCIC_POWER_CONTROL,
4558 (void) pcic_getb(pcic, socket, PCIC_POWER_CONTROL);
4563 pcic_err(pcic->dip, 8, "pcic_ll_reset pre_wait %d mS\n",
4565 pcic_mswait(pcic, socket, pcic_prereset_time);
4569 pcic_err(pcic->dip, 8,
4571 iobits = pcic_getb(pcic, socket, PCIC_INTERRUPT);
4573 pcic_putb(pcic, socket, PCIC_INTERRUPT, iobits);
4574 (void) pcic_getb(pcic, socket, PCIC_INTERRUPT);
4576 switch (pcic->pc_type) {
4578 pcic_82092_smiirq_ctl(pcic, socket, PCIC_82092_CTL_IRQ,
4585 pcic->pc_sockets[socket].pcs_state = 0;
4588 pcic_err(pcic->dip, 8, "pcic_ll_reset reset_wait %d mS\n",
4590 pcic_mswait(pcic, socket, pcic_reset_time);
4593 pcic_err(pcic->dip, 8, "pcic_ll_reset take it out of reset now\n");
4596 pcic_putb(pcic, socket, PCIC_INTERRUPT, PCIC_RESET | iobits);
4597 (void) pcic_getb(pcic, socket, PCIC_INTERRUPT);
4601 * want to sit around that long. The pcic is still usable.
4605 pcic_err(pcic->dip, 8, "pcic_ll_reset post_wait %d mS\n",
4607 pcic_mswait(pcic, socket, pcic_postreset_time);
4615 if (pcic->pc_flags & PCF_CBPWRCTL) {
4616 pcic_putcb(pcic, CB_CONTROL, pwr);
4617 (void) pcic_getcb(pcic, CB_CONTROL);
4619 pcic_putb(pcic, socket, PCIC_POWER_CONTROL, pwr);
4620 (void) pcic_getb(pcic, socket, PCIC_POWER_CONTROL);
4624 pcic_err(pcic->dip, 7, "pcic_ll_reset returning 0x%x\n", windowbits);
4640 pcicdev_t *pcic = anp->an_private;
4652 mutex_enter(&pcic->pc_lock); /* protect the registers */
4655 mint = pcic_getb(pcic, socket, PCIC_MANAGEMENT_INT);
4656 pcic_putb(pcic, socket, PCIC_MANAGEMENT_INT, mint & ~PCIC_CHANGE_MASK);
4658 sockp = &pcic->pc_sockets[socket];
4660 value = pcic_ll_reset(pcic, socket);
4682 pcic_putb(pcic, socket, PCIC_MAPPING_ENABLE, value);
4684 pcic_mswait(pcic, socket, 10);
4686 pcic_putb(pcic, socket, PCIC_MANAGEMENT_INT, mint);
4687 mutex_exit(&pcic->pc_lock);
4699 pcicdev_t *pcic = anp->an_private;
4707 pcic->pc_intr_mode);
4710 (void *)pcic->irq_top, (void *)handler->handler,
4726 switch (pcic->pc_intr_mode) {
4733 mutex_enter(&pcic->intr_lock);
4735 if (pcic->irq_top == NULL) {
4736 pcic->irq_top = intr;
4737 pcic->irq_current = pcic->irq_top;
4739 while (pcic->irq_current->next != NULL)
4740 pcic->irq_current = pcic->irq_current->next;
4741 pcic->irq_current->next = intr;
4742 pcic->irq_current = pcic->irq_current->next;
4745 pcic->irq_current->intr =
4747 pcic->irq_current->handler_id = handler->handler_id;
4748 pcic->irq_current->arg1 = handler->arg1;
4749 pcic->irq_current->arg2 = handler->arg2;
4750 pcic->irq_current->socket = handler->socket;
4752 mutex_exit(&pcic->intr_lock);
4754 handler->iblk_cookie = &pcic->pc_pri;
4755 handler->idev_cookie = &pcic->pc_dcookie;
4771 mutex_enter(&pcic->pc_lock);
4772 if (pcic->pc_handlers == NULL) {
4773 pcic->pc_handlers = intr;
4776 insque(intr, pcic->pc_handlers);
4778 mutex_exit(&pcic->pc_lock);
4792 (void *)pcic->irq_top, value);
4824 pcicdev_t *pcic = anp->an_private;
4839 pcic->pc_intr_mode);
4842 (void *)pcic->irq_top, (void *)handler->handler,
4847 switch (pcic->pc_intr_mode) {
4850 mutex_enter(&pcic->intr_lock);
4851 if (pcic->irq_top == NULL) {
4852 mutex_exit(&pcic->intr_lock);
4857 pcic->irq_current = pcic->irq_top;
4859 while ((pcic->irq_current != NULL) &&
4860 (pcic->irq_current->handler_id !=
4862 intr = pcic->irq_current;
4863 pcic->irq_current = pcic->irq_current->next;
4866 if (pcic->irq_current == NULL) {
4867 mutex_exit(&pcic->intr_lock);
4872 intr->next = pcic->irq_current->next;
4874 pcic->irq_top = pcic->irq_current->next;
4877 current = pcic->irq_current;
4878 pcic->irq_current = pcic->irq_top;
4879 mutex_exit(&pcic->intr_lock);
4886 mutex_enter(&pcic->pc_lock);
4895 (void) ddi_intr_disable(pcic->pc_intr_htblp[i]);
4897 pcic->pc_intr_htblp[i]);
4898 (void) ddi_intr_free(pcic->pc_intr_htblp[i]);
4899 (void) pcmcia_return_intr(pcic->dip, i);
4922 mutex_exit(&pcic->pc_lock);
4929 (void *)pcic->irq_top);
5028 xxdmp_cl_regs(pcicdev_t *pcic, int socket, uint32_t len)
5041 value = pcic_getb(pcic, sval, cregs[i].off);
5064 i = pcic_getb(pcic, socket, PCIC_TIME_SETUP_0);
5065 j = pcic_getb(pcic, socket, PCIC_TIME_SETUP_1);
5068 i = pcic_getb(pcic, socket, PCIC_TIME_COMMAND_0);
5069 j = pcic_getb(pcic, socket, PCIC_TIME_COMMAND_1);
5072 i = pcic_getb(pcic, socket, PCIC_TIME_RECOVER_0);
5073 j = pcic_getb(pcic, socket, PCIC_TIME_RECOVER_1);
5079 value = clext_reg_read(pcic, socket, cxregs[i].off);
5104 xxdmp_all_regs(pcicdev_t *pcic, int socket, uint32_t len)
5121 value = pcic_getb(pcic, socket, iregs[i].off);
5142 switch (pcic->pc_type) {
5147 (void) xxdmp_cl_regs(pcic, socket, 0xFFFF);
5160 pcic_mswait(pcicdev_t *pcic, int socket, int ms)
5163 pcic->pc_sockets[socket].pcs_flags |= PCS_WAITING;
5164 pcic_mutex_exit(&pcic->pc_lock);
5166 pcic_mutex_enter(&pcic->pc_lock);
5167 pcic->pc_sockets[socket].pcs_flags &= ~PCS_WAITING;
5172 * pcic_check_ready(pcic, index, off)
5178 pcic_check_ready(pcicdev_t *pcic, int socket)
5182 intstate = pcic_getb(pcic, socket, PCIC_INTERRUPT);
5183 ifstate = pcic_getb(pcic, socket, PCIC_INTERFACE_STATUS);
5195 xxdmp_all_regs(pcic, socket, -1);
5206 clext_reg_read(pcicdev_t *pcic, int sn, uchar_t ext_reg)
5210 switch (pcic->pc_io_type) {
5212 val = ddi_get8(pcic->handle,
5213 pcic->ioaddr + CB_CLEXT_OFFSET + ext_reg);
5216 pcic_putb(pcic, sn, PCIC_CL_EXINDEX, ext_reg);
5217 val = pcic_getb(pcic, sn, PCIC_CL_EXINDEX + 1);
5225 clext_reg_write(pcicdev_t *pcic, int sn, uchar_t ext_reg, uchar_t value)
5227 switch (pcic->pc_io_type) {
5229 ddi_put8(pcic->handle,
5230 pcic->ioaddr + CB_CLEXT_OFFSET + ext_reg, value);
5233 pcic_putb(pcic, sn, PCIC_CL_EXINDEX, ext_reg);
5234 pcic_putb(pcic, sn, PCIC_CL_EXINDEX + 1, value);
5267 pcic_find_pci_type(pcicdev_t *pcic)
5271 vend = ddi_getprop(DDI_DEV_T_ANY, pcic->dip,
5274 device = ddi_getprop(DDI_DEV_T_ANY, pcic->dip,
5279 pcic->pc_type = device;
5280 pcic->pc_chipname = "PCI:unknown";
5284 pcic->pc_chipname = PCIC_TYPE_i82092;
5287 pcic->pc_chipname = PCIC_TYPE_PD6729;
5294 if ((clext_reg_read(pcic, 0, PCIC_CLEXT_MISC_CTL_3) &
5297 pcic->pc_chipname = PCIC_TYPE_PD6730;
5298 pcic->pc_type = PCIC_CL_PD6730;
5302 pcic->pc_chipname = PCIC_TYPE_PD6730;
5305 pcic->pc_chipname = PCIC_TYPE_PD6832;
5308 pcic->pc_chipname = PCIC_TYPE_34C90;
5311 pcic->pc_chipname = PCIC_TYPE_TOPIC95;
5314 pcic->pc_chipname = PCIC_TYPE_TOPIC100;
5317 pcic->pc_chipname = PCIC_TYPE_PCI1031;
5320 pcic->pc_chipname = PCIC_TYPE_PCI1130;
5323 pcic->pc_chipname = PCIC_TYPE_PCI1131;
5326 pcic->pc_chipname = PCIC_TYPE_PCI1250;
5329 pcic->pc_chipname = PCIC_TYPE_PCI1225;
5332 pcic->pc_chipname = PCIC_TYPE_PCI1410;
5335 pcic->pc_chipname = PCIC_TYPE_PCI1510;
5338 pcic->pc_chipname = PCIC_TYPE_PCI1520;
5341 pcic->pc_chipname = PCIC_TYPE_PCI1221;
5344 pcic->pc_chipname = PCIC_TYPE_PCI1050;
5347 pcic->pc_chipname = PCIC_TYPE_1410;
5350 pcic->pc_chipname = PCIC_TYPE_OZ6912;
5353 pcic->pc_chipname = PCIC_TYPE_RL5C466;
5356 pcic->pc_chipname = PCIC_TYPE_PCI1420;
5359 pcic->pc_chipname = PCIC_TYPE_1420;
5364 pcic->pc_chipname = PCIC_TYPE_TOSHIBA;
5365 pcic->pc_type = PCIC_TOSHIBA_VENDOR;
5368 pcic->pc_chipname = PCIC_TYPE_TI;
5369 pcic->pc_type = PCIC_TI_VENDOR;
5372 pcic->pc_chipname = PCIC_TYPE_O2MICRO;
5373 pcic->pc_type = PCIC_O2MICRO_VENDOR;
5376 pcic->pc_chipname = PCIC_TYPE_RICOH;
5377 pcic->pc_type = PCIC_RICOH_VENDOR;
5380 if (!(pcic->pc_flags & PCF_CARDBUS))
5382 pcic->pc_chipname = PCIC_TYPE_YENTA;
5390 pcic_82092_smiirq_ctl(pcicdev_t *pcic, int socket, int intr, int state)
5392 uchar_t ppirr = ddi_get8(pcic->cfg_handle,
5393 pcic->cfgaddr + PCIC_82092_PPIRR);
5409 ddi_put8(pcic->cfg_handle, pcic->cfgaddr + PCIC_82092_PPIRR,
5449 pcic_handle_cd_change(pcicdev_t *pcic, pcic_socket_t *sockp, uint8_t status)
5475 pcic_err(pcic->dip, 6,
5476 "pcic%d handle_cd_change: socket %d card status 0x%x"
5477 " deb 0x%p\n", ddi_get_instance(pcic->dip),
5486 pcic_err(pcic->dip, 8, "New card (0x%x)\n", sockp->pcs_flags);
5488 cbps = pcic_getcb(pcic, CB_PRESENT_STATE);
5490 pcic_err(pcic->dip, 8, "CBus PS (0x%x)\n", cbps);
5499 ddi_get_name(pcic->dip),
5500 ddi_get_instance(pcic->dip),
5502 pcic_putcb(pcic, CB_EVENT_FORCE, CB_EF_CVTEST);
5510 cbps = pcic_getcb(pcic, CB_PRESENT_STATE);
5513 pcic_err(pcic->dip,
5517 if (pcic->pc_callback) {
5521 pcic->dip, PCM_DEVICETYPE,
5523 PC_CALLBACK(pcic->dip,
5524 pcic->pc_cb_arg,
5529 pcic_err(pcic->dip,
5532 if (pcic->pc_flags & PCF_CARDBUS) {
5536 if (!pcic_load_cardbus(pcic,
5539 pcic, sockp);
5573 pcic_err(pcic->dip, 5,
5574 "pcic%d: Odd card insertion indication on socket %d\n",
5575 ddi_get_instance(pcic->dip),
5597 if (pcic->pc_flags & PCF_CBPWRCTL) {
5598 pcic_putcb(pcic, CB_CONTROL, 0);
5600 pcic_putb(pcic, sockp->pcs_socket,
5602 (void) pcic_getb(pcic, sockp->pcs_socket,
5606 pcic_err(pcic->dip, 8, "Card removed\n");
5612 if (pcic_do_removal && pcic->pc_callback) {
5613 PC_CALLBACK(pcic->dip, pcic->pc_cb_arg,
5638 pcic_unload_cardbus(pcic, sockp);
5639 /* pcic_dump_all(pcic); */
5657 pcic_err(pcic->dip, 8, "Queueing up debounce timeout for "
5659 ddi_get_instance(pcic->dip),
5680 irq = pcic_getb(pcic, sockp->pcs_socket, PCIC_MANAGEMENT_INT);
5682 pcic_putb(pcic, sockp->pcs_socket, PCIC_MANAGEMENT_INT, irq);
5683 pcic_putcb(pcic, CB_STATUS_MASK, CB_SE_CCDMASK);
5688 pcic_err(pcic->dip, 7, "Leaving pcic_handle_cd_change\n");
5696 pcic_getb(pcicdev_t *pcic, int socket, int reg)
5702 cmn_err(CE_CONT, "pcic_getb0: pcic=%p socket=%d reg=%d\n",
5703 (void *)pcic, socket, reg);
5705 pcic->pc_io_type, (void *)pcic->handle,
5706 (void *)pcic->ioaddr);
5710 switch (pcic->pc_io_type) {
5712 return (ddi_get8(pcic->handle,
5713 pcic->ioaddr + CB_R2_OFFSET + reg));
5716 ddi_put8(pcic->handle, pcic->ioaddr, work);
5717 return (ddi_get8(pcic->handle, pcic->ioaddr + 1));
5722 pcic_putb(pcicdev_t *pcic, int socket, int reg, int8_t value)
5729 "pcic_putb0: pcic=%p socket=%d reg=%d value=%x \n",
5730 (void *)pcic, socket, reg, value);
5733 pcic->pc_io_type, (void *)pcic->handle,
5734 (void *)pcic->ioaddr);
5739 switch (pcic->pc_io_type) {
5741 ddi_put8(pcic->handle, pcic->ioaddr + CB_R2_OFFSET + reg,
5746 ddi_put8(pcic->handle, pcic->ioaddr, work);
5747 ddi_put8(pcic->handle, pcic->ioaddr + 1, value);
5760 pcic_ci_cirrus(pcicdev_t *pcic)
5765 value1 = pcic_getb(pcic, 0, PCIC_CHIP_INFO);
5766 pcic_putb(pcic, 0, PCIC_CHIP_INFO, 0);
5767 value1 = pcic_getb(pcic, 0, PCIC_CHIP_INFO);
5768 value2 = pcic_getb(pcic, 0, PCIC_CHIP_INFO);
5773 pcic->pc_type = PCIC_CL_PD6710;
5775 pcic->pc_chipname = PCIC_TYPE_PD6720;
5777 pcic->pc_chipname = PCIC_TYPE_PD6710;
5779 value1 = clext_reg_read(pcic, 0, PCIC_CLEXT_DMASK_0);
5781 clext_reg_write(pcic, 0, PCIC_CLEXT_SCRATCH, 0x55);
5782 value1 = clext_reg_read(pcic, 0, PCIC_CLEXT_SCRATCH);
5784 pcic->pc_chipname = PCIC_TYPE_PD6722;
5785 pcic->pc_type = PCIC_CL_PD6722;
5786 clext_reg_write(pcic, 0, PCIC_CLEXT_SCRATCH, 0);
5799 pcic_vadem_enable(pcicdev_t *pcic)
5801 ddi_put8(pcic->handle, pcic->ioaddr, PCIC_VADEM_P1);
5802 ddi_put8(pcic->handle, pcic->ioaddr, PCIC_VADEM_P2);
5803 ddi_put8(pcic->handle, pcic->ioaddr, pcic->pc_lastreg);
5807 pcic_ci_vadem(pcicdev_t *pcic)
5811 pcic_vadem_enable(pcic);
5812 value = pcic_getb(pcic, 0, PCIC_CHIP_REVISION);
5813 pcic_putb(pcic, 0, PCIC_CHIP_REVISION, 0xFF);
5814 if (pcic_getb(pcic, 0, PCIC_CHIP_REVISION) ==
5816 (pcic_getb(pcic, 0, PCIC_CHIP_REVISION) & PCIC_REV_MASK) ==
5819 pcic_vadem_enable(pcic);
5820 vadem = pcic_getb(pcic, 0, PCIC_VG_DMA) &
5823 pcic_putb(pcic, 0, PCIC_VG_DMA, new);
5824 value = pcic_getb(pcic, 0, PCIC_CHIP_REVISION);
5827 pcic_putb(pcic, 0, PCIC_VG_DMA, vadem);
5830 pcic->pc_chipname = PCIC_VG_365;
5831 pcic->pc_type = PCIC_VADEM;
5834 pcic->pc_chipname = PCIC_VG_465;
5835 pcic->pc_type = PCIC_VADEM;
5836 pcic->pc_flags |= PCF_1SOCKET;
5839 pcic->pc_chipname = PCIC_VG_468;
5840 pcic->pc_type = PCIC_VADEM;
5843 pcic->pc_chipname = PCIC_VG_469;
5844 pcic->pc_type = PCIC_VADEM_VG469;
5856 pcic_ci_ricoh(pcicdev_t *pcic)
5860 value = pcic_getb(pcic, 0, PCIC_RF_CHIP_IDENT);
5863 pcic->pc_type = PCIC_RICOH;
5864 pcic->pc_chipname = PCIC_TYPE_RF5C296;
5867 pcic->pc_type = PCIC_RICOH;
5868 pcic->pc_chipname = PCIC_TYPE_RF5C396;
6095 pcic_load_cardbus(pcicdev_t *pcic, const pcic_socket_t *sockp)
6098 dev_info_t *dip = pcic->dip;
6106 pcic_mutex_exit(&pcic->pc_lock);
6114 present_state = pcic_getcb(pcic, CB_PRESENT_STATE);
6154 retval = cardbus_load_cardbus(dip, sockp->pcs_socket, pcic->pc_base);
6161 pcic_mutex_enter(&pcic->pc_lock);
6168 pcic_unload_cardbus(pcicdev_t *pcic, const pcic_socket_t *sockp)
6170 dev_info_t *dip = pcic->dip;
6173 pcic_mutex_exit(&pcic->pc_lock);
6188 pcic_mutex_enter(&pcic->pc_lock);
6192 pcic_getcb(pcicdev_t *pcic, int reg)
6194 ASSERT(pcic->pc_io_type == PCIC_IO_TYPE_YENTA);
6196 return (ddi_get32(pcic->handle,
6197 (uint32_t *)(pcic->ioaddr + CB_CB_OFFSET + reg)));
6201 pcic_putcb(pcicdev_t *pcic, int reg, uint32_t value)
6203 ASSERT(pcic->pc_io_type == PCIC_IO_TYPE_YENTA);
6205 ddi_put32(pcic->handle,
6206 (uint32_t *)(pcic->ioaddr + CB_CB_OFFSET + reg), value);
6210 pcic_enable_io_intr(pcicdev_t *pcic, int socket, int irq)
6215 value = pcic_getb(pcic, socket, PCIC_INTERRUPT) & ~PCIC_INTR_MASK;
6216 pcic_putb(pcic, socket, PCIC_INTERRUPT, value | irq);
6218 switch (pcic->pc_type) {
6220 pcic_82092_smiirq_ctl(pcic, socket, PCIC_82092_CTL_IRQ,
6224 value = pcic_getb(pcic, 0, PCIC_CENTDMA);
6226 pcic_putb(pcic, 0, PCIC_CENTDMA, value);
6239 brdgctl = ddi_get16(pcic->cfg_handle,
6240 (uint16_t *)(pcic->cfgaddr + PCI_CBUS_BRIDGE_CTRL));
6245 ddi_put16(pcic->cfg_handle,
6246 (uint16_t *)(pcic->cfgaddr + PCI_CBUS_BRIDGE_CTRL),
6249 (void) ddi_get16(pcic->cfg_handle,
6250 (uint16_t *)(pcic->cfgaddr + PCI_CBUS_BRIDGE_CTRL));
6258 pcic_disable_io_intr(pcicdev_t *pcic, int socket)
6263 value = pcic_getb(pcic, socket, PCIC_INTERRUPT) & ~PCIC_INTR_MASK;
6264 pcic_putb(pcic, socket, PCIC_INTERRUPT, value);
6266 switch (pcic->pc_type) {
6268 pcic_82092_smiirq_ctl(pcic, socket, PCIC_82092_CTL_IRQ,
6272 value = pcic_getb(pcic, 0, PCIC_CENTDMA);
6274 pcic_putb(pcic, 0, PCIC_CENTDMA, value);
6276 (void) pcic_getb(pcic, 0, PCIC_CENTDMA);
6295 brdgctl = ddi_get16(pcic->cfg_handle,
6296 (uint16_t *)(pcic->cfgaddr + PCI_CBUS_BRIDGE_CTRL));
6301 ddi_put16(pcic->cfg_handle,
6302 (uint16_t *)(pcic->cfgaddr + PCI_CBUS_BRIDGE_CTRL),
6305 (void) ddi_get16(pcic->cfg_handle,
6306 (uint16_t *)(pcic->cfgaddr + PCI_CBUS_BRIDGE_CTRL));
6317 pcicdev_t *pcic = anp->an_private;
6319 mutex_enter(&pcic->pc_lock);
6320 pcic_enable_io_intr(pcic, 0, pcic->pc_sockets[0].pcs_irq);
6321 mutex_exit(&pcic->pc_lock);
6328 pcicdev_t *pcic = anp->an_private;
6330 mutex_enter(&pcic->pc_lock);
6331 pcic_disable_io_intr(pcic, 0);
6332 mutex_exit(&pcic->pc_lock);
6369 pcicdev_t *pcic = (pcicdev_t *)arg;
6371 pci_config_get16(pcic->cfg_handle, PCI_CONF_STAT);
6373 pci_config_get16(pcic->cfg_handle, 0x16);
6377 cardbus_dump_pci_config(pcic->dip);
6381 (void) sprintf(nm, "%s-%d", ddi_driver_name(pcic->dip),
6382 ddi_get_instance(pcic->dip));
6393 pci_config_put16(pcic->cfg_handle,
6395 pci_config_put16(pcic->cfg_handle, 0x16, pci_cfg_sec_stat);
6411 pcic_do_resume(pcicdev_t *pcic)
6421 pcic_mutex_enter(&pcic->pc_lock); /* protect the registers */
6422 for (i = 0; i < pcic->pc_numsockets; i++) {
6424 interrupt = pcic_getb(pcic, i, PCIC_INTERRUPT);
6425 if (pcic->pc_flags & PCF_USE_SMI)
6427 pcic_putb(pcic, i, PCIC_INTERRUPT,
6429 pcic->pc_sockets[i].pcs_debounce_id =
6430 pcic_add_debqueue(&pcic->pc_sockets[i],
6433 pcic_mutex_exit(&pcic->pc_lock); /* protect the registers */
6435 (void) pcmcia_wait_insert(pcic->dip);
6443 cfg = ddi_get8(pcic->cfg_handle,
6444 pcic->cfgaddr + PCIC_BRIDGE_CTL_REG);
6447 ddi_put8(pcic->cfg_handle,
6448 pcic->cfgaddr + PCIC_BRIDGE_CTL_REG,
6450 cfg = ddi_get8(pcic->cfg_handle,
6451 pcic->cfgaddr + PCIC_BRIDGE_CTL_REG);
6453 pcic_err(pcic->dip, 1,
6454 "Failed to take pcic out of reset");
6493 callb_generic_cpr, "pcic debounce thread");
6571 pcic_err(NULL, 6, "pcic: Failed to find debounce id 0x%p\n", id);
6579 pcic_exca_powerctl(pcicdev_t *pcic, int socket, int powerlevel)
6584 orig_pwrctl = pcic_getb(pcic, socket, PCIC_POWER_CONTROL);
6587 pcic_err(pcic->dip, 6,
6601 pcic_putb(pcic, socket, PCIC_POWER_CONTROL, powerlevel);
6602 (void) pcic_getb(pcic, socket, PCIC_POWER_CONTROL);
6615 pcic_putb(pcic, socket, PCIC_POWER_CONTROL, powerlevel);
6617 value = pcic_getb(pcic, socket, PCIC_POWER_CONTROL);
6618 pcic_mswait(pcic, socket, pcic_powerdelay);
6620 pcic_err(pcic->dip, 8,
6622 value, pcic_getb(pcic, socket,
6624 pcic_err(pcic->dip, 8,
6626 pcic_getcb(pcic, CB_PRESENT_STATE),
6627 pcic_getcb(pcic, CB_CONTROL));
6634 ifs = pcic_getb(pcic, socket,
6639 pcic_putb(pcic, socket,
6641 (void) pcic_getb(pcic, socket,
6643 pcic_mswait(pcic, socket, 40);
6645 pcic_putcb(pcic, CB_EVENT_FORCE,
6647 pcic_mswait(pcic, socket, 100);
6649 pcic_putb(pcic, socket,
6652 (void) pcic_getb(pcic, socket,
6654 pcic_mswait(pcic, socket,
6656 pcic_putb(pcic, socket,
6658 (void) pcic_getb(pcic, socket,
6660 pcic_mswait(pcic, socket,
6667 "pcic socket %d: Power didn't get turned"
6671 pcic_getb(pcic, socket, PCIC_POWER_CONTROL),
6673 pcic_getb(pcic, socket, PCIC_MISC_CTL_1),
6674 pcic_getb(pcic, socket, PCIC_INTERRUPT),
6679 pcic_err(pcic->dip, 8,
6683 pcic_getb(pcic, socket, PCIC_POWER_CONTROL),
6684 pcic_getb(pcic, socket, PCIC_MISC_CTL_1),
6685 pcic_getb(pcic, socket, PCIC_INTERRUPT));
6689 pcic_putb(pcic, socket, PCIC_POWER_CONTROL, powerlevel);
6690 (void) pcic_getb(pcic, socket, PCIC_POWER_CONTROL);
6698 pcic_cbus_powerctl(pcicdev_t *pcic, int socket)
6702 pcic_socket_t *sockp = &pcic->pc_sockets[socket];
6704 pcic_putcb(pcic, CB_STATUS_EVENT, CB_SE_POWER_CYCLE);
6712 orig_cbctl = pcic_getcb(pcic, CB_CONTROL);
6715 pcic_err(pcic->dip, 6,
6723 iobits = pcic_getb(pcic, socket, PCIC_INTERRUPT);
6724 pcic_putb(pcic, socket, PCIC_INTERRUPT,
6727 pcic_putcb(pcic, CB_CONTROL, cbctl);
6730 pcic_mswait(pcic, socket, pcic_powerdelay);
6734 cbstev = pcic_getcb(pcic, CB_STATUS_EVENT);
6745 pcic_mswait(pcic, socket, 400);
6747 cbps = pcic_getcb(pcic, CB_PRESENT_STATE);
6758 pcic_err(pcic->dip, 8,
6760 cbstev, pcic_getcb(pcic, CB_PRESENT_STATE),
6765 pcic_putb(pcic, socket, PCIC_INTERRUPT, iobits);
6769 pcic_mswait(pcic, socket, 40);
6773 pcic_putb(pcic, socket, PCIC_INTERRUPT, iobits);
6776 "pcic socket %d: Power didn't get turned on/off!\n"
6779 pcic_getcb(pcic, CB_PRESENT_STATE),
6795 pcic_err(NULL, 6, debp ? "pcic debounce list (%s) lbolt 0x%x:\n" :
6796 "pcic debounce_list (%s) EMPTY lbolt 0x%x\n", msg, lbolt);