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