Lines Matching refs:iores

57 BHND_NVRAM_IOPS_DEFN(iores);
79 struct bhnd_nvram_iores *iores; in bhnd_nvram_iores_new() local
130 iores = malloc(sizeof(*iores), M_BHND_NVRAM, M_WAITOK); in bhnd_nvram_iores_new()
131 iores->io.iops = &bhnd_nvram_iores_ops; in bhnd_nvram_iores_new()
132 iores->res = r; in bhnd_nvram_iores_new()
133 iores->offset = offset; in bhnd_nvram_iores_new()
134 iores->size = size; in bhnd_nvram_iores_new()
135 iores->bus_width = bus_width; in bhnd_nvram_iores_new()
137 return (&iores->io); in bhnd_nvram_iores_new()
149 struct bhnd_nvram_iores *iores = (struct bhnd_nvram_iores *)io; in bhnd_nvram_iores_getsize() local
150 return (iores->size); in bhnd_nvram_iores_getsize()
185 bhnd_nvram_iores_validate_req(struct bhnd_nvram_iores *iores, size_t offset, in bhnd_nvram_iores_validate_req() argument
189 if (offset > iores->size) in bhnd_nvram_iores_validate_req()
193 if (offset == iores->size) { in bhnd_nvram_iores_validate_req()
199 if (offset % iores->bus_width != 0) in bhnd_nvram_iores_validate_req()
203 *nbytes = ummin(*nbytes, iores->size - offset); in bhnd_nvram_iores_validate_req()
204 if (*nbytes < iores->bus_width && *nbytes % iores->bus_width != 0) in bhnd_nvram_iores_validate_req()
214 struct bhnd_nvram_iores *iores; in bhnd_nvram_iores_read() local
219 iores = (struct bhnd_nvram_iores *)io; in bhnd_nvram_iores_read()
224 if ((error = bhnd_nvram_iores_validate_req(iores, offset, &navail))) in bhnd_nvram_iores_read()
236 r_offset = iores->offset + offset; in bhnd_nvram_iores_read()
237 switch (iores->bus_width) { in bhnd_nvram_iores_read()
239 bhnd_bus_read_region_stream_1(iores->res, r_offset, buffer, in bhnd_nvram_iores_read()
243 bhnd_bus_read_region_stream_2(iores->res, r_offset, buffer, in bhnd_nvram_iores_read()
247 bhnd_bus_read_region_stream_4(iores->res, r_offset, buffer, in bhnd_nvram_iores_read()
261 struct bhnd_nvram_iores *iores; in bhnd_nvram_iores_write() local
266 iores = (struct bhnd_nvram_iores *)io; in bhnd_nvram_iores_write()
271 if ((error = bhnd_nvram_iores_validate_req(iores, offset, &navail))) in bhnd_nvram_iores_write()
279 r_offset = iores->offset + offset; in bhnd_nvram_iores_write()
280 switch (iores->bus_width) { in bhnd_nvram_iores_write()
282 bhnd_bus_write_region_stream_1(iores->res, r_offset, buffer, in bhnd_nvram_iores_write()
286 bhnd_bus_write_region_stream_2(iores->res, r_offset, buffer, in bhnd_nvram_iores_write()
290 bhnd_bus_write_region_stream_4(iores->res, r_offset, buffer, in bhnd_nvram_iores_write()