Commit 4ddebaf4 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc

Pull powerpc fixes from Ben Herrenschmidt:
 "Uli's patch fixes a regression in ptrace caused by a mis-merge of a
  previous LE patch.  The rest are all more endian fixes, all fairly
  trivial, found during testing of 3.13-rc's"

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
  powerpc/powernv: Fix OPAL LPC access in Little Endian
  powerpc/powernv: Fix endian issue in opal_xscom_read
  powerpc: Fix endian issues in crash dump code
  powerpc/pseries: Fix endian issues in MSI code
  powerpc/pseries: Fix PCIE link speed endian issue
  powerpc/pseries: Fix endian issues in nvram code
  powerpc/pseries: Fix endian issues in /proc/ppc64/lparcfg
  powerpc: Fix topology core_id endian issue on LE builds
  powerpc: Fix endian issue in setup-common.c
  powerpc: PTRACE_PEEKUSR always returns FPR0
parents f447ef4a 803c2d2f
...@@ -720,13 +720,13 @@ int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe, ...@@ -720,13 +720,13 @@ int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe,
int64_t opal_pci_poll(uint64_t phb_id); int64_t opal_pci_poll(uint64_t phb_id);
int64_t opal_return_cpu(void); int64_t opal_return_cpu(void);
int64_t opal_xscom_read(uint32_t gcid, uint32_t pcb_addr, uint64_t *val); int64_t opal_xscom_read(uint32_t gcid, uint32_t pcb_addr, __be64 *val);
int64_t opal_xscom_write(uint32_t gcid, uint32_t pcb_addr, uint64_t val); int64_t opal_xscom_write(uint32_t gcid, uint32_t pcb_addr, uint64_t val);
int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type, int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type,
uint32_t addr, uint32_t data, uint32_t sz); uint32_t addr, uint32_t data, uint32_t sz);
int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type, int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type,
uint32_t addr, uint32_t *data, uint32_t sz); uint32_t addr, __be32 *data, uint32_t sz);
int64_t opal_validate_flash(uint64_t buffer, uint32_t *size, uint32_t *result); int64_t opal_validate_flash(uint64_t buffer, uint32_t *size, uint32_t *result);
int64_t opal_manage_flash(uint8_t op); int64_t opal_manage_flash(uint8_t op);
int64_t opal_update_flash(uint64_t blk_list); int64_t opal_update_flash(uint64_t blk_list);
......
...@@ -124,15 +124,15 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, ...@@ -124,15 +124,15 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
void crash_free_reserved_phys_range(unsigned long begin, unsigned long end) void crash_free_reserved_phys_range(unsigned long begin, unsigned long end)
{ {
unsigned long addr; unsigned long addr;
const u32 *basep, *sizep; const __be32 *basep, *sizep;
unsigned int rtas_start = 0, rtas_end = 0; unsigned int rtas_start = 0, rtas_end = 0;
basep = of_get_property(rtas.dev, "linux,rtas-base", NULL); basep = of_get_property(rtas.dev, "linux,rtas-base", NULL);
sizep = of_get_property(rtas.dev, "rtas-size", NULL); sizep = of_get_property(rtas.dev, "rtas-size", NULL);
if (basep && sizep) { if (basep && sizep) {
rtas_start = *basep; rtas_start = be32_to_cpup(basep);
rtas_end = *basep + *sizep; rtas_end = rtas_start + be32_to_cpup(sizep);
} }
for (addr = begin; addr < end; addr += PAGE_SIZE) { for (addr = begin; addr < end; addr += PAGE_SIZE) {
......
...@@ -1555,7 +1555,7 @@ long arch_ptrace(struct task_struct *child, long request, ...@@ -1555,7 +1555,7 @@ long arch_ptrace(struct task_struct *child, long request,
flush_fp_to_thread(child); flush_fp_to_thread(child);
if (fpidx < (PT_FPSCR - PT_FPR0)) if (fpidx < (PT_FPSCR - PT_FPR0))
memcpy(&tmp, &child->thread.fp_state.fpr, memcpy(&tmp, &child->thread.TS_FPR(fpidx),
sizeof(long)); sizeof(long));
else else
tmp = child->thread.fp_state.fpscr; tmp = child->thread.fp_state.fpscr;
...@@ -1588,7 +1588,7 @@ long arch_ptrace(struct task_struct *child, long request, ...@@ -1588,7 +1588,7 @@ long arch_ptrace(struct task_struct *child, long request,
flush_fp_to_thread(child); flush_fp_to_thread(child);
if (fpidx < (PT_FPSCR - PT_FPR0)) if (fpidx < (PT_FPSCR - PT_FPR0))
memcpy(&child->thread.fp_state.fpr, &data, memcpy(&child->thread.TS_FPR(fpidx), &data,
sizeof(long)); sizeof(long));
else else
child->thread.fp_state.fpscr = data; child->thread.fp_state.fpscr = data;
......
...@@ -479,7 +479,7 @@ void __init smp_setup_cpu_maps(void) ...@@ -479,7 +479,7 @@ void __init smp_setup_cpu_maps(void)
if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) && if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) &&
(dn = of_find_node_by_path("/rtas"))) { (dn = of_find_node_by_path("/rtas"))) {
int num_addr_cell, num_size_cell, maxcpus; int num_addr_cell, num_size_cell, maxcpus;
const unsigned int *ireg; const __be32 *ireg;
num_addr_cell = of_n_addr_cells(dn); num_addr_cell = of_n_addr_cells(dn);
num_size_cell = of_n_size_cells(dn); num_size_cell = of_n_size_cells(dn);
...@@ -489,7 +489,7 @@ void __init smp_setup_cpu_maps(void) ...@@ -489,7 +489,7 @@ void __init smp_setup_cpu_maps(void)
if (!ireg) if (!ireg)
goto out; goto out;
maxcpus = ireg[num_addr_cell + num_size_cell]; maxcpus = be32_to_cpup(ireg + num_addr_cell + num_size_cell);
/* Double maxcpus for processors which have SMT capability */ /* Double maxcpus for processors which have SMT capability */
if (cpu_has_feature(CPU_FTR_SMT)) if (cpu_has_feature(CPU_FTR_SMT))
......
...@@ -580,7 +580,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) ...@@ -580,7 +580,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
int cpu_to_core_id(int cpu) int cpu_to_core_id(int cpu)
{ {
struct device_node *np; struct device_node *np;
const int *reg; const __be32 *reg;
int id = -1; int id = -1;
np = of_get_cpu_node(cpu, NULL); np = of_get_cpu_node(cpu, NULL);
...@@ -591,7 +591,7 @@ int cpu_to_core_id(int cpu) ...@@ -591,7 +591,7 @@ int cpu_to_core_id(int cpu)
if (!reg) if (!reg)
goto out; goto out;
id = *reg; id = be32_to_cpup(reg);
out: out:
of_node_put(np); of_node_put(np);
return id; return id;
......
...@@ -24,25 +24,25 @@ static int opal_lpc_chip_id = -1; ...@@ -24,25 +24,25 @@ static int opal_lpc_chip_id = -1;
static u8 opal_lpc_inb(unsigned long port) static u8 opal_lpc_inb(unsigned long port)
{ {
int64_t rc; int64_t rc;
uint32_t data; __be32 data;
if (opal_lpc_chip_id < 0 || port > 0xffff) if (opal_lpc_chip_id < 0 || port > 0xffff)
return 0xff; return 0xff;
rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 1); rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 1);
return rc ? 0xff : data; return rc ? 0xff : be32_to_cpu(data);
} }
static __le16 __opal_lpc_inw(unsigned long port) static __le16 __opal_lpc_inw(unsigned long port)
{ {
int64_t rc; int64_t rc;
uint32_t data; __be32 data;
if (opal_lpc_chip_id < 0 || port > 0xfffe) if (opal_lpc_chip_id < 0 || port > 0xfffe)
return 0xffff; return 0xffff;
if (port & 1) if (port & 1)
return (__le16)opal_lpc_inb(port) << 8 | opal_lpc_inb(port + 1); return (__le16)opal_lpc_inb(port) << 8 | opal_lpc_inb(port + 1);
rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 2); rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 2);
return rc ? 0xffff : data; return rc ? 0xffff : be32_to_cpu(data);
} }
static u16 opal_lpc_inw(unsigned long port) static u16 opal_lpc_inw(unsigned long port)
{ {
...@@ -52,7 +52,7 @@ static u16 opal_lpc_inw(unsigned long port) ...@@ -52,7 +52,7 @@ static u16 opal_lpc_inw(unsigned long port)
static __le32 __opal_lpc_inl(unsigned long port) static __le32 __opal_lpc_inl(unsigned long port)
{ {
int64_t rc; int64_t rc;
uint32_t data; __be32 data;
if (opal_lpc_chip_id < 0 || port > 0xfffc) if (opal_lpc_chip_id < 0 || port > 0xfffc)
return 0xffffffff; return 0xffffffff;
...@@ -62,7 +62,7 @@ static __le32 __opal_lpc_inl(unsigned long port) ...@@ -62,7 +62,7 @@ static __le32 __opal_lpc_inl(unsigned long port)
(__le32)opal_lpc_inb(port + 2) << 8 | (__le32)opal_lpc_inb(port + 2) << 8 |
opal_lpc_inb(port + 3); opal_lpc_inb(port + 3);
rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 4); rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 4);
return rc ? 0xffffffff : data; return rc ? 0xffffffff : be32_to_cpu(data);
} }
static u32 opal_lpc_inl(unsigned long port) static u32 opal_lpc_inl(unsigned long port)
......
...@@ -96,9 +96,11 @@ static int opal_scom_read(scom_map_t map, u64 reg, u64 *value) ...@@ -96,9 +96,11 @@ static int opal_scom_read(scom_map_t map, u64 reg, u64 *value)
{ {
struct opal_scom_map *m = map; struct opal_scom_map *m = map;
int64_t rc; int64_t rc;
__be64 v;
reg = opal_scom_unmangle(reg); reg = opal_scom_unmangle(reg);
rc = opal_xscom_read(m->chip, m->addr + reg, (uint64_t *)__pa(value)); rc = opal_xscom_read(m->chip, m->addr + reg, (__be64 *)__pa(&v));
*value = be64_to_cpu(v);
return opal_xscom_err_xlate(rc); return opal_xscom_err_xlate(rc);
} }
......
...@@ -157,7 +157,7 @@ static void parse_ppp_data(struct seq_file *m) ...@@ -157,7 +157,7 @@ static void parse_ppp_data(struct seq_file *m)
{ {
struct hvcall_ppp_data ppp_data; struct hvcall_ppp_data ppp_data;
struct device_node *root; struct device_node *root;
const int *perf_level; const __be32 *perf_level;
int rc; int rc;
rc = h_get_ppp(&ppp_data); rc = h_get_ppp(&ppp_data);
...@@ -201,7 +201,7 @@ static void parse_ppp_data(struct seq_file *m) ...@@ -201,7 +201,7 @@ static void parse_ppp_data(struct seq_file *m)
perf_level = of_get_property(root, perf_level = of_get_property(root,
"ibm,partition-performance-parameters-level", "ibm,partition-performance-parameters-level",
NULL); NULL);
if (perf_level && (*perf_level >= 1)) { if (perf_level && (be32_to_cpup(perf_level) >= 1)) {
seq_printf(m, seq_printf(m,
"physical_procs_allocated_to_virtualization=%d\n", "physical_procs_allocated_to_virtualization=%d\n",
ppp_data.phys_platform_procs); ppp_data.phys_platform_procs);
...@@ -435,7 +435,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) ...@@ -435,7 +435,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
int partition_potential_processors; int partition_potential_processors;
int partition_active_processors; int partition_active_processors;
struct device_node *rtas_node; struct device_node *rtas_node;
const int *lrdrp = NULL; const __be32 *lrdrp = NULL;
rtas_node = of_find_node_by_path("/rtas"); rtas_node = of_find_node_by_path("/rtas");
if (rtas_node) if (rtas_node)
...@@ -444,7 +444,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) ...@@ -444,7 +444,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
if (lrdrp == NULL) { if (lrdrp == NULL) {
partition_potential_processors = vdso_data->processorCount; partition_potential_processors = vdso_data->processorCount;
} else { } else {
partition_potential_processors = *(lrdrp + 4); partition_potential_processors = be32_to_cpup(lrdrp + 4);
} }
of_node_put(rtas_node); of_node_put(rtas_node);
...@@ -654,7 +654,7 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -654,7 +654,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
const char *model = ""; const char *model = "";
const char *system_id = ""; const char *system_id = "";
const char *tmp; const char *tmp;
const unsigned int *lp_index_ptr; const __be32 *lp_index_ptr;
unsigned int lp_index = 0; unsigned int lp_index = 0;
seq_printf(m, "%s %s\n", MODULE_NAME, MODULE_VERS); 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,7 +670,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
lp_index_ptr = of_get_property(rootdn, "ibm,partition-no", lp_index_ptr = of_get_property(rootdn, "ibm,partition-no",
NULL); NULL);
if (lp_index_ptr) if (lp_index_ptr)
lp_index = *lp_index_ptr; lp_index = be32_to_cpup(lp_index_ptr);
of_node_put(rootdn); of_node_put(rootdn);
} }
seq_printf(m, "serial_number=%s\n", system_id); seq_printf(m, "serial_number=%s\n", system_id);
......
...@@ -130,7 +130,8 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name) ...@@ -130,7 +130,8 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name)
{ {
struct device_node *dn; struct device_node *dn;
struct pci_dn *pdn; struct pci_dn *pdn;
const u32 *req_msi; const __be32 *p;
u32 req_msi;
pdn = pci_get_pdn(pdev); pdn = pci_get_pdn(pdev);
if (!pdn) if (!pdn)
...@@ -138,19 +139,20 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name) ...@@ -138,19 +139,20 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name)
dn = pdn->node; dn = pdn->node;
req_msi = of_get_property(dn, prop_name, NULL); p = of_get_property(dn, prop_name, NULL);
if (!req_msi) { if (!p) {
pr_debug("rtas_msi: No %s on %s\n", prop_name, dn->full_name); pr_debug("rtas_msi: No %s on %s\n", prop_name, dn->full_name);
return -ENOENT; return -ENOENT;
} }
if (*req_msi < nvec) { req_msi = be32_to_cpup(p);
if (req_msi < nvec) {
pr_debug("rtas_msi: %s requests < %d MSIs\n", prop_name, nvec); pr_debug("rtas_msi: %s requests < %d MSIs\n", prop_name, nvec);
if (*req_msi == 0) /* Be paranoid */ if (req_msi == 0) /* Be paranoid */
return -ENOSPC; return -ENOSPC;
return *req_msi; return req_msi;
} }
return 0; return 0;
...@@ -171,7 +173,7 @@ static int check_req_msix(struct pci_dev *pdev, int nvec) ...@@ -171,7 +173,7 @@ static int check_req_msix(struct pci_dev *pdev, int nvec)
static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total) static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total)
{ {
struct device_node *dn; struct device_node *dn;
const u32 *p; const __be32 *p;
dn = of_node_get(pci_device_to_OF_node(dev)); dn = of_node_get(pci_device_to_OF_node(dev));
while (dn) { while (dn) {
...@@ -179,7 +181,7 @@ static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total) ...@@ -179,7 +181,7 @@ static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total)
if (p) { if (p) {
pr_debug("rtas_msi: found prop on dn %s\n", pr_debug("rtas_msi: found prop on dn %s\n",
dn->full_name); dn->full_name);
*total = *p; *total = be32_to_cpup(p);
return dn; return dn;
} }
...@@ -232,13 +234,13 @@ struct msi_counts { ...@@ -232,13 +234,13 @@ struct msi_counts {
static void *count_non_bridge_devices(struct device_node *dn, void *data) static void *count_non_bridge_devices(struct device_node *dn, void *data)
{ {
struct msi_counts *counts = data; struct msi_counts *counts = data;
const u32 *p; const __be32 *p;
u32 class; u32 class;
pr_debug("rtas_msi: counting %s\n", dn->full_name); pr_debug("rtas_msi: counting %s\n", dn->full_name);
p = of_get_property(dn, "class-code", NULL); p = of_get_property(dn, "class-code", NULL);
class = p ? *p : 0; class = p ? be32_to_cpup(p) : 0;
if ((class >> 8) != PCI_CLASS_BRIDGE_PCI) if ((class >> 8) != PCI_CLASS_BRIDGE_PCI)
counts->num_devices++; counts->num_devices++;
...@@ -249,7 +251,7 @@ static void *count_non_bridge_devices(struct device_node *dn, void *data) ...@@ -249,7 +251,7 @@ static void *count_non_bridge_devices(struct device_node *dn, void *data)
static void *count_spare_msis(struct device_node *dn, void *data) static void *count_spare_msis(struct device_node *dn, void *data)
{ {
struct msi_counts *counts = data; struct msi_counts *counts = data;
const u32 *p; const __be32 *p;
int req; int req;
if (dn == counts->requestor) if (dn == counts->requestor)
...@@ -260,11 +262,11 @@ static void *count_spare_msis(struct device_node *dn, void *data) ...@@ -260,11 +262,11 @@ static void *count_spare_msis(struct device_node *dn, void *data)
req = 0; req = 0;
p = of_get_property(dn, "ibm,req#msi", NULL); p = of_get_property(dn, "ibm,req#msi", NULL);
if (p) if (p)
req = *p; req = be32_to_cpup(p);
p = of_get_property(dn, "ibm,req#msi-x", NULL); p = of_get_property(dn, "ibm,req#msi-x", NULL);
if (p) if (p)
req = max(req, (int)*p); req = max(req, (int)be32_to_cpup(p));
} }
if (req < counts->quota) if (req < counts->quota)
......
...@@ -43,8 +43,8 @@ static char nvram_buf[NVRW_CNT]; /* assume this is in the first 4GB */ ...@@ -43,8 +43,8 @@ static char nvram_buf[NVRW_CNT]; /* assume this is in the first 4GB */
static DEFINE_SPINLOCK(nvram_lock); static DEFINE_SPINLOCK(nvram_lock);
struct err_log_info { struct err_log_info {
int error_type; __be32 error_type;
unsigned int seq_num; __be32 seq_num;
}; };
struct nvram_os_partition { struct nvram_os_partition {
...@@ -79,9 +79,9 @@ static const char *pseries_nvram_os_partitions[] = { ...@@ -79,9 +79,9 @@ static const char *pseries_nvram_os_partitions[] = {
}; };
struct oops_log_info { struct oops_log_info {
u16 version; __be16 version;
u16 report_length; __be16 report_length;
u64 timestamp; __be64 timestamp;
} __attribute__((packed)); } __attribute__((packed));
static void oops_to_nvram(struct kmsg_dumper *dumper, static 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,8 +291,8 @@ int nvram_write_os_partition(struct nvram_os_partition *part, char * buff,
length = part->size; length = part->size;
} }
info.error_type = err_type; info.error_type = cpu_to_be32(err_type);
info.seq_num = error_log_cnt; info.seq_num = cpu_to_be32(error_log_cnt);
tmp_index = part->index; tmp_index = part->index;
...@@ -364,8 +364,8 @@ int nvram_read_partition(struct nvram_os_partition *part, char *buff, ...@@ -364,8 +364,8 @@ int nvram_read_partition(struct nvram_os_partition *part, char *buff,
} }
if (part->os_partition) { if (part->os_partition) {
*error_log_cnt = info.seq_num; *error_log_cnt = be32_to_cpu(info.seq_num);
*err_type = info.error_type; *err_type = be32_to_cpu(info.error_type);
} }
return 0; return 0;
...@@ -529,9 +529,9 @@ static int zip_oops(size_t text_len) ...@@ -529,9 +529,9 @@ static int zip_oops(size_t text_len)
pr_err("nvram: logging uncompressed oops/panic report\n"); pr_err("nvram: logging uncompressed oops/panic report\n");
return -1; return -1;
} }
oops_hdr->version = OOPS_HDR_VERSION; oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
oops_hdr->report_length = (u16) zipped_len; oops_hdr->report_length = cpu_to_be16(zipped_len);
oops_hdr->timestamp = get_seconds(); oops_hdr->timestamp = cpu_to_be64(get_seconds());
return 0; return 0;
} }
...@@ -574,9 +574,9 @@ static int nvram_pstore_write(enum pstore_type_id type, ...@@ -574,9 +574,9 @@ static int nvram_pstore_write(enum pstore_type_id type,
clobbering_unread_rtas_event()) clobbering_unread_rtas_event())
return -1; return -1;
oops_hdr->version = OOPS_HDR_VERSION; oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
oops_hdr->report_length = (u16) size; oops_hdr->report_length = cpu_to_be16(size);
oops_hdr->timestamp = get_seconds(); oops_hdr->timestamp = cpu_to_be64(get_seconds());
if (compressed) if (compressed)
err_type = ERR_TYPE_KERNEL_PANIC_GZ; 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,16 +670,16 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
size_t length, hdr_size; size_t length, hdr_size;
oops_hdr = (struct oops_log_info *)buff; oops_hdr = (struct oops_log_info *)buff;
if (oops_hdr->version < OOPS_HDR_VERSION) { if (be16_to_cpu(oops_hdr->version) < OOPS_HDR_VERSION) {
/* Old format oops header had 2-byte record size */ /* Old format oops header had 2-byte record size */
hdr_size = sizeof(u16); hdr_size = sizeof(u16);
length = oops_hdr->version; length = be16_to_cpu(oops_hdr->version);
time->tv_sec = 0; time->tv_sec = 0;
time->tv_nsec = 0; time->tv_nsec = 0;
} else { } else {
hdr_size = sizeof(*oops_hdr); hdr_size = sizeof(*oops_hdr);
length = oops_hdr->report_length; length = be16_to_cpu(oops_hdr->report_length);
time->tv_sec = oops_hdr->timestamp; time->tv_sec = be64_to_cpu(oops_hdr->timestamp);
time->tv_nsec = 0; time->tv_nsec = 0;
} }
*buf = kmalloc(length, GFP_KERNEL); *buf = kmalloc(length, GFP_KERNEL);
...@@ -889,13 +889,13 @@ static void oops_to_nvram(struct kmsg_dumper *dumper, ...@@ -889,13 +889,13 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
kmsg_dump_get_buffer(dumper, false, kmsg_dump_get_buffer(dumper, false,
oops_data, oops_data_sz, &text_len); oops_data, oops_data_sz, &text_len);
err_type = ERR_TYPE_KERNEL_PANIC; err_type = ERR_TYPE_KERNEL_PANIC;
oops_hdr->version = OOPS_HDR_VERSION; oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
oops_hdr->report_length = (u16) text_len; oops_hdr->report_length = cpu_to_be16(text_len);
oops_hdr->timestamp = get_seconds(); oops_hdr->timestamp = cpu_to_be64(get_seconds());
} }
(void) nvram_write_os_partition(&oops_log_partition, oops_buf, (void) nvram_write_os_partition(&oops_log_partition, oops_buf,
(int) (sizeof(*oops_hdr) + oops_hdr->report_length), err_type, (int) (sizeof(*oops_hdr) + text_len), err_type,
++oops_count); ++oops_count);
spin_unlock_irqrestore(&lock, flags); spin_unlock_irqrestore(&lock, flags);
......
...@@ -113,7 +113,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) ...@@ -113,7 +113,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
{ {
struct device_node *dn, *pdn; struct device_node *dn, *pdn;
struct pci_bus *bus; struct pci_bus *bus;
const uint32_t *pcie_link_speed_stats; const __be32 *pcie_link_speed_stats;
bus = bridge->bus; bus = bridge->bus;
...@@ -122,7 +122,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) ...@@ -122,7 +122,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
return 0; return 0;
for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) { for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) {
pcie_link_speed_stats = (const uint32_t *) of_get_property(pdn, pcie_link_speed_stats = of_get_property(pdn,
"ibm,pcie-link-speed-stats", NULL); "ibm,pcie-link-speed-stats", NULL);
if (pcie_link_speed_stats) if (pcie_link_speed_stats)
break; break;
...@@ -135,7 +135,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) ...@@ -135,7 +135,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
return 0; return 0;
} }
switch (pcie_link_speed_stats[0]) { switch (be32_to_cpup(pcie_link_speed_stats)) {
case 0x01: case 0x01:
bus->max_bus_speed = PCIE_SPEED_2_5GT; bus->max_bus_speed = PCIE_SPEED_2_5GT;
break; break;
...@@ -147,7 +147,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) ...@@ -147,7 +147,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
break; break;
} }
switch (pcie_link_speed_stats[1]) { switch (be32_to_cpup(pcie_link_speed_stats)) {
case 0x01: case 0x01:
bus->cur_bus_speed = PCIE_SPEED_2_5GT; bus->cur_bus_speed = PCIE_SPEED_2_5GT;
break; break;
......
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