This patch series takes a careful step-by-step process to sync the
opal.h header file (definition of interface to OPAL firmware) with
opal.h in firmware.
Each patch is designed to be as obvious as possible so that it's
easy for someone else to prove that I haven't messed it up anywhere.
In the process of doing this, I fixed a few things in firmware too,
so this matches skiboot at 4681ed9, which is a little after the most
recent skiboot release (4.1.1).
The biggest change is moving the function prototypes for API calls
out to opal-api.h.
Stewart Smith (18):
powerpc/powernv: sync OPAL API tokens with skiboot
powerpc/powernv: synchronize OPAL calls and return codes with
firmware
powerpc/powernv:
s/OPAL_PCI_SET_PHB_CXL_MODE/OPAL_PCI_SET_PHB_CAPI_MODE/ to match
firmware
powerpc/powernv: relocate struct opal_sg_entry in opal.h to same
place it is in firmware
powerpc/powernv: synchronize opal.h whitespace with firmware
powerpc/powernv: move OPAL_DUMP_REGION defines in opal.h to same
place as in firmware opal.h
powerpc/powernv: make whitespace for OPAL_PM_* defines match firmware
powerpc/powernv: Move OpalSysparamPerm,OpalMessageType in opal.h to
match firmware
powerpc/powernv: match enum OpalMessageType with firmware
powerpc/powernv: move OPAL API prototypes to opal-api.h
powerpc/powernv: make whitespace in enum OpalSysparamPerm match
firmware
powerpc/powernv: add CAPI and EPOW parts to opal.h
powerpc/powernv: add remaining missing enums to opal.h
powerpc/powernv: sync comments and whitespace in opal.h with firmware
powerpc/powernv: sync #includes in opal.h with firmware
powerpc/powernv: move SG_ENTRIES_PER_NODE to linux-specific
opal-api.h
powerpc/powernv: s/u8/uint8_t/ to match firmware in opal.h
powerpc/powernv: s/OpalM64EnableAction/OpalM64Action/ and __be64
annotation
arch/powerpc/include/asm/opal-api.h | 244 ++++++++++
arch/powerpc/include/asm/opal.h | 492 +++++++-------------
arch/powerpc/kernel/prom.c | 1 +
arch/powerpc/platforms/powernv/eeh-ioda.c | 1 +
arch/powerpc/platforms/powernv/eeh-powernv.c | 1 +
arch/powerpc/platforms/powernv/opal-async.c | 1 +
arch/powerpc/platforms/powernv/opal-dump.c | 1 +
arch/powerpc/platforms/powernv/opal-elog.c | 1 +
arch/powerpc/platforms/powernv/opal-flash.c | 1 +
arch/powerpc/platforms/powernv/opal-hmi.c | 1 +
arch/powerpc/platforms/powernv/opal-lpc.c | 1 +
.../powerpc/platforms/powernv/opal-memory-errors.c | 1 +
arch/powerpc/platforms/powernv/opal-msglog.c | 1 +
arch/powerpc/platforms/powernv/opal-nvram.c | 1 +
arch/powerpc/platforms/powernv/opal-rtc.c | 1 +
arch/powerpc/platforms/powernv/opal-sensor.c | 1 +
arch/powerpc/platforms/powernv/opal-sysparam.c | 1 +
arch/powerpc/platforms/powernv/opal-wrappers.S | 2 +-
arch/powerpc/platforms/powernv/opal-xscom.c | 1 +
arch/powerpc/platforms/powernv/opal.c | 1 +
arch/powerpc/platforms/powernv/pci-ioda.c | 5 +-
arch/powerpc/platforms/powernv/pci-p5ioc2.c | 1 +
arch/powerpc/platforms/powernv/pci.c | 1 +
arch/powerpc/platforms/powernv/setup.c | 1 +
arch/powerpc/platforms/powernv/smp.c | 1 +
arch/powerpc/platforms/powernv/subcore.c | 1 +
arch/powerpc/sysdev/xics/ics-opal.c | 1 +
drivers/char/ipmi/ipmi_powernv.c | 2 +-
drivers/hwmon/ibmpowernv.c | 1 +
drivers/i2c/busses/i2c-opal.c | 1 +
drivers/rtc/rtc-opal.c | 1 +
drivers/tty/hvc/hvc_opal.c | 1 +
32 files changed, 450 insertions(+), 322 deletions(-)
create mode 100644 arch/powerpc/include/asm/opal-api.h
--
1.7.10.4
This patch just matches whitespace and comments between
the opal.h from firmware and that in linux.
No addition/removal.
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index eb95b67..4694183 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -40,7 +40,7 @@ struct opal_sg_list {
/****** OPAL APIs ******/
/* Return codes */
-#define OPAL_SUCCESS 0
+#define OPAL_SUCCESS 0
#define OPAL_PARAMETER -1
#define OPAL_BUSY -2
#define OPAL_PARTIAL -3
@@ -109,7 +109,7 @@ struct opal_sg_list {
#define OPAL_GET_MSI_64 40
#define OPAL_START_CPU 41
#define OPAL_QUERY_CPU_STATUS 42
-#define OPAL_WRITE_OPPANEL 43
+#define OPAL_WRITE_OPPANEL 43 /* unimplemented */
#define OPAL_PCI_MAP_PE_DMA_WINDOW 44
#define OPAL_PCI_MAP_PE_DMA_WINDOW_REAL 45
#define OPAL_PCI_RESET 49
--
1.7.10.4
This just leaves us with CXL vs CAPI as differences in the list of OPAL
calls between opal.h in firmware and opal.h in Linux.
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 4694183..80cb4d3 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -56,6 +56,7 @@ struct opal_sg_list {
#define OPAL_HARDWARE_FROZEN -13
#define OPAL_WRONG_STATE -14
#define OPAL_ASYNC_COMPLETION -15
+#define OPAL_EMPTY -16
#define OPAL_I2C_TIMEOUT -17
#define OPAL_I2C_INVALID_CMD -18
#define OPAL_I2C_LBUS_PARITY -19
@@ -66,7 +67,8 @@ struct opal_sg_list {
#define OPAL_I2C_STOP_ERR -24
/* API Tokens (in r0) */
-#define OPAL_INVALID_CALL -1
+#define OPAL_INVALID_CALL -1
+#define OPAL_TEST 0
#define OPAL_CONSOLE_WRITE 1
#define OPAL_CONSOLE_READ 2
#define OPAL_RTC_READ 3
@@ -155,8 +157,10 @@ struct opal_sg_list {
#define OPAL_GET_PARAM 89
#define OPAL_SET_PARAM 90
#define OPAL_DUMP_RESEND 91
+#define OPAL_ELOG_SEND 92 /* Deprecated */
#define OPAL_PCI_SET_PHB_CXL_MODE 93
#define OPAL_DUMP_INFO2 94
+#define OPAL_WRITE_OPPANEL_ASYNC 95
#define OPAL_PCI_ERR_INJECT 96
#define OPAL_PCI_EEH_FREEZE_SET 97
#define OPAL_HANDLE_HMI 98
@@ -166,9 +170,12 @@ struct opal_sg_list {
#define OPAL_UNREGISTER_DUMP_REGION 102
#define OPAL_WRITE_TPO 103
#define OPAL_READ_TPO 104
+#define OPAL_GET_DPO_STATUS 105
+#define OPAL_OLD_I2C_REQUEST 106 /* Deprecated */
#define OPAL_IPMI_SEND 107
#define OPAL_IPMI_RECV 108
#define OPAL_I2C_REQUEST 109
+#define OPAL_LAST 109
/* Device tree flags */
--
1.7.10.4
OPAL/IBM calls it CAPI and Linux calls it CXL because CAPI was taken.
In order to have opal.h match between firmware and Linux, we're going
to just deal with one call used in a place be CAPI rather than CXL to
match what's in firmware.
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 4 ++--
arch/powerpc/platforms/powernv/opal-wrappers.S | 2 +-
arch/powerpc/platforms/powernv/pci-ioda.c | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 80cb4d3..e8d9bfc 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -158,7 +158,7 @@ struct opal_sg_list {
#define OPAL_SET_PARAM 90
#define OPAL_DUMP_RESEND 91
#define OPAL_ELOG_SEND 92 /* Deprecated */
-#define OPAL_PCI_SET_PHB_CXL_MODE 93
+#define OPAL_PCI_SET_PHB_CAPI_MODE 93
#define OPAL_DUMP_INFO2 94
#define OPAL_WRITE_OPPANEL_ASYNC 95
#define OPAL_PCI_ERR_INJECT 96
@@ -923,7 +923,7 @@ int64_t opal_handle_hmi(void);
int64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end);
int64_t opal_unregister_dump_region(uint32_t id);
int64_t opal_slw_set_reg(uint64_t cpu_pir, uint64_t sprn, uint64_t val);
-int64_t opal_pci_set_phb_cxl_mode(uint64_t phb_id, uint64_t mode, uint64_t pe_number);
+int64_t opal_pci_set_phb_capi_mode(uint64_t phb_id, uint64_t mode, uint64_t pe_number);
int64_t opal_ipmi_send(uint64_t interface, struct opal_ipmi_msg *msg,
uint64_t msg_len);
int64_t opal_ipmi_recv(uint64_t interface, struct opal_ipmi_msg *msg,
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 0509bca..03eb6e3 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -286,7 +286,7 @@ OPAL_CALL(opal_handle_hmi, OPAL_HANDLE_HMI);
OPAL_CALL(opal_slw_set_reg, OPAL_SLW_SET_REG);
OPAL_CALL(opal_register_dump_region, OPAL_REGISTER_DUMP_REGION);
OPAL_CALL(opal_unregister_dump_region, OPAL_UNREGISTER_DUMP_REGION);
-OPAL_CALL(opal_pci_set_phb_cxl_mode, OPAL_PCI_SET_PHB_CXL_MODE);
+OPAL_CALL(opal_pci_set_phb_capi_mode, OPAL_PCI_SET_PHB_CAPI_MODE);
OPAL_CALL(opal_tpo_write, OPAL_WRITE_TPO);
OPAL_CALL(opal_tpo_read, OPAL_READ_TPO);
OPAL_CALL(opal_ipmi_send, OPAL_IPMI_SEND);
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index fac88ed..3bc5917 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1481,9 +1481,9 @@ int pnv_phb_to_cxl(struct pci_dev *dev)
pe_info(pe, "Switching PHB to CXL\n");
- rc = opal_pci_set_phb_cxl_mode(phb->opal_id, 1, pe->pe_number);
+ rc = opal_pci_set_phb_capi_mode(phb->opal_id, 1, pe->pe_number);
if (rc)
- dev_err(&dev->dev, "opal_pci_set_phb_cxl_mode failed: %i\n", rc);
+ dev_err(&dev->dev, "opal_pci_set_phb_capi_mode failed: %i\n", rc);
return rc;
}
--
1.7.10.4
For whatever reason these structures were in different places.
Now they are not.
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 48 +++++++++++++++++++--------------------
1 file changed, 23 insertions(+), 25 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index e8d9bfc..0f9f06d 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -12,31 +12,6 @@
#ifndef __OPAL_H
#define __OPAL_H
-#ifndef __ASSEMBLY__
-/*
- * SG entry
- *
- * WARNING: The current implementation requires each entry
- * to represent a block that is 4k aligned *and* each block
- * size except the last one in the list to be as well.
- */
-struct opal_sg_entry {
- __be64 data;
- __be64 length;
-};
-
-/* SG list */
-struct opal_sg_list {
- __be64 length;
- __be64 next;
- struct opal_sg_entry entry[];
-};
-
-/* We calculate number of sg entries based on PAGE_SIZE */
-#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
-
-#endif /* __ASSEMBLY__ */
-
/****** OPAL APIs ******/
/* Return codes */
@@ -740,6 +715,29 @@ typedef struct oppanel_line {
uint64_t line_len;
} oppanel_line_t;
+/*
+ * SG entry
+ *
+ * WARNING: The current implementation requires each entry
+ * to represent a block that is 4k aligned *and* each block
+ * size except the last one in the list to be as well.
+ */
+struct opal_sg_entry {
+ __be64 data;
+ __be64 length;
+};
+
+/* SG list */
+struct opal_sg_list {
+ __be64 length;
+ __be64 next;
+ struct opal_sg_entry entry[];
+};
+
+/* We calculate number of sg entries based on PAGE_SIZE */
+#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
+
+
/* OPAL I2C request */
struct opal_i2c_request {
uint8_t type;
--
1.7.10.4
reduces the diff between linux and firmware header files significantly.
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 51 +++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 26 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 0f9f06d..9ca5167 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -251,33 +251,32 @@ enum OpalShpcLinkState {
enum OpalMmioWindowType {
OPAL_M32_WINDOW_TYPE = 1,
OPAL_M64_WINDOW_TYPE = 2,
- OPAL_IO_WINDOW_TYPE = 3
+ OPAL_IO_WINDOW_TYPE = 3
};
-
enum OpalShpcSlotState {
OPAL_SHPC_DEV_NOT_PRESENT = 0,
- OPAL_SHPC_DEV_PRESENT = 1
+ OPAL_SHPC_DEV_PRESENT = 1
};
enum OpalExceptionHandler {
- OPAL_MACHINE_CHECK_HANDLER = 1,
+ OPAL_MACHINE_CHECK_HANDLER = 1,
OPAL_HYPERVISOR_MAINTENANCE_HANDLER = 2,
- OPAL_SOFTPATCH_HANDLER = 3
+ OPAL_SOFTPATCH_HANDLER = 3
};
enum OpalPendingState {
- OPAL_EVENT_OPAL_INTERNAL = 0x1,
- OPAL_EVENT_NVRAM = 0x2,
- OPAL_EVENT_RTC = 0x4,
- OPAL_EVENT_CONSOLE_OUTPUT = 0x8,
- OPAL_EVENT_CONSOLE_INPUT = 0x10,
- OPAL_EVENT_ERROR_LOG_AVAIL = 0x20,
- OPAL_EVENT_ERROR_LOG = 0x40,
- OPAL_EVENT_EPOW = 0x80,
- OPAL_EVENT_LED_STATUS = 0x100,
- OPAL_EVENT_PCI_ERROR = 0x200,
- OPAL_EVENT_DUMP_AVAIL = 0x400,
- OPAL_EVENT_MSG_PENDING = 0x800,
+ OPAL_EVENT_OPAL_INTERNAL = 0x1,
+ OPAL_EVENT_NVRAM = 0x2,
+ OPAL_EVENT_RTC = 0x4,
+ OPAL_EVENT_CONSOLE_OUTPUT = 0x8,
+ OPAL_EVENT_CONSOLE_INPUT = 0x10,
+ OPAL_EVENT_ERROR_LOG_AVAIL = 0x20,
+ OPAL_EVENT_ERROR_LOG = 0x40,
+ OPAL_EVENT_EPOW = 0x80,
+ OPAL_EVENT_LED_STATUS = 0x100,
+ OPAL_EVENT_PCI_ERROR = 0x200,
+ OPAL_EVENT_DUMP_AVAIL = 0x400,
+ OPAL_EVENT_MSG_PENDING = 0x800,
};
enum OpalMessageType {
@@ -353,7 +352,7 @@ enum OpalPciReinitScope {
enum OpalPciResetState {
OPAL_DEASSERT_RESET = 0,
- OPAL_ASSERT_RESET = 1
+ OPAL_ASSERT_RESET = 1
};
enum OpalPciMaskAction {
@@ -451,17 +450,17 @@ struct OpalMemoryErrorData {
union {
/* Memory Resilience corrected/uncorrected error info */
struct {
- enum OpalMemErr_ResilErrType resil_err_type:8;
- uint8_t reserved_1[7];
- __be64 physical_address_start;
- __be64 physical_address_end;
+ enum OpalMemErr_ResilErrType resil_err_type:8;
+ uint8_t reserved_1[7];
+ __be64 physical_address_start;
+ __be64 physical_address_end;
} resilience;
/* Dynamic memory deallocation error info */
struct {
- enum OpalMemErr_DynErrType dyn_err_type:8;
- uint8_t reserved_1[7];
- __be64 physical_address_start;
- __be64 physical_address_end;
+ enum OpalMemErr_DynErrType dyn_err_type:8;
+ uint8_t reserved_1[7];
+ __be64 physical_address_start;
+ __be64 physical_address_end;
} dyn_dealloc;
} u;
};
--
1.7.10.4
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 9ca5167..7075f57 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -733,6 +733,13 @@ struct opal_sg_list {
struct opal_sg_entry entry[];
};
+/*
+ * Dump region ID range usable by the OS
+ */
+#define OPAL_DUMP_REGION_HOST_START 0x80
+#define OPAL_DUMP_REGION_LOG_BUF 0x80
+#define OPAL_DUMP_REGION_HOST_END 0xFF
+
/* We calculate number of sg entries based on PAGE_SIZE */
#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
@@ -979,13 +986,6 @@ struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr,
unsigned long vmalloc_size);
void opal_free_sg_list(struct opal_sg_list *sg);
-/*
- * Dump region ID range usable by the OS
- */
-#define OPAL_DUMP_REGION_HOST_START 0x80
-#define OPAL_DUMP_REGION_LOG_BUF 0x80
-#define OPAL_DUMP_REGION_HOST_END 0xFF
-
#endif /* __ASSEMBLY__ */
#endif /* __OPAL_H */
--
1.7.10.4
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 7075f57..31b9656 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -157,10 +157,10 @@
/* Flags set in power-mgmt nodes in device tree if
* respective idle states are supported in the platform.
*/
-#define OPAL_PM_NAP_ENABLED 0x00010000
-#define OPAL_PM_SLEEP_ENABLED 0x00020000
-#define OPAL_PM_WINKLE_ENABLED 0x00040000
-#define OPAL_PM_SLEEP_ENABLED_ER1 0x00080000
+#define OPAL_PM_NAP_ENABLED 0x00010000
+#define OPAL_PM_SLEEP_ENABLED 0x00020000
+#define OPAL_PM_WINKLE_ENABLED 0x00040000
+#define OPAL_PM_SLEEP_ENABLED_ER1 0x00080000 /* with workaround */
#ifndef __ASSEMBLY__
--
1.7.10.4
For whatever strange reason, these two structures were in different
locations in opal.h in firmware and opal.h in Linux. Move them around
to match firmware so that the diff is less.
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 31b9656..3786c6b 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -279,17 +279,6 @@ enum OpalPendingState {
OPAL_EVENT_MSG_PENDING = 0x800,
};
-enum OpalMessageType {
- OPAL_MSG_ASYNC_COMP = 0, /* params[0] = token, params[1] = rc,
- * additional params function-specific
- */
- OPAL_MSG_MEM_ERR,
- OPAL_MSG_EPOW,
- OPAL_MSG_SHUTDOWN,
- OPAL_MSG_HMI_EVT,
- OPAL_MSG_TYPE_MAX,
-};
-
enum OpalThreadStatus {
OPAL_THREAD_INACTIVE = 0x0,
OPAL_THREAD_STARTED = 0x1,
@@ -389,11 +378,15 @@ enum OpalLPCAddressType {
OPAL_LPC_FW = 2,
};
-/* System parameter permission */
-enum OpalSysparamPerm {
- OPAL_SYSPARAM_READ = 0x1,
- OPAL_SYSPARAM_WRITE = 0x2,
- OPAL_SYSPARAM_RW = (OPAL_SYSPARAM_READ | OPAL_SYSPARAM_WRITE),
+enum OpalMessageType {
+ OPAL_MSG_ASYNC_COMP = 0, /* params[0] = token, params[1] = rc,
+ * additional params function-specific
+ */
+ OPAL_MSG_MEM_ERR,
+ OPAL_MSG_EPOW,
+ OPAL_MSG_SHUTDOWN,
+ OPAL_MSG_HMI_EVT,
+ OPAL_MSG_TYPE_MAX,
};
struct opal_msg {
@@ -402,6 +395,13 @@ struct opal_msg {
__be64 params[8];
};
+/* System parameter permission */
+enum OpalSysparamPerm {
+ OPAL_SYSPARAM_READ = 0x1,
+ OPAL_SYSPARAM_WRITE = 0x2,
+ OPAL_SYSPARAM_RW = (OPAL_SYSPARAM_READ | OPAL_SYSPARAM_WRITE),
+};
+
enum {
OPAL_IPMI_MSG_FORMAT_VERSION_1 = 1,
};
--
1.7.10.4
Adds OPAL_MSG_DPO and docs for OPAL_MSG_SHUTDOWN
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 3786c6b..2deaadf 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -384,8 +384,9 @@ enum OpalMessageType {
*/
OPAL_MSG_MEM_ERR,
OPAL_MSG_EPOW,
- OPAL_MSG_SHUTDOWN,
+ OPAL_MSG_SHUTDOWN, /* params[0] = 1 reboot, 0 shutdown */
OPAL_MSG_HMI_EVT,
+ OPAL_MSG_DPO,
OPAL_MSG_TYPE_MAX,
};
--
1.7.10.4
To further the cause of syncing opal.h between firmware and linux,
move the function prototypes that were in opal.h out to opal-api.h
and fix the associated includes.
There are still a few places where opal.h is adequate.
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal-api.h | 240 ++++++++++++++++++++
arch/powerpc/include/asm/opal.h | 224 ------------------
arch/powerpc/kernel/prom.c | 1 +
arch/powerpc/platforms/powernv/eeh-ioda.c | 1 +
arch/powerpc/platforms/powernv/eeh-powernv.c | 1 +
arch/powerpc/platforms/powernv/opal-async.c | 1 +
arch/powerpc/platforms/powernv/opal-dump.c | 1 +
arch/powerpc/platforms/powernv/opal-elog.c | 1 +
arch/powerpc/platforms/powernv/opal-flash.c | 1 +
arch/powerpc/platforms/powernv/opal-hmi.c | 1 +
arch/powerpc/platforms/powernv/opal-lpc.c | 1 +
.../powerpc/platforms/powernv/opal-memory-errors.c | 1 +
arch/powerpc/platforms/powernv/opal-msglog.c | 1 +
arch/powerpc/platforms/powernv/opal-nvram.c | 1 +
arch/powerpc/platforms/powernv/opal-rtc.c | 1 +
arch/powerpc/platforms/powernv/opal-sensor.c | 1 +
arch/powerpc/platforms/powernv/opal-sysparam.c | 1 +
arch/powerpc/platforms/powernv/opal-xscom.c | 1 +
arch/powerpc/platforms/powernv/opal.c | 1 +
arch/powerpc/platforms/powernv/pci-ioda.c | 1 +
arch/powerpc/platforms/powernv/pci-p5ioc2.c | 1 +
arch/powerpc/platforms/powernv/pci.c | 1 +
arch/powerpc/platforms/powernv/setup.c | 1 +
arch/powerpc/platforms/powernv/smp.c | 1 +
arch/powerpc/platforms/powernv/subcore.c | 1 +
arch/powerpc/sysdev/xics/ics-opal.c | 1 +
drivers/char/ipmi/ipmi_powernv.c | 2 +-
drivers/hwmon/ibmpowernv.c | 1 +
drivers/i2c/busses/i2c-opal.c | 1 +
drivers/rtc/rtc-opal.c | 1 +
drivers/tty/hvc/hvc_opal.c | 1 +
31 files changed, 269 insertions(+), 225 deletions(-)
create mode 100644 arch/powerpc/include/asm/opal-api.h
diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
new file mode 100644
index 0000000..c4009dd
--- /dev/null
+++ b/arch/powerpc/include/asm/opal-api.h
@@ -0,0 +1,240 @@
+/*
+ * PowerNV OPAL definitions.
+ *
+ * Copyright 2011 IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef __OPAL_API_H
+#define __OPAL_API_H
+
+/* Linux specific definitions for interfacing with OPAL */
+
+/* /sys/firmware/opal */
+extern struct kobject *opal_kobj;
+
+/* /ibm,opal */
+extern struct device_node *opal_node;
+
+/* API functions */
+int64_t opal_invalid_call(void);
+int64_t opal_console_write(int64_t term_number, __be64 *length,
+ const uint8_t *buffer);
+int64_t opal_console_read(int64_t term_number, __be64 *length,
+ uint8_t *buffer);
+int64_t opal_console_write_buffer_space(int64_t term_number,
+ __be64 *length);
+int64_t opal_rtc_read(__be32 *year_month_day,
+ __be64 *hour_minute_second_millisecond);
+int64_t opal_rtc_write(uint32_t year_month_day,
+ uint64_t hour_minute_second_millisecond);
+int64_t opal_tpo_read(uint64_t token, __be32 *year_mon_day, __be32 *hour_min);
+int64_t opal_tpo_write(uint64_t token, uint32_t year_mon_day,
+ uint32_t hour_min);
+int64_t opal_cec_power_down(uint64_t request);
+int64_t opal_cec_reboot(void);
+int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset);
+int64_t opal_write_nvram(uint64_t buffer, uint64_t size, uint64_t offset);
+int64_t opal_handle_interrupt(uint64_t isn, __be64 *outstanding_event_mask);
+int64_t opal_poll_events(__be64 *outstanding_event_mask);
+int64_t opal_pci_set_hub_tce_memory(uint64_t hub_id, uint64_t tce_mem_addr,
+ uint64_t tce_mem_size);
+int64_t opal_pci_set_phb_tce_memory(uint64_t phb_id, uint64_t tce_mem_addr,
+ uint64_t tce_mem_size);
+int64_t opal_pci_config_read_byte(uint64_t phb_id, uint64_t bus_dev_func,
+ uint64_t offset, uint8_t *data);
+int64_t opal_pci_config_read_half_word(uint64_t phb_id, uint64_t bus_dev_func,
+ uint64_t offset, __be16 *data);
+int64_t opal_pci_config_read_word(uint64_t phb_id, uint64_t bus_dev_func,
+ uint64_t offset, __be32 *data);
+int64_t opal_pci_config_write_byte(uint64_t phb_id, uint64_t bus_dev_func,
+ uint64_t offset, uint8_t data);
+int64_t opal_pci_config_write_half_word(uint64_t phb_id, uint64_t bus_dev_func,
+ uint64_t offset, uint16_t data);
+int64_t opal_pci_config_write_word(uint64_t phb_id, uint64_t bus_dev_func,
+ uint64_t offset, uint32_t data);
+int64_t opal_set_xive(uint32_t isn, uint16_t server, uint8_t priority);
+int64_t opal_get_xive(uint32_t isn, __be16 *server, uint8_t *priority);
+int64_t opal_register_exception_handler(uint64_t opal_exception,
+ uint64_t handler_address,
+ uint64_t glue_cache_line);
+int64_t opal_pci_eeh_freeze_status(uint64_t phb_id, uint64_t pe_number,
+ uint8_t *freeze_state,
+ __be16 *pci_error_type,
+ __be64 *phb_status);
+int64_t opal_pci_eeh_freeze_clear(uint64_t phb_id, uint64_t pe_number,
+ uint64_t eeh_action_token);
+int64_t opal_pci_eeh_freeze_set(uint64_t phb_id, uint64_t pe_number,
+ uint64_t eeh_action_token);
+int64_t opal_pci_err_inject(uint64_t phb_id, uint32_t pe_no, uint32_t type,
+ uint32_t func, uint64_t addr, uint64_t mask);
+int64_t opal_pci_shpc(uint64_t phb_id, uint64_t shpc_action, uint8_t *state);
+
+
+
+int64_t opal_pci_phb_mmio_enable(uint64_t phb_id, uint16_t window_type,
+ uint16_t window_num, uint16_t enable);
+int64_t opal_pci_set_phb_mem_window(uint64_t phb_id, uint16_t window_type,
+ uint16_t window_num,
+ uint64_t starting_real_address,
+ uint64_t starting_pci_address,
+ uint64_t size);
+int64_t opal_pci_map_pe_mmio_window(uint64_t phb_id, uint16_t pe_number,
+ uint16_t window_type, uint16_t window_num,
+ uint16_t segment_num);
+int64_t opal_pci_set_phb_table_memory(uint64_t phb_id, uint64_t rtt_addr,
+ uint64_t ivt_addr, uint64_t ivt_len,
+ uint64_t reject_array_addr,
+ uint64_t peltv_addr);
+int64_t opal_pci_set_pe(uint64_t phb_id, uint64_t pe_number, uint64_t bus_dev_func,
+ uint8_t bus_compare, uint8_t dev_compare, uint8_t func_compare,
+ uint8_t pe_action);
+int64_t opal_pci_set_peltv(uint64_t phb_id, uint32_t parent_pe, uint32_t child_pe,
+ uint8_t state);
+int64_t opal_pci_set_mve(uint64_t phb_id, uint32_t mve_number, uint32_t pe_number);
+int64_t opal_pci_set_mve_enable(uint64_t phb_id, uint32_t mve_number,
+ uint32_t state);
+int64_t opal_pci_get_xive_reissue(uint64_t phb_id, uint32_t xive_number,
+ uint8_t *p_bit, uint8_t *q_bit);
+int64_t opal_pci_set_xive_reissue(uint64_t phb_id, uint32_t xive_number,
+ uint8_t p_bit, uint8_t q_bit);
+int64_t opal_pci_msi_eoi(uint64_t phb_id, uint32_t hw_irq);
+int64_t opal_pci_set_xive_pe(uint64_t phb_id, uint32_t pe_number,
+ uint32_t xive_num);
+int64_t opal_get_xive_source(uint64_t phb_id, uint32_t xive_num,
+ __be32 *interrupt_source_number);
+int64_t opal_get_msi_32(uint64_t phb_id, uint32_t mve_number, uint32_t xive_num,
+ uint8_t msi_range, __be32 *msi_address,
+ __be32 *message_data);
+int64_t opal_get_msi_64(uint64_t phb_id, uint32_t mve_number,
+ uint32_t xive_num, uint8_t msi_range,
+ __be64 *msi_address, __be32 *message_data);
+int64_t opal_start_cpu(uint64_t thread_number, uint64_t start_address);
+int64_t opal_query_cpu_status(uint64_t thread_number, uint8_t *thread_status);
+int64_t opal_write_oppanel(oppanel_line_t *lines, uint64_t num_lines);
+int64_t opal_pci_map_pe_dma_window(uint64_t phb_id, uint16_t pe_number, uint16_t window_id,
+ uint16_t tce_levels, uint64_t tce_table_addr,
+ uint64_t tce_table_size, uint64_t tce_page_size);
+int64_t opal_pci_map_pe_dma_window_real(uint64_t phb_id, uint16_t pe_number,
+ uint16_t dma_window_number, uint64_t pci_start_addr,
+ uint64_t pci_mem_size);
+int64_t opal_pci_reset(uint64_t phb_id, uint8_t reset_scope, uint8_t assert_state);
+
+int64_t opal_pci_get_hub_diag_data(uint64_t hub_id, void *diag_buffer,
+ uint64_t diag_buffer_len);
+int64_t opal_pci_get_phb_diag_data(uint64_t phb_id, void *diag_buffer,
+ uint64_t diag_buffer_len);
+int64_t opal_pci_get_phb_diag_data2(uint64_t phb_id, void *diag_buffer,
+ uint64_t diag_buffer_len);
+int64_t opal_pci_fence_phb(uint64_t phb_id);
+int64_t opal_pci_reinit(uint64_t phb_id, uint64_t reinit_scope, uint64_t data);
+int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action);
+int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action);
+int64_t opal_get_epow_status(__be64 *status);
+int64_t opal_set_system_attention_led(uint8_t led_action);
+int64_t opal_pci_next_error(uint64_t phb_id, __be64 *first_frozen_pe,
+ __be16 *pci_error_type, __be16 *severity);
+int64_t opal_pci_poll(uint64_t phb_id);
+int64_t opal_return_cpu(void);
+int64_t opal_check_token(uint64_t token);
+int64_t opal_reinit_cpus(uint64_t flags);
+
+int64_t opal_xscom_read(uint32_t gcid, uint64_t pcb_addr, __be64 *val);
+int64_t opal_xscom_write(uint32_t gcid, uint64_t pcb_addr, uint64_t val);
+
+int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type,
+ uint32_t addr, uint32_t data, uint32_t sz);
+int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type,
+ uint32_t addr, __be32 *data, uint32_t sz);
+
+int64_t opal_read_elog(uint64_t buffer, uint64_t size, uint64_t log_id);
+int64_t opal_get_elog_size(__be64 *log_id, __be64 *size, __be64 *elog_type);
+int64_t opal_write_elog(uint64_t buffer, uint64_t size, uint64_t offset);
+int64_t opal_send_ack_elog(uint64_t log_id);
+void opal_resend_pending_logs(void);
+
+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_update_flash(uint64_t blk_list);
+int64_t opal_dump_init(uint8_t dump_type);
+int64_t opal_dump_info(__be32 *dump_id, __be32 *dump_size);
+int64_t opal_dump_info2(__be32 *dump_id, __be32 *dump_size, __be32 *dump_type);
+int64_t opal_dump_read(uint32_t dump_id, uint64_t buffer);
+int64_t opal_dump_ack(uint32_t dump_id);
+int64_t opal_dump_resend_notification(void);
+
+int64_t opal_get_msg(uint64_t buffer, uint64_t size);
+int64_t opal_check_completion(uint64_t buffer, uint64_t size, uint64_t token);
+int64_t opal_sync_host_reboot(void);
+int64_t opal_get_param(uint64_t token, uint32_t param_id, uint64_t buffer,
+ uint64_t length);
+int64_t opal_set_param(uint64_t token, uint32_t param_id, uint64_t buffer,
+ uint64_t length);
+int64_t opal_sensor_read(uint32_t sensor_hndl, int token, __be32 *sensor_data);
+int64_t opal_handle_hmi(void);
+int64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end);
+int64_t opal_unregister_dump_region(uint32_t id);
+int64_t opal_slw_set_reg(uint64_t cpu_pir, uint64_t sprn, uint64_t val);
+int64_t opal_pci_set_phb_capi_mode(uint64_t phb_id, uint64_t mode, uint64_t pe_number);
+int64_t opal_ipmi_send(uint64_t interface, struct opal_ipmi_msg *msg,
+ uint64_t msg_len);
+int64_t opal_ipmi_recv(uint64_t interface, struct opal_ipmi_msg *msg,
+ uint64_t *msg_len);
+int64_t opal_i2c_request(uint64_t async_token, uint32_t bus_id,
+ struct opal_i2c_request *oreq);
+
+/* Internal functions */
+extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
+ int depth, void *data);
+extern int early_init_dt_scan_recoverable_ranges(unsigned long node,
+ const char *uname, int depth, void *data);
+
+extern int opal_get_chars(uint32_t vtermno, char *buf, int count);
+extern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len);
+
+extern void hvc_opal_init_early(void);
+
+extern int opal_notifier_register(struct notifier_block *nb);
+extern int opal_notifier_unregister(struct notifier_block *nb);
+
+extern int opal_message_notifier_register(enum OpalMessageType msg_type,
+ struct notifier_block *nb);
+extern void opal_notifier_enable(void);
+extern void opal_notifier_disable(void);
+extern void opal_notifier_update_evt(uint64_t evt_mask, uint64_t evt_val);
+
+extern int __opal_async_get_token(void);
+extern int opal_async_get_token_interruptible(void);
+extern int __opal_async_release_token(int token);
+extern int opal_async_release_token(int token);
+extern int opal_async_wait_response(uint64_t token, struct opal_msg *msg);
+extern int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data);
+
+struct rtc_time;
+extern unsigned long opal_get_boot_time(void);
+extern void opal_nvram_init(void);
+extern void opal_flash_init(void);
+extern void opal_flash_term_callback(void);
+extern int opal_elog_init(void);
+extern void opal_platform_dump_init(void);
+extern void opal_sys_param_init(void);
+extern void opal_msglog_init(void);
+
+extern int opal_machine_check(struct pt_regs *regs);
+extern bool opal_mce_check_early_recovery(struct pt_regs *regs);
+extern int opal_hmi_exception_early(struct pt_regs *regs);
+extern int opal_handle_hmi_exception(struct pt_regs *regs);
+
+extern void opal_shutdown(void);
+extern int opal_resync_timebase(void);
+
+extern void opal_lpc_init(void);
+
+struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr,
+ unsigned long vmalloc_size);
+void opal_free_sg_list(struct opal_sg_list *sg);
+#endif /* __OPAL_API_H */
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 2deaadf..4373010 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -763,230 +763,6 @@ struct opal_i2c_request {
__be64 buffer_ra; /* Buffer real address */
};
-/* /sys/firmware/opal */
-extern struct kobject *opal_kobj;
-
-/* /ibm,opal */
-extern struct device_node *opal_node;
-
-/* API functions */
-int64_t opal_invalid_call(void);
-int64_t opal_console_write(int64_t term_number, __be64 *length,
- const uint8_t *buffer);
-int64_t opal_console_read(int64_t term_number, __be64 *length,
- uint8_t *buffer);
-int64_t opal_console_write_buffer_space(int64_t term_number,
- __be64 *length);
-int64_t opal_rtc_read(__be32 *year_month_day,
- __be64 *hour_minute_second_millisecond);
-int64_t opal_rtc_write(uint32_t year_month_day,
- uint64_t hour_minute_second_millisecond);
-int64_t opal_tpo_read(uint64_t token, __be32 *year_mon_day, __be32 *hour_min);
-int64_t opal_tpo_write(uint64_t token, uint32_t year_mon_day,
- uint32_t hour_min);
-int64_t opal_cec_power_down(uint64_t request);
-int64_t opal_cec_reboot(void);
-int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset);
-int64_t opal_write_nvram(uint64_t buffer, uint64_t size, uint64_t offset);
-int64_t opal_handle_interrupt(uint64_t isn, __be64 *outstanding_event_mask);
-int64_t opal_poll_events(__be64 *outstanding_event_mask);
-int64_t opal_pci_set_hub_tce_memory(uint64_t hub_id, uint64_t tce_mem_addr,
- uint64_t tce_mem_size);
-int64_t opal_pci_set_phb_tce_memory(uint64_t phb_id, uint64_t tce_mem_addr,
- uint64_t tce_mem_size);
-int64_t opal_pci_config_read_byte(uint64_t phb_id, uint64_t bus_dev_func,
- uint64_t offset, uint8_t *data);
-int64_t opal_pci_config_read_half_word(uint64_t phb_id, uint64_t bus_dev_func,
- uint64_t offset, __be16 *data);
-int64_t opal_pci_config_read_word(uint64_t phb_id, uint64_t bus_dev_func,
- uint64_t offset, __be32 *data);
-int64_t opal_pci_config_write_byte(uint64_t phb_id, uint64_t bus_dev_func,
- uint64_t offset, uint8_t data);
-int64_t opal_pci_config_write_half_word(uint64_t phb_id, uint64_t bus_dev_func,
- uint64_t offset, uint16_t data);
-int64_t opal_pci_config_write_word(uint64_t phb_id, uint64_t bus_dev_func,
- uint64_t offset, uint32_t data);
-int64_t opal_set_xive(uint32_t isn, uint16_t server, uint8_t priority);
-int64_t opal_get_xive(uint32_t isn, __be16 *server, uint8_t *priority);
-int64_t opal_register_exception_handler(uint64_t opal_exception,
- uint64_t handler_address,
- uint64_t glue_cache_line);
-int64_t opal_pci_eeh_freeze_status(uint64_t phb_id, uint64_t pe_number,
- uint8_t *freeze_state,
- __be16 *pci_error_type,
- __be64 *phb_status);
-int64_t opal_pci_eeh_freeze_clear(uint64_t phb_id, uint64_t pe_number,
- uint64_t eeh_action_token);
-int64_t opal_pci_eeh_freeze_set(uint64_t phb_id, uint64_t pe_number,
- uint64_t eeh_action_token);
-int64_t opal_pci_err_inject(uint64_t phb_id, uint32_t pe_no, uint32_t type,
- uint32_t func, uint64_t addr, uint64_t mask);
-int64_t opal_pci_shpc(uint64_t phb_id, uint64_t shpc_action, uint8_t *state);
-
-
-
-int64_t opal_pci_phb_mmio_enable(uint64_t phb_id, uint16_t window_type,
- uint16_t window_num, uint16_t enable);
-int64_t opal_pci_set_phb_mem_window(uint64_t phb_id, uint16_t window_type,
- uint16_t window_num,
- uint64_t starting_real_address,
- uint64_t starting_pci_address,
- uint64_t size);
-int64_t opal_pci_map_pe_mmio_window(uint64_t phb_id, uint16_t pe_number,
- uint16_t window_type, uint16_t window_num,
- uint16_t segment_num);
-int64_t opal_pci_set_phb_table_memory(uint64_t phb_id, uint64_t rtt_addr,
- uint64_t ivt_addr, uint64_t ivt_len,
- uint64_t reject_array_addr,
- uint64_t peltv_addr);
-int64_t opal_pci_set_pe(uint64_t phb_id, uint64_t pe_number, uint64_t bus_dev_func,
- uint8_t bus_compare, uint8_t dev_compare, uint8_t func_compare,
- uint8_t pe_action);
-int64_t opal_pci_set_peltv(uint64_t phb_id, uint32_t parent_pe, uint32_t child_pe,
- uint8_t state);
-int64_t opal_pci_set_mve(uint64_t phb_id, uint32_t mve_number, uint32_t pe_number);
-int64_t opal_pci_set_mve_enable(uint64_t phb_id, uint32_t mve_number,
- uint32_t state);
-int64_t opal_pci_get_xive_reissue(uint64_t phb_id, uint32_t xive_number,
- uint8_t *p_bit, uint8_t *q_bit);
-int64_t opal_pci_set_xive_reissue(uint64_t phb_id, uint32_t xive_number,
- uint8_t p_bit, uint8_t q_bit);
-int64_t opal_pci_msi_eoi(uint64_t phb_id, uint32_t hw_irq);
-int64_t opal_pci_set_xive_pe(uint64_t phb_id, uint32_t pe_number,
- uint32_t xive_num);
-int64_t opal_get_xive_source(uint64_t phb_id, uint32_t xive_num,
- __be32 *interrupt_source_number);
-int64_t opal_get_msi_32(uint64_t phb_id, uint32_t mve_number, uint32_t xive_num,
- uint8_t msi_range, __be32 *msi_address,
- __be32 *message_data);
-int64_t opal_get_msi_64(uint64_t phb_id, uint32_t mve_number,
- uint32_t xive_num, uint8_t msi_range,
- __be64 *msi_address, __be32 *message_data);
-int64_t opal_start_cpu(uint64_t thread_number, uint64_t start_address);
-int64_t opal_query_cpu_status(uint64_t thread_number, uint8_t *thread_status);
-int64_t opal_write_oppanel(oppanel_line_t *lines, uint64_t num_lines);
-int64_t opal_pci_map_pe_dma_window(uint64_t phb_id, uint16_t pe_number, uint16_t window_id,
- uint16_t tce_levels, uint64_t tce_table_addr,
- uint64_t tce_table_size, uint64_t tce_page_size);
-int64_t opal_pci_map_pe_dma_window_real(uint64_t phb_id, uint16_t pe_number,
- uint16_t dma_window_number, uint64_t pci_start_addr,
- uint64_t pci_mem_size);
-int64_t opal_pci_reset(uint64_t phb_id, uint8_t reset_scope, uint8_t assert_state);
-
-int64_t opal_pci_get_hub_diag_data(uint64_t hub_id, void *diag_buffer,
- uint64_t diag_buffer_len);
-int64_t opal_pci_get_phb_diag_data(uint64_t phb_id, void *diag_buffer,
- uint64_t diag_buffer_len);
-int64_t opal_pci_get_phb_diag_data2(uint64_t phb_id, void *diag_buffer,
- uint64_t diag_buffer_len);
-int64_t opal_pci_fence_phb(uint64_t phb_id);
-int64_t opal_pci_reinit(uint64_t phb_id, uint64_t reinit_scope, uint64_t data);
-int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action);
-int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action);
-int64_t opal_get_epow_status(__be64 *status);
-int64_t opal_set_system_attention_led(uint8_t led_action);
-int64_t opal_pci_next_error(uint64_t phb_id, __be64 *first_frozen_pe,
- __be16 *pci_error_type, __be16 *severity);
-int64_t opal_pci_poll(uint64_t phb_id);
-int64_t opal_return_cpu(void);
-int64_t opal_check_token(uint64_t token);
-int64_t opal_reinit_cpus(uint64_t flags);
-
-int64_t opal_xscom_read(uint32_t gcid, uint64_t pcb_addr, __be64 *val);
-int64_t opal_xscom_write(uint32_t gcid, uint64_t pcb_addr, uint64_t val);
-
-int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type,
- uint32_t addr, uint32_t data, uint32_t sz);
-int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type,
- uint32_t addr, __be32 *data, uint32_t sz);
-
-int64_t opal_read_elog(uint64_t buffer, uint64_t size, uint64_t log_id);
-int64_t opal_get_elog_size(__be64 *log_id, __be64 *size, __be64 *elog_type);
-int64_t opal_write_elog(uint64_t buffer, uint64_t size, uint64_t offset);
-int64_t opal_send_ack_elog(uint64_t log_id);
-void opal_resend_pending_logs(void);
-
-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_update_flash(uint64_t blk_list);
-int64_t opal_dump_init(uint8_t dump_type);
-int64_t opal_dump_info(__be32 *dump_id, __be32 *dump_size);
-int64_t opal_dump_info2(__be32 *dump_id, __be32 *dump_size, __be32 *dump_type);
-int64_t opal_dump_read(uint32_t dump_id, uint64_t buffer);
-int64_t opal_dump_ack(uint32_t dump_id);
-int64_t opal_dump_resend_notification(void);
-
-int64_t opal_get_msg(uint64_t buffer, uint64_t size);
-int64_t opal_check_completion(uint64_t buffer, uint64_t size, uint64_t token);
-int64_t opal_sync_host_reboot(void);
-int64_t opal_get_param(uint64_t token, uint32_t param_id, uint64_t buffer,
- uint64_t length);
-int64_t opal_set_param(uint64_t token, uint32_t param_id, uint64_t buffer,
- uint64_t length);
-int64_t opal_sensor_read(uint32_t sensor_hndl, int token, __be32 *sensor_data);
-int64_t opal_handle_hmi(void);
-int64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end);
-int64_t opal_unregister_dump_region(uint32_t id);
-int64_t opal_slw_set_reg(uint64_t cpu_pir, uint64_t sprn, uint64_t val);
-int64_t opal_pci_set_phb_capi_mode(uint64_t phb_id, uint64_t mode, uint64_t pe_number);
-int64_t opal_ipmi_send(uint64_t interface, struct opal_ipmi_msg *msg,
- uint64_t msg_len);
-int64_t opal_ipmi_recv(uint64_t interface, struct opal_ipmi_msg *msg,
- uint64_t *msg_len);
-int64_t opal_i2c_request(uint64_t async_token, uint32_t bus_id,
- struct opal_i2c_request *oreq);
-
-/* Internal functions */
-extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
- int depth, void *data);
-extern int early_init_dt_scan_recoverable_ranges(unsigned long node,
- const char *uname, int depth, void *data);
-
-extern int opal_get_chars(uint32_t vtermno, char *buf, int count);
-extern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len);
-
-extern void hvc_opal_init_early(void);
-
-extern int opal_notifier_register(struct notifier_block *nb);
-extern int opal_notifier_unregister(struct notifier_block *nb);
-
-extern int opal_message_notifier_register(enum OpalMessageType msg_type,
- struct notifier_block *nb);
-extern void opal_notifier_enable(void);
-extern void opal_notifier_disable(void);
-extern void opal_notifier_update_evt(uint64_t evt_mask, uint64_t evt_val);
-
-extern int __opal_async_get_token(void);
-extern int opal_async_get_token_interruptible(void);
-extern int __opal_async_release_token(int token);
-extern int opal_async_release_token(int token);
-extern int opal_async_wait_response(uint64_t token, struct opal_msg *msg);
-extern int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data);
-
-struct rtc_time;
-extern unsigned long opal_get_boot_time(void);
-extern void opal_nvram_init(void);
-extern void opal_flash_init(void);
-extern void opal_flash_term_callback(void);
-extern int opal_elog_init(void);
-extern void opal_platform_dump_init(void);
-extern void opal_sys_param_init(void);
-extern void opal_msglog_init(void);
-
-extern int opal_machine_check(struct pt_regs *regs);
-extern bool opal_mce_check_early_recovery(struct pt_regs *regs);
-extern int opal_hmi_exception_early(struct pt_regs *regs);
-extern int opal_handle_hmi_exception(struct pt_regs *regs);
-
-extern void opal_shutdown(void);
-extern int opal_resync_timebase(void);
-
-extern void opal_lpc_init(void);
-
-struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr,
- unsigned long vmalloc_size);
-void opal_free_sg_list(struct opal_sg_list *sg);
-
#endif /* __ASSEMBLY__ */
#endif /* __OPAL_H */
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 6a799b3..18bce9b 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -54,6 +54,7 @@
#include <asm/pci-bridge.h>
#include <asm/kexec.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/fadump.h>
#include <asm/debug.h>
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index 2809c98..c619ecc 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -27,6 +27,7 @@
#include <asm/iommu.h>
#include <asm/msi_bitmap.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/pci-bridge.h>
#include <asm/ppc-pci.h>
#include <asm/tce.h>
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index 1d19e79..8de102c 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -33,6 +33,7 @@
#include <asm/machdep.h>
#include <asm/msi_bitmap.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/ppc-pci.h>
#include "powernv.h"
diff --git a/arch/powerpc/platforms/powernv/opal-async.c b/arch/powerpc/platforms/powernv/opal-async.c
index 693b6cd..9bfad37 100644
--- a/arch/powerpc/platforms/powernv/opal-async.c
+++ b/arch/powerpc/platforms/powernv/opal-async.c
@@ -22,6 +22,7 @@
#include <linux/of.h>
#include <asm/machdep.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#define N_ASYNC_COMPLETIONS 64
diff --git a/arch/powerpc/platforms/powernv/opal-dump.c b/arch/powerpc/platforms/powernv/opal-dump.c
index 23260f7..d8b4c25 100644
--- a/arch/powerpc/platforms/powernv/opal-dump.c
+++ b/arch/powerpc/platforms/powernv/opal-dump.c
@@ -17,6 +17,7 @@
#include <linux/delay.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#define DUMP_TYPE_FSP 0x01
diff --git a/arch/powerpc/platforms/powernv/opal-elog.c b/arch/powerpc/platforms/powernv/opal-elog.c
index 518fe95..63d12c3 100644
--- a/arch/powerpc/platforms/powernv/opal-elog.c
+++ b/arch/powerpc/platforms/powernv/opal-elog.c
@@ -19,6 +19,7 @@
#include <linux/kobject.h>
#include <asm/uaccess.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
struct elog_obj {
struct kobject kobj;
diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
index 5c21d9c..94846aa 100644
--- a/arch/powerpc/platforms/powernv/opal-flash.c
+++ b/arch/powerpc/platforms/powernv/opal-flash.c
@@ -23,6 +23,7 @@
#include <linux/delay.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
/* FLASH status codes */
#define FLASH_NO_OP -1099 /* No operation initiated by user */
diff --git a/arch/powerpc/platforms/powernv/opal-hmi.c b/arch/powerpc/platforms/powernv/opal-hmi.c
index b322bfb..3658a36 100644
--- a/arch/powerpc/platforms/powernv/opal-hmi.c
+++ b/arch/powerpc/platforms/powernv/opal-hmi.c
@@ -27,6 +27,7 @@
#include <linux/slab.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/cputable.h>
#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c
index e4169d6..40c7115 100644
--- a/arch/powerpc/platforms/powernv/opal-lpc.c
+++ b/arch/powerpc/platforms/powernv/opal-lpc.c
@@ -20,6 +20,7 @@
#include <asm/firmware.h>
#include <asm/xics.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/prom.h>
#include <asm/uaccess.h>
#include <asm/debug.h>
diff --git a/arch/powerpc/platforms/powernv/opal-memory-errors.c b/arch/powerpc/platforms/powernv/opal-memory-errors.c
index 43db213..027988a 100644
--- a/arch/powerpc/platforms/powernv/opal-memory-errors.c
+++ b/arch/powerpc/platforms/powernv/opal-memory-errors.c
@@ -29,6 +29,7 @@
#include <asm/machdep.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/cputable.h>
static int opal_mem_err_nb_init;
diff --git a/arch/powerpc/platforms/powernv/opal-msglog.c b/arch/powerpc/platforms/powernv/opal-msglog.c
index 44ed78a..4cb0f29 100644
--- a/arch/powerpc/platforms/powernv/opal-msglog.c
+++ b/arch/powerpc/platforms/powernv/opal-msglog.c
@@ -11,6 +11,7 @@
#include <asm/io.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <linux/debugfs.h>
#include <linux/of.h>
#include <linux/types.h>
diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c
index f9896fd..c26084c 100644
--- a/arch/powerpc/platforms/powernv/opal-nvram.c
+++ b/arch/powerpc/platforms/powernv/opal-nvram.c
@@ -16,6 +16,7 @@
#include <linux/of.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/machdep.h>
static unsigned int nvram_size;
diff --git a/arch/powerpc/platforms/powernv/opal-rtc.c b/arch/powerpc/platforms/powernv/opal-rtc.c
index 37dbee1..21f8f9b 100644
--- a/arch/powerpc/platforms/powernv/opal-rtc.c
+++ b/arch/powerpc/platforms/powernv/opal-rtc.c
@@ -19,6 +19,7 @@
#include <linux/of_platform.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/firmware.h>
#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/powernv/opal-sensor.c b/arch/powerpc/platforms/powernv/opal-sensor.c
index 4ab67ef..7a41921 100644
--- a/arch/powerpc/platforms/powernv/opal-sensor.c
+++ b/arch/powerpc/platforms/powernv/opal-sensor.c
@@ -22,6 +22,7 @@
#include <linux/mutex.h>
#include <linux/of_platform.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/machdep.h>
static DEFINE_MUTEX(opal_sensor_mutex);
diff --git a/arch/powerpc/platforms/powernv/opal-sysparam.c b/arch/powerpc/platforms/powernv/opal-sysparam.c
index 9d1acf2..2d1c486 100644
--- a/arch/powerpc/platforms/powernv/opal-sysparam.c
+++ b/arch/powerpc/platforms/powernv/opal-sysparam.c
@@ -25,6 +25,7 @@
#include <linux/gfp.h>
#include <linux/stat.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#define MAX_PARAM_DATA_LEN 64
diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c b/arch/powerpc/platforms/powernv/opal-xscom.c
index 7634d1c..ce5642a 100644
--- a/arch/powerpc/platforms/powernv/opal-xscom.c
+++ b/arch/powerpc/platforms/powernv/opal-xscom.c
@@ -18,6 +18,7 @@
#include <asm/machdep.h>
#include <asm/firmware.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/scom.h>
/*
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index f10b9ec..2925cf0 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -26,6 +26,7 @@
#include <asm/machdep.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/firmware.h>
#include <asm/mce.h>
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 3bc5917..28810bc 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -32,6 +32,7 @@
#include <asm/msi_bitmap.h>
#include <asm/ppc-pci.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/iommu.h>
#include <asm/tce.h>
#include <asm/xics.h>
diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
index 6ef6d4d..7261eb8e 100644
--- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
+++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
@@ -29,6 +29,7 @@
#include <asm/msi_bitmap.h>
#include <asm/ppc-pci.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/iommu.h>
#include <asm/tce.h>
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 4945e87..c8a035a 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -29,6 +29,7 @@
#include <asm/msi_bitmap.h>
#include <asm/ppc-pci.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/iommu.h>
#include <asm/tce.h>
#include <asm/firmware.h>
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index d2de7d5..9fe6fe3 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -34,6 +34,7 @@
#include <asm/xics.h>
#include <asm/rtas.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/kexec.h>
#include <asm/smp.h>
#include <asm/cputhreads.h>
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index fc34025..94d8ca0 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -30,6 +30,7 @@
#include <asm/cputhreads.h>
#include <asm/xics.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/runlatch.h>
#include <asm/code-patching.h>
#include <asm/dbell.h>
diff --git a/arch/powerpc/platforms/powernv/subcore.c b/arch/powerpc/platforms/powernv/subcore.c
index f60f80a..1a1d59d 100644
--- a/arch/powerpc/platforms/powernv/subcore.c
+++ b/arch/powerpc/platforms/powernv/subcore.c
@@ -21,6 +21,7 @@
#include <asm/kvm_ppc.h>
#include <asm/machdep.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/smp.h>
#include "subcore.h"
diff --git a/arch/powerpc/sysdev/xics/ics-opal.c b/arch/powerpc/sysdev/xics/ics-opal.c
index 4ba554e..983b6f4 100644
--- a/arch/powerpc/sysdev/xics/ics-opal.c
+++ b/arch/powerpc/sysdev/xics/ics-opal.c
@@ -29,6 +29,7 @@
#include <asm/errno.h>
#include <asm/xics.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/firmware.h>
static int ics_opal_mangle_server(int server)
diff --git a/drivers/char/ipmi/ipmi_powernv.c b/drivers/char/ipmi/ipmi_powernv.c
index 79524ed..86f17f2 100644
--- a/drivers/char/ipmi/ipmi_powernv.c
+++ b/drivers/char/ipmi/ipmi_powernv.c
@@ -17,7 +17,7 @@
#include <linux/of.h>
#include <asm/opal.h>
-
+#include <asm/opal-api.h>
struct ipmi_smi_powernv {
u64 interface_id;
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
index febe817..fb5ae1b 100644
--- a/drivers/hwmon/ibmpowernv.c
+++ b/drivers/hwmon/ibmpowernv.c
@@ -29,6 +29,7 @@
#include <linux/platform_device.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <linux/err.h>
#define MAX_ATTR_LEN 32
diff --git a/drivers/i2c/busses/i2c-opal.c b/drivers/i2c/busses/i2c-opal.c
index 16f90b1..dec8892 100644
--- a/drivers/i2c/busses/i2c-opal.c
+++ b/drivers/i2c/busses/i2c-opal.c
@@ -27,6 +27,7 @@
#include <asm/firmware.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
static int i2c_opal_translate_error(int rc)
{
diff --git a/drivers/rtc/rtc-opal.c b/drivers/rtc/rtc-opal.c
index 95f6521..5b82541 100644
--- a/drivers/rtc/rtc-opal.c
+++ b/drivers/rtc/rtc-opal.c
@@ -27,6 +27,7 @@
#include <linux/platform_device.h>
#include <linux/of.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include <asm/firmware.h>
static void opal_to_tm(u32 y_m_d, u64 h_m_s_ms, struct rtc_time *tm)
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
index 071551b..8d4a91d 100644
--- a/drivers/tty/hvc/hvc_opal.c
+++ b/drivers/tty/hvc/hvc_opal.c
@@ -36,6 +36,7 @@
#include <asm/hvsi.h>
#include <asm/udbg.h>
#include <asm/opal.h>
+#include <asm/opal-api.h>
#include "hvc_console.h"
--
1.7.10.4
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 4373010..240ee1c 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -398,9 +398,9 @@ struct opal_msg {
/* System parameter permission */
enum OpalSysparamPerm {
- OPAL_SYSPARAM_READ = 0x1,
- OPAL_SYSPARAM_WRITE = 0x2,
- OPAL_SYSPARAM_RW = (OPAL_SYSPARAM_READ | OPAL_SYSPARAM_WRITE),
+ OPAL_SYSPARAM_READ = 0x1,
+ OPAL_SYSPARAM_WRITE = 0x2,
+ OPAL_SYSPARAM_RW = (OPAL_SYSPARAM_READ | OPAL_SYSPARAM_WRITE),
};
enum {
--
1.7.10.4
this adds CAPI and EPOW parts to opal.h that previously were only
in firmware opal.h
Currently unused, but gets us really close to being able to share
opal.h between firmware and linux.
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 52 +++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 240ee1c..214a106 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -414,6 +414,46 @@ struct opal_ipmi_msg {
uint8_t data[];
};
+/*
+ * EPOW status sharing (OPAL and the host)
+ *
+ * The host will pass on OPAL, a buffer of length OPAL_SYSEPOW_MAX
+ * with individual elements being 16 bits wide to fetch the system
+ * wide EPOW status. Each element in the buffer will contain the
+ * EPOW status in it's bit representation for a particular EPOW sub
+ * class as defiend here. So multiple detailed EPOW status bits
+ * specific for any sub class can be represented in a single buffer
+ * element as it's bit representation.
+ */
+
+/* System EPOW type */
+enum OpalSysEpow {
+ OPAL_SYSEPOW_POWER = 0, /* Power EPOW */
+ OPAL_SYSEPOW_TEMP = 1, /* Temperature EPOW */
+ OPAL_SYSEPOW_COOLING = 2, /* Cooling EPOW */
+ OPAL_SYSEPOW_MAX = 3, /* Max EPOW categories */
+};
+
+/* Power EPOW */
+enum OpalSysPower {
+ OPAL_SYSPOWER_UPS = 0x0001, /* System on UPS power */
+ OPAL_SYSPOWER_CHNG = 0x0002, /* System power configuration change */
+ OPAL_SYSPOWER_FAIL = 0x0004, /* System impending power failure */
+ OPAL_SYSPOWER_INCL = 0x0008, /* System incomplete power */
+};
+
+/* Temperature EPOW */
+enum OpalSysTemp {
+ OPAL_SYSTEMP_AMB = 0x0001, /* System over ambient temperature */
+ OPAL_SYSTEMP_INT = 0x0002, /* System over internal temperature */
+ OPAL_SYSTEMP_HMD = 0x0004, /* System over ambient humidity */
+};
+
+/* Cooling EPOW */
+enum OpalSysCooling {
+ OPAL_SYSCOOL_INSF = 0x0001, /* System insufficient cooling */
+};
+
/* FSP memory errors handling */
enum OpalMemErr_Version {
OpalMemErr_V1 = 1,
@@ -741,6 +781,18 @@ struct opal_sg_list {
#define OPAL_DUMP_REGION_LOG_BUF 0x80
#define OPAL_DUMP_REGION_HOST_END 0xFF
+/* CAPI modes for PHB */
+enum {
+ OPAL_PHB_CAPI_MODE_PCIE = 0,
+ OPAL_PHB_CAPI_MODE_CAPI = 1,
+ OPAL_PHB_CAPI_MODE_SNOOP_OFF = 2,
+ OPAL_PHB_CAPI_MODE_SNOOP_ON = 3,
+};
+
+/* CAPI feature flags (in device-tree) */
+#define OPAL_PHB_CAPI_FLAG_SNOOP_CONTROL 0x00000001
+#define OPAL_PHB_CAPI_FLAG_REVERT_TO_PCIE 0x00000002
+
/* We calculate number of sg entries based on PAGE_SIZE */
#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
--
1.7.10.4
Some enums in firmware opal.h were missing from linux opal.h, add them.
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 214a106..c09cf66 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -244,8 +244,13 @@ enum OpalShpcAction {
};
enum OpalShpcLinkState {
- OPAL_SHPC_LINK_DOWN = 0,
- OPAL_SHPC_LINK_UP = 1
+ OPAL_SHPC_LINK_DOWN = 0,
+ OPAL_SHPC_LINK_UP_x1 = 1,
+ OPAL_SHPC_LINK_UP_x2 = 2,
+ OPAL_SHPC_LINK_UP_x4 = 4,
+ OPAL_SHPC_LINK_UP_x8 = 8,
+ OPAL_SHPC_LINK_UP_x16 = 16,
+ OPAL_SHPC_LINK_UP_x32 = 32
};
enum OpalMmioWindowType {
@@ -253,10 +258,15 @@ enum OpalMmioWindowType {
OPAL_M64_WINDOW_TYPE = 2,
OPAL_IO_WINDOW_TYPE = 3
};
+
enum OpalShpcSlotState {
OPAL_SHPC_DEV_NOT_PRESENT = 0,
OPAL_SHPC_DEV_PRESENT = 1
};
+enum OpalShpcPowerState {
+ OPAL_SHPC_POWER_OFF = 0,
+ OPAL_SHPC_POWER_ON = 1
+};
enum OpalExceptionHandler {
OPAL_MACHINE_CHECK_HANDLER = 1,
@@ -367,6 +377,11 @@ enum OpalEpowStatus {
OPAL_EPOW_OVER_INTERNAL_TEMP = 3
};
+enum OpalCheckTokenStatus {
+ OPAL_TOKEN_ABSENT = 0,
+ OPAL_TOKEN_PRESENT = 1
+};
+
/*
* Address cycle types for LPC accesses. These also correspond
* to the content of the first cell of the "reg" property for
@@ -536,6 +551,7 @@ enum OpalHMI_ErrType {
OpalHMI_ERROR_SCOM_FIR,
OpalHMI_ERROR_DEBUG_TRIG_FIR,
OpalHMI_ERROR_HYP_RESOURCE,
+ OpalHMI_ERROR_CAPP_RECOVERY,
};
struct OpalHMIEvent {
--
1.7.10.4
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index c09cf66..2aaa861 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -346,6 +346,11 @@ enum OpalPciResetScope {
};
enum OpalPciReinitScope {
+ /*
+ * Note: we chose values that do not overlap
+ * OpalPciResetScope as OPAL v2 used the same
+ * enum for both
+ */
OPAL_REINIT_PCI_DEV = 1000
};
@@ -423,10 +428,10 @@ enum {
};
struct opal_ipmi_msg {
- uint8_t version;
- uint8_t netfn;
- uint8_t cmd;
- uint8_t data[];
+ uint8_t version;
+ uint8_t netfn;
+ uint8_t cmd;
+ uint8_t data[];
};
/*
@@ -477,7 +482,6 @@ enum OpalMemErr_Version {
enum OpalMemErrType {
OPAL_MEM_ERR_TYPE_RESILIENCE = 0,
OPAL_MEM_ERR_TYPE_DYN_DALLOC,
- OPAL_MEM_ERR_TYPE_SCRUB,
};
/* Memory Reilience error type */
@@ -731,11 +735,10 @@ struct OpalIoPhb3ErrorData {
__be64 errorClass;
__be64 correlator;
+ /* PHB3 MMIO Error Regs */
__be64 nFir; /* 000 */
__be64 nFirMask; /* 003 */
__be64 nFirWOF; /* 008 */
-
- /* PHB3 MMIO Error Regs */
__be64 phbPlssr; /* 120 */
__be64 phbCsr; /* 110 */
__be64 lemFir; /* C00 */
@@ -772,7 +775,7 @@ typedef struct oppanel_line {
} oppanel_line_t;
/*
- * SG entry
+ * SG entries
*
* WARNING: The current implementation requires each entry
* to represent a block that is 4k aligned *and* each block
@@ -783,7 +786,11 @@ struct opal_sg_entry {
__be64 length;
};
-/* SG list */
+/*
+ * Candiate image SG list.
+ *
+ * length = VER | length
+ */
struct opal_sg_list {
__be64 length;
__be64 next;
--
1.7.10.4
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 2aaa861..b60a25a 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -12,6 +12,12 @@
#ifndef __OPAL_H
#define __OPAL_H
+#ifdef __SKIBOOT__
+#ifndef __ASSEMBLY__
+#include <types.h>
+#endif /* __ASSEMBLY__ */
+#endif /* __SKIBOOT__ */
+
/****** OPAL APIs ******/
/* Return codes */
@@ -164,8 +170,6 @@
#ifndef __ASSEMBLY__
-#include <linux/notifier.h>
-
/* Other enums */
enum OpalVendorApiTokens {
OPAL_START_VENDOR_API_RANGE = 1000, OPAL_END_VENDOR_API_RANGE = 1999
--
1.7.10.4
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal-api.h | 4 ++++
arch/powerpc/include/asm/opal.h | 4 ----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
index c4009dd..172d08e 100644
--- a/arch/powerpc/include/asm/opal-api.h
+++ b/arch/powerpc/include/asm/opal-api.h
@@ -237,4 +237,8 @@ extern void opal_lpc_init(void);
struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr,
unsigned long vmalloc_size);
void opal_free_sg_list(struct opal_sg_list *sg);
+
+/* We calculate number of sg entries based on PAGE_SIZE */
+#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
+
#endif /* __OPAL_API_H */
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index b60a25a..2441f36 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -820,10 +820,6 @@ enum {
#define OPAL_PHB_CAPI_FLAG_SNOOP_CONTROL 0x00000001
#define OPAL_PHB_CAPI_FLAG_REVERT_TO_PCIE 0x00000002
-/* We calculate number of sg entries based on PAGE_SIZE */
-#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
-
-
/* OPAL I2C request */
struct opal_i2c_request {
uint8_t type;
--
1.7.10.4
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 2441f36..68ce7ef 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -612,13 +612,13 @@ struct OpalIoP7IOCErrorData {
__be64 biLdcp2; /* 3C0110, 3C0128 */
__be64 biFenceStatus; /* 3C0130, 3C0130 */
- u8 biDownbound; /* BI Downbound or Upbound */
+ uint8_t biDownbound; /* BI Downbound or Upbound */
}bi;
struct OpalIoP7IOCCiErrorData {
__be64 ciPortStatus; /* 3Dn008 */
__be64 ciPortLdcp; /* 3Dn010 */
- u8 ciPort; /* Index of CI port: 0/1 */
+ uint8_t ciPort; /* Index of CI port: 0/1 */
}ci;
};
};
--
1.7.10.4
This finally syncs the content of opal.h between linux and firmware
Signed-off-by: Stewart Smith <[email protected]>
---
arch/powerpc/include/asm/opal.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 68ce7ef..6ea59ca 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -334,7 +334,7 @@ enum OpalMveEnableAction {
OPAL_ENABLE_MVE = 1
};
-enum OpalM64EnableAction {
+enum OpalM64Action {
OPAL_DISABLE_M64 = 0,
OPAL_ENABLE_M64_SPLIT = 1,
OPAL_ENABLE_M64_NON_SPLIT = 2
@@ -774,8 +774,8 @@ enum {
};
typedef struct oppanel_line {
- const char * line;
- uint64_t line_len;
+ __be64 line;
+ __be64 line_len;
} oppanel_line_t;
/*
--
1.7.10.4
On Tue, 2015-02-10 at 13:26 +1100, Stewart Smith wrote:
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -1481,9 +1481,9 @@ int pnv_phb_to_cxl(struct pci_dev *dev)
>
> pe_info(pe, "Switching PHB to CXL\n");
>
> - rc = opal_pci_set_phb_cxl_mode(phb->opal_id, 1, pe->pe_number);
> + rc = opal_pci_set_phb_capi_mode(phb->opal_id, 1, pe->pe_number);
> if (rc)
> - dev_err(&dev->dev, "opal_pci_set_phb_cxl_mode failed: %i\n", rc);
> + dev_err(&dev->dev, "opal_pci_set_phb_capi_mode failed: %i\n", rc);
>
> return rc;
> }
Add a comment above the call: /* CAPI is the IBM/Firmware name for "CXL" */
Cheers,
Ben.
On Tue, 2015-02-10 at 13:26 +1100, Stewart Smith wrote:
> This patch series takes a careful step-by-step process to sync the
> opal.h header file (definition of interface to OPAL firmware) with
> opal.h in firmware.
>
> Each patch is designed to be as obvious as possible so that it's
> easy for someone else to prove that I haven't messed it up anywhere.
>
> In the process of doing this, I fixed a few things in firmware too,
> so this matches skiboot at 4681ed9, which is a little after the most
> recent skiboot release (4.1.1).
>
> The biggest change is moving the function prototypes for API calls
> out to opal-api.h.
Hi Stewart,
I'm going to be a total pain, and suggest that this is the wrong approach :)
I was on board until patch 15, where you have to add an #ifdef SKIBOOT to guard
an include, and you have to remove an include on the Linux side.
I think the better solution would be to pull all the common parts out into a
new file, opal-api.h. That file would define the API between Linux & Skiboot,
and absolutely nothing else.
Both Linux and Skiboot would continue to have an opal.h, which would include
opal-api.h, and then anything else needed on either side to make a functioning
opal.h - eg. other includes & definitions (SG_ENTRIES_PER_NODE).
It would also have the advantage that because opal-api.h is a new file, we can
get it synced from the beginning and not worry about all the whitespace &
rearranging patches. ie. there'd just be one patch on both sides to add the new
file and move definitions into it from opal.h.
If you don't violently disagree I'll do a patch for that and we can see how it
looks?
cheers
Michael Ellerman <[email protected]> writes:
> I'm going to be a total pain, and suggest that this is the wrong approach :)
>
> I was on board until patch 15, where you have to add an #ifdef SKIBOOT to guard
> an include, and you have to remove an include on the Linux side.
(the Linux include was actually not used it seems)
> I think the better solution would be to pull all the common parts out into a
> new file, opal-api.h. That file would define the API between Linux & Skiboot,
> and absolutely nothing else.
Sounds fine.
> Both Linux and Skiboot would continue to have an opal.h, which would include
> opal-api.h, and then anything else needed on either side to make a functioning
> opal.h - eg. other includes & definitions (SG_ENTRIES_PER_NODE).
>
> It would also have the advantage that because opal-api.h is a new file, we can
> get it synced from the beginning and not worry about all the whitespace &
> rearranging patches. ie. there'd just be one patch on both sides to add the new
> file and move definitions into it from opal.h.
Sure. I was doing it bit by bit just so that it was reviewable that I
didn't miss anything or violently screw anything up. Plus, there were
things that should be changed in skiboot as well.
> If you don't violently disagree I'll do a patch for that and we can see how it
> looks?
Not violently :)
I'd go back and do a similar thing to skiboot to make them match again
though, having linux/opal-api.h match skiboot/opal.h would just cause
swearing fits :)