Changeset fb2de0a in mainline
- Timestamp:
- 2011-05-25T18:02:22Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1889786, d208f3f
- Parents:
- fcbcaae9
- Location:
- uspace/drv/uhci-hcd
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/Makefile
rfcbcaae9 rfb2de0a 48 48 root_hub.c \ 49 49 hw_struct/transfer_descriptor.c \ 50 utils/slab.c \51 50 pci.c \ 52 51 batch.c -
uspace/drv/uhci-hcd/utils/malloc32.h
rfcbcaae9 rfb2de0a 41 41 #include <as.h> 42 42 43 #include "slab.h"44 45 43 #define UHCI_STRCUTURES_ALIGNMENT 16 46 44 #define UHCI_REQUIRED_PAGE_SIZE 4096 … … 70 68 */ 71 69 static inline void * malloc32(size_t size) { 72 if (size <= SLAB_ELEMENT_SIZE) 73 return slab_malloc_g(); 74 usb_log_warning("Requested %zu bytes, current allocator can't handle " 75 "that amount, pray that the standard malloc will suffice.", size); 76 return memalign(UHCI_STRCUTURES_ALIGNMENT, size); 70 /* This works only when the host has less than 4GB of memory as 71 * physical address needs to fit into 32 bits */ 72 73 /* If we need more than one page there is no guarantee that the 74 * memory will be continuous */ 75 if (size > PAGE_SIZE) 76 return NULL; 77 /* Calculate alignment to make sure the block won't cross page 78 * boundary */ 79 size_t alignment = UHCI_STRCUTURES_ALIGNMENT; 80 while (alignment < size) 81 alignment *= 2; 82 return memalign(alignment, size); 77 83 } 78 84 /*----------------------------------------------------------------------------*/ … … 84 90 if (!addr) 85 91 return; 86 if (slab_in_range_g(addr))87 return slab_free_g(addr);88 92 free(addr); 89 93 }
Note:
See TracChangeset
for help on using the changeset viewer.