powerpc/powernv: Update opal.h to add new LPC and XSCOM functions
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 15 Jul 2013 03:03:09 +0000 (13:03 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 14 Aug 2013 04:57:56 +0000 (14:57 +1000)
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/opal.h
arch/powerpc/platforms/powernv/opal-wrappers.S

index 029fe85722aaac41a6c5ff0e0ed4c3ae4dd5cfc2..c701e2be73b1ffed11aeed57824a5a8a9e4d0159 100644 (file)
@@ -124,6 +124,10 @@ extern int opal_enter_rtas(struct rtas_args *args,
 #define OPAL_PCI_POLL                          62
 #define OPAL_PCI_MSI_EOI                       63
 #define OPAL_PCI_GET_PHB_DIAG_DATA2            64
+#define OPAL_XSCOM_READ                                65
+#define OPAL_XSCOM_WRITE                       66
+#define OPAL_LPC_READ                          67
+#define OPAL_LPC_WRITE                         68
 
 #ifndef __ASSEMBLY__
 
@@ -337,6 +341,17 @@ enum OpalEpowStatus {
        OPAL_EPOW_OVER_INTERNAL_TEMP = 3
 };
 
+/*
+ * Address cycle types for LPC accesses. These also correspond
+ * to the content of the first cell of the "reg" property for
+ * device nodes on the LPC bus
+ */
+enum OpalLPCAddressType {
+       OPAL_LPC_MEM    = 0,
+       OPAL_LPC_IO     = 1,
+       OPAL_LPC_FW     = 2,
+};
+
 struct opal_machine_check_event {
        enum OpalMCE_Version    version:8;      /* 0x00 */
        uint8_t                 in_use;         /* 0x01 */
@@ -632,6 +647,14 @@ int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe,
                            uint16_t *pci_error_type, uint16_t *severity);
 int64_t opal_pci_poll(uint64_t phb_id);
 
+int64_t opal_xscom_read(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,
+                      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, uint32_t *data, uint32_t sz);
+
 /* Internal functions */
 extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data);
 
index e88863ffb13543d15d6812942a5d9560c69f5c0b..42c06fba3994ad817984d58369832db032451026 100644 (file)
@@ -111,3 +111,7 @@ OPAL_CALL(opal_pci_next_error,                      OPAL_PCI_NEXT_ERROR);
 OPAL_CALL(opal_pci_poll,                       OPAL_PCI_POLL);
 OPAL_CALL(opal_pci_msi_eoi,                    OPAL_PCI_MSI_EOI);
 OPAL_CALL(opal_pci_get_phb_diag_data2,         OPAL_PCI_GET_PHB_DIAG_DATA2);
+OPAL_CALL(opal_xscom_read,                     OPAL_XSCOM_READ);
+OPAL_CALL(opal_xscom_write,                    OPAL_XSCOM_WRITE);
+OPAL_CALL(opal_lpc_read,                       OPAL_LPC_READ);
+OPAL_CALL(opal_lpc_write,                      OPAL_LPC_WRITE);