Lines Matching full:range

27  * logic_pio_register_range - register logical PIO range for a host
28 * @new_range: pointer to the IO range to be registered.
31 * If the range already exists, -EEXIST will be returned, which should be
34 * Register a new IO range node in the IO range list.
38 struct logic_pio_hwaddr *range; in logic_pio_register_range() local
53 list_for_each_entry(range, &io_range_list, list) { in logic_pio_register_range()
54 if (range->fwnode == new_range->fwnode) { in logic_pio_register_range()
55 /* range already there */ in logic_pio_register_range()
59 if (range->flags == LOGIC_PIO_CPU_MMIO && in logic_pio_register_range()
62 if (start >= range->hw_start + range->size || in logic_pio_register_range()
63 end < range->hw_start) { in logic_pio_register_range()
64 mmio_end = range->io_start + range->size; in logic_pio_register_range()
69 } else if (range->flags == LOGIC_PIO_INDIRECT && in logic_pio_register_range()
71 iio_sz += range->size; in logic_pio_register_range()
75 /* range not registered yet, check for available space */ in logic_pio_register_range()
84 pr_warn("Requested IO range too big, new size set to 64K\n"); in logic_pio_register_range()
107 * logic_pio_unregister_range - unregister a logical PIO range for a host
108 * @range: pointer to the IO range which has been already registered.
110 * Unregister a previously-registered IO range node.
112 void logic_pio_unregister_range(struct logic_pio_hwaddr *range) in logic_pio_unregister_range() argument
115 list_del_rcu(&range->list); in logic_pio_unregister_range()
121 * find_io_range_by_fwnode - find logical PIO range for given FW node
122 * @fwnode: FW node handle associated with logical PIO range
130 struct logic_pio_hwaddr *range, *found_range = NULL; in find_io_range_by_fwnode() local
133 list_for_each_entry_rcu(range, &io_range_list, list) { in find_io_range_by_fwnode()
134 if (range->fwnode == fwnode) { in find_io_range_by_fwnode()
135 found_range = range; in find_io_range_by_fwnode()
144 /* Return a registered range given an input PIO token */
147 struct logic_pio_hwaddr *range, *found_range = NULL; in find_io_range() local
150 list_for_each_entry_rcu(range, &io_range_list, list) { in find_io_range()
151 if (in_range(pio, range->io_start, range->size)) { in find_io_range()
152 found_range = range; in find_io_range()
175 struct logic_pio_hwaddr *range; in logic_pio_to_hwaddr() local
177 range = find_io_range(pio); in logic_pio_to_hwaddr()
178 if (range) in logic_pio_to_hwaddr()
179 return range->hw_start + pio - range->io_start; in logic_pio_to_hwaddr()
195 struct logic_pio_hwaddr *range; in logic_pio_trans_hwaddr() local
197 range = find_io_range_by_fwnode(fwnode); in logic_pio_trans_hwaddr()
198 if (!range || range->flags == LOGIC_PIO_CPU_MMIO) { in logic_pio_trans_hwaddr()
199 pr_err("IO range not found or invalid\n"); in logic_pio_trans_hwaddr()
202 if (range->size < size) { in logic_pio_trans_hwaddr()
203 pr_err("resource size %pa cannot fit in IO range size %pa\n", in logic_pio_trans_hwaddr()
204 &size, &range->size); in logic_pio_trans_hwaddr()
207 return addr - range->hw_start + range->io_start; in logic_pio_trans_hwaddr()
212 struct logic_pio_hwaddr *range; in logic_pio_trans_cpuaddr() local
215 list_for_each_entry_rcu(range, &io_range_list, list) { in logic_pio_trans_cpuaddr()
216 if (range->flags != LOGIC_PIO_CPU_MMIO) in logic_pio_trans_cpuaddr()
218 if (in_range(addr, range->hw_start, range->size)) { in logic_pio_trans_cpuaddr()
221 cpuaddr = addr - range->hw_start + range->io_start; in logic_pio_trans_cpuaddr()