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