Changeset 26e7d6d in mainline for uspace/drv/bus/usb/uhci/pci.c
- Timestamp:
- 2011-09-19T16:31:00Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a347a11
- Parents:
- 3842a955 (diff), 086290d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/pci.c
r3842a955 r26e7d6d 61 61 assert(io_reg_size); 62 62 assert(irq_no); 63 63 64 64 async_sess_t *parent_sess = 65 65 devman_parent_device_connect(EXCHANGE_SERIALIZE, dev->handle, … … 67 67 if (!parent_sess) 68 68 return ENOMEM; 69 69 70 70 hw_resource_list_t hw_resources; 71 int rc = hw_res_get_resource_list(parent_sess, &hw_resources); 71 const int rc = hw_res_get_resource_list(parent_sess, &hw_resources); 72 async_hangup(parent_sess); 72 73 if (rc != EOK) { 73 async_hangup(parent_sess);74 74 return rc; 75 75 } 76 76 77 77 uintptr_t io_address = 0; 78 78 size_t io_size = 0; 79 79 bool io_found = false; 80 80 81 81 int irq = 0; 82 82 bool irq_found = false; 83 83 84 84 size_t i; 85 85 for (i = 0; i < hw_resources.count; i++) { … … 102 102 } 103 103 } 104 105 async_hangup(parent_sess); 106 104 free(hw_resources.resources); 105 107 106 if (!io_found || !irq_found) 108 107 return ENOENT; 109 108 110 109 *io_reg_address = io_address; 111 110 *io_reg_size = io_size; 112 111 *irq_no = irq; 113 112 114 113 return EOK; 115 114 } 116 115 /*----------------------------------------------------------------------------*/ 117 116 /** Call the PCI driver with a request to enable interrupts 118 117 * … … 127 126 if (!parent_sess) 128 127 return ENOMEM; 129 128 130 129 const bool enabled = hw_res_enable_interrupt(parent_sess); 131 130 async_hangup(parent_sess); 132 131 133 132 return enabled ? EOK : EIO; 134 133 } 135 134 /*----------------------------------------------------------------------------*/ 136 135 /** Call the PCI driver with a request to clear legacy support register 137 136 * … … 142 141 { 143 142 assert(device); 144 143 145 144 async_sess_t *parent_sess = 146 145 devman_parent_device_connect(EXCHANGE_SERIALIZE, device->handle, … … 148 147 if (!parent_sess) 149 148 return ENOMEM; 150 149 151 150 /* See UHCI design guide for these values p.45, 152 151 * write all WC bits in USB legacy register */ 153 152 const sysarg_t address = 0xc0; 154 153 const sysarg_t value = 0xaf00; 155 154 156 155 async_exch_t *exch = async_exchange_begin(parent_sess); 157 156 158 157 const int rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE), 159 158 IPC_M_CONFIG_SPACE_WRITE_16, address, value); 160 159 161 160 async_exchange_end(exch); 162 161 async_hangup(parent_sess); 163 162 164 163 return rc; 165 164 }
Note:
See TracChangeset
for help on using the changeset viewer.