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

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
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -153,7 +153,8 @@
#define OPAL_FLASH_READ				110
#define OPAL_FLASH_WRITE			111
#define OPAL_FLASH_ERASE			112
#define OPAL_LAST				112
#define OPAL_PRD_MSG				113
#define OPAL_LAST				113

/* Device tree flags */

@@ -359,6 +360,7 @@ enum opal_msg_type {
	OPAL_MSG_SHUTDOWN,		/* params[0] = 1 reboot, 0 shutdown */
	OPAL_MSG_HMI_EVT,
	OPAL_MSG_DPO,
	OPAL_MSG_PRD,
	OPAL_MSG_TYPE_MAX,
};

@@ -681,6 +683,23 @@ typedef struct oppanel_line {
	__be64 line_len;
} 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
 *
+1 −0
Original line number Diff line number Diff line
@@ -194,6 +194,7 @@ 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);
int64_t opal_prd_msg(struct opal_prd_msg *msg);

int64_t opal_flash_read(uint64_t id, uint64_t offset, uint64_t buf,
		uint64_t size, uint64_t token);
+58 −0
Original line number Diff line number Diff line
/*
 * 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 */
+7 −0
Original line number Diff line number Diff line
@@ -19,3 +19,10 @@ config PPC_POWERNV
	select CPU_FREQ_GOV_CONSERVATIVE
	select PPC_DOORBELL
	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
+1 −0
Original line number Diff line number Diff line
@@ -9,3 +9,4 @@ obj-$(CONFIG_EEH) += eeh-powernv.o
obj-$(CONFIG_PPC_SCOM)	+= opal-xscom.o
obj-$(CONFIG_MEMORY_FAILURE)	+= opal-memory-errors.o
obj-$(CONFIG_TRACEPOINTS)	+= opal-tracepoints.o
obj-$(CONFIG_OPAL_PRD)	+= opal-prd.o
Loading