Changes in uspace/drv/uhci-hcd/pci.c [e247d83:af81980] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/pci.c
re247d83 raf81980 52 52 * @return Error code. 53 53 */ 54 int pci_get_my_registers( constddf_dev_t *dev,54 int pci_get_my_registers(ddf_dev_t *dev, 55 55 uintptr_t *io_reg_address, size_t *io_reg_size, int *irq_no) 56 56 { 57 assert(dev); 58 assert(io_reg_address); 59 assert(io_reg_size); 60 assert(irq_no); 57 assert(dev != NULL); 61 58 62 59 int parent_phone = … … 69 66 int rc = hw_res_get_resource_list(parent_phone, &hw_resources); 70 67 if (rc != EOK) { 71 async_hangup(parent_phone); 72 return rc; 68 goto leave; 73 69 } 74 70 … … 82 78 size_t i; 83 79 for (i = 0; i < hw_resources.count; i++) { 84 consthw_resource_t *res = &hw_resources.resources[i];80 hw_resource_t *res = &hw_resources.resources[i]; 85 81 switch (res->type) 86 82 { … … 103 99 } 104 100 } 105 async_hangup(parent_phone);106 101 107 if (!io_found || !irq_found) 108 return ENOENT; 102 if (!io_found || !irq_found) { 103 rc = ENOENT; 104 goto leave; 105 } 109 106 110 107 *io_reg_address = io_address; … … 112 109 *irq_no = irq; 113 110 114 return EOK; 111 rc = EOK; 112 leave: 113 async_hangup(parent_phone); 114 return rc; 115 115 } 116 116 /*----------------------------------------------------------------------------*/ … … 120 120 * @return Error code. 121 121 */ 122 int pci_enable_interrupts( constddf_dev_t *device)122 int pci_enable_interrupts(ddf_dev_t *device) 123 123 { 124 const int parent_phone = 125 devman_parent_device_connect(device->handle, IPC_FLAG_BLOCKING); 126 if (parent_phone < 0) { 127 return parent_phone; 128 } 129 const bool enabled = hw_res_enable_interrupt(parent_phone); 124 int parent_phone = devman_parent_device_connect(device->handle, 125 IPC_FLAG_BLOCKING); 126 bool enabled = hw_res_enable_interrupt(parent_phone); 130 127 async_hangup(parent_phone); 131 128 return enabled ? EOK : EIO; … … 137 134 * @return Error code. 138 135 */ 139 int pci_disable_legacy( constddf_dev_t *device)136 int pci_disable_legacy(ddf_dev_t *device) 140 137 { 141 138 assert(device); 142 constint parent_phone =139 int parent_phone = 143 140 devman_parent_device_connect(device->handle, IPC_FLAG_BLOCKING); 144 141 if (parent_phone < 0) { … … 148 145 /* See UHCI design guide for these values p.45, 149 146 * write all WC bits in USB legacy register */ 150 constsysarg_t address = 0xc0;151 constsysarg_t value = 0xaf00;147 sysarg_t address = 0xc0; 148 sysarg_t value = 0xaf00; 152 149 153 constint rc = async_req_3_0(parent_phone, DEV_IFACE_ID(PCI_DEV_IFACE),150 int rc = async_req_3_0(parent_phone, DEV_IFACE_ID(PCI_DEV_IFACE), 154 151 IPC_M_CONFIG_SPACE_WRITE_16, address, value); 155 152 async_hangup(parent_phone);
Note:
See TracChangeset
for help on using the changeset viewer.