Lines Matching full:range
46 u64 (*map)(__be32 *addr, const __be32 *range,
66 static u64 of_bus_default_map(__be32 *addr, const __be32 *range, in of_bus_default_map() argument
71 cp = of_read_number(range, na); in of_bus_default_map()
72 s = of_read_number(range + na + pna, ns); in of_bus_default_map()
104 static u64 of_bus_default_flags_map(__be32 *addr, const __be32 *range, int na, in of_bus_default_flags_map() argument
110 if (*addr != *range) in of_bus_default_flags_map()
114 cp = of_read_number(range + 1, na - 1); in of_bus_default_flags_map()
115 s = of_read_number(range + na + pna, ns); in of_bus_default_flags_map()
195 static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns, in of_bus_pci_map() argument
202 rf = of_bus_pci_get_flags(range); in of_bus_pci_map()
209 cp = of_read_number(range + 1, na - 1); in of_bus_pci_map()
210 s = of_read_number(range + na + pna, ns); in of_bus_pci_map()
224 * @range: the PCI range that describes the resource
225 * @np: device node where the range belongs to
227 * reflect the values contained in the range.
229 * Returns -EINVAL if the range cannot be converted to resource.
231 * Note that if the range is an IO range, the resource will be converted
233 * if the range cannot be matched to any host bridge IO space (our case here).
234 * To guard against that we try to register the IO range first.
237 int of_pci_range_to_resource(struct of_pci_range *range, in of_pci_range_to_resource() argument
241 res->flags = range->flags; in of_pci_range_to_resource()
247 err = pci_register_io_range(&np->fwnode, range->cpu_addr, in of_pci_range_to_resource()
248 range->size); in of_pci_range_to_resource()
251 port = pci_address_to_pio(range->cpu_addr); in of_pci_range_to_resource()
259 upper_32_bits(range->cpu_addr)) { in of_pci_range_to_resource()
264 res->start = range->cpu_addr; in of_pci_range_to_resource()
266 res->end = res->start + range->size - 1; in of_pci_range_to_resource()
278 * @np: device node where the range belongs to
281 * reflect the values contained in the range.
283 * Returns ENOENT if the entry is not found or EINVAL if the range cannot be
290 struct of_range range; in of_range_to_resource() local
296 for_each_of_range(&parser, &range) in of_range_to_resource()
298 return of_pci_range_to_resource(&range, np, res); in of_range_to_resource()
322 static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns, in of_bus_isa_map() argument
328 if ((addr[0] ^ range[0]) & cpu_to_be32(1)) in of_bus_isa_map()
332 cp = of_read_number(range + 1, na - 1); in of_bus_isa_map()
333 s = of_read_number(range + na + pna, ns); in of_bus_isa_map()
683 * @start: return value for the start of the DMA range
684 * @length: return value for the length of the DMA range
801 parser->range = of_get_property(node, name, &rlen); in parser_init()
802 if (parser->range == NULL) in parser_init()
805 parser->end = parser->range + rlen / sizeof(__be32); in parser_init()
826 struct of_pci_range *range) in of_pci_range_parser_one() argument
833 if (!range) in of_pci_range_parser_one()
836 if (!parser->range || parser->range + np > parser->end) in of_pci_range_parser_one()
839 range->flags = parser->bus->get_flags(parser->range); in of_pci_range_parser_one()
841 range->bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na); in of_pci_range_parser_one()
844 range->cpu_addr = of_translate_dma_address(parser->node, in of_pci_range_parser_one()
845 parser->range + na); in of_pci_range_parser_one()
847 range->cpu_addr = of_translate_address(parser->node, in of_pci_range_parser_one()
848 parser->range + na); in of_pci_range_parser_one()
849 range->size = of_read_number(parser->range + parser->pna + na, ns); in of_pci_range_parser_one()
851 parser->range += np; in of_pci_range_parser_one()
854 while (parser->range + np <= parser->end) { in of_pci_range_parser_one()
858 flags = parser->bus->get_flags(parser->range); in of_pci_range_parser_one()
859 bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na); in of_pci_range_parser_one()
862 parser->range + na); in of_pci_range_parser_one()
865 parser->range + na); in of_pci_range_parser_one()
866 size = of_read_number(parser->range + parser->pna + na, ns); in of_pci_range_parser_one()
868 if (flags != range->flags) in of_pci_range_parser_one()
870 if (bus_addr != range->bus_addr + range->size || in of_pci_range_parser_one()
871 cpu_addr != range->cpu_addr + range->size) in of_pci_range_parser_one()
874 range->size += size; in of_pci_range_parser_one()
875 parser->range += np; in of_pci_range_parser_one()
878 return range; in of_pci_range_parser_one()
896 /* memory-mapped I/O range */ in of_translate_ioport()
908 * of_dma_get_range - Get DMA range info and put it into a map array
909 * @np: device node to get DMA range info
910 * @map: dma range structure to return
929 struct of_range range; in of_dma_get_range() local
958 for_each_of_range(&parser, &range) { in of_dma_get_range()
959 if (range.cpu_addr == OF_BAD_ADDR) { in of_dma_get_range()
961 range.bus_addr, node); in of_dma_get_range()
984 for_each_of_range(&parser, &range) { in of_dma_get_range()
986 range.bus_addr, range.cpu_addr, range.size); in of_dma_get_range()
987 if (range.cpu_addr == OF_BAD_ADDR) in of_dma_get_range()
989 r->cpu_start = range.cpu_addr; in of_dma_get_range()
990 r->dma_start = range.bus_addr; in of_dma_get_range()
991 r->size = range.size; in of_dma_get_range()
992 r->offset = range.cpu_addr - range.bus_addr; in of_dma_get_range()
1015 struct of_range range; in of_dma_get_max_cpu_address() local
1026 for_each_of_range(&parser, &range) in of_dma_get_max_cpu_address()
1027 if (range.cpu_addr + range.size > cpu_end) in of_dma_get_max_cpu_address()
1028 cpu_end = range.cpu_addr + range.size - 1; in of_dma_get_max_cpu_address()
1152 * Returns -EINVAL if the range cannot be converted to resource.
1179 * @np: the device whose io range will be mapped
1180 * @index: index of the io range
1201 * @device: the device whose io range will be mapped
1202 * @index: index of the io range