aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/pseries')
-rw-r--r--arch/powerpc/platforms/pseries/lparcfg.c12
-rw-r--r--arch/powerpc/platforms/pseries/msi.c28
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c46
-rw-r--r--arch/powerpc/platforms/pseries/pci.c8
4 files changed, 48 insertions, 46 deletions
diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c
index e738007eae64..c9fecf09b8fa 100644
--- a/arch/powerpc/platforms/pseries/lparcfg.c
+++ b/arch/powerpc/platforms/pseries/lparcfg.c
@@ -157,7 +157,7 @@ static void parse_ppp_data(struct seq_file *m)
157{ 157{
158 struct hvcall_ppp_data ppp_data; 158 struct hvcall_ppp_data ppp_data;
159 struct device_node *root; 159 struct device_node *root;
160 const int *perf_level; 160 const __be32 *perf_level;
161 int rc; 161 int rc;
162 162
163 rc = h_get_ppp(&ppp_data); 163 rc = h_get_ppp(&ppp_data);
@@ -201,7 +201,7 @@ static void parse_ppp_data(struct seq_file *m)
201 perf_level = of_get_property(root, 201 perf_level = of_get_property(root,
202 "ibm,partition-performance-parameters-level", 202 "ibm,partition-performance-parameters-level",
203 NULL); 203 NULL);
204 if (perf_level && (*perf_level >= 1)) { 204 if (perf_level && (be32_to_cpup(perf_level) >= 1)) {
205 seq_printf(m, 205 seq_printf(m,
206 "physical_procs_allocated_to_virtualization=%d\n", 206 "physical_procs_allocated_to_virtualization=%d\n",
207 ppp_data.phys_platform_procs); 207 ppp_data.phys_platform_procs);
@@ -435,7 +435,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
435 int partition_potential_processors; 435 int partition_potential_processors;
436 int partition_active_processors; 436 int partition_active_processors;
437 struct device_node *rtas_node; 437 struct device_node *rtas_node;
438 const int *lrdrp = NULL; 438 const __be32 *lrdrp = NULL;
439 439
440 rtas_node = of_find_node_by_path("/rtas"); 440 rtas_node = of_find_node_by_path("/rtas");
441 if (rtas_node) 441 if (rtas_node)
@@ -444,7 +444,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
444 if (lrdrp == NULL) { 444 if (lrdrp == NULL) {
445 partition_potential_processors = vdso_data->processorCount; 445 partition_potential_processors = vdso_data->processorCount;
446 } else { 446 } else {
447 partition_potential_processors = *(lrdrp + 4); 447 partition_potential_processors = be32_to_cpup(lrdrp + 4);
448 } 448 }
449 of_node_put(rtas_node); 449 of_node_put(rtas_node);
450 450
@@ -654,7 +654,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
654 const char *model = ""; 654 const char *model = "";
655 const char *system_id = ""; 655 const char *system_id = "";
656 const char *tmp; 656 const char *tmp;
657 const unsigned int *lp_index_ptr; 657 const __be32 *lp_index_ptr;
658 unsigned int lp_index = 0; 658 unsigned int lp_index = 0;
659 659
660 seq_printf(m, "%s %s\n", MODULE_NAME, MODULE_VERS); 660 seq_printf(m, "%s %s\n", MODULE_NAME, MODULE_VERS);
@@ -670,7 +670,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
670 lp_index_ptr = of_get_property(rootdn, "ibm,partition-no", 670 lp_index_ptr = of_get_property(rootdn, "ibm,partition-no",
671 NULL); 671 NULL);
672 if (lp_index_ptr) 672 if (lp_index_ptr)
673 lp_index = *lp_index_ptr; 673 lp_index = be32_to_cpup(lp_index_ptr);
674 of_node_put(rootdn); 674 of_node_put(rootdn);
675 } 675 }
676 seq_printf(m, "serial_number=%s\n", system_id); 676 seq_printf(m, "serial_number=%s\n", system_id);
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 6d2f0abce6fa..0c882e83c4ce 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -130,7 +130,8 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name)
130{ 130{
131 struct device_node *dn; 131 struct device_node *dn;
132 struct pci_dn *pdn; 132 struct pci_dn *pdn;
133 const u32 *req_msi; 133 const __be32 *p;
134 u32 req_msi;
134 135
135 pdn = pci_get_pdn(pdev); 136 pdn = pci_get_pdn(pdev);
136 if (!pdn) 137 if (!pdn)
@@ -138,19 +139,20 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name)
138 139
139 dn = pdn->node; 140 dn = pdn->node;
140 141
141 req_msi = of_get_property(dn, prop_name, NULL); 142 p = of_get_property(dn, prop_name, NULL);
142 if (!req_msi) { 143 if (!p) {
143 pr_debug("rtas_msi: No %s on %s\n", prop_name, dn->full_name); 144 pr_debug("rtas_msi: No %s on %s\n", prop_name, dn->full_name);
144 return -ENOENT; 145 return -ENOENT;
145 } 146 }
146 147
147 if (*req_msi < nvec) { 148 req_msi = be32_to_cpup(p);
149 if (req_msi < nvec) {
148 pr_debug("rtas_msi: %s requests < %d MSIs\n", prop_name, nvec); 150 pr_debug("rtas_msi: %s requests < %d MSIs\n", prop_name, nvec);
149 151
150 if (*req_msi == 0) /* Be paranoid */ 152 if (req_msi == 0) /* Be paranoid */
151 return -ENOSPC; 153 return -ENOSPC;
152 154
153 return *req_msi; 155 return req_msi;
154 } 156 }
155 157
156 return 0; 158 return 0;
@@ -171,7 +173,7 @@ static int check_req_msix(struct pci_dev *pdev, int nvec)
171static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total) 173static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total)
172{ 174{
173 struct device_node *dn; 175 struct device_node *dn;
174 const u32 *p; 176 const __be32 *p;
175 177
176 dn = of_node_get(pci_device_to_OF_node(dev)); 178 dn = of_node_get(pci_device_to_OF_node(dev));
177 while (dn) { 179 while (dn) {
@@ -179,7 +181,7 @@ static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total)
179 if (p) { 181 if (p) {
180 pr_debug("rtas_msi: found prop on dn %s\n", 182 pr_debug("rtas_msi: found prop on dn %s\n",
181 dn->full_name); 183 dn->full_name);
182 *total = *p; 184 *total = be32_to_cpup(p);
183 return dn; 185 return dn;
184 } 186 }
185 187
@@ -232,13 +234,13 @@ struct msi_counts {
232static void *count_non_bridge_devices(struct device_node *dn, void *data) 234static void *count_non_bridge_devices(struct device_node *dn, void *data)
233{ 235{
234 struct msi_counts *counts = data; 236 struct msi_counts *counts = data;
235 const u32 *p; 237 const __be32 *p;
236 u32 class; 238 u32 class;
237 239
238 pr_debug("rtas_msi: counting %s\n", dn->full_name); 240 pr_debug("rtas_msi: counting %s\n", dn->full_name);
239 241
240 p = of_get_property(dn, "class-code", NULL); 242 p = of_get_property(dn, "class-code", NULL);
241 class = p ? *p : 0; 243 class = p ? be32_to_cpup(p) : 0;
242 244
243 if ((class >> 8) != PCI_CLASS_BRIDGE_PCI) 245 if ((class >> 8) != PCI_CLASS_BRIDGE_PCI)
244 counts->num_devices++; 246 counts->num_devices++;
@@ -249,7 +251,7 @@ static void *count_non_bridge_devices(struct device_node *dn, void *data)
249static void *count_spare_msis(struct device_node *dn, void *data) 251static void *count_spare_msis(struct device_node *dn, void *data)
250{ 252{
251 struct msi_counts *counts = data; 253 struct msi_counts *counts = data;
252 const u32 *p; 254 const __be32 *p;
253 int req; 255 int req;
254 256
255 if (dn == counts->requestor) 257 if (dn == counts->requestor)
@@ -260,11 +262,11 @@ static void *count_spare_msis(struct device_node *dn, void *data)
260 req = 0; 262 req = 0;
261 p = of_get_property(dn, "ibm,req#msi", NULL); 263 p = of_get_property(dn, "ibm,req#msi", NULL);
262 if (p) 264 if (p)
263 req = *p; 265 req = be32_to_cpup(p);
264 266
265 p = of_get_property(dn, "ibm,req#msi-x", NULL); 267 p = of_get_property(dn, "ibm,req#msi-x", NULL);
266 if (p) 268 if (p)
267 req = max(req, (int)*p); 269 req = max(req, (int)be32_to_cpup(p));
268 } 270 }
269 271
270 if (req < counts->quota) 272 if (req < counts->quota)
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 7bfaf58d4664..d7096f2f7751 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -43,8 +43,8 @@ static char nvram_buf[NVRW_CNT]; /* assume this is in the first 4GB */
43static DEFINE_SPINLOCK(nvram_lock); 43static DEFINE_SPINLOCK(nvram_lock);
44 44
45struct err_log_info { 45struct err_log_info {
46 int error_type; 46 __be32 error_type;
47 unsigned int seq_num; 47 __be32 seq_num;
48}; 48};
49 49
50struct nvram_os_partition { 50struct nvram_os_partition {
@@ -79,9 +79,9 @@ static const char *pseries_nvram_os_partitions[] = {
79}; 79};
80 80
81struct oops_log_info { 81struct oops_log_info {
82 u16 version; 82 __be16 version;
83 u16 report_length; 83 __be16 report_length;
84 u64 timestamp; 84 __be64 timestamp;
85} __attribute__((packed)); 85} __attribute__((packed));
86 86
87static void oops_to_nvram(struct kmsg_dumper *dumper, 87static void oops_to_nvram(struct kmsg_dumper *dumper,
@@ -291,8 +291,8 @@ int nvram_write_os_partition(struct nvram_os_partition *part, char * buff,
291 length = part->size; 291 length = part->size;
292 } 292 }
293 293
294 info.error_type = err_type; 294 info.error_type = cpu_to_be32(err_type);
295 info.seq_num = error_log_cnt; 295 info.seq_num = cpu_to_be32(error_log_cnt);
296 296
297 tmp_index = part->index; 297 tmp_index = part->index;
298 298
@@ -364,8 +364,8 @@ int nvram_read_partition(struct nvram_os_partition *part, char *buff,
364 } 364 }
365 365
366 if (part->os_partition) { 366 if (part->os_partition) {
367 *error_log_cnt = info.seq_num; 367 *error_log_cnt = be32_to_cpu(info.seq_num);
368 *err_type = info.error_type; 368 *err_type = be32_to_cpu(info.error_type);
369 } 369 }
370 370
371 return 0; 371 return 0;
@@ -529,9 +529,9 @@ static int zip_oops(size_t text_len)
529 pr_err("nvram: logging uncompressed oops/panic report\n"); 529 pr_err("nvram: logging uncompressed oops/panic report\n");
530 return -1; 530 return -1;
531 } 531 }
532 oops_hdr->version = OOPS_HDR_VERSION; 532 oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
533 oops_hdr->report_length = (u16) zipped_len; 533 oops_hdr->report_length = cpu_to_be16(zipped_len);
534 oops_hdr->timestamp = get_seconds(); 534 oops_hdr->timestamp = cpu_to_be64(get_seconds());
535 return 0; 535 return 0;
536} 536}
537 537
@@ -574,9 +574,9 @@ static int nvram_pstore_write(enum pstore_type_id type,
574 clobbering_unread_rtas_event()) 574 clobbering_unread_rtas_event())
575 return -1; 575 return -1;
576 576
577 oops_hdr->version = OOPS_HDR_VERSION; 577 oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
578 oops_hdr->report_length = (u16) size; 578 oops_hdr->report_length = cpu_to_be16(size);
579 oops_hdr->timestamp = get_seconds(); 579 oops_hdr->timestamp = cpu_to_be64(get_seconds());
580 580
581 if (compressed) 581 if (compressed)
582 err_type = ERR_TYPE_KERNEL_PANIC_GZ; 582 err_type = ERR_TYPE_KERNEL_PANIC_GZ;
@@ -670,16 +670,16 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
670 size_t length, hdr_size; 670 size_t length, hdr_size;
671 671
672 oops_hdr = (struct oops_log_info *)buff; 672 oops_hdr = (struct oops_log_info *)buff;
673 if (oops_hdr->version < OOPS_HDR_VERSION) { 673 if (be16_to_cpu(oops_hdr->version) < OOPS_HDR_VERSION) {
674 /* Old format oops header had 2-byte record size */ 674 /* Old format oops header had 2-byte record size */
675 hdr_size = sizeof(u16); 675 hdr_size = sizeof(u16);
676 length = oops_hdr->version; 676 length = be16_to_cpu(oops_hdr->version);
677 time->tv_sec = 0; 677 time->tv_sec = 0;
678 time->tv_nsec = 0; 678 time->tv_nsec = 0;
679 } else { 679 } else {
680 hdr_size = sizeof(*oops_hdr); 680 hdr_size = sizeof(*oops_hdr);
681 length = oops_hdr->report_length; 681 length = be16_to_cpu(oops_hdr->report_length);
682 time->tv_sec = oops_hdr->timestamp; 682 time->tv_sec = be64_to_cpu(oops_hdr->timestamp);
683 time->tv_nsec = 0; 683 time->tv_nsec = 0;
684 } 684 }
685 *buf = kmalloc(length, GFP_KERNEL); 685 *buf = kmalloc(length, GFP_KERNEL);
@@ -889,13 +889,13 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
889 kmsg_dump_get_buffer(dumper, false, 889 kmsg_dump_get_buffer(dumper, false,
890 oops_data, oops_data_sz, &text_len); 890 oops_data, oops_data_sz, &text_len);
891 err_type = ERR_TYPE_KERNEL_PANIC; 891 err_type = ERR_TYPE_KERNEL_PANIC;
892 oops_hdr->version = OOPS_HDR_VERSION; 892 oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
893 oops_hdr->report_length = (u16) text_len; 893 oops_hdr->report_length = cpu_to_be16(text_len);
894 oops_hdr->timestamp = get_seconds(); 894 oops_hdr->timestamp = cpu_to_be64(get_seconds());
895 } 895 }
896 896
897 (void) nvram_write_os_partition(&oops_log_partition, oops_buf, 897 (void) nvram_write_os_partition(&oops_log_partition, oops_buf,
898 (int) (sizeof(*oops_hdr) + oops_hdr->report_length), err_type, 898 (int) (sizeof(*oops_hdr) + text_len), err_type,
899 ++oops_count); 899 ++oops_count);
900 900
901 spin_unlock_irqrestore(&lock, flags); 901 spin_unlock_irqrestore(&lock, flags);
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 5f93856cdf47..70670a2d9cf2 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -113,7 +113,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
113{ 113{
114 struct device_node *dn, *pdn; 114 struct device_node *dn, *pdn;
115 struct pci_bus *bus; 115 struct pci_bus *bus;
116 const uint32_t *pcie_link_speed_stats; 116 const __be32 *pcie_link_speed_stats;
117 117
118 bus = bridge->bus; 118 bus = bridge->bus;
119 119
@@ -122,7 +122,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
122 return 0; 122 return 0;
123 123
124 for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) { 124 for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) {
125 pcie_link_speed_stats = (const uint32_t *) of_get_property(pdn, 125 pcie_link_speed_stats = of_get_property(pdn,
126 "ibm,pcie-link-speed-stats", NULL); 126 "ibm,pcie-link-speed-stats", NULL);
127 if (pcie_link_speed_stats) 127 if (pcie_link_speed_stats)
128 break; 128 break;
@@ -135,7 +135,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
135 return 0; 135 return 0;
136 } 136 }
137 137
138 switch (pcie_link_speed_stats[0]) { 138 switch (be32_to_cpup(pcie_link_speed_stats)) {
139 case 0x01: 139 case 0x01:
140 bus->max_bus_speed = PCIE_SPEED_2_5GT; 140 bus->max_bus_speed = PCIE_SPEED_2_5GT;
141 break; 141 break;
@@ -147,7 +147,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
147 break; 147 break;
148 } 148 }
149 149
150 switch (pcie_link_speed_stats[1]) { 150 switch (be32_to_cpup(pcie_link_speed_stats)) {
151 case 0x01: 151 case 0x01:
152 bus->cur_bus_speed = PCIE_SPEED_2_5GT; 152 bus->cur_bus_speed = PCIE_SPEED_2_5GT;
153 break; 153 break;