void pci_attach_hook(struct device *parent, struct device *self, struct pcibus_attach_args *pba) { #ifdef PCI_CONFIGURE_VERBOSE printf("pci_attach_hook\n"); ibm4xx_show_pci_map(); #endif ibm4xx_setup_pci(); #ifdef PCI_CONFIGURE_VERBOSE ibm4xx_show_pci_map(); #endif }
static void pchbattach(device_t parent, device_t self, void *aux) { struct plb_attach_args *paa = aux; struct pcibus_attach_args pba; char devinfo[256]; #ifdef PCI_NETBSD_CONFIGURE struct extent *ioext, *memext; #ifdef PCI_CONFIGURE_VERBOSE extern int pci_conf_debug; pci_conf_debug = 1; #endif #endif pci_chipset_tag_t pc = 0; pcitag_t tag; int class, id; pci_machdep_init(); tag = pci_make_tag(pc, 0, 0, 0); class = pci_conf_read(pc, tag, PCI_CLASS_REG); id = pci_conf_read(pc, tag, PCI_ID_REG); aprint_normal("\n"); pcifound = true; /* * All we do is print out a description. Eventually, we * might want to add code that does something that's * possibly chipset-specific. */ pci_devinfo(id, class, 0, devinfo, sizeof(devinfo)); aprprint_normal_dev(self, "%s (rev. 0x%02x)\n", devinfo, PCI_REVISION(class)); pci_machdep_init(); /* Redundant... */ ibm4xx_setup_pci(); #ifdef PCI_CONFIGURE_VERBOSE ibm4xx_show_pci_map(); #endif if (bus_space_init(&pchb_io_tag, "pchbio", NULL, 0)) panic("pchbattach: can't init IO tag"); if (bus_space_init(&pchb_mem_tag, "pchbmem", NULL, 0)) panic("pchbattach: can't init MEM tag"); #ifdef PCI_NETBSD_CONFIGURE memext = extent_create("pcimem", MIN_PCI_MEMADDR_NOPREFETCH, MIN_PCI_MEMADDR_NOPREFETCH + 0x1fffffff, M_DEVBUF, NULL, 0, EX_NOWAIT); ioext = extent_create("pciio", MIN_PCI_PCI_IOADDR, MIN_PCI_PCI_IOADDR + 0xffff, M_DEVBUF, NULL, 0, EX_NOWAIT); pci_configure_bus(0, ioext, memext, NULL, 0, 32); extent_destroy(memext); extent_destroy(ioext); #endif /* PCI_NETBSD_CONFIGURE */ #ifdef PCI_CONFIGURE_VERBOSE printf("running config_found PCI\n"); #endif /* IO window located @ e8000000 and maps to 0-0xffff */ pba.pba_iot = &pchb_io_tag; /* PCI memory window is directly mapped */ pba.pba_memt = &pchb_mem_tag; pba.pba_dmat = paa->plb_dmat; pba.pba_dmat64 = NULL; pba.pba_bus = 0; pba.pba_bridgetag = NULL; pba.pba_flags = PCI_FLAGS_MEM_OKAY | PCI_FLAGS_IO_OKAY; config_found_ia(self, "pcibus", &pba, pchbprint); }