int ppc_isa_attach(device_t dev) { struct ppc_data *ppc = device_get_softc(dev); if ((ppc->ppc_avm & PPB_ECP) && (ppc->ppc_dmachan > 0)) { /* acquire the DMA channel forever */ /* XXX */ isa_dma_acquire(ppc->ppc_dmachan); isa_dmainit(ppc->ppc_dmachan, 1024); /* nlpt.BUFSIZE */ ppc->ppc_dmadone = ppc_isa_dmadone; } return (ppc_attach(dev)); }
int ppc_attach(device_t dev) { struct ppc_data *ppc = DEVTOSOFTC(dev); device_t ppbus; device_t parent = device_get_parent(dev); device_printf(dev, "%s chipset (%s) in %s mode%s\n", ppc_models[ppc->ppc_model], ppc_avms[ppc->ppc_avm], ppc_modes[ppc->ppc_mode], (PPB_IS_EPP(ppc->ppc_mode)) ? ppc_epp_protocol[ppc->ppc_epp] : ""); if (ppc->ppc_fifo) device_printf(dev, "FIFO with %d/%d/%d bytes threshold\n", ppc->ppc_fifo, ppc->ppc_wthr, ppc->ppc_rthr); if ((ppc->ppc_avm & PPB_ECP) && (ppc->ppc_dmachan > 0)) { /* acquire the DMA channel forever */ /* XXX */ isa_dma_acquire(ppc->ppc_dmachan); isa_dmainit(ppc->ppc_dmachan, 1024); /* nlpt.BUFSIZE */ } /* add ppbus as a child of this isa to parallel bridge */ ppbus = device_add_child(dev, "ppbus", -1); /* * Probe the ppbus and attach devices found. */ device_probe_and_attach(ppbus); /* register the ppc interrupt handler as default */ if (ppc->res_irq) { /* default to the tty mask for registration */ /* XXX */ if (BUS_SETUP_INTR(parent, dev, ppc->res_irq, INTR_TYPE_TTY, ppcintr, dev, &ppc->intr_cookie) == 0) { /* remember the ppcintr is registered */ ppc->ppc_registered = 1; } } return (0); }
/* * Attach the mainbus. */ void mainbus_attach(device_t parent, device_t self, void *aux) { #if NPCI > 0 union mainbus_attach_args mba; #endif #if NACPI > 0 int acpi_present = 0; #endif #ifdef MPBIOS int mpbios_present = 0; #endif int mpacpi_active = 0; int numcpus = 0; #if NACPI > 0 || defined(MPBIOS) int numioapics = 0; #endif #if defined(PCI_BUS_FIXUP) int pci_maxbus = 0; #endif aprint_naive("\n"); aprint_normal("\n"); #ifdef MPBIOS mpbios_present = mpbios_probe(self); #endif #if NPCI > 0 pci_mode = pci_mode_detect(); #if defined(PCI_BUS_FIXUP) if (pci_mode != 0) { pci_maxbus = pci_bus_fixup(NULL, 0); aprint_debug("PCI bus max, after pci_bus_fixup: %i\n", pci_maxbus); #if defined(PCI_ADDR_FIXUP) pciaddr.extent_port = NULL; pciaddr.extent_mem = NULL; pci_addr_fixup(NULL, pci_maxbus); #endif } #endif #endif #if NACPI > 0 if ((boothowto & RB_MD2) == 0 && acpi_check(self, "acpibus")) acpi_present = acpi_probe(); /* * First, see if the MADT contains CPUs, and possibly I/O APICs. * Building the interrupt routing structures can only * be done later (via a callback). */ if (acpi_present) mpacpi_active = mpacpi_scan_apics(self, &numcpus, &numioapics); #endif if (!mpacpi_active) { #ifdef MPBIOS if (mpbios_present) mpbios_scan(self, &numcpus, &numioapics); else #endif if (numcpus == 0) { struct cpu_attach_args caa; memset(&caa, 0, sizeof(caa)); caa.cpu_number = 0; caa.cpu_role = CPU_ROLE_SP; caa.cpu_func = 0; config_found_ia(self, "cpubus", &caa, mainbus_print); } } #if NISADMA > 0 && NACPI > 0 /* * ACPI needs ISA DMA initialized before they start probing. */ isa_dmainit(&x86_isa_chipset, X86_BUS_SPACE_IO, &isa_bus_dma_tag, self); #endif #if NACPI > 0 if (acpi_present) { mba.mba_acpi.aa_iot = X86_BUS_SPACE_IO; mba.mba_acpi.aa_memt = X86_BUS_SPACE_MEM; mba.mba_acpi.aa_pc = NULL; mba.mba_acpi.aa_pciflags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED | PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY; mba.mba_acpi.aa_ic = &x86_isa_chipset; config_found_ia(self, "acpibus", &mba.mba_acpi, 0); } #endif #if NIPMI > 0 memset(&mba.mba_ipmi, 0, sizeof(mba.mba_ipmi)); mba.mba_ipmi.iaa_iot = X86_BUS_SPACE_IO; mba.mba_ipmi.iaa_memt = X86_BUS_SPACE_MEM; if (ipmi_probe(&mba.mba_ipmi)) config_found_ia(self, "ipmibus", &mba.mba_ipmi, 0); #endif #if NPCI > 0 if (pci_mode != 0) { mba.mba_pba.pba_iot = X86_BUS_SPACE_IO; mba.mba_pba.pba_memt = X86_BUS_SPACE_MEM; mba.mba_pba.pba_dmat = &pci_bus_dma_tag; mba.mba_pba.pba_dmat64 = &pci_bus_dma64_tag; mba.mba_pba.pba_pc = NULL; mba.mba_pba.pba_flags = pci_bus_flags(); mba.mba_pba.pba_bus = 0; mba.mba_pba.pba_bridgetag = NULL; #if NACPI > 0 && defined(ACPI_SCANPCI) if (mpacpi_active) mpacpi_scan_pci(self, &mba.mba_pba, pcibusprint); else #endif #if defined(MPBIOS) && defined(MPBIOS_SCANPCI) if (mpbios_scanned != 0) mpbios_scan_pci(self, &mba.mba_pba, pcibusprint); else #endif config_found_ia(self, "pcibus", &mba.mba_pba, pcibusprint); #if NACPI > 0 if (mp_verbose) acpi_pci_link_state(); #endif } #endif #if NISA > 0 if (isa_has_been_seen == 0) config_found_ia(self, "isabus", &mba_iba, isabusprint); #endif if (!pmf_device_register(self, NULL, NULL)) aprint_error_dev(self, "couldn't establish power handler\n"); }