static void __init sabre_pbm_init(struct pci_controller_info *p, int sabre_node, u32 dma_begin) 
static void sabre_pbm_init(struct pci_controller_info *p, int sabre_node, u32 dma_begin) 
static void __init sabre_pbm_init(struct pci_controller_info *p, int sabre_node, u32 dma_begin){	struct pci_pbm_info *pbm;	char namebuf[128];	u32 busrange[2];	int node, simbas_found;	simbas_found = 0;	node = prom_getchild(sabre_node);	while ((node = prom_searchsiblings(node, "pci")) != 0) {		int err;		err = prom_getproperty(node, "model", namebuf, sizeof(namebuf));		if ((err <= 0) || strncmp(namebuf, "SUNW,simba", err))			goto next_pci;		err = prom_getproperty(node, "bus-range",				       (char *)&busrange[0], sizeof(busrange));		if (err == 0 || err == -1) {			prom_printf("APB: Error, cannot get PCI bus-range.\n");			prom_halt();		}		simbas_found++;		if (busrange[0] == 1)			pbm = &p->pbm_B;		else			pbm = &p->pbm_A;		pbm->chip_type = PBM_CHIP_TYPE_SABRE;		pbm->parent = p;		pbm->prom_node = node;		pbm->pci_first_slot = 1;		pbm->pci_first_busno = busrange[0];		pbm->pci_last_busno = busrange[1];		prom_getstring(node, "name", pbm->prom_name, sizeof(pbm->prom_name));		err = prom_getproperty(node, "ranges",				       (char *)pbm->pbm_ranges,				       sizeof(pbm->pbm_ranges));		if (err != -1)			pbm->num_pbm_ranges =				(err / sizeof(struct linux_prom_pci_ranges));		else			pbm->num_pbm_ranges = 0;		err = prom_getproperty(node, "interrupt-map",				       (char *)pbm->pbm_intmap,				       sizeof(pbm->pbm_intmap));		if (err != -1) {			pbm->num_pbm_intmap = (err / sizeof(struct linux_prom_pci_intmap));			err = prom_getproperty(node, "interrupt-map-mask",					       (char *)&pbm->pbm_intmask,					       sizeof(pbm->pbm_intmask));			if (err == -1) {				prom_printf("APB: Fatal error, no interrupt-map-mask.\n");				prom_halt();			}		} else {			pbm->num_pbm_intmap = 0;			memset(&pbm->pbm_intmask, 0, sizeof(pbm->pbm_intmask));		}		pbm_register_toplevel_resources(p, pbm);	next_pci:		node = prom_getsibling(node);		if (!node)			break;	}	if (simbas_found == 0) {		int err;		/* No APBs underneath, probably this is a hummingbird		 * system.		 */		pbm = &p->pbm_A;		pbm->parent = p;		pbm->prom_node = sabre_node;		pbm->pci_first_busno = p->pci_first_busno;		pbm->pci_last_busno = p->pci_last_busno;		prom_getstring(sabre_node, "name", pbm->prom_name, sizeof(pbm->prom_name));		err = prom_getproperty(sabre_node, "ranges",				       (char *) pbm->pbm_ranges,				       sizeof(pbm->pbm_ranges));		if (err != -1)			pbm->num_pbm_ranges =				(err / sizeof(struct linux_prom_pci_ranges));		else			pbm->num_pbm_ranges = 0;		err = prom_getproperty(sabre_node, "interrupt-map",				       (char *) pbm->pbm_intmap,				       sizeof(pbm->pbm_intmap));		if (err != -1) {			pbm->num_pbm_intmap = (err / sizeof(struct linux_prom_pci_intmap));			err = prom_getproperty(sabre_node, "interrupt-map-mask",					       (char *)&pbm->pbm_intmask,					       sizeof(pbm->pbm_intmask));			if (err == -1) {				prom_printf("Hummingbird: Fatal error, no interrupt-map-mask.\n");				prom_halt();			}		} else {			pbm->num_pbm_intmap = 0;			memset(&pbm->pbm_intmask, 0, sizeof(pbm->pbm_intmask));		}		sprintf(pbm->name, "SABRE%d PBM%c", p->index,			(pbm == &p->pbm_A ? 'A' : 'B'));		pbm->io_space.name = pbm->mem_space.name = pbm->name;		/* Hack up top-level resources. */		pbm->io_space.start = p->pbm_A.controller_regs + SABRE_IOSPACE;		pbm->io_space.end   = pbm->io_space.start + (1UL << 24) - 1UL;		pbm->io_space.flags = IORESOURCE_IO;		pbm->mem_space.start = p->pbm_A.controller_regs + SABRE_MEMSPACE;		pbm->mem_space.end   = pbm->mem_space.start + (unsigned long)dma_begin - 1UL;		pbm->mem_space.flags = IORESOURCE_MEM;		if (request_resource(&ioport_resource, &pbm->io_space) < 0) {			prom_printf("Cannot register Hummingbird's IO space.\n");			prom_halt();		}		if (request_resource(&iomem_resource, &pbm->mem_space) < 0) {			prom_printf("Cannot register Hummingbird's MEM space.\n");			prom_halt();		}		pci_register_legacy_regions(&pbm->io_space,					    &pbm->mem_space);	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/085ae41f66657a9655ce832b0a61832a06f0e1dc/pci_sabre.c/buggy/arch/sparc64/kernel/pci_sabre.c