aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2019-12-08 22:22:45 +1000
committerOliver O'Halloran <oohall@gmail.com>2019-12-16 14:50:56 +1100
commit1b9a449d5d48de9520befd09892d85d6aec7ba62 (patch)
treed8fb15c0217cf0328a8afeb90cb03bac1dbbc8db /hw
parent0ed09ec18e3f856d5456908c4abe3649a025ea12 (diff)
downloadskiboot-1b9a449d5d48de9520befd09892d85d6aec7ba62.zip
skiboot-1b9a449d5d48de9520befd09892d85d6aec7ba62.tar.gz
skiboot-1b9a449d5d48de9520befd09892d85d6aec7ba62.tar.bz2
opal-api: add endian conversions to most opal calls
This adds missing endian conversions to most calls, sufficient at least to handle calls from a kernel booting on mambo. Subsystems requiring more extensive changes (e.g., xive) will be done with individual changes. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/dts.c12
-rw-r--r--hw/fake-rtc.c11
-rw-r--r--hw/fsp/fsp-console.c26
-rw-r--r--hw/fsp/fsp-rtc.c25
-rw-r--r--hw/fsp/fsp-sensor.c8
-rw-r--r--hw/ipmi/ipmi-rtc.c11
-rw-r--r--hw/lpc-rtc.c11
-rw-r--r--hw/lpc-uart.c16
-rw-r--r--hw/lpc.c29
-rw-r--r--hw/npu2-opencapi.c12
-rw-r--r--hw/occ-sensor.c13
-rw-r--r--hw/phb4.c6
-rw-r--r--hw/xscom.c19
13 files changed, 125 insertions, 74 deletions
diff --git a/hw/dts.c b/hw/dts.c
index 31b068b..c21c5c7 100644
--- a/hw/dts.c
+++ b/hw/dts.c
@@ -174,9 +174,9 @@ static void dts_async_read_temp(struct timer *t __unused, void *data,
rc = dts_read_core_temp_p9(cpu->pir, &dts);
if (!rc) {
if (cpu->sensor_attr == SENSOR_DTS_ATTR_TEMP_MAX)
- *cpu->sensor_data = dts.temp;
+ *cpu->sensor_data = cpu_to_be64(dts.temp);
else if (cpu->sensor_attr == SENSOR_DTS_ATTR_TEMP_TRIP)
- *cpu->sensor_data = dts.trip;
+ *cpu->sensor_data = cpu_to_be64(dts.trip);
}
if (!swkup_rc)
@@ -191,7 +191,7 @@ static void dts_async_read_temp(struct timer *t __unused, void *data,
}
static int dts_read_core_temp(u32 pir, struct dts *dts, u8 attr,
- int token, u64 *sensor_data)
+ int token, __be64 *sensor_data)
{
struct cpu_thread *cpu;
int rc;
@@ -286,7 +286,7 @@ enum sensor_dts_class {
*/
#define centaur_get_id(rid) (0x80000000 | ((rid) & 0x3ff))
-int64_t dts_sensor_read(u32 sensor_hndl, int token, u64 *sensor_data)
+int64_t dts_sensor_read(u32 sensor_hndl, int token, __be64 *sensor_data)
{
uint8_t attr = sensor_get_attr(sensor_hndl);
uint32_t rid = sensor_get_rid(sensor_hndl);
@@ -313,9 +313,9 @@ int64_t dts_sensor_read(u32 sensor_hndl, int token, u64 *sensor_data)
return rc;
if (attr == SENSOR_DTS_ATTR_TEMP_MAX)
- *sensor_data = dts.temp;
+ *sensor_data = cpu_to_be64(dts.temp);
else if (attr == SENSOR_DTS_ATTR_TEMP_TRIP)
- *sensor_data = dts.trip;
+ *sensor_data = cpu_to_be64(dts.trip);
return 0;
}
diff --git a/hw/fake-rtc.c b/hw/fake-rtc.c
index 328be97..fd2882d 100644
--- a/hw/fake-rtc.c
+++ b/hw/fake-rtc.c
@@ -34,13 +34,15 @@ static int64_t fake_rtc_write(uint32_t ymd, uint64_t hmsm)
return OPAL_SUCCESS;
}
-static int64_t fake_rtc_read(uint32_t *ymd, uint64_t *hmsm)
+static int64_t fake_rtc_read(__be32 *__ymd, __be64 *__hmsm)
{
time_t sec;
struct tm tm_calculated;
+ uint32_t ymd;
+ uint64_t hmsm;
- if (!ymd || !hmsm)
+ if (!__ymd || !__hmsm)
return OPAL_PARAMETER;
/* Compute the emulated clock value */
@@ -48,10 +50,13 @@ static int64_t fake_rtc_read(uint32_t *ymd, uint64_t *hmsm)
sec = tb_to_secs(mftb() - tb_synctime) + mktime(&tm_offset);
gmtime_r(&sec, &tm_calculated);
- tm_to_datetime(&tm_calculated, ymd, hmsm);
+ tm_to_datetime(&tm_calculated, &ymd, &hmsm);
unlock(&emulation_lock);
+ *__ymd = cpu_to_be32(ymd);
+ *__hmsm = cpu_to_be64(hmsm);
+
return OPAL_SUCCESS;
}
diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
index 1a2ecab..624efb4 100644
--- a/hw/fsp/fsp-console.c
+++ b/hw/fsp/fsp-console.c
@@ -579,7 +579,7 @@ void fsp_console_preinit(void)
}
-static int64_t fsp_console_write(int64_t term_number, int64_t *length,
+static int64_t fsp_console_write(int64_t term_number, __be64 *__length,
const uint8_t *buffer)
{
struct fsp_serial *fs;
@@ -596,7 +596,7 @@ static int64_t fsp_console_write(int64_t term_number, int64_t *length,
return OPAL_CLOSED;
}
/* Clamp to a reasonable size */
- requested = *length;
+ requested = be64_to_cpu(*__length);
if (requested > 0x1000)
requested = 0x1000;
written = fsp_write_vserial(fs, buffer, requested);
@@ -618,7 +618,7 @@ static int64_t fsp_console_write(int64_t term_number, int64_t *length,
buffer[6], buffer[6], buffer[7], buffer[7]);
#endif /* OPAL_DEBUG_CONSOLE_IO */
- *length = written;
+ *__length = cpu_to_be64(written);
unlock(&fsp_con_lock);
if (written)
@@ -628,11 +628,12 @@ static int64_t fsp_console_write(int64_t term_number, int64_t *length,
}
static int64_t fsp_console_write_buffer_space(int64_t term_number,
- int64_t *length)
+ __be64 *__length)
{
static bool elog_generated = false;
struct fsp_serial *fs;
struct fsp_serbuf_hdr *sb;
+ int64_t length;
if (term_number < 0 || term_number >= MAX_SERIAL)
return OPAL_PARAMETER;
@@ -645,15 +646,16 @@ static int64_t fsp_console_write_buffer_space(int64_t term_number,
return OPAL_CLOSED;
}
sb = fs->out_buf;
- *length = (sb->next_out + SER_BUF_DATA_SIZE - sb->next_in - 1)
+ length = (sb->next_out + SER_BUF_DATA_SIZE - sb->next_in - 1)
% SER_BUF_DATA_SIZE;
unlock(&fsp_con_lock);
/* Console buffer has enough space to write incoming data */
- if (*length != fs->out_buf_prev_len) {
- fs->out_buf_prev_len = *length;
+ if (length != fs->out_buf_prev_len) {
+ fs->out_buf_prev_len = length;
fs->out_buf_timeout = 0;
+ *__length = cpu_to_be64(length);
return OPAL_SUCCESS;
}
@@ -667,8 +669,10 @@ static int64_t fsp_console_write_buffer_space(int64_t term_number,
secs_to_tb(SER_BUFFER_OUT_TIMEOUT);
}
- if (tb_compare(mftb(), fs->out_buf_timeout) != TB_AAFTERB)
+ if (tb_compare(mftb(), fs->out_buf_timeout) != TB_AAFTERB) {
+ *__length = cpu_to_be64(length);
return OPAL_SUCCESS;
+ }
/*
* FSP is still active but not reading console data. Hence
@@ -686,13 +690,13 @@ static int64_t fsp_console_write_buffer_space(int64_t term_number,
return OPAL_RESOURCE;
}
-static int64_t fsp_console_read(int64_t term_number, int64_t *length,
+static int64_t fsp_console_read(int64_t term_number, __be64 *__length,
uint8_t *buffer)
{
struct fsp_serial *fs;
struct fsp_serbuf_hdr *sb;
bool pending = false;
- uint32_t old_nin, n, i, chunk, req = *length;
+ uint32_t old_nin, n, i, chunk, req = be64_to_cpu(*__length);
int rc = OPAL_SUCCESS;
if (term_number < 0 || term_number >= MAX_SERIAL)
@@ -716,7 +720,7 @@ static int64_t fsp_console_read(int64_t term_number, int64_t *length,
pending = true;
n = req;
}
- *length = n;
+ *__length = cpu_to_be64(n);
chunk = SER_BUF_DATA_SIZE - sb->next_out;
if (chunk > n)
diff --git a/hw/fsp/fsp-rtc.c b/hw/fsp/fsp-rtc.c
index 53838f8..e68836e 100644
--- a/hw/fsp/fsp-rtc.c
+++ b/hw/fsp/fsp-rtc.c
@@ -249,12 +249,13 @@ static int64_t fsp_rtc_send_read_request(void)
return OPAL_BUSY_EVENT;
}
-static int64_t fsp_opal_rtc_read(uint32_t *year_month_day,
- uint64_t *hour_minute_second_millisecond)
+static int64_t fsp_opal_rtc_read(__be32 *__ymd, __be64 *__hmsm)
{
int64_t rc;
+ uint32_t ymd;
+ uint64_t hmsm;
- if (!year_month_day || !hour_minute_second_millisecond)
+ if (!__ymd || !__hmsm)
return OPAL_PARAMETER;
lock(&rtc_lock);
@@ -267,8 +268,7 @@ static int64_t fsp_opal_rtc_read(uint32_t *year_month_day,
/* During R/R of FSP, read cached TOD */
if (fsp_in_rr()) {
if (rtc_tod_state == RTC_TOD_VALID) {
- rtc_cache_get_datetime(year_month_day,
- hour_minute_second_millisecond);
+ rtc_cache_get_datetime(&ymd, &hmsm);
rc = OPAL_SUCCESS;
} else {
rc = OPAL_INTERNAL_ERROR;
@@ -290,11 +290,9 @@ static int64_t fsp_opal_rtc_read(uint32_t *year_month_day,
opal_rtc_eval_events(true);
if (rtc_tod_state == RTC_TOD_VALID) {
- rtc_cache_get_datetime(year_month_day,
- hour_minute_second_millisecond);
+ rtc_cache_get_datetime(&ymd, &hmsm);
prlog(PR_TRACE,"FSP-RTC Cached datetime: %x %llx\n",
- *year_month_day,
- *hour_minute_second_millisecond);
+ ymd, hmsm);
rc = OPAL_SUCCESS;
} else {
rc = OPAL_INTERNAL_ERROR;
@@ -306,8 +304,7 @@ static int64_t fsp_opal_rtc_read(uint32_t *year_month_day,
prlog(PR_TRACE, "RTC read timed out\n");
if (rtc_tod_state == RTC_TOD_VALID) {
- rtc_cache_get_datetime(year_month_day,
- hour_minute_second_millisecond);
+ rtc_cache_get_datetime(&ymd, &hmsm);
rc = OPAL_SUCCESS;
} else {
rc = OPAL_INTERNAL_ERROR;
@@ -319,6 +316,12 @@ static int64_t fsp_opal_rtc_read(uint32_t *year_month_day,
}
out:
unlock(&rtc_lock);
+
+ if (rc == OPAL_SUCCESS) {
+ *__ymd = cpu_to_be32(ymd);
+ *__hmsm = cpu_to_be64(hmsm);
+ }
+
return rc;
}
diff --git a/hw/fsp/fsp-sensor.c b/hw/fsp/fsp-sensor.c
index 43c8ce4..74deac7 100644
--- a/hw/fsp/fsp-sensor.c
+++ b/hw/fsp/fsp-sensor.c
@@ -70,7 +70,7 @@ enum spcn_attr {
/* Parsed sensor attributes, passed through OPAL */
struct opal_sensor_data {
uint64_t async_token; /* Asynchronous token */
- uint64_t *sensor_data; /* Kernel pointer to copy data */
+ __be64 *sensor_data; /* Kernel pointer to copy data */
enum spcn_attr spcn_attr; /* Modifier attribute */
uint16_t rid; /* Sensor RID */
uint8_t frc; /* Sensor resource class */
@@ -243,7 +243,7 @@ static void fsp_sensor_process_data(struct opal_sensor_data *attr)
sensor_buf_ptr += spcn_mod_data[attr->mod_index].entry_size;
}
- *(attr->sensor_data) = sensor_data;
+ *attr->sensor_data = cpu_to_be64(sensor_data);
if (sensor_data == INVALID_DATA)
queue_msg_for_delivery(OPAL_PARTIAL, attr);
else
@@ -345,7 +345,7 @@ static void fsp_sensor_read_complete(struct fsp_msg *msg)
unlock(&sensor_lock);
return;
err:
- *(attr->sensor_data) = INVALID_DATA;
+ *attr->sensor_data = cpu_to_be64(INVALID_DATA);
queue_msg_for_delivery(rc, attr);
unlock(&sensor_lock);
log_simple_error(&e_info(OPAL_RC_SENSOR_ASYNC_COMPLETE),
@@ -496,7 +496,7 @@ static int64_t parse_sensor_id(uint32_t handler, struct opal_sensor_data *attr)
int64_t fsp_opal_read_sensor(uint32_t sensor_hndl, int token,
- uint64_t *sensor_data)
+ __be64 *sensor_data)
{
struct opal_sensor_data *attr;
int64_t rc;
diff --git a/hw/ipmi/ipmi-rtc.c b/hw/ipmi/ipmi-rtc.c
index deb4add..ad98f21 100644
--- a/hw/ipmi/ipmi-rtc.c
+++ b/hw/ipmi/ipmi-rtc.c
@@ -62,12 +62,13 @@ static int64_t ipmi_set_sel_time(uint32_t _tv)
return ipmi_queue_msg(msg);
}
-static int64_t ipmi_opal_rtc_read(uint32_t *y_m_d,
- uint64_t *h_m_s_m)
+static int64_t ipmi_opal_rtc_read(__be32 *__ymd, __be64 *__hmsm)
{
int ret = 0;
+ uint32_t ymd;
+ uint64_t hmsm;
- if (!y_m_d || !h_m_s_m)
+ if (!__ymd || !__hmsm)
return OPAL_PARAMETER;
switch(time_status) {
@@ -83,7 +84,9 @@ static int64_t ipmi_opal_rtc_read(uint32_t *y_m_d,
break;
case updated:
- rtc_cache_get_datetime(y_m_d, h_m_s_m);
+ rtc_cache_get_datetime(&ymd, &hmsm);
+ *__ymd = cpu_to_be32(ymd);
+ *__hmsm = cpu_to_be64(hmsm);
time_status = idle;
ret = OPAL_SUCCESS;
break;
diff --git a/hw/lpc-rtc.c b/hw/lpc-rtc.c
index f560c8c..ba15941f 100644
--- a/hw/lpc-rtc.c
+++ b/hw/lpc-rtc.c
@@ -139,14 +139,15 @@ static void lpc_init_hw(void)
unlock(&rtc_lock);
}
-static int64_t lpc_opal_rtc_read(uint32_t *y_m_d,
- uint64_t *h_m_s_m)
+static int64_t lpc_opal_rtc_read(__be32 *__ymd, __be64 *__hmsm)
{
uint8_t val;
int64_t rc = OPAL_SUCCESS;
struct tm tm;
+ uint32_t ymd;
+ uint64_t hmsm;
- if (!y_m_d || !h_m_s_m)
+ if (!__ymd || !__hmsm)
return OPAL_PARAMETER;
/* Return busy if updating. This is somewhat racy, but will
@@ -172,7 +173,9 @@ static int64_t lpc_opal_rtc_read(uint32_t *y_m_d,
rtc_cache_update(&tm);
/* Convert to OPAL time */
- tm_to_datetime(&tm, y_m_d, h_m_s_m);
+ tm_to_datetime(&tm, &ymd, &hmsm);
+ *__ymd = cpu_to_be32(ymd);
+ *__hmsm = cpu_to_be64(hmsm);
}
return rc;
diff --git a/hw/lpc-uart.c b/hw/lpc-uart.c
index feca229..b37e042 100644
--- a/hw/lpc-uart.c
+++ b/hw/lpc-uart.c
@@ -255,10 +255,10 @@ static uint32_t uart_tx_buf_space(void)
(out_buf_prod + OUT_BUF_SIZE - out_buf_cons) % OUT_BUF_SIZE;
}
-static int64_t uart_opal_write(int64_t term_number, int64_t *length,
+static int64_t uart_opal_write(int64_t term_number, __be64 *__length,
const uint8_t *buffer)
{
- size_t written = 0, len = *length;
+ size_t written = 0, len = be64_to_cpu(*__length);
if (term_number != 0)
return OPAL_PARAMETER;
@@ -277,19 +277,19 @@ static int64_t uart_opal_write(int64_t term_number, int64_t *length,
unlock(&uart_lock);
- *length = written;
+ *__length = cpu_to_be64(written);
return OPAL_SUCCESS;
}
static int64_t uart_opal_write_buffer_space(int64_t term_number,
- int64_t *length)
+ __be64 *__length)
{
if (term_number != 0)
return OPAL_PARAMETER;
lock(&uart_lock);
- *length = uart_tx_buf_space();
+ *__length = cpu_to_be64(uart_tx_buf_space());
unlock(&uart_lock);
return OPAL_SUCCESS;
@@ -326,10 +326,10 @@ static void uart_adjust_opal_event(void)
}
/* This is called with the console lock held */
-static int64_t uart_opal_read(int64_t term_number, int64_t *length,
+static int64_t uart_opal_read(int64_t term_number, __be64 *__length,
uint8_t *buffer)
{
- size_t req_count = *length, read_cnt = 0;
+ size_t req_count = be64_to_cpu(*__length), read_cnt = 0;
uint8_t lsr = 0;
if (term_number != 0)
@@ -373,7 +373,7 @@ static int64_t uart_opal_read(int64_t term_number, int64_t *length,
/* Adjust the OPAL event */
uart_adjust_opal_event();
- *length = read_cnt;
+ *__length = cpu_to_be64(read_cnt);
return OPAL_SUCCESS;
}
diff --git a/hw/lpc.c b/hw/lpc.c
index ec5146f..abf5497 100644
--- a/hw/lpc.c
+++ b/hw/lpc.c
@@ -673,27 +673,36 @@ int64_t lpc_probe_read(enum OpalLPCAddressType addr_type, uint32_t addr,
* existing Linux expectations
*/
static 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)
{
struct proc_chip *chip;
int64_t rc;
+ uint32_t tmp;
chip = get_chip(chip_id);
if (!chip || !chip->lpc)
return OPAL_PARAMETER;
- if (addr_type == OPAL_LPC_FW || sz == 1)
- return __lpc_read(chip->lpc, addr_type, addr, data, sz, false);
- *data = 0;
- while(sz--) {
- uint32_t byte;
-
- rc = __lpc_read(chip->lpc, addr_type, addr, &byte, 1, false);
+ if (addr_type == OPAL_LPC_FW) {
+ rc = __lpc_read(chip->lpc, addr_type, addr, &tmp, sz, false);
if (rc)
return rc;
- *data = *data | (byte << (8 * sz));
- addr++;
+
+ } else {
+ tmp = 0;
+ while (sz--) {
+ uint32_t byte;
+
+ rc = __lpc_read(chip->lpc, addr_type, addr, &byte, 1, false);
+ if (rc)
+ return rc;
+ tmp = tmp | (byte << (8 * sz));
+ addr++;
+ }
}
+
+ *data = cpu_to_be32(tmp);
+
return OPAL_SUCCESS;
}
diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
index ed6650f..19589c9 100644
--- a/hw/npu2-opencapi.c
+++ b/hw/npu2-opencapi.c
@@ -2250,10 +2250,12 @@ out:
}
static int64_t opal_npu_mem_alloc(uint64_t phb_id, uint32_t __unused bdfn,
- uint64_t size, uint64_t *bar)
+ uint64_t size, __be64 *__bar)
{
struct phb *phb = pci_get_phb(phb_id);
struct npu2_dev *dev;
+ uint64_t bar;
+ int64_t rc;
if (!phb || phb->phb_type != phb_type_npu_v2_opencapi)
@@ -2263,10 +2265,14 @@ static int64_t opal_npu_mem_alloc(uint64_t phb_id, uint32_t __unused bdfn,
if (!dev)
return OPAL_PARAMETER;
- if (!opal_addr_valid(bar))
+ if (!opal_addr_valid(__bar))
return OPAL_PARAMETER;
- return alloc_mem_bar(dev, size, bar);
+ rc = alloc_mem_bar(dev, size, &bar);
+ if (rc == OPAL_SUCCESS)
+ *__bar = cpu_to_be64(bar);
+
+ return rc;
}
opal_call(OPAL_NPU_MEM_ALLOC, opal_npu_mem_alloc, 4);
diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index 8434c19..da846bd 100644
--- a/hw/occ-sensor.c
+++ b/hw/occ-sensor.c
@@ -241,13 +241,14 @@ static void *select_sensor_buffer(struct occ_sensor_data_header *hb, int id)
return buffer;
}
-int occ_sensor_read(u32 handle, u64 *data)
+int occ_sensor_read(u32 handle, __be64 *data)
{
struct occ_sensor_data_header *hb;
struct occ_sensor_name *md;
u16 id = sensor_get_rid(handle);
u8 occ_num = sensor_get_frc(handle);
u8 attr = sensor_get_attr(handle);
+ u64 d;
void *buff;
if (occ_num > MAX_OCCS)
@@ -271,15 +272,17 @@ int occ_sensor_read(u32 handle, u64 *data)
if (!buff)
return OPAL_HARDWARE;
- *data = read_sensor(buff, attr);
- if (!*data)
+ d = read_sensor(buff, attr);
+ if (!d)
return OPAL_SUCCESS;
md = get_names_block(hb);
if (md[id].type == OCC_SENSOR_TYPE_POWER && attr == SENSOR_ACCUMULATOR)
- scale_energy(&md[id], data);
+ scale_energy(&md[id], &d);
else
- scale_sensor(&md[id], data);
+ scale_sensor(&md[id], &d);
+
+ *data = cpu_to_be64(d);
return OPAL_SUCCESS;
}
diff --git a/hw/phb4.c b/hw/phb4.c
index e96466d..85d6a0c 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -1571,7 +1571,7 @@ static int64_t phb4_set_option(struct phb *phb, enum OpalPhbOption opt,
}
static int64_t phb4_get_option(struct phb *phb, enum OpalPhbOption opt,
- uint64_t *setting)
+ __be64 *setting)
{
struct phb4 *p = phb_to_phb4(phb);
uint64_t data64;
@@ -1579,10 +1579,10 @@ static int64_t phb4_get_option(struct phb *phb, enum OpalPhbOption opt,
data64 = phb4_read_reg(p, PHB_CTRLR);
switch (opt) {
case OPAL_PHB_OPTION_TVE1_4GB:
- *setting = (data64 & PPC_BIT(24)) ? 1 : 0;
+ *setting = cpu_to_be64((data64 & PPC_BIT(24)) ? 1 : 0);
break;
case OPAL_PHB_OPTION_MMIO_EEH_DISABLE:
- *setting = (data64 & PPC_BIT(14)) ? 1 : 0;
+ *setting = cpu_to_be64((data64 & PPC_BIT(14)) ? 1 : 0);
break;
default:
return OPAL_UNSUPPORTED;
diff --git a/hw/xscom.c b/hw/xscom.c
index 381cf2c..a851695 100644
--- a/hw/xscom.c
+++ b/hw/xscom.c
@@ -638,7 +638,17 @@ int _xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val, bool take_loc
return rc;
}
-opal_call(OPAL_XSCOM_READ, xscom_read, 3);
+static int64_t opal_xscom_read(uint32_t partid, uint64_t pcb_addr, __be64 *__val)
+{
+ uint64_t val;
+ int64_t rc;
+
+ rc = xscom_read(partid, pcb_addr, &val);
+ *__val = cpu_to_be64(val);
+
+ return rc;
+}
+opal_call(OPAL_XSCOM_READ, opal_xscom_read, 3);
int _xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val, bool take_lock)
{
@@ -682,7 +692,12 @@ int _xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val, bool take_loc
unlock(&xscom_lock);
return rc;
}
-opal_call(OPAL_XSCOM_WRITE, xscom_write, 3);
+
+static int64_t opal_xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val)
+{
+ return xscom_write(partid, pcb_addr, val);
+}
+opal_call(OPAL_XSCOM_WRITE, opal_xscom_write, 3);
/*
* Perform a xscom read-modify-write.