Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91970
b: refs/heads/master
c: 4a28333
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Apr 24, 2008
1 parent 3baae2f commit dba7b2f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ad072004ca35a9918964ca7aee2bf00d79c8657f
refs/heads/master: 4a28333984be123d9c063df23175c48749c4b4a0
28 changes: 16 additions & 12 deletions trunk/arch/sparc64/kernel/mdesc.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* mdesc.c: Sun4V machine description handling.
*
* Copyright (C) 2007 David S. Miller <davem@davemloft.net>
* Copyright (C) 2007, 2008 David S. Miller <davem@davemloft.net>
*/
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/bootmem.h>
#include <linux/lmb.h>
#include <linux/log2.h>
#include <linux/list.h>
#include <linux/slab.h>
Expand Down Expand Up @@ -84,24 +84,28 @@ static void mdesc_handle_init(struct mdesc_handle *hp,
hp->handle_size = handle_size;
}

static struct mdesc_handle * __init mdesc_bootmem_alloc(unsigned int mdesc_size)
static struct mdesc_handle * __init mdesc_lmb_alloc(unsigned int mdesc_size)
{
struct mdesc_handle *hp;
unsigned int handle_size, alloc_size;
struct mdesc_handle *hp;
unsigned long paddr;

handle_size = (sizeof(struct mdesc_handle) -
sizeof(struct mdesc_hdr) +
mdesc_size);
alloc_size = PAGE_ALIGN(handle_size);

hp = __alloc_bootmem(alloc_size, PAGE_SIZE, 0UL);
if (hp)
mdesc_handle_init(hp, handle_size, hp);
paddr = lmb_alloc(alloc_size, PAGE_SIZE);

hp = NULL;
if (paddr) {
hp = __va(paddr);
mdesc_handle_init(hp, handle_size, hp);
}
return hp;
}

static void mdesc_bootmem_free(struct mdesc_handle *hp)
static void mdesc_lmb_free(struct mdesc_handle *hp)
{
unsigned int alloc_size, handle_size = hp->handle_size;
unsigned long start, end;
Expand All @@ -124,9 +128,9 @@ static void mdesc_bootmem_free(struct mdesc_handle *hp)
}
}

static struct mdesc_mem_ops bootmem_mdesc_ops = {
.alloc = mdesc_bootmem_alloc,
.free = mdesc_bootmem_free,
static struct mdesc_mem_ops lmb_mdesc_ops = {
.alloc = mdesc_lmb_alloc,
.free = mdesc_lmb_free,
};

static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size)
Expand Down Expand Up @@ -888,7 +892,7 @@ void __init sun4v_mdesc_init(void)

printk("MDESC: Size is %lu bytes.\n", len);

hp = mdesc_alloc(len, &bootmem_mdesc_ops);
hp = mdesc_alloc(len, &lmb_mdesc_ops);
if (hp == NULL) {
prom_printf("MDESC: alloc of %lu bytes failed.\n", len);
prom_halt();
Expand Down
6 changes: 3 additions & 3 deletions trunk/arch/sparc64/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,9 @@ void __init paging_init(void)

prom_build_devicetree();

if (tlb_type == hypervisor)
sun4v_mdesc_init();

/* Setup bootmem... */
pages_avail = 0;
last_valid_pfn = end_pfn = bootmem_init(&pages_avail, phys_base);
Expand All @@ -1224,9 +1227,6 @@ void __init paging_init(void)

kernel_physical_mapping_init();

if (tlb_type == hypervisor)
sun4v_mdesc_init();

{
unsigned long zones_size[MAX_NR_ZONES];
unsigned long zholes_size[MAX_NR_ZONES];
Expand Down

0 comments on commit dba7b2f

Please sign in to comment.