~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to arch/tile/kernel/pci-dma.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
 * can count on nothing having been touched.
87
87
 */
88
88
 
 
89
/* Flush a PA range from cache page by page. */
 
90
static void __dma_map_pa_range(dma_addr_t dma_addr, size_t size)
 
91
{
 
92
        struct page *page = pfn_to_page(PFN_DOWN(dma_addr));
 
93
        size_t bytesleft = PAGE_SIZE - (dma_addr & (PAGE_SIZE - 1));
 
94
 
 
95
        while ((ssize_t)size > 0) {
 
96
                /* Flush the page. */
 
97
                homecache_flush_cache(page++, 0);
 
98
 
 
99
                /* Figure out if we need to continue on the next page. */
 
100
                size -= bytesleft;
 
101
                bytesleft = PAGE_SIZE;
 
102
        }
 
103
}
89
104
 
90
105
/*
91
106
 * dma_map_single can be passed any memory address, and there appear
97
112
dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
98
113
               enum dma_data_direction direction)
99
114
{
100
 
        struct page *page;
101
 
        dma_addr_t dma_addr;
102
 
        int thispage;
 
115
        dma_addr_t dma_addr = __pa(ptr);
103
116
 
104
117
        BUG_ON(!valid_dma_direction(direction));
105
118
        WARN_ON(size == 0);
106
119
 
107
 
        dma_addr = __pa(ptr);
108
 
 
109
 
        /* We might have been handed a buffer that wraps a page boundary */
110
 
        while ((int)size > 0) {
111
 
                /* The amount to flush that's on this page */
112
 
                thispage = PAGE_SIZE - ((unsigned long)ptr & (PAGE_SIZE - 1));
113
 
                thispage = min((int)thispage, (int)size);
114
 
                /* Is this valid for any page we could be handed? */
115
 
                page = pfn_to_page(kaddr_to_pfn(ptr));
116
 
                homecache_flush_cache(page, 0);
117
 
                ptr += thispage;
118
 
                size -= thispage;
119
 
        }
 
120
        __dma_map_pa_range(dma_addr, size);
120
121
 
121
122
        return dma_addr;
122
123
}
140
141
        WARN_ON(nents == 0 || sglist->length == 0);
141
142
 
142
143
        for_each_sg(sglist, sg, nents, i) {
143
 
                struct page *page;
144
144
                sg->dma_address = sg_phys(sg);
145
 
                page = pfn_to_page(sg->dma_address >> PAGE_SHIFT);
146
 
                homecache_flush_cache(page, 0);
 
145
                __dma_map_pa_range(sg->dma_address, sg->length);
147
146
        }
148
147
 
149
148
        return nents;
163
162
{
164
163
        BUG_ON(!valid_dma_direction(direction));
165
164
 
 
165
        BUG_ON(offset + size > PAGE_SIZE);
166
166
        homecache_flush_cache(page, 0);
167
167
 
168
168
        return page_to_pa(page) + offset;