Commit 0d7cd855 authored by Jeremy Kerr's avatar Jeremy Kerr Committed by Michael Ellerman

powerpc/powernv: Add opal-prd channel

This change adds a char device to access the "PRD" (processor runtime
diagnostics) channel to OPAL firmware.

Includes contributions from Vaidyanathan Srinivasan, Neelesh Gupta &
Vishal Kulkarni.
Signed-off-by: default avatarNeelesh Gupta <neelegup@linux.vnet.ibm.com>
Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
Acked-by: default avatarStewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 594fcb9e
...@@ -153,7 +153,8 @@ ...@@ -153,7 +153,8 @@
#define OPAL_FLASH_READ 110 #define OPAL_FLASH_READ 110
#define OPAL_FLASH_WRITE 111 #define OPAL_FLASH_WRITE 111
#define OPAL_FLASH_ERASE 112 #define OPAL_FLASH_ERASE 112
#define OPAL_LAST 112 #define OPAL_PRD_MSG 113
#define OPAL_LAST 113
/* Device tree flags */ /* Device tree flags */
...@@ -359,6 +360,7 @@ enum opal_msg_type { ...@@ -359,6 +360,7 @@ enum opal_msg_type {
OPAL_MSG_SHUTDOWN, /* params[0] = 1 reboot, 0 shutdown */ OPAL_MSG_SHUTDOWN, /* params[0] = 1 reboot, 0 shutdown */
OPAL_MSG_HMI_EVT, OPAL_MSG_HMI_EVT,
OPAL_MSG_DPO, OPAL_MSG_DPO,
OPAL_MSG_PRD,
OPAL_MSG_TYPE_MAX, OPAL_MSG_TYPE_MAX,
}; };
...@@ -681,6 +683,23 @@ typedef struct oppanel_line { ...@@ -681,6 +683,23 @@ typedef struct oppanel_line {
__be64 line_len; __be64 line_len;
} oppanel_line_t; } oppanel_line_t;
enum opal_prd_msg_type {
OPAL_PRD_MSG_TYPE_INIT = 0, /* HBRT --> OPAL */
OPAL_PRD_MSG_TYPE_FINI, /* HBRT/kernel --> OPAL */
OPAL_PRD_MSG_TYPE_ATTN, /* HBRT <-- OPAL */
OPAL_PRD_MSG_TYPE_ATTN_ACK, /* HBRT --> OPAL */
OPAL_PRD_MSG_TYPE_OCC_ERROR, /* HBRT <-- OPAL */
OPAL_PRD_MSG_TYPE_OCC_RESET, /* HBRT <-- OPAL */
};
struct opal_prd_msg_header {
uint8_t type;
uint8_t pad[1];
__be16 size;
};
struct opal_prd_msg;
/* /*
* SG entries * SG entries
* *
......
...@@ -194,6 +194,7 @@ int64_t opal_ipmi_recv(uint64_t interface, struct opal_ipmi_msg *msg, ...@@ -194,6 +194,7 @@ int64_t opal_ipmi_recv(uint64_t interface, struct opal_ipmi_msg *msg,
uint64_t *msg_len); uint64_t *msg_len);
int64_t opal_i2c_request(uint64_t async_token, uint32_t bus_id, int64_t opal_i2c_request(uint64_t async_token, uint32_t bus_id,
struct opal_i2c_request *oreq); struct opal_i2c_request *oreq);
int64_t opal_prd_msg(struct opal_prd_msg *msg);
int64_t opal_flash_read(uint64_t id, uint64_t offset, uint64_t buf, int64_t opal_flash_read(uint64_t id, uint64_t offset, uint64_t buf,
uint64_t size, uint64_t token); uint64_t size, uint64_t token);
......
/*
* OPAL Runtime Diagnostics interface driver
* Supported on POWERNV platform
*
* (C) Copyright IBM 2015
*
* Author: Vaidyanathan Srinivasan <svaidy at linux.vnet.ibm.com>
* Author: Jeremy Kerr <jk@ozlabs.org>
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _UAPI_ASM_POWERPC_OPAL_PRD_H_
#define _UAPI_ASM_POWERPC_OPAL_PRD_H_
#include <linux/types.h>
/**
* The version of the kernel interface of the PRD system. This describes the
* interface available for the /dev/opal-prd device. The actual PRD message
* layout and content is private to the firmware <--> userspace interface, so
* is not covered by this versioning.
*
* Future interface versions are backwards-compatible; if a later kernel
* version is encountered, functionality provided in earlier versions
* will work.
*/
#define OPAL_PRD_KERNEL_VERSION 1
#define OPAL_PRD_GET_INFO _IOR('o', 0x01, struct opal_prd_info)
#define OPAL_PRD_SCOM_READ _IOR('o', 0x02, struct opal_prd_scom)
#define OPAL_PRD_SCOM_WRITE _IOW('o', 0x03, struct opal_prd_scom)
#ifndef __ASSEMBLY__
struct opal_prd_info {
__u64 version;
__u64 reserved[3];
};
struct opal_prd_scom {
__u64 chip;
__u64 addr;
__u64 data;
__s64 rc;
};
#endif /* __ASSEMBLY__ */
#endif /* _UAPI_ASM_POWERPC_OPAL_PRD_H */
...@@ -19,3 +19,10 @@ config PPC_POWERNV ...@@ -19,3 +19,10 @@ config PPC_POWERNV
select CPU_FREQ_GOV_CONSERVATIVE select CPU_FREQ_GOV_CONSERVATIVE
select PPC_DOORBELL select PPC_DOORBELL
default y default y
config OPAL_PRD
tristate 'OPAL PRD driver'
depends on PPC_POWERNV
help
This enables the opal-prd driver, a facility to run processor
recovery diagnostics on OpenPower machines
...@@ -9,3 +9,4 @@ obj-$(CONFIG_EEH) += eeh-powernv.o ...@@ -9,3 +9,4 @@ obj-$(CONFIG_EEH) += eeh-powernv.o
obj-$(CONFIG_PPC_SCOM) += opal-xscom.o obj-$(CONFIG_PPC_SCOM) += opal-xscom.o
obj-$(CONFIG_MEMORY_FAILURE) += opal-memory-errors.o obj-$(CONFIG_MEMORY_FAILURE) += opal-memory-errors.o
obj-$(CONFIG_TRACEPOINTS) += opal-tracepoints.o obj-$(CONFIG_TRACEPOINTS) += opal-tracepoints.o
obj-$(CONFIG_OPAL_PRD) += opal-prd.o
This diff is collapsed.
...@@ -296,3 +296,4 @@ OPAL_CALL(opal_i2c_request, OPAL_I2C_REQUEST); ...@@ -296,3 +296,4 @@ OPAL_CALL(opal_i2c_request, OPAL_I2C_REQUEST);
OPAL_CALL(opal_flash_read, OPAL_FLASH_READ); OPAL_CALL(opal_flash_read, OPAL_FLASH_READ);
OPAL_CALL(opal_flash_write, OPAL_FLASH_WRITE); OPAL_CALL(opal_flash_write, OPAL_FLASH_WRITE);
OPAL_CALL(opal_flash_erase, OPAL_FLASH_ERASE); OPAL_CALL(opal_flash_erase, OPAL_FLASH_ERASE);
OPAL_CALL(opal_prd_msg, OPAL_PRD_MSG);
...@@ -711,9 +711,10 @@ static int __init opal_init(void) ...@@ -711,9 +711,10 @@ static int __init opal_init(void)
opal_msglog_init(); opal_msglog_init();
} }
/* Initialize platform devices: IPMI backend & flash interface */ /* Initialize platform devices: IPMI backend, PRD & flash interface */
opal_pdev_init(opal_node, "ibm,opal-ipmi"); opal_pdev_init(opal_node, "ibm,opal-ipmi");
opal_pdev_init(opal_node, "ibm,opal-flash"); opal_pdev_init(opal_node, "ibm,opal-flash");
opal_pdev_init(opal_node, "ibm,opal-prd");
return 0; return 0;
} }
...@@ -752,6 +753,7 @@ EXPORT_SYMBOL_GPL(opal_ipmi_recv); ...@@ -752,6 +753,7 @@ EXPORT_SYMBOL_GPL(opal_ipmi_recv);
EXPORT_SYMBOL_GPL(opal_flash_read); EXPORT_SYMBOL_GPL(opal_flash_read);
EXPORT_SYMBOL_GPL(opal_flash_write); EXPORT_SYMBOL_GPL(opal_flash_write);
EXPORT_SYMBOL_GPL(opal_flash_erase); EXPORT_SYMBOL_GPL(opal_flash_erase);
EXPORT_SYMBOL_GPL(opal_prd_msg);
/* Convert a region of vmalloc memory to an opal sg list */ /* Convert a region of vmalloc memory to an opal sg list */
struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr, struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr,
......
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