Lines Matching full:range

45 	u64		(*map)(__be32 *addr, const __be32 *range,
65 static u64 of_bus_default_map(__be32 *addr, const __be32 *range, in of_bus_default_map() argument
70 cp = of_read_number(range, na); in of_bus_default_map()
71 s = of_read_number(range + na + pna, ns); in of_bus_default_map()
168 static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns, in of_bus_pci_map() argument
175 rf = of_bus_pci_get_flags(range); in of_bus_pci_map()
182 cp = of_read_number(range + 1, na - 1); in of_bus_pci_map()
183 s = of_read_number(range + na + pna, ns); in of_bus_pci_map()
201 * @range: the PCI range that describes the resource
202 * @np: device node where the range belongs to
204 * reflect the values contained in the range.
206 * Returns -EINVAL if the range cannot be converted to resource.
208 * Note that if the range is an IO range, the resource will be converted
210 * if the range cannot be matched to any host bridge IO space (our case here).
211 * To guard against that we try to register the IO range first.
214 int of_pci_range_to_resource(struct of_pci_range *range, in of_pci_range_to_resource() argument
218 res->flags = range->flags; in of_pci_range_to_resource()
224 err = pci_register_io_range(&np->fwnode, range->cpu_addr, in of_pci_range_to_resource()
225 range->size); in of_pci_range_to_resource()
228 port = pci_address_to_pio(range->cpu_addr); in of_pci_range_to_resource()
236 upper_32_bits(range->cpu_addr)) { in of_pci_range_to_resource()
241 res->start = range->cpu_addr; in of_pci_range_to_resource()
243 res->end = res->start + range->size - 1; in of_pci_range_to_resource()
255 * @np: device node where the range belongs to
258 * reflect the values contained in the range.
260 * Returns ENOENT if the entry is not found or EINVAL if the range cannot be
267 struct of_range range; in of_range_to_resource() local
273 for_each_of_range(&parser, &range) in of_range_to_resource()
275 return of_pci_range_to_resource(&range, np, res); in of_range_to_resource()
299 static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns, in of_bus_isa_map() argument
305 if ((addr[0] ^ range[0]) & cpu_to_be32(1)) in of_bus_isa_map()
309 cp = of_read_number(range + 1, na - 1); in of_bus_isa_map()
310 s = of_read_number(range + na + pna, ns); in of_bus_isa_map()
664 * @start: return value for the start of the DMA range
665 * @length: return value for the length of the DMA range
782 parser->range = of_get_property(node, name, &rlen); in parser_init()
783 if (parser->range == NULL) in parser_init()
786 parser->end = parser->range + rlen / sizeof(__be32); in parser_init()
807 struct of_pci_range *range) in of_pci_range_parser_one() argument
814 if (!range) in of_pci_range_parser_one()
817 if (!parser->range || parser->range + np > parser->end) in of_pci_range_parser_one()
820 range->flags = parser->bus->get_flags(parser->range); in of_pci_range_parser_one()
826 range->bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na); in of_pci_range_parser_one()
829 range->cpu_addr = of_translate_dma_address(parser->node, in of_pci_range_parser_one()
830 parser->range + na); in of_pci_range_parser_one()
832 range->cpu_addr = of_translate_address(parser->node, in of_pci_range_parser_one()
833 parser->range + na); in of_pci_range_parser_one()
834 range->size = of_read_number(parser->range + parser->pna + na, ns); in of_pci_range_parser_one()
836 parser->range += np; in of_pci_range_parser_one()
839 while (parser->range + np <= parser->end) { in of_pci_range_parser_one()
843 flags = parser->bus->get_flags(parser->range); in of_pci_range_parser_one()
844 bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na); in of_pci_range_parser_one()
847 parser->range + na); in of_pci_range_parser_one()
850 parser->range + na); in of_pci_range_parser_one()
851 size = of_read_number(parser->range + parser->pna + na, ns); in of_pci_range_parser_one()
853 if (flags != range->flags) in of_pci_range_parser_one()
855 if (bus_addr != range->bus_addr + range->size || in of_pci_range_parser_one()
856 cpu_addr != range->cpu_addr + range->size) in of_pci_range_parser_one()
859 range->size += size; in of_pci_range_parser_one()
860 parser->range += np; in of_pci_range_parser_one()
863 return range; in of_pci_range_parser_one()
881 /* memory-mapped I/O range */ in of_translate_ioport()
893 * of_dma_get_range - Get DMA range info and put it into a map array
894 * @np: device node to get DMA range info
895 * @map: dma range structure to return
914 struct of_range range; in of_dma_get_range() local
943 for_each_of_range(&parser, &range) { in of_dma_get_range()
944 if (range.cpu_addr == OF_BAD_ADDR) { in of_dma_get_range()
946 range.bus_addr, node); in of_dma_get_range()
969 for_each_of_range(&parser, &range) { in of_dma_get_range()
971 range.bus_addr, range.cpu_addr, range.size); in of_dma_get_range()
972 if (range.cpu_addr == OF_BAD_ADDR) in of_dma_get_range()
974 r->cpu_start = range.cpu_addr; in of_dma_get_range()
975 r->dma_start = range.bus_addr; in of_dma_get_range()
976 r->size = range.size; in of_dma_get_range()
977 r->offset = range.cpu_addr - range.bus_addr; in of_dma_get_range()
1000 struct of_range range; in of_dma_get_max_cpu_address() local
1011 for_each_of_range(&parser, &range) in of_dma_get_max_cpu_address()
1012 if (range.cpu_addr + range.size > cpu_end) in of_dma_get_max_cpu_address()
1013 cpu_end = range.cpu_addr + range.size - 1; in of_dma_get_max_cpu_address()
1133 * Returns -EINVAL if the range cannot be converted to resource.
1160 * @np: the device whose io range will be mapped
1161 * @index: index of the io range
1182 * @device: the device whose io range will be mapped
1183 * @index: index of the io range