initial import
[ps3freebsd_ps3vuart.git] / ps3sm_msg.h
blob7010f08a5c3c5a99102a468c858197169735cb5a
1 /*-
2 * Copyright (C) 2011, 2012 glevand <geoffrey.levand@mail.ru>
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer,
10 * without modification, immediately at the beginning of the file.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * $FreeBSD$
29 #ifndef _PS3SM_MSG_H
30 #define _PS3SM_MSG_H
32 enum ps3sm_service {
33 PS3SM_SID_REQ = 0x0001,
34 PS3SM_SID_EXT_EVENT = 0x0004,
35 PS3SM_SID_SET_NEXT_OP = 0x0005,
36 PS3SM_SID_REQ_ERROR = 0x0006,
37 PS3SM_SID_SET_ATTR = 0x0008,
38 PS3SM_SID_GET_INTER_LPAR_PARAM = 0x0009,
39 PS3SM_SID_SET_INTER_LPAR_PARAM = 0x000a,
40 PS3SM_SID_CTL_LED = 0x000c,
41 PS3SM_SID_RING_BUZZER = 0x0015,
44 enum ps3sm_request_type {
45 PS3SM_REQ_TYPE_SHUTDOWN = 1,
48 enum ps3sm_guest_os_id {
49 PS3SM_GOS_ID_SELF = 0,
52 enum ps3sm_external_event {
53 PS3SM_EXT_EVENT_POWER_PRESSED = 3,
54 PS3SM_EXT_EVENT_POWER_RELEASED = 4,
55 PS3SM_EXT_EVENT_RESET_PRESSED = 5,
56 PS3SM_EXT_EVENT_RESET_RELEASED = 6,
57 PS3SM_EXT_EVENT_THERMAL_ALERT = 7,
58 PS3SM_EXT_EVENT_THERMAL_CLEARED = 8,
61 enum ps3sm_next_operation {
62 PS3SM_NEXT_OP_SYS_SHUTDOWN = 1,
63 PS3SM_NEXT_OP_SYS_REBOOT = 2,
64 PS3SM_NEXT_OP_LPAR_REBOOT = 0x82,
67 enum ps3sm_wake_source {
68 PS3SM_WAKE_SRC_DEFAULT = 0,
69 PS3SM_WAKE_SRC_WOL = 0x00000400,
70 PS3SM_WAKE_SRC_POR = 0x80000000,
73 enum ps3sm_attr {
74 PS3SM_ATTR_POWER = (1 << 0),
75 PS3SM_ATTR_RESET = (1 << 1),
76 PS3SM_ATTR_THERMAL = (1 << 2),
79 #define PS3SM_VERSION 1
81 struct ps3sm_header {
82 uint8_t version;
83 uint8_t length;
84 uint8_t res1[2];
85 uint32_t payload_length;
86 uint16_t sid; /* enum ps3sm_service */
87 uint8_t res2[2];
88 uint32_t tag;
91 #define PS3SM_HDR(_p) ((struct ps3sm_header *) (_p))
93 #define PS3SM_REQ_VERSION 1
95 struct ps3sm_req {
96 struct ps3sm_header hdr;
97 uint8_t version;
98 uint8_t type; /* enum ps3sm_request_type */
99 uint8_t gos_id; /* enum ps3sm_guest_os_id */
100 uint8_t res[13];
103 #define PS3SM_EXT_EVENT_VERSION 1
105 struct ps3sm_ext_event {
106 struct ps3sm_header hdr;
107 uint8_t version;
108 uint8_t type; /* enum ps3sm_external_event */
109 uint8_t res1[2];
110 uint32_t value;
111 uint8_t res2[8];
114 #define PS3SM_SET_NEXT_OP_VERSION 3
116 struct ps3sm_set_next_op {
117 struct ps3sm_header hdr;
118 uint8_t version;
119 uint8_t type; /* enum ps3sm_next_operation */
120 uint8_t gos_id;
121 uint8_t res1;
122 uint8_t wake_src; /* enum ps3sm_wake_source */
123 uint8_t res2[8];
126 #define PS3SM_REQ_ERROR_VERSION 1
128 struct ps3sm_req_error {
129 struct ps3sm_header hdr;
130 uint8_t version;
131 uint8_t res[7];
134 #define PS3SM_SET_ATTR_VERSION 1
136 struct ps3sm_set_attr {
137 struct ps3sm_header hdr;
138 uint8_t version;
139 uint8_t res[3];
140 uint32_t attrs; /* enum ps3sm_attr */
143 #define PS3SM_CTL_LED_VERSION 1
145 struct ps3sm_ctl_led {
146 struct ps3sm_header hdr;
147 uint8_t version;
148 uint8_t arg1;
149 uint8_t arg2;
150 uint8_t res1;
151 uint8_t arg3;
152 uint8_t arg4;
153 uint8_t res2[2];
156 #define PS3SM_RING_BUZZER_VERSION 1
158 struct ps3sm_ring_buzzer {
159 struct ps3sm_header hdr;
160 uint8_t version;
161 uint8_t arg1;
162 uint8_t arg2;
163 uint8_t res;
164 uint32_t arg3;
167 static inline void
168 ps3sm_init_header(struct ps3sm_header *hdr, uint32_t payload_length,
169 uint16_t sid, uint32_t tag)
171 hdr->version = PS3SM_VERSION;
172 hdr->length = sizeof(struct ps3sm_header);
173 hdr->payload_length = payload_length;
174 hdr->sid = sid;
175 hdr->tag = tag;
178 #endif /* _PS3SM_MSG_H */