1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#ifndef _SYS_SCHPC_MSG_H
28#define	_SYS_SCHPC_MSG_H
29
30#pragma ident	"%Z%%M%	%I%	%E% SMI"
31
32/*
33 * This header file describes the messages that are sent between the
34 * schpc Hot Plug Controller Driver running on the domain and the System
35 * Controller.
36 */
37
38#ifdef	__cplusplus
39extern "C" {
40#endif
41
42/*
43 * Format of the Get Slot Status specific part of
44 * PCI Hot Plug message.
45 */
46typedef struct {
47	uint16_t	slot_power_on 		:1, /* Slot Power is on */
48			slot_powergood		:1, /* Slot Power is good */
49			slot_powerfault		:1, /* Slot Power has faulted */
50			slot_empty		:1, /* No occupant in slot */
51			slot_freq_cap		:2, /* Slot's Freq Capability */
52			slot_freq_setting	:2, /* Slot Freq setting */
53			slot_condition		:2, /* Condition of slot */
54			slot_HEALTHY		:1, /* Value of HEALTHY# sig */
55			slot_ENUM		:1, /* Value of ENUM# sig */
56			slot_mode_cap		:1, /* Conven or PCI-X */
57			slot_mode_setting	:1, /* Conven or PCI-X */
58			reserved		:2;
59	uint8_t		slot_replystatus;
60} pci_getslot_t;
61
62/*
63 * Format of the Set Slot Status specific part of
64 * PCI Hot Plug message.
65 */
66typedef struct {
67	uint16_t	slot_power_on		:1, /* Connect Slot to bus */
68			slot_power_off		:1, /* Disconnect from bus */
69			slot_led_power		:2, /* Slot Power LED */
70			slot_led_service	:2, /* OK To Remove LED */
71			slot_led_fault		:2, /* Fault LED */
72			slot_disable_ENUM	:1, /* Disable ENUM Event */
73			slot_enable_ENUM	:1, /* Enable ENUM Event */
74			slot_disable_HEALTHY	:1, /* Disable HEALTHY EVENT */
75			slot_enable_HEALTHY	:1, /* Enable HEALTHY EVENT */
76			reserved		:4;
77	uint8_t		slot_replystatus;
78} pci_setslot_t;
79
80/*
81 * Format of the Slot Event specific part of
82 * the PCI Hot Plug message.
83 */
84typedef struct {
85	uint16_t	slot_power		:1, /* Slot Power has changed */
86			slot_presence		:1, /* occupant has been    */
87						    /* inserted or removed  */
88			slot_ENUM		:1, /* ENUM# has changed */
89			slot_HEALTHY		:1, /* HEALTHY# has changed */
90			slot_powergood		:1, /* Power is good */
91			slot_powerfault		:1, /* Power has faulted */
92			reserved		:10;
93} pci_slotevent_t;
94
95/*
96 * PCI Hot Plug message
97 */
98typedef struct {
99	uint8_t		pcimsg_node;
100	uint8_t		pcimsg_board;
101	uint8_t		pcimsg_slot;
102	uint8_t		pcimsg_revision;
103	uint8_t		pcimsg_command;
104	union {
105		pci_setslot_t	pcimsg_setslot;
106		pci_getslot_t	pcimsg_getslot;
107		pci_slotevent_t	pcimsg_slotevent;
108	} pcimsg_type;
109} pcimsg_t;
110
111/*
112 * Keys for the outgoing and incoming mailboxes
113 */
114#define	KEY_PCSC	0x50435343	/* Outgoing Mailbox 'PCSC' */
115#define	KEY_SCPC	0x53435043	/* Incoming Mailbox 'SCPC' */
116
117/*
118 * default timeout in seconds for mboxsc_getmsg calls
119 */
120#define	PCSC_TIMEOUT	30
121
122/* Commands */
123#define	PCIMSG_GETSLOTSTATUS	0x1
124#define	PCIMSG_SETSLOTSTATUS	0x2
125#define	PCIMSG_SLOTEVENT	0x3
126
127/* Message Revisions */
128#define	PCIMSG_REVISION		0x10
129#define	PCIMSG_REVISION_1_0	0x10
130
131/*
132 * Values for the slot_condition field of the get slot status command.
133 */
134#define	PCIMSG_SLOTCOND_UNKNOWN		0x0
135#define	PCIMSG_SLOTCOND_GOOD		0x1
136#define	PCIMSG_SLOTCOND_REC_FAIL	0x2
137#define	PCIMSG_SLOTCOND_OCC_FAIL	0x3
138#define	PCIMSG_SLOTCOND_NOHOTPLUG	0x4
139
140/*
141 * Values for the slot_freq_cap and slot_freq_setting fields of the get
142 * slot status command.
143 */
144#define	PCIMSG_FREQ_33MHZ	0x0
145#define	PCIMSG_FREQ_66MHZ	0x1
146#define	PCIMSG_FREQ_90MHZ	0x2
147#define	PCIMSG_FREQ_133MHZ	0x3
148
149/*
150 * Values for the slot_mode_cap and slot_mode_setting of the get
151 * slot status command.
152 */
153#define	PCIMSG_MODE_CONVEN	0x0
154#define	PCIMSG_MODE_PCIX	0x1
155
156/*
157 * Values for the PRSNT signals.
158 */
159#define	PCIMSG_PRSNT_NOADAPTER	0x0
160#define	PCIMSG_PRSNT_25W	0x1
161#define	PCIMSG_PRSNT_15W	0x2
162#define	PCIMSG_PRSNT_7_5W	0x3
163
164/*
165 * Values to turn on and off slot characteristics.
166 */
167#define	PCIMSG_ON		0x1
168#define	PCIMSG_OFF		0x0
169
170/*
171 * Values to set the power, service and fault LEDs
172 */
173#define	PCIMSG_LED_OFF		0x00
174#define	PCIMSG_LED_ON		0x01
175#define	PCIMSG_LED_FLASH	0x02
176
177/*
178 * Return values for the slot_replystatus field for the get/set slot status
179 * commands.
180 */
181#define	PCIMSG_REPLY_GOOD	0x0
182#define	PCIMSG_REPLY_FAIL	0x1
183
184#ifdef __cplusplus
185}
186#endif
187
188#endif /* _SYS_SCHPC_MSG_H */
189