Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95861
b: refs/heads/master
c: ccc3402
h: refs/heads/master
i:
  95859: 3d91ec3
v: v3
  • Loading branch information
David S. Miller committed May 2, 2008
1 parent 3607d85 commit d5d9305
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 111 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: 2678fefedbbc03a3ae6f5c254791bf147d6c52fd
refs/heads/master: ccc34028d46230f715eeda4c8cce27e919934fad
2 changes: 1 addition & 1 deletion trunk/arch/sparc/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int prom_probe_memory (void)
register int i;

i = 0;
mlist= *prom_meminfo()->v0_available;
mlist= prom_meminfo();
bytes = tally = mlist->num_bytes;
base_paddr = (unsigned long) mlist->start_adr;

Expand Down
103 changes: 4 additions & 99 deletions trunk/arch/sparc/prom/memory.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* $Id: memory.c,v 1.15 2000/01/29 01:09:12 anton Exp $
* memory.c: Prom routine for acquiring various bits of information
/* memory.c: Prom routine for acquiring various bits of information
* about RAM on the machine, both virtual and physical.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
Expand All @@ -22,19 +21,9 @@
*/

struct linux_prom_registers prom_reg_memlist[64];
struct linux_prom_registers prom_reg_tmp[64];

struct linux_mlist_v0 prom_phys_total[64];
struct linux_mlist_v0 prom_prom_taken[64];
struct linux_mlist_v0 prom_phys_avail[64];

struct linux_mlist_v0 *prom_ptot_ptr = prom_phys_total;
struct linux_mlist_v0 *prom_ptak_ptr = prom_prom_taken;
struct linux_mlist_v0 *prom_pavl_ptr = prom_phys_avail;

struct linux_mem_v0 prom_memlist;


/* Internal Prom library routine to sort a linux_mlist_v0 memory
* list. Used below in initialization.
*/
Expand Down Expand Up @@ -77,33 +66,13 @@ void __init prom_meminit(void)
switch(prom_vers) {
case PROM_V0:
/* Nice, kind of easier to do in this case. */
/* First, the total physical descriptors. */
for(mptr = (*(romvec->pv_v0mem.v0_totphys)), iter=0;
mptr; mptr=mptr->theres_more, iter++) {
prom_phys_total[iter].start_adr = mptr->start_adr;
prom_phys_total[iter].num_bytes = mptr->num_bytes;
prom_phys_total[iter].theres_more = &prom_phys_total[iter+1];
}
prom_phys_total[iter-1].theres_more = NULL;
/* Second, the total prom taken descriptors. */
for(mptr = (*(romvec->pv_v0mem.v0_prommap)), iter=0;
mptr; mptr=mptr->theres_more, iter++) {
prom_prom_taken[iter].start_adr = mptr->start_adr;
prom_prom_taken[iter].num_bytes = mptr->num_bytes;
prom_prom_taken[iter].theres_more = &prom_prom_taken[iter+1];
}
prom_prom_taken[iter-1].theres_more = NULL;
/* Last, the available physical descriptors. */
for(mptr = (*(romvec->pv_v0mem.v0_available)), iter=0;
mptr; mptr=mptr->theres_more, iter++) {
prom_phys_avail[iter].start_adr = mptr->start_adr;
prom_phys_avail[iter].num_bytes = mptr->num_bytes;
prom_phys_avail[iter].theres_more = &prom_phys_avail[iter+1];
}
prom_phys_avail[iter-1].theres_more = NULL;
/* Sort all the lists. */
prom_sortmemlist(prom_phys_total);
prom_sortmemlist(prom_prom_taken);
prom_sortmemlist(prom_phys_avail);
break;
case PROM_V2:
Expand All @@ -124,69 +93,12 @@ void __init prom_meminit(void)
&prom_phys_avail[iter+1];
}
prom_phys_avail[iter-1].theres_more = NULL;

num_regs = prom_getproperty(node, "reg",
(char *) prom_reg_memlist,
sizeof(prom_reg_memlist));
num_regs = (num_regs/sizeof(struct linux_prom_registers));
for(iter=0; iter<num_regs; iter++) {
prom_phys_total[iter].start_adr =
(char *) prom_reg_memlist[iter].phys_addr;
prom_phys_total[iter].num_bytes =
(unsigned long) prom_reg_memlist[iter].reg_size;
prom_phys_total[iter].theres_more =
&prom_phys_total[iter+1];
}
prom_phys_total[iter-1].theres_more = NULL;

node = prom_getchild(prom_root_node);
node = prom_searchsiblings(node, "virtual-memory");
num_regs = prom_getproperty(node, "available",
(char *) prom_reg_memlist,
sizeof(prom_reg_memlist));
num_regs = (num_regs/sizeof(struct linux_prom_registers));

/* Convert available virtual areas to taken virtual
* areas. First sort, then convert.
*/
for(iter=0; iter<num_regs; iter++) {
prom_prom_taken[iter].start_adr =
(char *) prom_reg_memlist[iter].phys_addr;
prom_prom_taken[iter].num_bytes =
(unsigned long) prom_reg_memlist[iter].reg_size;
prom_prom_taken[iter].theres_more =
&prom_prom_taken[iter+1];
}
prom_prom_taken[iter-1].theres_more = NULL;

prom_sortmemlist(prom_prom_taken);

/* Finally, convert. */
for(iter=0; iter<num_regs; iter++) {
prom_prom_taken[iter].start_adr =
prom_prom_taken[iter].start_adr +
prom_prom_taken[iter].num_bytes;
prom_prom_taken[iter].num_bytes =
prom_prom_taken[iter+1].start_adr -
prom_prom_taken[iter].start_adr;
}
prom_prom_taken[iter-1].num_bytes =
0xffffffff - (unsigned long) prom_prom_taken[iter-1].start_adr;

/* Sort the other two lists. */
prom_sortmemlist(prom_phys_total);
prom_sortmemlist(prom_phys_avail);
break;

case PROM_SUN4:
#ifdef CONFIG_SUN4
/* how simple :) */
prom_phys_total[0].start_adr = NULL;
prom_phys_total[0].num_bytes = *(sun4_romvec->memorysize);
prom_phys_total[0].theres_more = NULL;
prom_prom_taken[0].start_adr = NULL;
prom_prom_taken[0].num_bytes = 0x0;
prom_prom_taken[0].theres_more = NULL;
prom_phys_avail[0].start_adr = NULL;
prom_phys_avail[0].num_bytes = *(sun4_romvec->memoryavail);
prom_phys_avail[0].theres_more = NULL;
Expand All @@ -196,20 +108,13 @@ void __init prom_meminit(void)
default:
break;
};

/* Link all the lists into the top-level descriptor. */
prom_memlist.v0_totphys=&prom_ptot_ptr;
prom_memlist.v0_prommap=&prom_ptak_ptr;
prom_memlist.v0_available=&prom_pavl_ptr;

return;
}

/* This returns a pointer to our libraries internal v0 format
* memory descriptor.
* available memory list.
*/
struct linux_mem_v0 *
struct linux_mlist_v0 *
prom_meminfo(void)
{
return &prom_memlist;
return prom_phys_avail;
}
13 changes: 3 additions & 10 deletions trunk/include/asm-sparc/oplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,10 @@ extern void prom_seek(int device_handle, unsigned int seek_hival,

/* Machine memory configuration routine. */

/* This function returns a V0 format memory descriptor table, it has three
* entries. One for the total amount of physical ram on the machine, one
* for the amount of physical ram available, and one describing the virtual
* areas which are allocated by the prom. So, in a sense the physical
* available is a calculation of the total physical minus the physical mapped
* by the prom with virtual mappings.
*
* These lists are returned pre-sorted, this should make your life easier
* since the prom itself is way too lazy to do such nice things.
/* This function returns a V0 format available memory descriptor entry.
* This list is pre-sorted,
*/
extern struct linux_mem_v0 *prom_meminfo(void);
extern struct linux_mlist_v0 *prom_meminfo(void);

/* Miscellaneous routines, don't really fit in any category per se. */

Expand Down

0 comments on commit d5d9305

Please sign in to comment.