Changes in uspace/drv/uhci-hcd/pci.c [4abc304:a7e2f0d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/pci.c
r4abc304 ra7e2f0d 40 40 41 41 #include <usb/debug.h> 42 #include <pci_dev_iface.h> 42 43 43 44 #include "pci.h" … … 64 65 65 66 int rc; 66 67 67 hw_resource_list_t hw_resources; 68 68 rc = hw_res_get_resource_list(parent_phone, &hw_resources); … … 81 81 for (i = 0; i < hw_resources.count; i++) { 82 82 hw_resource_t *res = &hw_resources.resources[i]; 83 switch (res->type) { 84 case INTERRUPT: 85 irq = res->res.interrupt.irq; 86 irq_found = true; 87 usb_log_debug2("Found interrupt: %d.\n", irq); 88 break; 89 case IO_RANGE: 90 io_address = res->res.io_range.address; 91 io_size = res->res.io_range.size; 92 usb_log_debug2("Found io: %llx %zu.\n", 93 res->res.io_range.address, res->res.io_range.size); 94 io_found = true; 95 break; 96 default: 97 break; 83 switch (res->type) 84 { 85 case INTERRUPT: 86 irq = res->res.interrupt.irq; 87 irq_found = true; 88 usb_log_debug2("Found interrupt: %d.\n", irq); 89 break; 90 91 case IO_RANGE: 92 io_address = res->res.io_range.address; 93 io_size = res->res.io_range.size; 94 usb_log_debug2("Found io: %llx %zu.\n", 95 res->res.io_range.address, res->res.io_range.size); 96 io_found = true; 97 98 default: 99 break; 98 100 } 99 101 } 100 102 101 if (!io_found) { 102 rc = ENOENT; 103 goto leave; 104 } 105 106 if (!irq_found) { 103 if (!io_found || !irq_found) { 107 104 rc = ENOENT; 108 105 goto leave; … … 120 117 } 121 118 /*----------------------------------------------------------------------------*/ 119 /** Calls the PCI driver with a request to enable interrupts 120 * 121 * @param[in] device Device asking for interrupts 122 * @return Error code. 123 */ 122 124 int pci_enable_interrupts(ddf_dev_t *device) 123 125 { … … 128 130 return enabled ? EOK : EIO; 129 131 } 132 /*----------------------------------------------------------------------------*/ 133 /** Calls the PCI driver with a request to clear legacy support register 134 * 135 * @param[in] device Device asking to disable interrupts 136 * @return Error code. 137 */ 138 int pci_disable_legacy(ddf_dev_t *device) 139 { 140 assert(device); 141 int parent_phone = 142 devman_parent_device_connect(device->handle, IPC_FLAG_BLOCKING); 143 if (parent_phone < 0) { 144 return parent_phone; 145 } 146 147 /* See UHCI design guide for these values, 148 * write all WC bits in USB legacy register */ 149 sysarg_t address = 0xc0; 150 sysarg_t value = 0x8f00; 151 152 int rc = async_req_3_0(parent_phone, DEV_IFACE_ID(PCI_DEV_IFACE), 153 IPC_M_CONFIG_SPACE_WRITE_16, address, value); 154 async_hangup(parent_phone); 155 156 return rc; 157 } 158 /*----------------------------------------------------------------------------*/ 130 159 /** 131 160 * @}
Note:
See TracChangeset
for help on using the changeset viewer.