Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / tools / gen-seeprom / env-seeprom.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* Hypervisor Software File: env-seeprom.h
5*
6* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
7*
8* - Do no alter or remove copyright notices
9*
10* - Redistribution and use of this software in source and binary forms, with
11* or without modification, are permitted provided that the following
12* conditions are met:
13*
14* - Redistribution of source code must retain the above copyright notice,
15* this list of conditions and the following disclaimer.
16*
17* - Redistribution in binary form must reproduce the above copyright notice,
18* this list of conditions and the following disclaimer in the
19* documentation and/or other materials provided with the distribution.
20*
21* Neither the name of Sun Microsystems, Inc. or the names of contributors
22* may be used to endorse or promote products derived from this software
23* without specific prior written permission.
24*
25* This software is provided "AS IS," without a warranty of any kind.
26* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
27* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
28* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
29* MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
30* ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
31* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
32* OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
33* FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
34* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
35* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
36* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
37*
38* You acknowledge that this software is not designed, licensed or
39* intended for use in the design, construction, operation or maintenance of
40* any nuclear facility.
41*
42* ========== Copyright Header End ============================================
43*/
44/*
45 * id: @(#)env-seeprom.h 1.2 02/10/09
46 * purpose:
47 * copyright: Copyright 2000-2002 Sun Microsystems, Inc. All Rights Reserved
48 * copyright: Use is subject to license terms.
49 */
50
51
52struct env_parameter_data
53{
54 char *name;
55 unsigned short size;
56};
57
58#define H_POFF_SIZE 1
59#define H_SDWN_SIZE 1
60#define H_WARN_SIZE 1
61#define L_WARN_SIZE 1
62#define L_SDWN_SIZE 1
63#define L_POFF_SIZE 1
64#define POLICY_SIZE 1
65#define VB_SIZE 1
66#define RES_SIZE 1
67#define NUM_COR_SIZE 2
68
69#define COR_SIZE 2
70
71#define FAN_TSPIN_SZ 1
72#define FAN_SPD_SZ 1
73#define FAN_SETPOINT_SZ 2
74#define FAN_LOOPGAIN_SZ 2
75#define FAN_LOOPBIAS_SZ 2
76#define FAN_HYST_SZ 2
77#define FAN_TEST_INT_SZ 2
78#define FAN_TEST_RPM_SZ 2
79#define FAN_GROSS_RPM_SZ 2
80#define FAN_CTL_PAIR_SZ 1
81#define FAN_MIN_RANGE_SZ 2
82
83#define ID_SIZE 4
84#define OFFSET_SIZE 2
85#define FAN_ID_SIZE 4
86#define FAN_OFF_SIZE 2
87#define SENSOR_BLOCK_SIZE (ID_SIZE + OFFSET_SIZE)
88#define FAN_BLOCK_SIZE (FAN_ID_SIZE + FAN_OFF_SIZE)
89
90#define VER_SIZE 1
91#define NUM_SEN_SIZE 1
92#define NUM_FAN_SIZE 1
93
94struct env_parameter_data env_parameters[] =
95{
96 /* name size */
97 { "high-poweroff", H_POFF_SIZE },
98 { "high-shutdown", H_SDWN_SIZE },
99 { "high-warning", H_WARN_SIZE },
100 { "low-warning", L_WARN_SIZE },
101 { "low-shutdown", L_SDWN_SIZE },
102 { "low-poweroff", L_POFF_SIZE },
103 { "policy", POLICY_SIZE },
104 { "valid-bytes", VB_SIZE },
105 { "reserved1", RES_SIZE },
106 { "reserved2", RES_SIZE },
107 { "reserved3", RES_SIZE },
108 { "reserved4", RES_SIZE },
109 { "reserved5", RES_SIZE },
110 { "reserved6", RES_SIZE },
111 { "num-corrections", NUM_COR_SIZE },
112 { "correction", 0 },
113 { NULL, 0 },
114};
115
116struct env_parameter_data fan_parameters[] =
117{
118 /* name size */
119 { "tspin-up", FAN_TSPIN_SZ },
120 { "min-fan-spd", FAN_SPD_SZ },
121 { "setpoint", FAN_SETPOINT_SZ },
122 { "loop-gain", FAN_LOOPGAIN_SZ },
123 { "loop-bias", FAN_LOOPBIAS_SZ },
124 { "hysteresis", FAN_HYST_SZ },
125 { "test-interval", FAN_TEST_INT_SZ },
126 { "test-rpm-threshold", FAN_TEST_RPM_SZ },
127 { "gross-rpm-threshold", FAN_GROSS_RPM_SZ },
128 { "num-ctl-pairs", FAN_CTL_PAIR_SZ },
129 { "fan-min-range", FAN_MIN_RANGE_SZ },
130 { NULL, 0 },
131};
132
133/*
134 * COR_SIZE is not added because the number of corrections is dynamic
135 */
136
137#define ENV_ENTRY_SIZE (H_POFF_SIZE + H_SDWN_SIZE + H_WARN_SIZE + \
138 L_WARN_SIZE + L_SDWN_SIZE + L_POFF_SIZE + \
139 POLICY_SIZE + VB_SIZE + (6 * RES_SIZE) + \
140 NUM_COR_SIZE)
141
142/*
143 * FAN_MIN_RANGE_SIZE is not added because the number of min/range entries
144 * is dynamic.
145 */
146
147#define ENV_FAN_ENTRY_SIZE (FAN_TSPIN_SZ + FAN_SPD_SZ + FAN_SETPOINT_SZ \
148 + FAN_LOOPGAIN_SZ + FAN_LOOPBIAS_SZ \
149 + FAN_HYST_SZ + FAN_TEST_INT_SZ \
150 + FAN_TEST_RPM_SZ + FAN_GROSS_RPM_SZ \
151 + FAN_CTL_PAIR_SZ)
152
153struct id_header_data
154{
155 int num_sensors, num_fans;
156 unsigned char *id_block;
157 unsigned char *fan_block;
158};
159
160struct env_table_entry
161{
162 unsigned char env_data[ENV_ENTRY_SIZE];
163 int correction_size;
164 unsigned char *correction_data;
165 struct env_table_entry *next;
166};
167
168struct fan_table_entry
169{
170 unsigned char fan_data[ENV_FAN_ENTRY_SIZE];
171 int fan_pair_size;
172 unsigned char *fan_ctl_data;
173 struct fan_table_entry *next;
174};