Module Name: src Committed By: skrll Date: Thu Mar 27 10:11:04 UTC 2014
Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_2835_arm.c Log Message: Remove #if 0'ed code. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.10 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.11 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c:1.10 Wed Mar 26 16:07:15 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Thu Mar 27 10:11:04 2014 @@ -251,6 +251,13 @@ typedef struct bulkinfo_struct { int size; } BULKINFO_T; +/* There is a potential problem with partial cache lines (pages?) +** at the ends of the block when reading. If the CPU accessed anything in +** the same line (page?) then it may have pulled old data into the cache, +** obscuring the new data underneath. We can solve this by transferring the +** partial cache lines separately, and allowing the ARM to copy into the +** cached area. +*/ VCHIQ_STATUS_T vchiq_prepare_bulk_data(VCHIQ_BULK_T *bulk, VCHI_MEM_HANDLE_T memhandle, void *buf, int size, int dir) @@ -554,195 +561,3 @@ vchiq_platform_handle_timeout(VCHIQ_STAT { (void)state; } -/* - * Local functions - */ - -/* There is a potential problem with partial cache lines (pages?) -** at the ends of the block when reading. If the CPU accessed anything in -** the same line (page?) then it may have pulled old data into the cache, -** obscuring the new data underneath. We can solve this by transferring the -** partial cache lines separately, and allowing the ARM to copy into the -** cached area. - -** N.B. This implementation plays slightly fast and loose with the Linux -** driver programming rules, e.g. its use of __virt_to_bus instead of -** dma_map_single, but it isn't a multi-platform driver and it benefits -** from increased speed as a result. -*/ - -#if 0 -static int -create_pagelist(char __user *buf, size_t count, unsigned short type, - struct task_struct *task, PAGELIST_T ** ppagelist) -{ - PAGELIST_T *pagelist; - struct page **pages; - struct page *page; - unsigned long *addrs; - unsigned int num_pages, offset, i; - char *addr, *base_addr, *next_addr; - int run, addridx, actual_pages; - - offset = (unsigned int)buf & (PAGE_SIZE - 1); - num_pages = (count + offset + PAGE_SIZE - 1) / PAGE_SIZE; - - *ppagelist = NULL; - - /* Allocate enough storage to hold the page pointers and the page - ** list - */ - pagelist = kmalloc(sizeof(PAGELIST_T) + - (num_pages * sizeof(unsigned long)) + - (num_pages * sizeof(pages[0])), - GFP_KERNEL); - - vchiq_log_trace(vchiq_arm_log_level, - "create_pagelist - %x", (unsigned int)pagelist); - if (!pagelist) - return -ENOMEM; - - addrs = pagelist->addrs; - pages = (struct page **)(addrs + num_pages); - - down_read(&task->mm->mmap_sem); - actual_pages = get_user_pages(task, task->mm, - (unsigned long)buf & ~(PAGE_SIZE - 1), num_pages, - (type == PAGELIST_READ) /*Write */ , 0 /*Force */ , - pages, NULL /*vmas */); - up_read(&task->mm->mmap_sem); - - if (actual_pages != num_pages) - { - /* This is probably due to the process being killed */ - while (actual_pages > 0) - { - actual_pages--; - page_cache_release(pages[actual_pages]); - } - kfree(pagelist); - if (actual_pages == 0) - actual_pages = -ENOMEM; - return actual_pages; - } - - pagelist->length = count; - pagelist->type = type; - pagelist->offset = offset; - - /* Group the pages into runs of contiguous pages */ - - base_addr = VCHIQ_ARM_ADDRESS(page_address(pages[0])); - next_addr = base_addr + PAGE_SIZE; - addridx = 0; - run = 0; - - for (i = 1; i < num_pages; i++) { - addr = VCHIQ_ARM_ADDRESS(page_address(pages[i])); - if ((addr == next_addr) && (run < (PAGE_SIZE - 1))) { - next_addr += PAGE_SIZE; - run++; - } else { - addrs[addridx] = (unsigned long)base_addr + run; - addridx++; - base_addr = addr; - next_addr = addr + PAGE_SIZE; - run = 0; - } - } - - addrs[addridx] = (unsigned long)base_addr + run; - addridx++; - - /* Partial cache lines (fragments) require special measures */ - if ((type == PAGELIST_READ) && - ((pagelist->offset & (CACHE_LINE_SIZE - 1)) || - ((pagelist->offset + pagelist->length) & - (CACHE_LINE_SIZE - 1)))) { - FRAGMENTS_T *fragments; - - if (down_interruptible(&g_free_fragments_sema) != 0) { - kfree(pagelist); - return -EINTR; - } - - WARN_ON(g_free_fragments == NULL); - - down(&g_free_fragments_mutex); - fragments = (FRAGMENTS_T *) g_free_fragments; - WARN_ON(fragments == NULL); - g_free_fragments = *(FRAGMENTS_T **) g_free_fragments; - up(&g_free_fragments_mutex); - pagelist->type = - PAGELIST_READ_WITH_FRAGMENTS + (fragments - - g_fragments_base); - } - - for (page = virt_to_page(pagelist); - page <= virt_to_page(addrs + num_pages - 1); page++) { - flush_dcache_page(page); - } - - *ppagelist = pagelist; - - return 0; -} - -static void -free_pagelist(PAGELIST_T *pagelist, int actual) -{ - struct page **pages; - unsigned int num_pages, i; - - vchiq_log_trace(vchiq_arm_log_level, - "free_pagelist - %x, %d", (unsigned int)pagelist, actual); - - num_pages = - (pagelist->length + pagelist->offset + PAGE_SIZE - 1) / - PAGE_SIZE; - - pages = (struct page **)(pagelist->addrs + num_pages); - - /* Deal with any partial cache lines (fragments) */ - if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS) { - FRAGMENTS_T *fragments = g_fragments_base + - (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS); - int head_bytes, tail_bytes; - head_bytes = (CACHE_LINE_SIZE - pagelist->offset) & - (CACHE_LINE_SIZE - 1); - tail_bytes = (pagelist->offset + actual) & - (CACHE_LINE_SIZE - 1); - - if ((actual >= 0) && (head_bytes != 0)) { - if (head_bytes > actual) - head_bytes = actual; - - memcpy((char *)page_address(pages[0]) + - pagelist->offset, - fragments->headbuf, - head_bytes); - } - if ((actual >= 0) && (head_bytes < actual) && - (tail_bytes != 0)) { - memcpy((char *)page_address(pages[num_pages - 1]) + - ((pagelist->offset + actual) & - (PAGE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1)), - fragments->tailbuf, tail_bytes); - } - - down(&g_free_fragments_mutex); - *(FRAGMENTS_T **) fragments = g_free_fragments; - g_free_fragments = fragments; - up(&g_free_fragments_mutex); - up(&g_free_fragments_sema); - } - - for (i = 0; i < num_pages; i++) { - if (pagelist->type != PAGELIST_WRITE) - set_page_dirty(pages[i]); - page_cache_release(pages[i]); - } - - kfree(pagelist); -} -#endif