diff options
author | Dean Nelson <dcn@sgi.com> | 2008-04-25 16:22:19 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2008-04-29 16:49:01 -0400 |
commit | e4a064dfa2b242519a9f06f9a1e58c27bf0c371b (patch) | |
tree | 671214b5b256e4b397ce321346d58a551845fe68 /arch/ia64/kernel/uncached.c | |
parent | e617fce64e5faea149fcf3bffc1b42e4ba29e7e5 (diff) |
[IA64] allocate multiple contiguous pages via uncached allocator
Enable the uncached allocator to allocate multiple pages of contiguous
uncached memory.
Signed-off-by: Dean Nelson <dcn@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/kernel/uncached.c')
-rw-r--r-- | arch/ia64/kernel/uncached.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c index 2a90c32024f4..e77995a6e3ed 100644 --- a/arch/ia64/kernel/uncached.c +++ b/arch/ia64/kernel/uncached.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2001-2006 Silicon Graphics, Inc. All rights reserved. | 2 | * Copyright (C) 2001-2008 Silicon Graphics, Inc. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of version 2 of the GNU General Public License | 5 | * under the terms of version 2 of the GNU General Public License |
@@ -177,12 +177,13 @@ failed: | |||
177 | * uncached_alloc_page | 177 | * uncached_alloc_page |
178 | * | 178 | * |
179 | * @starting_nid: node id of node to start with, or -1 | 179 | * @starting_nid: node id of node to start with, or -1 |
180 | * @n_pages: number of contiguous pages to allocate | ||
180 | * | 181 | * |
181 | * Allocate 1 uncached page. Allocates on the requested node. If no | 182 | * Allocate the specified number of contiguous uncached pages on the |
182 | * uncached pages are available on the requested node, roundrobin starting | 183 | * the requested node. If not enough contiguous uncached pages are available |
183 | * with the next higher node. | 184 | * on the requested node, roundrobin starting with the next higher node. |
184 | */ | 185 | */ |
185 | unsigned long uncached_alloc_page(int starting_nid) | 186 | unsigned long uncached_alloc_page(int starting_nid, int n_pages) |
186 | { | 187 | { |
187 | unsigned long uc_addr; | 188 | unsigned long uc_addr; |
188 | struct uncached_pool *uc_pool; | 189 | struct uncached_pool *uc_pool; |
@@ -202,7 +203,8 @@ unsigned long uncached_alloc_page(int starting_nid) | |||
202 | if (uc_pool->pool == NULL) | 203 | if (uc_pool->pool == NULL) |
203 | continue; | 204 | continue; |
204 | do { | 205 | do { |
205 | uc_addr = gen_pool_alloc(uc_pool->pool, PAGE_SIZE); | 206 | uc_addr = gen_pool_alloc(uc_pool->pool, |
207 | n_pages * PAGE_SIZE); | ||
206 | if (uc_addr != 0) | 208 | if (uc_addr != 0) |
207 | return uc_addr; | 209 | return uc_addr; |
208 | } while (uncached_add_chunk(uc_pool, nid) == 0); | 210 | } while (uncached_add_chunk(uc_pool, nid) == 0); |
@@ -217,11 +219,12 @@ EXPORT_SYMBOL(uncached_alloc_page); | |||
217 | /* | 219 | /* |
218 | * uncached_free_page | 220 | * uncached_free_page |
219 | * | 221 | * |
220 | * @uc_addr: uncached address of page to free | 222 | * @uc_addr: uncached address of first page to free |
223 | * @n_pages: number of contiguous pages to free | ||
221 | * | 224 | * |
222 | * Free a single uncached page. | 225 | * Free the specified number of uncached pages. |
223 | */ | 226 | */ |
224 | void uncached_free_page(unsigned long uc_addr) | 227 | void uncached_free_page(unsigned long uc_addr, int n_pages) |
225 | { | 228 | { |
226 | int nid = paddr_to_nid(uc_addr - __IA64_UNCACHED_OFFSET); | 229 | int nid = paddr_to_nid(uc_addr - __IA64_UNCACHED_OFFSET); |
227 | struct gen_pool *pool = uncached_pools[nid].pool; | 230 | struct gen_pool *pool = uncached_pools[nid].pool; |
@@ -232,7 +235,7 @@ void uncached_free_page(unsigned long uc_addr) | |||
232 | if ((uc_addr & (0XFUL << 60)) != __IA64_UNCACHED_OFFSET) | 235 | if ((uc_addr & (0XFUL << 60)) != __IA64_UNCACHED_OFFSET) |
233 | panic("uncached_free_page invalid address %lx\n", uc_addr); | 236 | panic("uncached_free_page invalid address %lx\n", uc_addr); |
234 | 237 | ||
235 | gen_pool_free(pool, uc_addr, PAGE_SIZE); | 238 | gen_pool_free(pool, uc_addr, n_pages * PAGE_SIZE); |
236 | } | 239 | } |
237 | EXPORT_SYMBOL(uncached_free_page); | 240 | EXPORT_SYMBOL(uncached_free_page); |
238 | 241 | ||