Changes in / [095b2017:da3dafc] in mainline
- Files:
-
- 1 added
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/as.c
r095b2017 rda3dafc 1949 1949 sysarg_t sys_as_area_create(uintptr_t address, size_t size, unsigned int flags) 1950 1950 { 1951 if (as_area_create(AS, flags , size, address,1951 if (as_area_create(AS, flags | AS_AREA_CACHEABLE, size, address, 1952 1952 AS_AREA_ATTR_NONE, &anon_backend, NULL)) 1953 1953 return (sysarg_t) address; -
uspace/drv/uhci-hcd/Makefile
r095b2017 rda3dafc 40 40 root_hub.c \ 41 41 hw_struct/transfer_descriptor.c \ 42 utils/slab.c \43 42 pci.c \ 44 43 batch.c -
uspace/drv/uhci-hcd/hc.c
r095b2017 rda3dafc 223 223 ret = instance ? EOK : ENOMEM; 224 224 CHECK_RET_DEST_CMDS_RETURN(ret, "Failed to get frame list page.\n"); 225 usb_log_debug("Initialized frame list at %p.\n", instance->frame_list);225 usb_log_debug("Initialized frame list.\n"); 226 226 227 227 /* Set all frames to point to the first queue head */ … … 336 336 instance->transfers[batch->speed][batch->transfer_type]; 337 337 assert(list); 338 if (batch->transfer_type == USB_TRANSFER_CONTROL) {339 usb_device_keeper_use_control(340 &instance->manager, batch->target.address);341 }342 338 transfer_list_add_batch(list, batch); 343 339 … … 361 357 /* Lower 2 bits are transaction error and transaction complete */ 362 358 if (status & 0x3) { 363 LIST_INITIALIZE(done); 364 transfer_list_remove_finished( 365 &instance->transfers_interrupt, &done); 366 transfer_list_remove_finished( 367 &instance->transfers_control_slow, &done); 368 transfer_list_remove_finished( 369 &instance->transfers_control_full, &done); 370 transfer_list_remove_finished( 371 &instance->transfers_bulk_full, &done); 372 373 while (!list_empty(&done)) { 374 link_t *item = done.next; 375 list_remove(item); 376 usb_transfer_batch_t *batch = 377 list_get_instance(item, usb_transfer_batch_t, link); 378 if (batch->transfer_type == USB_TRANSFER_CONTROL) { 379 usb_device_keeper_release_control( 380 &instance->manager, batch->target.address); 381 } 382 batch->next_step(batch); 383 } 359 transfer_list_remove_finished(&instance->transfers_interrupt); 360 transfer_list_remove_finished(&instance->transfers_control_slow); 361 transfer_list_remove_finished(&instance->transfers_control_full); 362 transfer_list_remove_finished(&instance->transfers_bulk_full); 384 363 } 385 364 /* bits 4 and 5 indicate hc error */ -
uspace/drv/uhci-hcd/transfer_list.c
r095b2017 rda3dafc 58 58 } 59 59 instance->queue_head_pa = addr_to_phys(instance->queue_head); 60 usb_log_debug2("Transfer list %s setup with QH: %p(%p).\n",61 name, instance->queue_head, instance->queue_head_pa);62 60 63 61 qh_init(instance->queue_head); … … 120 118 qh_set_next_qh(last_qh, pa); 121 119 122 asm volatile ("": : :"memory");123 124 120 /* Add to the driver list */ 125 121 list_append(&batch->link, &instance->batch_list); … … 141 137 * this transfer list leading to the deadlock if its done inline. 142 138 */ 143 void transfer_list_remove_finished(transfer_list_t *instance, link_t *done) 144 { 145 assert(instance); 146 assert(done); 139 void transfer_list_remove_finished(transfer_list_t *instance) 140 { 141 assert(instance); 142 143 LIST_INITIALIZE(done); 147 144 148 145 fibril_mutex_lock(&instance->guard); … … 156 153 /* Save for post-processing */ 157 154 transfer_list_remove_batch(instance, batch); 158 list_append(current, done);155 list_append(current, &done); 159 156 } 160 157 current = next; … … 162 159 fibril_mutex_unlock(&instance->guard); 163 160 161 while (!list_empty(&done)) { 162 link_t *item = done.next; 163 list_remove(item); 164 usb_transfer_batch_t *batch = 165 list_get_instance(item, usb_transfer_batch_t, link); 166 batch->next_step(batch); 167 } 164 168 } 165 169 /*----------------------------------------------------------------------------*/ … … 218 222 qpos = "NOT FIRST"; 219 223 } 220 asm volatile ("": : :"memory");221 224 /* Remove from the batch list */ 222 225 list_remove(&batch->link); -
uspace/drv/uhci-hcd/transfer_list.h
r095b2017 rda3dafc 67 67 void transfer_list_add_batch(transfer_list_t *instance, usb_transfer_batch_t *batch); 68 68 69 void transfer_list_remove_finished(transfer_list_t *instance , link_t *done);69 void transfer_list_remove_finished(transfer_list_t *instance); 70 70 71 71 void transfer_list_abort_all(transfer_list_t *instance); -
uspace/drv/uhci-hcd/utils/malloc32.h
r095b2017 rda3dafc 40 40 #include <as.h> 41 41 42 #include "slab.h"43 44 42 #define UHCI_STRCUTURES_ALIGNMENT 16 45 43 #define UHCI_REQUIRED_PAGE_SIZE 4096 46 47 44 48 45 /** Get physical address translation … … 57 54 58 55 uintptr_t result; 59 const int ret = as_get_physical_mapping(addr, &result); 60 assert(ret == EOK); 56 int ret = as_get_physical_mapping(addr, &result); 61 57 62 58 if (ret != EOK) … … 70 66 * @return Address of the alligned and big enough memory place, NULL on failure. 71 67 */ 72 static inline void * malloc32(size_t size) { 73 if (size <= SLAB_ELEMENT_SIZE) 74 return slab_malloc_g(); 75 assert(false); 76 return memalign(UHCI_STRCUTURES_ALIGNMENT, size); 77 } 68 static inline void * malloc32(size_t size) 69 { return memalign(UHCI_STRCUTURES_ALIGNMENT, size); } 78 70 /*----------------------------------------------------------------------------*/ 79 71 /** Physical mallocator simulator … … 81 73 * @param[in] addr Address of the place allocated by malloc32 82 74 */ 83 static inline void free32(void *addr) { 84 if (!addr) 85 return; 86 if (slab_in_range_g(addr)) 87 return slab_free_g(addr); 88 free(addr); 89 } 75 static inline void free32(void *addr) 76 { if (addr) free(addr); } 90 77 /*----------------------------------------------------------------------------*/ 91 78 /** Create 4KB page mapping … … 95 82 static inline void * get_page(void) 96 83 { 97 void * free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);98 assert(free_address); /* TODO: remove this assert */84 void * free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE); 85 assert(free_address); 99 86 if (free_address == 0) 100 87 return NULL; 101 void *ret = as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE, 88 void* ret = 89 as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE, 102 90 AS_AREA_READ | AS_AREA_WRITE); 103 91 if (ret != free_address) -
uspace/lib/c/generic/malloc.c
r095b2017 rda3dafc 240 240 size_t asize = ALIGN_UP(size, PAGE_SIZE); 241 241 242 astart = as_area_create(astart, asize, AS_AREA_WRITE | AS_AREA_READ | AS_AREA_CACHEABLE);242 astart = as_area_create(astart, asize, AS_AREA_WRITE | AS_AREA_READ); 243 243 if (astart == (void *) -1) 244 244 return false; -
uspace/lib/usb/include/usb/host/device_keeper.h
r095b2017 rda3dafc 51 51 usb_speed_t speed; 52 52 bool occupied; 53 bool control_used;54 53 uint16_t toggle_status[2]; 55 54 devman_handle_t handle; … … 62 61 struct usb_device_info devices[USB_ADDRESS_COUNT]; 63 62 fibril_mutex_t guard; 64 fibril_condvar_t change;63 fibril_condvar_t default_address_occupied; 65 64 usb_address_t last_address; 66 65 } usb_device_keeper_t; … … 98 97 usb_address_t address); 99 98 100 void usb_device_keeper_use_control(usb_device_keeper_t *instance,101 usb_address_t address);102 103 void usb_device_keeper_release_control(usb_device_keeper_t *instance,104 usb_address_t address);105 106 99 #endif 107 100 /** -
uspace/lib/usb/src/host/device_keeper.c
r095b2017 rda3dafc 49 49 assert(instance); 50 50 fibril_mutex_initialize(&instance->guard); 51 fibril_condvar_initialize(&instance-> change);51 fibril_condvar_initialize(&instance->default_address_occupied); 52 52 instance->last_address = 0; 53 53 unsigned i = 0; 54 54 for (; i < USB_ADDRESS_COUNT; ++i) { 55 55 instance->devices[i].occupied = false; 56 instance->devices[i].control_used = false;57 56 instance->devices[i].handle = 0; 58 57 instance->devices[i].toggle_status[0] = 0; … … 72 71 fibril_mutex_lock(&instance->guard); 73 72 while (instance->devices[USB_ADDRESS_DEFAULT].occupied) { 74 fibril_condvar_wait(&instance->change, &instance->guard); 73 fibril_condvar_wait(&instance->default_address_occupied, 74 &instance->guard); 75 75 } 76 76 instance->devices[USB_ADDRESS_DEFAULT].occupied = true; … … 90 90 instance->devices[USB_ADDRESS_DEFAULT].occupied = false; 91 91 fibril_mutex_unlock(&instance->guard); 92 fibril_condvar_signal(&instance-> change);92 fibril_condvar_signal(&instance->default_address_occupied); 93 93 } 94 94 /*----------------------------------------------------------------------------*/ … … 309 309 return instance->devices[address].speed; 310 310 } 311 /*----------------------------------------------------------------------------*/ 312 void usb_device_keeper_use_control(usb_device_keeper_t *instance, 313 usb_address_t address) 314 { 315 assert(instance); 316 fibril_mutex_lock(&instance->guard); 317 while (instance->devices[address].control_used) { 318 fibril_condvar_wait(&instance->change, &instance->guard); 319 } 320 instance->devices[address].control_used = true; 321 fibril_mutex_unlock(&instance->guard); 322 } 323 /*----------------------------------------------------------------------------*/ 324 void usb_device_keeper_release_control(usb_device_keeper_t *instance, 325 usb_address_t address) 326 { 327 assert(instance); 328 fibril_mutex_lock(&instance->guard); 329 instance->devices[address].control_used = false; 330 fibril_mutex_unlock(&instance->guard); 331 fibril_condvar_signal(&instance->change); 332 } 311 333 312 /** 334 313 * @}
Note:
See TracChangeset
for help on using the changeset viewer.