Commit 2c777215 authored by Nathan Fontenot's avatar Nathan Fontenot Committed by Michael Ellerman

powerpc: Move of_drconf_cell struct to asm/drmem.h

Now that the powerpc code parses dynamic reconfiguration memory
LMB information from the LMB array and not the device tree
directly we can move the of_drconf_cell struct to drmem.h where
it fits better.

In addition, the struct is renamed to of_drconf_cell_v1 in
anticipation of upcoming support for version 2 of the dynamic
reconfiguration property and the members are typed as __be*
values to reflect how they exist in the device tree.
Signed-off-by: default avatarNathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 6195a500
...@@ -35,6 +35,25 @@ extern struct drmem_lmb_info *drmem_info; ...@@ -35,6 +35,25 @@ extern struct drmem_lmb_info *drmem_info;
&drmem_info->lmbs[0], \ &drmem_info->lmbs[0], \
&drmem_info->lmbs[drmem_info->n_lmbs - 1]) &drmem_info->lmbs[drmem_info->n_lmbs - 1])
/*
* The of_drconf_cell_v1 struct defines the layout of the LMB data
* specified in the ibm,dynamic-memory device tree property.
* The property itself is a 32-bit value specifying the number of
* LMBs followed by an array of of_drconf_cell_v1 entries, one
* per LMB.
*/
struct of_drconf_cell_v1 {
__be64 base_addr;
__be32 drc_index;
__be32 reserved;
__be32 aa_index;
__be32 flags;
};
#define DRCONF_MEM_ASSIGNED 0x00000008
#define DRCONF_MEM_AI_INVALID 0x00000040
#define DRCONF_MEM_RESERVED 0x00000080
static inline u32 drmem_lmb_size(void) static inline u32 drmem_lmb_size(void)
{ {
return drmem_info->lmb_size; return drmem_info->lmb_size;
......
...@@ -80,22 +80,6 @@ extern void of_instantiate_rtc(void); ...@@ -80,22 +80,6 @@ extern void of_instantiate_rtc(void);
extern int of_get_ibm_chip_id(struct device_node *np); extern int of_get_ibm_chip_id(struct device_node *np);
/* The of_drconf_cell struct defines the layout of the LMB array
* specified in the device tree property
* ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory
*/
struct of_drconf_cell {
u64 base_addr;
u32 drc_index;
u32 reserved;
u32 aa_index;
u32 flags;
};
#define DRCONF_MEM_ASSIGNED 0x00000008
#define DRCONF_MEM_AI_INVALID 0x00000040
#define DRCONF_MEM_RESERVED 0x00000080
/* /*
* There are two methods for telling firmware what our capabilities are. * There are two methods for telling firmware what our capabilities are.
* Newer machines have an "ibm,client-architecture-support" method on the * Newer machines have an "ibm,client-architecture-support" method on the
......
...@@ -66,7 +66,7 @@ static int drmem_update_dt_v1(struct device_node *memory, ...@@ -66,7 +66,7 @@ static int drmem_update_dt_v1(struct device_node *memory,
struct property *prop) struct property *prop)
{ {
struct property *new_prop; struct property *new_prop;
struct of_drconf_cell *dr_cell; struct of_drconf_cell_v1 *dr_cell;
struct drmem_lmb *lmb; struct drmem_lmb *lmb;
u32 *p; u32 *p;
...@@ -77,7 +77,7 @@ static int drmem_update_dt_v1(struct device_node *memory, ...@@ -77,7 +77,7 @@ static int drmem_update_dt_v1(struct device_node *memory,
p = new_prop->value; p = new_prop->value;
*p++ = cpu_to_be32(drmem_info->n_lmbs); *p++ = cpu_to_be32(drmem_info->n_lmbs);
dr_cell = (struct of_drconf_cell *)p; dr_cell = (struct of_drconf_cell_v1 *)p;
for_each_drmem_lmb(lmb) { for_each_drmem_lmb(lmb) {
dr_cell->base_addr = cpu_to_be64(lmb->base_addr); dr_cell->base_addr = cpu_to_be64(lmb->base_addr);
......
...@@ -996,7 +996,7 @@ static int pseries_add_mem_node(struct device_node *np) ...@@ -996,7 +996,7 @@ static int pseries_add_mem_node(struct device_node *np)
static int pseries_update_drconf_memory(struct of_reconfig_data *pr) static int pseries_update_drconf_memory(struct of_reconfig_data *pr)
{ {
struct of_drconf_cell *new_drmem, *old_drmem; struct of_drconf_cell_v1 *new_drmem, *old_drmem;
unsigned long memblock_size; unsigned long memblock_size;
u32 entries; u32 entries;
__be32 *p; __be32 *p;
...@@ -1019,11 +1019,11 @@ static int pseries_update_drconf_memory(struct of_reconfig_data *pr) ...@@ -1019,11 +1019,11 @@ static int pseries_update_drconf_memory(struct of_reconfig_data *pr)
* of_drconf_cell's. * of_drconf_cell's.
*/ */
entries = be32_to_cpu(*p++); entries = be32_to_cpu(*p++);
old_drmem = (struct of_drconf_cell *)p; old_drmem = (struct of_drconf_cell_v1 *)p;
p = (__be32 *)pr->prop->value; p = (__be32 *)pr->prop->value;
p++; p++;
new_drmem = (struct of_drconf_cell *)p; new_drmem = (struct of_drconf_cell_v1 *)p;
for (i = 0; i < entries; i++) { for (i = 0; i < entries; i++) {
if ((be32_to_cpu(old_drmem[i].flags) & DRCONF_MEM_ASSIGNED) && if ((be32_to_cpu(old_drmem[i].flags) & DRCONF_MEM_ASSIGNED) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment