Changes in uspace/drv/ohci/pci.c [dc5f2fb:79ae36dd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/pci.c
rdc5f2fb r79ae36dd 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 /** 29 30 * @addtogroup drvusbohci … … 34 35 * PCI related functions needed by the OHCI driver. 35 36 */ 37 36 38 #include <errno.h> 37 39 #include <assert.h> … … 63 65 assert(irq_no); 64 66 65 int parent_phone = devman_parent_device_connect(dev->handle, 67 async_sess_t *parent_sess = 68 devman_parent_device_connect(EXCHANGE_SERIALIZE, dev->handle, 66 69 IPC_FLAG_BLOCKING); 67 if (parent_phone < 0) { 68 return parent_phone; 69 } 70 71 int rc; 72 70 if (!parent_sess) 71 return ENOMEM; 72 73 73 hw_resource_list_t hw_resources; 74 rc = hw_res_get_resource_list(parent_phone, &hw_resources);74 int rc = hw_res_get_resource_list(parent_sess, &hw_resources); 75 75 if (rc != EOK) { 76 async_hangup(parent_ phone);76 async_hangup(parent_sess); 77 77 return rc; 78 78 } 79 79 80 80 uintptr_t mem_address = 0; 81 81 size_t mem_size = 0; 82 82 bool mem_found = false; 83 83 84 84 int irq = 0; 85 85 bool irq_found = false; 86 86 87 87 size_t i; 88 88 for (i = 0; i < hw_resources.count; i++) { 89 89 hw_resource_t *res = &hw_resources.resources[i]; 90 switch (res->type) 91 { 90 switch (res->type) { 92 91 case INTERRUPT: 93 92 irq = res->res.interrupt.irq; … … 95 94 usb_log_debug2("Found interrupt: %d.\n", irq); 96 95 break; 97 98 96 case MEM_RANGE: 99 97 if (res->res.mem_range.address != 0 … … 104 102 (void *) mem_address, mem_size); 105 103 mem_found = true; 106 104 } 107 105 default: 108 106 break; 109 107 } 110 108 } 111 109 112 110 if (mem_found && irq_found) { 113 111 *mem_reg_address = mem_address; … … 115 113 *irq_no = irq; 116 114 rc = EOK; 117 } else {115 } else 118 116 rc = ENOENT; 119 } 120 121 async_hangup(parent_phone); 117 118 async_hangup(parent_sess); 122 119 return rc; 123 120 } 124 /*----------------------------------------------------------------------------*/ 125 /** Call sthe PCI driver with a request to enable interrupts121 122 /** Call the PCI driver with a request to enable interrupts 126 123 * 127 124 * @param[in] device Device asking for interrupts … … 130 127 int pci_enable_interrupts(ddf_dev_t *device) 131 128 { 132 int parent_phone = 133 devman_parent_device_connect(device->handle, IPC_FLAG_BLOCKING); 134 if (parent_phone < 0) { 135 return parent_phone; 136 } 137 bool enabled = hw_res_enable_interrupt(parent_phone); 138 async_hangup(parent_phone); 129 async_sess_t *parent_sess = 130 devman_parent_device_connect(EXCHANGE_SERIALIZE, device->handle, 131 IPC_FLAG_BLOCKING); 132 if (!parent_sess) 133 return ENOMEM; 134 135 bool enabled = hw_res_enable_interrupt(parent_sess); 136 async_hangup(parent_sess); 137 139 138 return enabled ? EOK : EIO; 140 139 } 141 /**142 * @}143 */144 140 145 141 /**
Note:
See TracChangeset
for help on using the changeset viewer.