Changeset e247d83 in mainline
- Timestamp:
- 2011-05-23T14:04:51Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 563ead9
- Parents:
- 8953514
- Location:
- uspace/drv
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/hc.c
r8953514 re247d83 85 85 /* allow access to hc control registers */ 86 86 regs_t *io; 87 ret = pio_enable(regs, reg_size, (void **)&io);87 ret = pio_enable(regs, reg_size, (void **)&io); 88 88 CHECK_RET_RETURN(ret, 89 89 "Failed(%d) to gain access to registers at %p: %s.\n", … … 143 143 } 144 144 145 uint16_t status = pio_read_16(®isters->usbcmd);145 const uint16_t status = pio_read_16(®isters->usbcmd); 146 146 if (status != 0) 147 147 usb_log_warning("Previous command value: %x.\n", status); … … 212 212 /* Init USB frame list page*/ 213 213 instance->frame_list = get_page(); 214 ret = instance ? EOK : ENOMEM;214 ret = instance->frame_list ? EOK : ENOMEM; 215 215 CHECK_RET_RETURN(ret, "Failed to get frame list page.\n"); 216 216 usb_log_debug("Initialized frame list at %p.\n", instance->frame_list); … … 277 277 &instance->transfers_control_slow); 278 278 279 /*FSBR*/ 279 /*FSBR, This feature is not needed (adds no benefit) and is supposedly 280 * buggy on certain hw, enable at your own risk. */ 280 281 #ifdef FSBR 281 282 transfer_list_set_next(&instance->transfers_bulk_full, … … 428 429 } 429 430 430 uintptr_t frame_list =431 const uintptr_t frame_list = 431 432 pio_read_32(&instance->registers->flbaseadd) & ~0xfff; 432 433 if (frame_list != addr_to_phys(instance->frame_list)) { -
uspace/drv/uhci-hcd/hc.h
r8953514 re247d83 154 154 */ 155 155 static inline hc_t * fun_to_hc(ddf_fun_t *fun) 156 { return (hc_t*)fun->driver_data; } 156 { 157 assert(fun); 158 return fun->driver_data; 159 } 157 160 #endif 158 161 /** -
uspace/drv/uhci-hcd/pci.c
r8953514 re247d83 52 52 * @return Error code. 53 53 */ 54 int pci_get_my_registers( ddf_dev_t *dev,54 int pci_get_my_registers(const ddf_dev_t *dev, 55 55 uintptr_t *io_reg_address, size_t *io_reg_size, int *irq_no) 56 56 { 57 assert(dev != NULL); 57 assert(dev); 58 assert(io_reg_address); 59 assert(io_reg_size); 60 assert(irq_no); 58 61 59 62 int parent_phone = … … 66 69 int rc = hw_res_get_resource_list(parent_phone, &hw_resources); 67 70 if (rc != EOK) { 68 goto leave; 71 async_hangup(parent_phone); 72 return rc; 69 73 } 70 74 … … 78 82 size_t i; 79 83 for (i = 0; i < hw_resources.count; i++) { 80 hw_resource_t *res = &hw_resources.resources[i];84 const hw_resource_t *res = &hw_resources.resources[i]; 81 85 switch (res->type) 82 86 { … … 99 103 } 100 104 } 105 async_hangup(parent_phone); 101 106 102 if (!io_found || !irq_found) { 103 rc = ENOENT; 104 goto leave; 105 } 107 if (!io_found || !irq_found) 108 return ENOENT; 106 109 107 110 *io_reg_address = io_address; … … 109 112 *irq_no = irq; 110 113 111 rc = EOK; 112 leave: 113 async_hangup(parent_phone); 114 return rc; 114 return EOK; 115 115 } 116 116 /*----------------------------------------------------------------------------*/ … … 120 120 * @return Error code. 121 121 */ 122 int pci_enable_interrupts( ddf_dev_t *device)122 int pci_enable_interrupts(const ddf_dev_t *device) 123 123 { 124 int parent_phone = devman_parent_device_connect(device->handle, 125 IPC_FLAG_BLOCKING); 126 bool enabled = hw_res_enable_interrupt(parent_phone); 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); 127 130 async_hangup(parent_phone); 128 131 return enabled ? EOK : EIO; … … 134 137 * @return Error code. 135 138 */ 136 int pci_disable_legacy( ddf_dev_t *device)139 int pci_disable_legacy(const ddf_dev_t *device) 137 140 { 138 141 assert(device); 139 int parent_phone =142 const int parent_phone = 140 143 devman_parent_device_connect(device->handle, IPC_FLAG_BLOCKING); 141 144 if (parent_phone < 0) { … … 145 148 /* See UHCI design guide for these values p.45, 146 149 * write all WC bits in USB legacy register */ 147 sysarg_t address = 0xc0;148 sysarg_t value = 0xaf00;150 const sysarg_t address = 0xc0; 151 const sysarg_t value = 0xaf00; 149 152 150 int rc = async_req_3_0(parent_phone, DEV_IFACE_ID(PCI_DEV_IFACE),153 const int rc = async_req_3_0(parent_phone, DEV_IFACE_ID(PCI_DEV_IFACE), 151 154 IPC_M_CONFIG_SPACE_WRITE_16, address, value); 152 155 async_hangup(parent_phone); -
uspace/drv/uhci-hcd/pci.h
r8953514 re247d83 38 38 #include <ddf/driver.h> 39 39 40 int pci_get_my_registers( ddf_dev_t *, uintptr_t *, size_t *, int *);41 int pci_enable_interrupts( ddf_dev_t *);42 int pci_disable_legacy( ddf_dev_t *);40 int pci_get_my_registers(const ddf_dev_t *, uintptr_t *, size_t *, int *); 41 int pci_enable_interrupts(const ddf_dev_t *); 42 int pci_disable_legacy(const ddf_dev_t *); 43 43 44 44 #endif -
uspace/drv/uhci-hcd/root_hub.c
r8953514 re247d83 60 60 return ret; 61 61 } 62 assert(match_str); 62 63 63 64 ret = ddf_fun_add_match_id(fun, match_str, 100); -
uspace/drv/uhci-hcd/transfer_list.c
r8953514 re247d83 58 58 return ENOMEM; 59 59 } 60 uint32_t queue_head_pa = addr_to_phys(instance->queue_head);60 const uint32_t queue_head_pa = addr_to_phys(instance->queue_head); 61 61 usb_log_debug2("Transfer list %s setup with QH: %p (%#" PRIx32" ).\n", 62 62 name, instance->queue_head, queue_head_pa); … … 90 90 { 91 91 assert(instance); 92 assert(instance->queue_head); 92 93 assert(next); 93 if (!instance->queue_head)94 return;95 94 /* Set queue_head.next to point to the follower */ 96 95 qh_set_next_qh(instance->queue_head, next->queue_head); … … 137 136 write_barrier(); 138 137 139 /* Add to the driver list */138 /* Add to the driver's list */ 140 139 list_append(&batch->link, &instance->batch_list); 141 140 … … 160 159 link_t *current = instance->batch_list.next; 161 160 while (current != &instance->batch_list) { 162 link_t * next = current->next;161 link_t * const next = current->next; 163 162 usb_transfer_batch_t *batch = 164 163 usb_transfer_batch_from_link(current); … … 182 181 fibril_mutex_lock(&instance->guard); 183 182 while (!list_empty(&instance->batch_list)) { 184 link_t * current = instance->batch_list.next;183 link_t * const current = instance->batch_list.next; 185 184 usb_transfer_batch_t *batch = 186 185 usb_transfer_batch_from_link(current); -
uspace/drv/uhci-hcd/uhci.c
r8953514 re247d83 77 77 { 78 78 assert(dev); 79 hc_t *hc = &((uhci_t*)dev->driver_data)->hc; 79 uhci_t *uhci = dev->driver_data; 80 assert(uhci); 81 hc_t *hc = &uhci->hc; 80 82 uint16_t status = IPC_GET_ARG1(*call); 81 83 assert(hc); … … 144 146 { 145 147 assert(fun); 146 return &((rh_t*)fun->driver_data)->resource_list; 148 rh_t *rh = fun->driver_data; 149 assert(rh); 150 return &rh->resource_list; 147 151 } 148 152 /*----------------------------------------------------------------------------*/ -
uspace/drv/uhci-hcd/uhci.h
r8953514 re247d83 35 35 #ifndef DRV_UHCI_UHCI_H 36 36 #define DRV_UHCI_UHCI_H 37 #include <ddi.h>38 37 #include <ddf/driver.h> 39 38 -
uspace/drv/uhci-rhd/port.c
r8953514 re247d83 209 209 int uhci_port_reset_enable(int portno, void *arg) 210 210 { 211 uhci_port_t *port = (uhci_port_t *)arg;211 uhci_port_t *port = arg; 212 212 213 213 usb_log_debug2("%s: new_device_enable_port.\n", port->id_string);
Note:
See TracChangeset
for help on using the changeset viewer.