Lines Matching full:range
50 u64 (*map)(__be32 *addr, const __be32 *range,
70 static u64 of_bus_default_map(__be32 *addr, const __be32 *range, in of_bus_default_map() argument
75 cp = of_read_number(range, na); in of_bus_default_map()
76 s = of_read_number(range + na + pna, ns); in of_bus_default_map()
166 static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns, in of_bus_pci_map() argument
173 rf = of_bus_pci_get_flags(range); in of_bus_pci_map()
180 cp = of_read_number(range + 1, na - 1); in of_bus_pci_map()
181 s = of_read_number(range + na + pna, ns); in of_bus_pci_map()
258 * @range: the PCI range that describes the resource
259 * @np: device node where the range belongs to
261 * reflect the values contained in the range.
263 * Returns EINVAL if the range cannot be converted to resource.
265 * Note that if the range is an IO range, the resource will be converted
267 * if the range cannot be matched to any host bridge IO space (our case here).
268 * To guard against that we try to register the IO range first.
271 int of_pci_range_to_resource(struct of_pci_range *range, in of_pci_range_to_resource() argument
275 res->flags = range->flags; in of_pci_range_to_resource()
281 err = pci_register_io_range(&np->fwnode, range->cpu_addr, in of_pci_range_to_resource()
282 range->size); in of_pci_range_to_resource()
285 port = pci_address_to_pio(range->cpu_addr); in of_pci_range_to_resource()
293 upper_32_bits(range->cpu_addr)) { in of_pci_range_to_resource()
298 res->start = range->cpu_addr; in of_pci_range_to_resource()
300 res->end = res->start + range->size - 1; in of_pci_range_to_resource()
329 static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns, in of_bus_isa_map() argument
335 if ((addr[0] ^ range[0]) & cpu_to_be32(1)) in of_bus_isa_map()
339 cp = of_read_number(range + 1, na - 1); in of_bus_isa_map()
340 s = of_read_number(range + na + pna, ns); in of_bus_isa_map()
724 parser->range = of_get_property(node, name, &rlen); in parser_init()
725 if (parser->range == NULL) in parser_init()
728 parser->end = parser->range + rlen / sizeof(__be32); in parser_init()
749 struct of_pci_range *range) in of_pci_range_parser_one() argument
756 if (!range) in of_pci_range_parser_one()
759 if (!parser->range || parser->range + np > parser->end) in of_pci_range_parser_one()
762 range->flags = parser->bus->get_flags(parser->range); in of_pci_range_parser_one()
768 range->bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na); in of_pci_range_parser_one()
771 range->cpu_addr = of_translate_dma_address(parser->node, in of_pci_range_parser_one()
772 parser->range + na); in of_pci_range_parser_one()
774 range->cpu_addr = of_translate_address(parser->node, in of_pci_range_parser_one()
775 parser->range + na); in of_pci_range_parser_one()
776 range->size = of_read_number(parser->range + parser->pna + na, ns); in of_pci_range_parser_one()
778 parser->range += np; in of_pci_range_parser_one()
781 while (parser->range + np <= parser->end) { in of_pci_range_parser_one()
785 flags = parser->bus->get_flags(parser->range); in of_pci_range_parser_one()
786 bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na); in of_pci_range_parser_one()
789 parser->range + na); in of_pci_range_parser_one()
792 parser->range + na); in of_pci_range_parser_one()
793 size = of_read_number(parser->range + parser->pna + na, ns); in of_pci_range_parser_one()
795 if (flags != range->flags) in of_pci_range_parser_one()
797 if (bus_addr != range->bus_addr + range->size || in of_pci_range_parser_one()
798 cpu_addr != range->cpu_addr + range->size) in of_pci_range_parser_one()
801 range->size += size; in of_pci_range_parser_one()
802 parser->range += np; in of_pci_range_parser_one()
805 return range; in of_pci_range_parser_one()
823 /* memory-mapped I/O range */ in of_translate_ioport()
887 * @np: the device whose io range will be mapped
888 * @index: index of the io range
906 * @device: the device whose io range will be mapped
907 * @index: index of the io range
943 * of_dma_get_range - Get DMA range info and put it into a map array
944 * @np: device node to get DMA range info
945 * @map: dma range structure to return
964 struct of_range range; in of_dma_get_range() local
993 for_each_of_range(&parser, &range) in of_dma_get_range()
1007 for_each_of_range(&parser, &range) { in of_dma_get_range()
1009 range.bus_addr, range.cpu_addr, range.size); in of_dma_get_range()
1010 if (range.cpu_addr == OF_BAD_ADDR) { in of_dma_get_range()
1012 range.bus_addr, node); in of_dma_get_range()
1015 r->cpu_start = range.cpu_addr; in of_dma_get_range()
1016 r->dma_start = range.bus_addr; in of_dma_get_range()
1017 r->size = range.size; in of_dma_get_range()
1018 r->offset = range.cpu_addr - range.bus_addr; in of_dma_get_range()
1041 struct of_range range; in of_dma_get_max_cpu_address() local
1052 for_each_of_range(&parser, &range) in of_dma_get_max_cpu_address()
1053 if (range.cpu_addr + range.size > cpu_end) in of_dma_get_max_cpu_address()
1054 cpu_end = range.cpu_addr + range.size - 1; in of_dma_get_max_cpu_address()