Changes in uspace/drv/bus/usb/uhci/pci.c [75f9dcd:266976f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/pci.c
r75f9dcd r266976f 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 29 28 /** 30 29 * @addtogroup drvusbuhcihc … … 39 38 #include <assert.h> 40 39 #include <devman.h> 41 #include <device/hw_res .h>40 #include <device/hw_res_parsed.h> 42 41 43 42 #include <usb/debug.h> … … 68 67 return ENOMEM; 69 68 70 hw_resource_list_t hw_resources; 71 const int rc = hw_res_get_resource_list(parent_sess, &hw_resources); 69 hw_res_list_parsed_t hw_res; 70 hw_res_list_parsed_init(&hw_res); 71 const int ret = hw_res_get_list_parsed(parent_sess, &hw_res, 0); 72 72 async_hangup(parent_sess); 73 if (r c!= EOK) {74 return r c;73 if (ret != EOK) { 74 return ret; 75 75 } 76 76 77 uintptr_t io_address = 0; 78 size_t io_size = 0; 79 bool io_found = false; 77 /* We want one irq and one io range. */ 78 if (hw_res.irqs.count != 1 || hw_res.io_ranges.count != 1) { 79 hw_res_list_parsed_clean(&hw_res); 80 return EINVAL; 81 } 80 82 81 int irq = 0; 82 bool irq_found = false; 83 if (io_reg_address) 84 *io_reg_address = hw_res.io_ranges.ranges[0].address; 85 if (io_reg_size) 86 *io_reg_size = hw_res.io_ranges.ranges[0].size; 87 if (irq_no) 88 *irq_no = hw_res.irqs.irqs[0]; 83 89 84 for (size_t i = 0; i < hw_resources.count; i++) { 85 const hw_resource_t *res = &hw_resources.resources[i]; 86 switch (res->type) { 87 case INTERRUPT: 88 irq = res->res.interrupt.irq; 89 irq_found = true; 90 usb_log_debug2("Found interrupt: %d.\n", irq); 91 break; 92 case IO_RANGE: 93 io_address = res->res.io_range.address; 94 io_size = res->res.io_range.size; 95 usb_log_debug2("Found io: %" PRIx64" %zu.\n", 96 res->res.io_range.address, res->res.io_range.size); 97 io_found = true; 98 break; 99 default: 100 break; 101 } 102 } 103 free(hw_resources.resources); 104 105 if (!io_found || !irq_found) 106 return ENOENT; 107 108 *io_reg_address = io_address; 109 *io_reg_size = io_size; 110 *irq_no = irq; 111 90 hw_res_list_parsed_clean(&hw_res); 112 91 return EOK; 113 92 }
Note:
See TracChangeset
for help on using the changeset viewer.