FreeBSD/sys/powerpc/ofw/ofw_machdep.c
/*
 * Return a bus handle and bus tag that corresponds to the register
 * numbered regno for the device referenced by the package handle
 * dev. This function is intended to be used by console drivers in
 * early boot only. It works by mapping the address of the device's
 * register in the address space of its parent and recursively walk
 * the device tree upward this way.
 */
Return a bus handle and bus tag that corresponds to the register
numbered regno for the device referenced by the package handle
dev. This function is intended to be used by console drivers in
early boot only. It works by mapping the address of the device's
register in the address space of its parent and recursively walk
the device tree upward this way.
Return a bus handle and bus tag that corresponds to the register numbered regno for the device referenced by the package handle dev . This function is intended to be used by console drivers in early boot only . It works by mapping the address of the device ' s register in the address space of its parent and recursively walk the device tree upward this way .
int
OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *tag,
    bus_space_handle_t *handle, bus_size_t *sz)
{
	bus_addr_t addr;
	bus_size_t size;
	pcell_t pci_hi;
	int flags, res;
	res = ofw_reg_to_paddr(dev, regno, &addr, &size, &pci_hi);
	if (res < 0)
		return (res);
	if (pci_hi == OFW_PADDR_NOT_PCI) {
		*tag = &bs_be_tag;
		flags = 0;
	} else {
		*tag = &bs_le_tag;
		flags = (pci_hi & OFW_PCI_PHYS_HI_PREFETCHABLE) ? 
		    BUS_SPACE_MAP_PREFETCHABLE: 0;
	}
	if (sz != NULL)
		*sz = size;
	return (bus_space_map(*tag, addr, size, flags, handle));
}
int OF_decode_addr ( phandle_t dev , int regno , bus_space_tag_t * tag , bus_space_handle_t * handle , bus_size_t * sz ) { bus_addr_t addr ; bus_size_t size ; pcell_t pci_hi ; int flags , res ; res = ofw_reg_to_paddr ( dev , regno , & addr , & size , & pci_hi ) ; if ( res < 0 ) return ( res ) ; if ( pci_hi == OFW_PADDR_NOT_PCI ) { * tag = & bs_be_tag ; flags = 0 ; } else { * tag = & bs_le_tag ; flags = ( pci_hi & OFW_PCI_PHYS_HI_PREFETCHABLE ) ? BUS_SPACE_MAP_PREFETCHABLE : 0 ; } if ( sz != NULL ) * sz = size ; return ( bus_space_map ( * tag , addr , size , flags , handle ) ) ; }
Return a bus handle and bus tag that corresponds to the register
 numbered regno for the device referenced by the package handle
 dev.
Return a bus handle and bus tag that corresponds to the register numbered regno for the device referenced by the package handle dev .