Lines Matching refs:ppc

70 #define LOG_PPC(function, ppc, string) \  argument
88 #define PPC_CONFIG_LOCK(ppc) critical_enter() argument
89 #define PPC_CONFIG_UNLOCK(ppc) critical_exit() argument
136 struct ppc_data *ppc = DEVTOSOFTC(dev); in ppc_ecp_sync() local
138 PPC_ASSERT_LOCKED(ppc); in ppc_ecp_sync()
139 if (!(ppc->ppc_avm & PPB_ECP) && !(ppc->ppc_dtm & PPB_ECP)) in ppc_ecp_sync()
142 r = r_ecr(ppc); in ppc_ecp_sync()
147 r = r_ecr(ppc); in ppc_ecp_sync()
164 ppc_detect_fifo(struct ppc_data *ppc) in ppc_detect_fifo() argument
171 ecr_sav = r_ecr(ppc); in ppc_detect_fifo()
172 ctr_sav = r_ctr(ppc); in ppc_detect_fifo()
175 w_ecr(ppc, 0xf4); in ppc_detect_fifo()
178 ppc->ppc_pword = (r_cnfgA(ppc) & PPC_PWORD_MASK); in ppc_detect_fifo()
181 if (ppc->ppc_pword != PPC_PWORD_8) { in ppc_detect_fifo()
182 LOG_PPC(__func__, ppc, "PWord not supported"); in ppc_detect_fifo()
186 w_ecr(ppc, 0x34); /* byte mode, no interrupt, no DMA */ in ppc_detect_fifo()
187 ctr = r_ctr(ppc); in ppc_detect_fifo()
188 w_ctr(ppc, ctr | PCD); /* set direction to 1 */ in ppc_detect_fifo()
191 w_ecr(ppc, 0xd4); in ppc_detect_fifo()
195 if (r_ecr(ppc) & PPC_FIFO_EMPTY) in ppc_detect_fifo()
197 cc = r_fifo(ppc); in ppc_detect_fifo()
201 LOG_PPC(__func__, ppc, "can't flush FIFO"); in ppc_detect_fifo()
206 w_ecr(ppc, 0xd0); in ppc_detect_fifo()
212 w_fifo(ppc, (char)i); in ppc_detect_fifo()
213 if (!ppc->ppc_rthr && (r_ecr(ppc) & PPC_SERVICE_INTR)) { in ppc_detect_fifo()
215 ppc->ppc_rthr = i+1; in ppc_detect_fifo()
217 if (r_ecr(ppc) & PPC_FIFO_FULL) { in ppc_detect_fifo()
218 ppc->ppc_fifo = i+1; in ppc_detect_fifo()
224 LOG_PPC(__func__, ppc, "can't fill FIFO"); in ppc_detect_fifo()
228 w_ecr(ppc, 0xd4); /* test mode, no interrupt, no DMA */ in ppc_detect_fifo()
229 w_ctr(ppc, ctr & ~PCD); /* set direction to 0 */ in ppc_detect_fifo()
230 w_ecr(ppc, 0xd0); /* enable interrupts */ in ppc_detect_fifo()
235 for (i=ppc->ppc_fifo; i>0; i--) { in ppc_detect_fifo()
236 if (r_fifo(ppc) != (char)(ppc->ppc_fifo-i)) { in ppc_detect_fifo()
237 LOG_PPC(__func__, ppc, "invalid data in FIFO"); in ppc_detect_fifo()
240 if (r_ecr(ppc) & PPC_SERVICE_INTR) { in ppc_detect_fifo()
242 ppc->ppc_wthr = ppc->ppc_fifo - i+1; in ppc_detect_fifo()
245 if (i>1 && (r_ecr(ppc) & PPC_FIFO_EMPTY)) { in ppc_detect_fifo()
246 LOG_PPC(__func__, ppc, "data lost in FIFO"); in ppc_detect_fifo()
252 if (!(r_ecr(ppc) & PPC_FIFO_EMPTY)) { in ppc_detect_fifo()
253 LOG_PPC(__func__, ppc, "can't empty the FIFO"); in ppc_detect_fifo()
257 w_ctr(ppc, ctr_sav); in ppc_detect_fifo()
258 w_ecr(ppc, ecr_sav); in ppc_detect_fifo()
263 w_ctr(ppc, ctr_sav); in ppc_detect_fifo()
264 w_ecr(ppc, ecr_sav); in ppc_detect_fifo()
270 ppc_detect_port(struct ppc_data *ppc) in ppc_detect_port() argument
273 w_ctr(ppc, 0x0c); /* To avoid missing PS2 ports */ in ppc_detect_port()
274 w_dtr(ppc, 0xaa); in ppc_detect_port()
275 if (r_dtr(ppc) != 0xaa) in ppc_detect_port()
289 ppc_reset_epp_timeout(struct ppc_data *ppc) in ppc_reset_epp_timeout() argument
293 r = r_str(ppc); in ppc_reset_epp_timeout()
294 w_str(ppc, r | 0x1); in ppc_reset_epp_timeout()
295 w_str(ppc, r & 0xfe); in ppc_reset_epp_timeout()
301 ppc_check_epp_timeout(struct ppc_data *ppc) in ppc_check_epp_timeout() argument
303 ppc_reset_epp_timeout(ppc); in ppc_check_epp_timeout()
305 return (!(r_str(ppc) & TIMEOUT)); in ppc_check_epp_timeout()
312 ppc_generic_setmode(struct ppc_data *ppc, int mode) in ppc_generic_setmode() argument
317 if (mode && !(ppc->ppc_avm & mode)) in ppc_generic_setmode()
321 if ((ppc->ppc_avm & PPB_ECP) || (ppc->ppc_dtm & PPB_ECP)) { in ppc_generic_setmode()
326 w_ecr(ppc, PPC_ECR_RESET); in ppc_generic_setmode()
341 w_ecr(ppc, ecr); in ppc_generic_setmode()
344 ppc->ppc_mode = mode; in ppc_generic_setmode()
357 ppc_smclike_setmode(struct ppc_data *ppc, int mode) in ppc_smclike_setmode() argument
362 if (mode && !(ppc->ppc_avm & mode)) in ppc_smclike_setmode()
366 if ((ppc->ppc_avm & PPB_ECP) || (ppc->ppc_dtm & PPB_ECP)) { in ppc_smclike_setmode()
371 w_ecr(ppc, PPC_ECR_RESET); in ppc_smclike_setmode()
387 w_ecr(ppc, ecr); in ppc_smclike_setmode()
390 ppc->ppc_mode = mode; in ppc_smclike_setmode()
422 ppc_pc873xx_detect(struct ppc_data *ppc, int chipset_mode) /* XXX mode never forced */ in ppc_pc873xx_detect() argument
450 ppc->ppc_model = NS_PC87332; in ppc_pc873xx_detect()
452 ppc->ppc_model = NS_PC87306; in ppc_pc873xx_detect()
454 ppc->ppc_model = NS_PC87334; in ppc_pc873xx_detect()
458 ppc->ppc_model = NS_PC87303; in ppc_pc873xx_detect()
489 if (pc873xx_porttab[val & 0x3] != ppc->ppc_base) { in ppc_pc873xx_detect()
492 switch (ppc->ppc_base) { in ppc_pc873xx_detect()
522 if (pc873xx_porttab[val] != ppc->ppc_base) { in ppc_pc873xx_detect()
525 pc873xx_porttab[val], ppc->ppc_base); in ppc_pc873xx_detect()
534 if (ppc->ppc_base == 0x378) in ppc_pc873xx_detect()
540 printf("PC873xx irq %d at 0x%x\n", irq, ppc->ppc_base); in ppc_pc873xx_detect()
545 if (irq != ppc->ppc_irq) { in ppc_pc873xx_detect()
550 if (ppc->ppc_base == 0x378 && !(ptr & PC873_CFGLOCK)) { in ppc_pc873xx_detect()
551 if (ppc->ppc_irq == 7) { in ppc_pc873xx_detect()
559 printf("PC873xx irq set to %d\n", ppc->ppc_irq); in ppc_pc873xx_detect()
576 ppc->ppc_avm |= PPB_NIBBLE; in ppc_pc873xx_detect()
581 ppc->ppc_avm |= PPB_EPP; in ppc_pc873xx_detect()
587 ppc->ppc_epp = EPP_1_9; in ppc_pc873xx_detect()
589 ppc->ppc_epp = EPP_1_7; in ppc_pc873xx_detect()
591 if ((ppc->ppc_model == NS_PC87332) && bootverbose) { in ppc_pc873xx_detect()
600 ppc->ppc_avm |= PPB_ECP; in ppc_pc873xx_detect()
605 ppc->ppc_avm |= PPB_PS2; in ppc_pc873xx_detect()
613 ppc->ppc_avm |= PPB_SPP; in ppc_pc873xx_detect()
640 ppc->ppc_epp = EPP_1_9; /* XXX */ in ppc_pc873xx_detect()
646 if (ppc->ppc_model == NS_PC87332) { in ppc_pc873xx_detect()
682 ppc->ppc_avm = chipset_mode; in ppc_pc873xx_detect()
688 ppc->ppc_type = PPC_TYPE_GENERIC; in ppc_pc873xx_detect()
689 ppc_generic_setmode(ppc, chipset_mode); in ppc_pc873xx_detect()
702 ppc_smc37c66xgt_detect(struct ppc_data *ppc, int chipset_mode) in ppc_smc37c66xgt_detect() argument
716 PPC_CONFIG_LOCK(ppc); in ppc_smc37c66xgt_detect()
719 PPC_CONFIG_UNLOCK(ppc); in ppc_smc37c66xgt_detect()
728 PPC_CONFIG_LOCK(ppc); in ppc_smc37c66xgt_detect()
731 PPC_CONFIG_UNLOCK(ppc); in ppc_smc37c66xgt_detect()
757 if (port_address[(int)r] != ppc->ppc_base) { in ppc_smc37c66xgt_detect()
762 ppc->ppc_model = type; in ppc_smc37c66xgt_detect()
771 device_printf(ppc->ppc_dev, "SMC registers CR1=0x%x", in ppc_smc37c66xgt_detect()
786 ppc->ppc_avm |= PPB_ECP | PPB_EPP | PPB_SPP; in ppc_smc37c66xgt_detect()
799 ppc->ppc_avm |= PPB_SPP; in ppc_smc37c66xgt_detect()
805 ppc->ppc_avm |= PPB_EPP | PPB_SPP; in ppc_smc37c66xgt_detect()
811 ppc->ppc_avm |= PPB_ECP | PPB_SPP; in ppc_smc37c66xgt_detect()
817 ppc->ppc_avm |= PPB_ECP | PPB_EPP | PPB_SPP; in ppc_smc37c66xgt_detect()
824 ppc->ppc_avm |= PPB_SPP; in ppc_smc37c66xgt_detect()
831 ppc->ppc_avm = chipset_mode; in ppc_smc37c66xgt_detect()
868 ppc->ppc_avm = chipset_mode; in ppc_smc37c66xgt_detect()
872 if (ppc->ppc_avm & PPB_ECP) { in ppc_smc37c66xgt_detect()
883 if (ppc->ppc_avm & PPB_EPP) { in ppc_smc37c66xgt_detect()
892 if (ppc->ppc_epp == EPP_1_9) in ppc_smc37c66xgt_detect()
900 ppc->ppc_type = PPC_TYPE_SMCLIKE; in ppc_smc37c66xgt_detect()
901 ppc_smclike_setmode(ppc, chipset_mode); in ppc_smc37c66xgt_detect()
911 ppc_smc37c935_detect(struct ppc_data *ppc, int chipset_mode) in ppc_smc37c935_detect() argument
915 PPC_CONFIG_LOCK(ppc); in ppc_smc37c935_detect()
918 PPC_CONFIG_UNLOCK(ppc); in ppc_smc37c935_detect()
929 ppc->ppc_model = type; in ppc_smc37c935_detect()
936 outb(SMC935_DAT, (u_char)((ppc->ppc_base & 0xff00) >> 8)); in ppc_smc37c935_detect()
938 outb(SMC935_DAT, (u_char)(ppc->ppc_base & 0xff)); in ppc_smc37c935_detect()
941 ppc->ppc_avm = PPB_COMPATIBLE; /* default mode */ in ppc_smc37c935_detect()
943 ppc->ppc_avm = chipset_mode; in ppc_smc37c935_detect()
950 if (ppc->ppc_epp == EPP_1_9) { in ppc_smc37c935_detect()
954 if (ppc->ppc_epp == EPP_1_7) { in ppc_smc37c935_detect()
967 if (ppc->ppc_epp == EPP_1_9) { in ppc_smc37c935_detect()
971 if (ppc->ppc_epp == EPP_1_7) { in ppc_smc37c935_detect()
984 ppc->ppc_type = PPC_TYPE_SMCLIKE; in ppc_smc37c935_detect()
985 ppc_smclike_setmode(ppc, chipset_mode); in ppc_smc37c935_detect()
1006 ppc_w83877f_detect(struct ppc_data *ppc, int chipset_mode) in ppc_w83877f_detect() argument
1042 if (ppc->ppc_base != inb(efdr) * 4) /* 4 bytes boundaries */ in ppc_w83877f_detect()
1050 ppc->ppc_model = WINB_W83877F; in ppc_w83877f_detect()
1054 ppc->ppc_model = WINB_W83877AF; in ppc_w83877f_detect()
1058 ppc->ppc_model = WINB_UNKNOWN; in ppc_w83877f_detect()
1063 device_printf(ppc->ppc_dev, "0x%x - ", w83877f_keys[i]); in ppc_w83877f_detect()
1081 ppc->ppc_type = PPC_TYPE_GENERIC; in ppc_w83877f_detect()
1097 device_printf(ppc->ppc_dev, in ppc_w83877f_detect()
1106 device_printf(ppc->ppc_dev, in ppc_w83877f_detect()
1111 ppc->ppc_avm |= PPB_EPP | PPB_SPP; in ppc_w83877f_detect()
1113 device_printf(ppc->ppc_dev, "EPP SPP\n"); in ppc_w83877f_detect()
1117 ppc->ppc_avm |= PPB_ECP | PPB_SPP; in ppc_w83877f_detect()
1119 device_printf(ppc->ppc_dev, "ECP SPP\n"); in ppc_w83877f_detect()
1123 ppc->ppc_avm |= PPB_ECP | PPB_EPP | PPB_SPP; in ppc_w83877f_detect()
1124 ppc->ppc_type = PPC_TYPE_SMCLIKE; in ppc_w83877f_detect()
1127 device_printf(ppc->ppc_dev, "ECP+EPP SPP\n"); in ppc_w83877f_detect()
1148 device_printf(ppc->ppc_dev, in ppc_w83877f_detect()
1151 ppc->ppc_type = PPC_TYPE_SMCLIKE; in ppc_w83877f_detect()
1156 device_printf(ppc->ppc_dev, "ECP\n"); in ppc_w83877f_detect()
1162 device_printf(ppc->ppc_dev, "EPP SPP\n"); in ppc_w83877f_detect()
1164 ppc->ppc_avm = chipset_mode; in ppc_w83877f_detect()
1170 switch (ppc->ppc_type) { in ppc_w83877f_detect()
1172 ppc_smclike_setmode(ppc, chipset_mode); in ppc_w83877f_detect()
1175 ppc_generic_setmode(ppc, chipset_mode); in ppc_w83877f_detect()
1187 ppc_generic_detect(struct ppc_data *ppc, int chipset_mode) in ppc_generic_detect() argument
1190 ppc->ppc_type = PPC_TYPE_GENERIC; in ppc_generic_detect()
1193 device_printf(ppc->ppc_dev, "SPP"); in ppc_generic_detect()
1196 w_ecr(ppc, PPC_ECR_PS2); in ppc_generic_detect()
1197 if ((r_ecr(ppc) & 0xe0) == PPC_ECR_PS2) { in ppc_generic_detect()
1198 ppc->ppc_dtm |= PPB_ECP | PPB_SPP; in ppc_generic_detect()
1203 w_ecr(ppc, PPC_ECR_EPP); in ppc_generic_detect()
1207 if (ppc_check_epp_timeout(ppc)) { in ppc_generic_detect()
1208 ppc->ppc_dtm |= PPB_EPP; in ppc_generic_detect()
1210 if (ppc->ppc_dtm & PPB_ECP) { in ppc_generic_detect()
1212 ppc->ppc_model = SMC_LIKE; in ppc_generic_detect()
1213 ppc->ppc_type = PPC_TYPE_SMCLIKE; in ppc_generic_detect()
1223 w_ecr(ppc, PPC_ECR_STD); in ppc_generic_detect()
1227 ppc->ppc_dtm |= PPB_NIBBLE; in ppc_generic_detect()
1230 ppc->ppc_avm = chipset_mode; in ppc_generic_detect()
1232 ppc->ppc_avm = ppc->ppc_dtm; in ppc_generic_detect()
1237 switch (ppc->ppc_type) { in ppc_generic_detect()
1239 ppc_smclike_setmode(ppc, chipset_mode); in ppc_generic_detect()
1242 ppc_generic_setmode(ppc, chipset_mode); in ppc_generic_detect()
1255 ppc_detect(struct ppc_data *ppc, int chipset_mode) { in ppc_detect() argument
1271 if (!ppc_detect_port(ppc) && chipset_mode == 0) in ppc_detect()
1275 ppc->ppc_avm = PPB_COMPATIBLE; in ppc_detect()
1283 if (ppc->ppc_flags & 0x40) { in ppc_detect()
1288 ppc->ppc_mode = ppc_generic_detect(ppc, chipset_mode); in ppc_detect()
1293 if ((mode = chipset_detect[i](ppc, chipset_mode)) != -1) { in ppc_detect()
1294 ppc->ppc_mode = mode; in ppc_detect()
1302 if ((ppc->ppc_avm & PPB_ECP) && !(ppc->ppc_flags & 0x80)) in ppc_detect()
1303 ppc_detect_fifo(ppc); in ppc_detect()
1317 struct ppc_data *ppc = DEVTOSOFTC(dev); in ppc_exec_microseq() local
1332 #define r_reg(reg,ppc) (bus_read_1((ppc)->res_ioport, reg)) in ppc_exec_microseq() argument
1333 #define w_reg(reg, ppc, byte) (bus_write_1((ppc)->res_ioport, reg, byte)) in ppc_exec_microseq() argument
1337 PPC_ASSERT_LOCKED(ppc); in ppc_exec_microseq()
1342 cc = r_reg(mi->arg[0].i, ppc); in ppc_exec_microseq()
1345 w_reg(mi->arg[0].i, ppc, cc); in ppc_exec_microseq()
1351 ptr = ppc->ppc_ptr; in ppc_exec_microseq()
1354 accum = ppc->ppc_accum; in ppc_exec_microseq()
1356 w_reg(reg, ppc, *ptr++); in ppc_exec_microseq()
1357 ppc->ppc_accum = accum; in ppc_exec_microseq()
1360 w_reg(reg, ppc, *ptr++); in ppc_exec_microseq()
1361 ppc->ppc_ptr = ptr; in ppc_exec_microseq()
1369 ptr = ppc->ppc_ptr; in ppc_exec_microseq()
1372 accum = ppc->ppc_accum; in ppc_exec_microseq()
1374 *ptr++ = r_reg(reg, ppc) & mask; in ppc_exec_microseq()
1375 ppc->ppc_accum = accum; in ppc_exec_microseq()
1378 *ptr++ = r_reg(reg, ppc) & mask; in ppc_exec_microseq()
1379 ppc->ppc_ptr = ptr; in ppc_exec_microseq()
1385 *((char *) mi->arg[2].p) = r_reg(mi->arg[0].i, ppc) & in ppc_exec_microseq()
1396 w_reg(mi->arg[0].i, ppc, (char)mi->arg[1].i); in ppc_exec_microseq()
1407 PPC_UNLOCK(ppc); in ppc_exec_microseq()
1409 PPC_LOCK(ppc); in ppc_exec_microseq()
1421 w_reg(reg, ppc, *p++); in ppc_exec_microseq()
1428 ppc->ppc_accum = mi->arg[0].i; in ppc_exec_microseq()
1433 if (--ppc->ppc_accum > 0) in ppc_exec_microseq()
1439 cc = r_str(ppc); in ppc_exec_microseq()
1446 cc = r_str(ppc); in ppc_exec_microseq()
1453 cc = r_str(ppc); in ppc_exec_microseq()
1465 if ((error = mi->arg[0].f(mi->arg[1].p, ppc->ppc_ptr))) in ppc_exec_microseq()
1472 ppc->ppc_ptr = (char *)mi->arg[0].p; in ppc_exec_microseq()
1532 struct ppc_data *ppc = arg; in ppcintr() local
1542 PPC_LOCK(ppc); in ppcintr()
1543 if (ppc->ppc_intr_hook != NULL && in ppcintr()
1544 ppc->ppc_intr_hook(ppc->ppc_intr_arg) == 0) { in ppcintr()
1545 PPC_UNLOCK(ppc); in ppcintr()
1549 str = r_str(ppc); in ppcintr()
1550 ctr = r_ctr(ppc); in ppcintr()
1551 ecr = r_ecr(ppc); in ppcintr()
1559 PPC_UNLOCK(ppc); in ppcintr()
1565 if ((str & nFAULT) && (ppc->ppc_mode & PPB_ECP)) { in ppcintr()
1568 if (ppc->ppc_irqstat & PPC_IRQ_nFAULT) { in ppcintr()
1569 w_ecr(ppc, ecr | PPC_nFAULT_INTR); in ppcintr()
1570 ppc->ppc_irqstat &= ~PPC_IRQ_nFAULT; in ppcintr()
1573 PPC_UNLOCK(ppc); in ppcintr()
1578 if (ppc->ppc_irqstat & PPC_IRQ_DMA) { in ppcintr()
1580 w_ecr(ppc, ecr | PPC_SERVICE_INTR); in ppcintr()
1581 ppc->ppc_irqstat &= ~PPC_IRQ_DMA; in ppcintr()
1582 ecr = r_ecr(ppc); in ppcintr()
1585 if ((ppc->ppc_avm & PPB_ECP) && (ecr & PPC_ENABLE_DMA)) { in ppcintr()
1590 w_ecr(ppc, ecr & ~PPC_ENABLE_DMA); in ppcintr()
1591 ecr = r_ecr(ppc); in ppcintr()
1593 if (ppc->ppc_dmastat == PPC_DMA_STARTED) { in ppcintr()
1597 ppc->ppc_dmadone(ppc); in ppcintr()
1598 ppc->ppc_dmastat = PPC_DMA_COMPLETE; in ppcintr()
1601 wakeup(ppc); in ppcintr()
1604 } else if (ppc->ppc_irqstat & PPC_IRQ_FIFO) { in ppcintr()
1606 ppc->ppc_irqstat &= ~PPC_IRQ_FIFO; in ppcintr()
1608 PPC_UNLOCK(ppc); in ppcintr()
1628 struct ppc_data *ppc = DEVTOSOFTC(dev); in ppc_reset_epp() local
1630 PPC_ASSERT_LOCKED(ppc); in ppc_reset_epp()
1631 ppc_reset_epp_timeout(ppc); in ppc_reset_epp()
1639 struct ppc_data *ppc = DEVTOSOFTC(dev); in ppc_setmode() local
1641 PPC_ASSERT_LOCKED(ppc); in ppc_setmode()
1642 switch (ppc->ppc_type) { in ppc_setmode()
1644 return (ppc_smclike_setmode(ppc, mode)); in ppc_setmode()
1649 return (ppc_generic_setmode(ppc, mode)); in ppc_setmode()
1663 struct ppc_data *ppc; in ppc_probe() local
1670 ppc = DEVTOSOFTC(dev); in ppc_probe()
1671 bzero(ppc, sizeof(struct ppc_data)); in ppc_probe()
1673 ppc->rid_ioport = rid; in ppc_probe()
1701 ppc->res_ioport = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, in ppc_probe()
1702 &ppc->rid_ioport, in ppc_probe()
1706 if (ppc->res_ioport != 0) { in ppc_probe()
1711 ppc->res_ioport = bus_alloc_resource_anywhere(dev, in ppc_probe()
1713 &ppc->rid_ioport, in ppc_probe()
1716 if (ppc->res_ioport != 0) { in ppc_probe()
1726 ppc->ppc_base = rman_get_start(ppc->res_ioport); in ppc_probe()
1728 ppc->ppc_flags = device_get_flags(dev); in ppc_probe()
1730 if (!(ppc->ppc_flags & 0x20)) { in ppc_probe()
1731 ppc->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, in ppc_probe()
1732 &ppc->rid_irq, in ppc_probe()
1734 ppc->res_drq = bus_alloc_resource_any(dev, SYS_RES_DRQ, in ppc_probe()
1735 &ppc->rid_drq, in ppc_probe()
1739 if (ppc->res_irq) in ppc_probe()
1740 ppc->ppc_irq = rman_get_start(ppc->res_irq); in ppc_probe()
1741 if (ppc->res_drq) in ppc_probe()
1742 ppc->ppc_dmachan = rman_get_start(ppc->res_drq); in ppc_probe()
1744 ppc->ppc_dev = dev; in ppc_probe()
1745 ppc->ppc_model = GENERIC; in ppc_probe()
1747 ppc->ppc_mode = PPB_COMPATIBLE; in ppc_probe()
1748 ppc->ppc_epp = (ppc->ppc_flags & 0x10) >> 4; in ppc_probe()
1750 ppc->ppc_type = PPC_TYPE_GENERIC; in ppc_probe()
1755 if (ppc_detect(ppc, ppc->ppc_flags & 0xf)) in ppc_probe()
1761 if (ppc->res_irq != 0) { in ppc_probe()
1762 bus_release_resource(dev, SYS_RES_IRQ, ppc->rid_irq, in ppc_probe()
1763 ppc->res_irq); in ppc_probe()
1765 if (ppc->res_ioport != 0) { in ppc_probe()
1766 bus_release_resource(dev, SYS_RES_IOPORT, ppc->rid_ioport, in ppc_probe()
1767 ppc->res_ioport); in ppc_probe()
1769 if (ppc->res_drq != 0) { in ppc_probe()
1770 bus_release_resource(dev, SYS_RES_DRQ, ppc->rid_drq, in ppc_probe()
1771 ppc->res_drq); in ppc_probe()
1779 struct ppc_data *ppc = DEVTOSOFTC(dev); in ppc_attach() local
1782 mtx_init(&ppc->ppc_lock, device_get_nameunit(dev), "ppc", MTX_DEF); in ppc_attach()
1785 ppc_models[ppc->ppc_model], ppc_avms[ppc->ppc_avm], in ppc_attach()
1786 ppc_modes[ppc->ppc_mode], (PPB_IS_EPP(ppc->ppc_mode)) ? in ppc_attach()
1787 ppc_epp_protocol[ppc->ppc_epp] : ""); in ppc_attach()
1789 if (ppc->ppc_fifo) in ppc_attach()
1791 ppc->ppc_fifo, ppc->ppc_wthr, ppc->ppc_rthr); in ppc_attach()
1793 if (ppc->res_irq) { in ppc_attach()
1795 error = bus_setup_intr(dev, ppc->res_irq, INTR_TYPE_TTY | in ppc_attach()
1796 INTR_MPSAFE, NULL, ppcintr, ppc, &ppc->intr_cookie); in ppc_attach()
1801 mtx_destroy(&ppc->ppc_lock); in ppc_attach()
1807 ppc->ppbus = device_add_child(dev, "ppbus", -1); in ppc_attach()
1812 device_probe_and_attach(ppc->ppbus); in ppc_attach()
1820 struct ppc_data *ppc = DEVTOSOFTC(dev); in ppc_detach() local
1822 if (ppc->res_irq == 0) { in ppc_detach()
1829 if (ppc->res_irq != 0) { in ppc_detach()
1830 bus_teardown_intr(dev, ppc->res_irq, ppc->intr_cookie); in ppc_detach()
1831 bus_release_resource(dev, SYS_RES_IRQ, ppc->rid_irq, in ppc_detach()
1832 ppc->res_irq); in ppc_detach()
1834 if (ppc->res_ioport != 0) { in ppc_detach()
1835 bus_release_resource(dev, SYS_RES_IOPORT, ppc->rid_ioport, in ppc_detach()
1836 ppc->res_ioport); in ppc_detach()
1838 if (ppc->res_drq != 0) { in ppc_detach()
1839 bus_release_resource(dev, SYS_RES_DRQ, ppc->rid_drq, in ppc_detach()
1840 ppc->res_drq); in ppc_detach()
1843 mtx_destroy(&ppc->ppc_lock); in ppc_detach()
1851 struct ppc_data *ppc = DEVTOSOFTC(ppcdev); in ppc_io() local
1853 PPC_ASSERT_LOCKED(ppc); in ppc_io()
1856 bus_write_multi_1(ppc->res_ioport, PPC_EPP_DATA, addr, cnt); in ppc_io()
1859 bus_write_multi_2(ppc->res_ioport, PPC_EPP_DATA, (u_int16_t *)addr, cnt); in ppc_io()
1862 bus_write_multi_4(ppc->res_ioport, PPC_EPP_DATA, (u_int32_t *)addr, cnt); in ppc_io()
1865 bus_read_multi_1(ppc->res_ioport, PPC_EPP_DATA, addr, cnt); in ppc_io()
1868 bus_read_multi_2(ppc->res_ioport, PPC_EPP_DATA, (u_int16_t *)addr, cnt); in ppc_io()
1871 bus_read_multi_4(ppc->res_ioport, PPC_EPP_DATA, (u_int32_t *)addr, cnt); in ppc_io()
1874 return (r_dtr(ppc)); in ppc_io()
1876 return (r_str(ppc)); in ppc_io()
1878 return (r_ctr(ppc)); in ppc_io()
1880 return (r_epp_A(ppc)); in ppc_io()
1882 return (r_epp_D(ppc)); in ppc_io()
1884 return (r_ecr(ppc)); in ppc_io()
1886 return (r_fifo(ppc)); in ppc_io()
1888 w_dtr(ppc, byte); in ppc_io()
1891 w_str(ppc, byte); in ppc_io()
1894 w_ctr(ppc, byte); in ppc_io()
1897 w_epp_A(ppc, byte); in ppc_io()
1900 w_epp_D(ppc, byte); in ppc_io()
1903 w_ecr(ppc, byte); in ppc_io()
1906 w_fifo(ppc, byte); in ppc_io()
1919 struct ppc_data *ppc = (struct ppc_data *)device_get_softc(bus); in ppc_read_ivar() local
1923 PPC_ASSERT_LOCKED(ppc); in ppc_read_ivar()
1924 *val = (u_long)ppc->ppc_epp; in ppc_read_ivar()
1927 *val = (uintptr_t)&ppc->ppc_lock; in ppc_read_ivar()
1939 struct ppc_data *ppc = (struct ppc_data *)device_get_softc(bus); in ppc_write_ivar() local
1943 PPC_ASSERT_LOCKED(ppc); in ppc_write_ivar()
1944 if (dev != ppc->ppbus) in ppc_write_ivar()
1947 ppc->ppc_intr_hook = NULL; in ppc_write_ivar()
1950 if (ppc->ppc_intr_hook != NULL) in ppc_write_ivar()
1952 ppc->ppc_intr_hook = (void *)val; in ppc_write_ivar()
1953 ppc->ppc_intr_arg = device_get_softc(dev); in ppc_write_ivar()
1970 struct ppc_data *ppc = DEVTOSOFTC(bus); in ppc_alloc_resource() local
1975 return (ppc->res_irq); in ppc_alloc_resource()
1986 struct ppc_data *ppc = DEVTOSOFTC(bus); in ppc_release_resource() local
1992 KASSERT(r == ppc->res_irq, in ppc_release_resource()
2001 MODULE_DEPEND(ppc, ppbus, 1, 1, 1);