1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef _ASM_POWERPC_RTAS_TYPES_H
3 #define _ASM_POWERPC_RTAS_TYPES_H
4 
5 #include <linux/spinlock_types.h>
6 
7 typedef __be32 rtas_arg_t;
8 
9 struct rtas_args {
10 	__be32 token;
11 	__be32 nargs;
12 	__be32 nret;
13 	rtas_arg_t args[16];
14 	rtas_arg_t *rets;     /* Pointer to return values in args[]. */
15 };
16 
17 struct rtas_t {
18 	unsigned long entry;		/* physical address pointer */
19 	unsigned long base;		/* physical address pointer */
20 	unsigned long size;
21 	arch_spinlock_t lock;
22 	struct rtas_args args;
23 	struct device_node *dev;	/* virtual address pointer */
24 };
25 
26 struct rtas_error_log {
27 	/* Byte 0 */
28 	u8		byte0;			/* Architectural version */
29 
30 	/* Byte 1 */
31 	u8		byte1;
32 	/* XXXXXXXX
33 	 * XXX		3: Severity level of error
34 	 *    XX	2: Degree of recovery
35 	 *      X	1: Extended log present?
36 	 *       XX	2: Reserved
37 	 */
38 
39 	/* Byte 2 */
40 	u8		byte2;
41 	/* XXXXXXXX
42 	 * XXXX		4: Initiator of event
43 	 *     XXXX	4: Target of failed operation
44 	 */
45 	u8		byte3;			/* General event or error*/
46 	__be32		extended_log_length;	/* length in bytes */
47 	unsigned char	buffer[1];		/* Start of extended log */
48 						/* Variable length.      */
49 };
50 
51 /* RTAS general extended event log, Version 6. The extended log starts
52  * from "buffer" field of struct rtas_error_log defined above.
53  */
54 struct rtas_ext_event_log_v6 {
55 	/* Byte 0 */
56 	u8 byte0;
57 	/* XXXXXXXX
58 	 * X		1: Log valid
59 	 *  X		1: Unrecoverable error
60 	 *   X		1: Recoverable (correctable or successfully retried)
61 	 *    X		1: Bypassed unrecoverable error (degraded operation)
62 	 *     X	1: Predictive error
63 	 *      X	1: "New" log (always 1 for data returned from RTAS)
64 	 *       X	1: Big Endian
65 	 *        X	1: Reserved
66 	 */
67 
68 	/* Byte 1 */
69 	u8 byte1;			/* reserved */
70 
71 	/* Byte 2 */
72 	u8 byte2;
73 	/* XXXXXXXX
74 	 * X		1: Set to 1 (indicating log is in PowerPC format)
75 	 *  XXX		3: Reserved
76 	 *     XXXX	4: Log format used for bytes 12-2047
77 	 */
78 
79 	/* Byte 3 */
80 	u8 byte3;			/* reserved */
81 	/* Byte 4-11 */
82 	u8 reserved[8];			/* reserved */
83 	/* Byte 12-15 */
84 	__be32  company_id;		/* Company ID of the company	*/
85 					/* that defines the format for	*/
86 					/* the vendor specific log type	*/
87 	/* Byte 16-end of log */
88 	u8 vendor_log[1];		/* Start of vendor specific log	*/
89 					/* Variable length.		*/
90 };
91 
92 /* Vendor specific Platform Event Log Format, Version 6, section header */
93 struct pseries_errorlog {
94 	__be16 id;			/* 0x00 2-byte ASCII section ID	*/
95 	__be16 length;			/* 0x02 Section length in bytes	*/
96 	u8 version;			/* 0x04 Section version		*/
97 	u8 subtype;			/* 0x05 Section subtype		*/
98 	__be16 creator_component;	/* 0x06 Creator component ID	*/
99 	u8 data[];			/* 0x08 Start of section data	*/
100 };
101 
102 /* RTAS pseries hotplug errorlog section */
103 struct pseries_hp_errorlog {
104 	u8	resource;
105 	u8	action;
106 	u8	id_type;
107 	u8	reserved;
108 	union {
109 		__be32	drc_index;
110 		__be32	drc_count;
111 		struct { __be32 count, index; } ic;
112 		char	drc_name[1];
113 	} _drc_u;
114 };
115 
116 #endif /* _ASM_POWERPC_RTAS_TYPES_H */
117