Changeset 79ae36dd in mainline for uspace/drv/uhci_rhd/main.c
- Timestamp:
- 2011-06-08T19:01:55Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0eff68e
- Parents:
- 764d71e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci_rhd/main.c
r764d71e r79ae36dd 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 /** @addtogroup drvusbuhcirh 29 30 * @{ … … 32 33 * @brief UHCI root hub initialization routines 33 34 */ 35 34 36 #include <ddf/driver.h> 35 37 #include <devman.h> … … 48 50 static int hc_get_my_registers(const ddf_dev_t *dev, 49 51 uintptr_t *io_reg_address, size_t *io_reg_size); 50 /*----------------------------------------------------------------------------*/ 52 51 53 static int uhci_rh_add_device(ddf_dev_t *device); 52 /*----------------------------------------------------------------------------*/ 54 53 55 static driver_ops_t uhci_rh_driver_ops = { 54 56 .add_device = uhci_rh_add_device, 55 57 }; 56 /*----------------------------------------------------------------------------*/ 58 57 59 static driver_t uhci_rh_driver = { 58 60 .name = NAME, 59 61 .driver_ops = &uhci_rh_driver_ops 60 62 }; 61 /*----------------------------------------------------------------------------*/ 63 62 64 /** Initialize global driver structures (NONE). 63 65 * … … 74 76 return ddf_driver_main(&uhci_rh_driver); 75 77 } 76 /*----------------------------------------------------------------------------*/ 78 77 79 /** Initialize a new ddf driver instance of UHCI root hub. 78 80 * … … 122 124 return EOK; 123 125 } 124 /*----------------------------------------------------------------------------*/ 126 125 127 /** Get address of I/O registers. 126 128 * … … 134 136 { 135 137 assert(dev); 136 137 const int parent_phone = devman_parent_device_connect(dev->handle, 138 139 async_sess_t *parent_sess = 140 devman_parent_device_connect(EXCHANGE_SERIALIZE, dev->handle, 138 141 IPC_FLAG_BLOCKING); 139 if (parent_phone < 0) { 140 return parent_phone; 141 } 142 142 if (!parent_sess) 143 return ENOMEM; 144 143 145 hw_resource_list_t hw_resources; 144 const int ret = hw_res_get_resource_list(parent_ phone, &hw_resources);146 const int ret = hw_res_get_resource_list(parent_sess, &hw_resources); 145 147 if (ret != EOK) { 146 async_hangup(parent_ phone);148 async_hangup(parent_sess); 147 149 return ret; 148 150 } 149 151 150 152 uintptr_t io_address = 0; 151 153 size_t io_size = 0; 152 154 bool io_found = false; 153 155 154 156 size_t i = 0; 155 157 for (; i < hw_resources.count; i++) { … … 160 162 io_found = true; 161 163 } 164 162 165 } 163 async_hangup(parent_ phone);164 165 if (!io_found) {166 async_hangup(parent_sess); 167 168 if (!io_found) 166 169 return ENOENT; 167 }168 if (io_reg_address != NULL) {170 171 if (io_reg_address != NULL) 169 172 *io_reg_address = io_address; 170 }171 if (io_reg_size != NULL) {173 174 if (io_reg_size != NULL) 172 175 *io_reg_size = io_size; 173 }176 174 177 return EOK; 175 178 } 179 176 180 /** 177 181 * @}
Note:
See TracChangeset
for help on using the changeset viewer.