diff options
author | David S. Miller <davem@davemloft.net> | 2008-02-13 22:22:23 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-24 02:32:12 -0400 |
commit | 4a28333984be123d9c063df23175c48749c4b4a0 (patch) | |
tree | fd463dad09c9578b9762cddd508cdae73c0d45c3 /arch/sparc64/kernel/mdesc.c | |
parent | ad072004ca35a9918964ca7aee2bf00d79c8657f (diff) |
[SPARC64]: Initialize MDESC earlier and use lmb_alloc()
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/mdesc.c')
-rw-r--r-- | arch/sparc64/kernel/mdesc.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc64/kernel/mdesc.c index 910083589569..dde52bcf5c64 100644 --- a/arch/sparc64/kernel/mdesc.c +++ b/arch/sparc64/kernel/mdesc.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* mdesc.c: Sun4V machine description handling. | 1 | /* mdesc.c: Sun4V machine description handling. |
2 | * | 2 | * |
3 | * Copyright (C) 2007 David S. Miller <davem@davemloft.net> | 3 | * Copyright (C) 2007, 2008 David S. Miller <davem@davemloft.net> |
4 | */ | 4 | */ |
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | #include <linux/bootmem.h> | 7 | #include <linux/lmb.h> |
8 | #include <linux/log2.h> | 8 | #include <linux/log2.h> |
9 | #include <linux/list.h> | 9 | #include <linux/list.h> |
10 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
@@ -84,24 +84,28 @@ static void mdesc_handle_init(struct mdesc_handle *hp, | |||
84 | hp->handle_size = handle_size; | 84 | hp->handle_size = handle_size; |
85 | } | 85 | } |
86 | 86 | ||
87 | static struct mdesc_handle * __init mdesc_bootmem_alloc(unsigned int mdesc_size) | 87 | static struct mdesc_handle * __init mdesc_lmb_alloc(unsigned int mdesc_size) |
88 | { | 88 | { |
89 | struct mdesc_handle *hp; | ||
90 | unsigned int handle_size, alloc_size; | 89 | unsigned int handle_size, alloc_size; |
90 | struct mdesc_handle *hp; | ||
91 | unsigned long paddr; | ||
91 | 92 | ||
92 | handle_size = (sizeof(struct mdesc_handle) - | 93 | handle_size = (sizeof(struct mdesc_handle) - |
93 | sizeof(struct mdesc_hdr) + | 94 | sizeof(struct mdesc_hdr) + |
94 | mdesc_size); | 95 | mdesc_size); |
95 | alloc_size = PAGE_ALIGN(handle_size); | 96 | alloc_size = PAGE_ALIGN(handle_size); |
96 | 97 | ||
97 | hp = __alloc_bootmem(alloc_size, PAGE_SIZE, 0UL); | 98 | paddr = lmb_alloc(alloc_size, PAGE_SIZE); |
98 | if (hp) | ||
99 | mdesc_handle_init(hp, handle_size, hp); | ||
100 | 99 | ||
100 | hp = NULL; | ||
101 | if (paddr) { | ||
102 | hp = __va(paddr); | ||
103 | mdesc_handle_init(hp, handle_size, hp); | ||
104 | } | ||
101 | return hp; | 105 | return hp; |
102 | } | 106 | } |
103 | 107 | ||
104 | static void mdesc_bootmem_free(struct mdesc_handle *hp) | 108 | static void mdesc_lmb_free(struct mdesc_handle *hp) |
105 | { | 109 | { |
106 | unsigned int alloc_size, handle_size = hp->handle_size; | 110 | unsigned int alloc_size, handle_size = hp->handle_size; |
107 | unsigned long start, end; | 111 | unsigned long start, end; |
@@ -124,9 +128,9 @@ static void mdesc_bootmem_free(struct mdesc_handle *hp) | |||
124 | } | 128 | } |
125 | } | 129 | } |
126 | 130 | ||
127 | static struct mdesc_mem_ops bootmem_mdesc_ops = { | 131 | static struct mdesc_mem_ops lmb_mdesc_ops = { |
128 | .alloc = mdesc_bootmem_alloc, | 132 | .alloc = mdesc_lmb_alloc, |
129 | .free = mdesc_bootmem_free, | 133 | .free = mdesc_lmb_free, |
130 | }; | 134 | }; |
131 | 135 | ||
132 | static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size) | 136 | static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size) |
@@ -888,7 +892,7 @@ void __init sun4v_mdesc_init(void) | |||
888 | 892 | ||
889 | printk("MDESC: Size is %lu bytes.\n", len); | 893 | printk("MDESC: Size is %lu bytes.\n", len); |
890 | 894 | ||
891 | hp = mdesc_alloc(len, &bootmem_mdesc_ops); | 895 | hp = mdesc_alloc(len, &lmb_mdesc_ops); |
892 | if (hp == NULL) { | 896 | if (hp == NULL) { |
893 | prom_printf("MDESC: alloc of %lu bytes failed.\n", len); | 897 | prom_printf("MDESC: alloc of %lu bytes failed.\n", len); |
894 | prom_halt(); | 898 | prom_halt(); |