For HCs that have local memory, replace the current DMA API usage with a genalloc generic allocator to manage the mappings for these devices. To help users, introduce a new HCD API, usb_hcd_setup_local_mem() that will setup up the genalloc backing up the device local memory. It will be used in subsequent patches. This is in preparation for dropping the existing "coherent" dma mem declaration APIs. The current implementation was relying on a short circuit in the DMA API that in the end, was acting as an allocator for these type of devices.
Showing the changes to include/linux (1 of 7 files). Show all
Unified · Split
| @@ -216,6 +216,9 @@ struct usb_hcd { · 215 unmodified lines | |||
| 216 | #define HC_IS_RUNNING(state) ((state) & __ACTIVE) | 216 | #define HC_IS_RUNNING(state) ((state) & __ACTIVE) |
| 217 | #define HC_IS_SUSPENDED(state) ((state) & __SUSPEND) | 217 | #define HC_IS_SUSPENDED(state) ((state) & __SUSPEND) |
| 218 | 218 | ||
| 219 | /* memory pool for HCs having local memory, or %NULL */ | ||
| 220 | struct gen_pool *localmem_pool; | ||
| 221 | |||
| 219 | /* more shared queuing code would be good; it should support | 222 | /* more shared queuing code would be good; it should support |
| 220 | * smarter scheduling, handle transaction translators, etc; | 223 | * smarter scheduling, handle transaction translators, etc; |
| 221 | * input size of periodic table to an interrupt scheduler. | 224 | * input size of periodic table to an interrupt scheduler. |
| @@ -461,6 +464,8 @@ extern int usb_add_hcd(struct usb_hcd *hcd, · 239 unmodified lines | |||
| 461 | unsigned int irqnum, unsigned long irqflags); | 464 | unsigned int irqnum, unsigned long irqflags); |
| 462 | extern void usb_remove_hcd(struct usb_hcd *hcd); | 465 | extern void usb_remove_hcd(struct usb_hcd *hcd); |
| 463 | extern int usb_hcd_find_raw_port_number(struct usb_hcd *hcd, int port1); | 466 | extern int usb_hcd_find_raw_port_number(struct usb_hcd *hcd, int port1); |
| 467 | int usb_hcd_setup_local_mem(struct usb_hcd *hcd, phys_addr_t phys_addr, | ||
| 468 | dma_addr_t dma, size_t size); | ||
| 464 | 469 | ||
| 465 | struct platform_device; | 470 | struct platform_device; |
| 466 | extern void usb_hcd_platform_shutdown(struct platform_device *dev); | 471 | extern void usb_hcd_platform_shutdown(struct platform_device *dev); |