diff mbox

[RFC,v0,04/15] ppc: Make creation of DRC entries in FDT endian safe

Message ID 1409810785-12391-5-git-send-email-bharata@linux.vnet.ibm.com
State New
Headers show

Commit Message

Bharata B Rao Sept. 4, 2014, 6:06 a.m. UTC
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
 hw/ppc/spapr.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 29b7de4..bdbda1f 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -397,10 +397,10 @@  static void spapr_create_drc_dt_entries(void *fdt)
 
     /* ibm,drc-indexes */
     memset(int_buf, 0, sizeof(int_buf));
-    int_buf[0] = SPAPR_DRC_PHB_TABLE_SIZE;
+    int_buf[0] = cpu_to_be32(SPAPR_DRC_PHB_TABLE_SIZE);
 
     for (i = 1; i <= SPAPR_DRC_PHB_TABLE_SIZE; i++) {
-        int_buf[i] = spapr->drc_table[i-1].drc_index;
+        int_buf[i] = cpu_to_be32(spapr->drc_table[i-1].drc_index);
     }
 
     ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-indexes", int_buf,
@@ -411,10 +411,10 @@  static void spapr_create_drc_dt_entries(void *fdt)
 
     /* ibm,drc-power-domains */
     memset(int_buf, 0, sizeof(int_buf));
-    int_buf[0] = SPAPR_DRC_PHB_TABLE_SIZE;
+    int_buf[0] = cpu_to_be32(SPAPR_DRC_PHB_TABLE_SIZE);
 
     for (i = 1; i <= SPAPR_DRC_PHB_TABLE_SIZE; i++) {
-        int_buf[i] = 0xffffffff;
+        int_buf[i] = cpu_to_be32(0xffffffff);
     }
 
     ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-power-domains", int_buf,
@@ -426,7 +426,7 @@  static void spapr_create_drc_dt_entries(void *fdt)
     /* ibm,drc-names */
     memset(char_buf, 0, sizeof(char_buf));
     entries = (uint32_t *)&char_buf[0];
-    *entries = SPAPR_DRC_PHB_TABLE_SIZE;
+    *entries = cpu_to_be32(SPAPR_DRC_PHB_TABLE_SIZE);
     offset = sizeof(*entries);
 
     for (i = 0; i < SPAPR_DRC_PHB_TABLE_SIZE; i++) {
@@ -442,7 +442,7 @@  static void spapr_create_drc_dt_entries(void *fdt)
     /* ibm,drc-types */
     memset(char_buf, 0, sizeof(char_buf));
     entries = (uint32_t *)&char_buf[0];
-    *entries = SPAPR_DRC_PHB_TABLE_SIZE;
+    *entries = cpu_to_be32(SPAPR_DRC_PHB_TABLE_SIZE);
     offset = sizeof(*entries);
 
     for (i = 0; i < SPAPR_DRC_PHB_TABLE_SIZE; i++) {