forked from 47-studio-org/openbmc-acm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
acm.h
588 lines (513 loc) · 12.7 KB
/
acm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
/* acm.h
*
* Copyright 2016 Hewlett Packard Enterprise Development, LP
*
* Hewlett-Packard and the Hewlett-Packard logo are trademarks of
* Hewlett-Packard Development Company, L.P. in the U.S. and/or other countries.
*
* Confidential computer software. Valid license from Hewlett Packard Enterprise is required for
* possession, use or copying. Consistent with FAR 12.211 and 12.212,
* Commercial Computer Software, Computer Software Documentation, and Technical
* Data for Commercial Items are licensed to the U.S. Government under
* vendor's standard commercial license.
*/
#ifndef ACM_H
#define ACM_H
#define TIMEOUT 5
#define ACM_IN "/sys/bus/i2c/devices/3-1008/gxp_acm_in"
#define ACM_OUT "/sys/bus/i2c/devices/3-1008/gxp_acm_out"
#define ACM_PWM_IN "/sys/class/hwmon/hwmon" //This will be the base search for x/pwm0
#define ACM_PWM_FILE "/pwm0"
#define ACM_FAN_PWM_BLK 1
#define ACM_MAX_BLOCK_NUM 0x105
//extern void *pwm_thread(void *vargp);
typedef struct
{
unsigned int valid_blks[34]; //bit map of updated blocks. Up to block 0x40f in bits
}ACM_BLOCK_0; //This block is for iLO to track stats on block usage
typedef struct
{
unsigned char fan_pwms[8];
}ACM_BLOCK_1; //fan pwms to acm
typedef struct
{
unsigned char fan_cnt;
unsigned char fan_status[16];
unsigned char fan_speed[16]; //0-100%
unsigned char fan_rotors[16]; //rev 1.11
unsigned char fan_rotor_status[16];
}ACM_BLOCK_2; //fan status
typedef struct
{
unsigned char fan_override;
}ACM_BLOCK_3; //fan speed override pwm to acm
typedef struct
{
unsigned int chassis_total_pwr;
}ACM_BLOCK_4; //chassis pwr in 32 bit big endian value
typedef struct
{
unsigned short present; //1bit per pwr supply
unsigned short status; //failed
unsigned short mismatch;
unsigned short supply_ready;
unsigned short supply_input_ok;
unsigned short gen_fail_status;
unsigned short supply_enable_status;
unsigned short input_voltage[16];
}ACM_BLOCK_5;
typedef struct
{
unsigned short chassis_12v_rail_mv;
unsigned short total_input_pwr_avg;
unsigned short total_output_pwr_avg;
unsigned short rolling_avg_input_pwr;
unsigned short rolling_avg_output_pwr;
unsigned short input_peak_pwr;
unsigned short output_peak_pwr;
}ACM_BLOCK_6;
typedef struct
{
unsigned char iPDU[128];
}ACM_BLOCK_7;
typedef struct
{
unsigned char type0;
unsigned char type0_len;
unsigned char type0_ver[4];
unsigned char type1;
unsigned char type1_len;
unsigned char type1_ver[17];
unsigned char type2;
unsigned char type2_len;
unsigned char type2_name[11];
}PING_DATA;
typedef struct
{
/* union
{
unsigned char data[128];
ACM_PING_DATA acm_ping;
}acm_ping_data;
*/
union
{
PING_DATA ilo_ping;
unsigned char data[48];
}ilo_ping_data;
}ACM_BLOCK_8; //ping
typedef struct
{
unsigned char fw_update; //fw update pending
}ACM_BLOCK_9;
typedef struct
{
unsigned char chassis_asset_tag[32];
}ACM_BLOCK_A;
typedef struct
{
unsigned char chassis_fru[256];
}ACM_BLOCK_B;
typedef struct
{
unsigned char url[256]; //APM SSO url
}ACM_BLOCK_C;
//These are not in current acm spec, through 0x1A
typedef struct
{
unsigned short pic_family;
unsigned short tray_id;
unsigned short bay_id;
unsigned short fw_rev;
unsigned char tray_fru[256];
}ACM_BLOCK_15;
//block 20 is the firmware upgrade ping to acm and the only thing in the request is block number 0x20 no data.
//The request from the flash engine will include the file number of the buffer we will open it and get a handle
typedef struct
{
int file_num; //int
int file_handle; //DLBUF handle
}ACM_BLOCK_20;
typedef struct
{
unsigned short bytes;
unsigned short offset;
unsigned char percent;
unsigned char resv;
unsigned char data[1024];
}ACM_BLOCK_23;
typedef struct
{
unsigned char status; //0 ok
}ACM_BLOCK_24;
typedef struct
{
unsigned char data[256]; //Free format data for Moonshot team to do whatever they like
}ACM_BLOCK_2F;
//0x30 -0x3f Undefined power regulation
typedef struct
{
unsigned char pwr_reg_enable;
unsigned char eeprom_enable;
unsigned char pwr_reg_mode;
}ACM_BLOCK_30;
typedef struct
{
unsigned char pwr_reg_zone_cfg[256];
}ACM_BLOCK_31;
typedef struct
{
unsigned char pwr_req_set_point_cfg[160];
}ACM_BLOCK_32;
typedef struct
{
unsigned char cal_start;
unsigned char eeprom_save;
unsigned char msb_num_secs;
unsigned char lsb_num_secs;
unsigned char cal_scope;
unsigned char cal_all_zone;
unsigned char cal_time[8];
}ACM_BLOCK_33;
typedef struct
{
unsigned char cal_scope;
}ACM_BLOCK_36;
typedef struct
{
unsigned char cal_status_resp[64];
}ACM_BLOCK_37;
typedef struct
{
unsigned char node_pwm_status[160];
}ACM_BLOCK_38;
typedef struct
{
unsigned char setpoint[256];
}ACM_BLOCK_39;
typedef struct
{
unsigned char setpoint_status[160];
}ACM_BLOCK_3A;
typedef struct
{
unsigned char cal_status;
unsigned char cal_scope;
}ACM_BLOCK_3B;
//0x40 - 0x47
typedef struct
{
unsigned char PXE_MAC_ADDR[3][6]; // to acm
}ACM_BLOCK_40;
typedef struct
{
unsigned char asset_tag[256]; //server asset tag
}ACM_BLOCK_41;
typedef struct
{
unsigned char ilo_ip4v_addr[4]; //ilo ip addr to acm
unsigned char ilo_ip4v_mask[4]; //ip mask???
unsigned char mac_addr[6]; //iLO MAC addr
}ACM_BLOCK_42;
typedef struct
{
unsigned char tray_fru[512];
}ACM_BLOCK_43;
typedef struct
{
unsigned short punative_cap;
}ACM_BLOCK_44;
typedef struct
{
unsigned short dc_watts_avg_pwr_cnt;
unsigned short dc_peak_pwr_rd;
unsigned short dc_pwr_acc_msw; //big endian
unsigned short dc_pwr_acc_lsw; //big_endian
}ACM_BLOCK_45;
typedef struct
{
unsigned short dc_watts; //node power big endian
}ACM_BLOCK_46;
typedef struct
{
unsigned short avg_pwr; // avg power big endian
unsigned short avg_peak; // avg peak big endian
unsigned short rolling_avg_pwr; // 1 min rolling avg power big endian
}ACM_BLOCK_47;
//0xA1 IML log
typedef struct
{
unsigned char iml_entry[256];
}ACM_BLOCK_A1;
//B0-CF power supply fru undefined
typedef struct
{
unsigned char pwr_fru[256];
}ACM_BLOCK_B0_BF;
//C0-C7 Megacell Undefined
typedef struct
{
unsigned char id;
unsigned char bay;
unsigned char fru[256];
}ACM_BLOCK_C0;
typedef struct
{
unsigned char id;
unsigned char bay;
unsigned char megacell_regs[256];
}ACM_BLOCK_C1;
typedef struct
{
unsigned char megacell_regs_req[64];
}ACM_BLOCK_C2;
typedef struct
{
unsigned char megacell_regs_resp[256];
}ACM_BLOCK_C3;
typedef struct
{
unsigned char id;
unsigned char bay;
unsigned char megacell_data_req[62];
}ACM_BLOCK_C4;
typedef struct
{
unsigned char megacell_data_resp[256];
}ACM_BLOCK_C5;
typedef struct
{
unsigned char id;
unsigned char bay;
unsigned char data_lsb;
unsigned char data_msb;
}ACM_BLOCK_C6;
typedef struct
{
unsigned char id;
unsigned char bay;
unsigned char temp_lsb;
unsigned char temp_msb;
}ACM_BLOCK_C7;
//D0-D5 HD Zoning not snap 1
typedef struct
{
unsigned char backplane_info[256]; // hard drive backplane info.
}ACM_BLOCK_D1;
typedef struct
{
unsigned char zone_table[66]; // hard drive current zone table
}ACM_BLOCK_D2;
typedef struct
{
unsigned char zone_table[66]; // hard drive pending zone table (Type ID + SPE Node ID + Bays Data)
}ACM_BLOCK_D3;
typedef struct
{
unsigned char reset_defaults[4]; // reset to factory defaults
}ACM_BLOCK_D4;
typedef struct
{
unsigned char hdbp_id; // hard drive backplane ID.
unsigned char resv[3];
}ACM_BLOCK_D6;
//E0 - E2 power supply temps
typedef struct
{
unsigned char count; //number of power supply entries to follow
unsigned short inlet_temp[16];
}ACM_BLOCK_E0;
typedef struct
{
unsigned char count; //num of supply entries to follow
unsigned short temp[16]; //internal temp
}ACM_BLOCK_E1;
typedef struct
{
unsigned char count;
unsigned short watts[16]; //power supply total output power of 12V main. reg 0x22 in power supply
}ACM_BLOCK_E2;
typedef struct
{
unsigned short input_pwr; //total input pwr supply capacity ac watts
unsigned short output_pwr; //total power supply output power dc watts
}ACM_BLOCK_E3;
typedef struct
{
unsigned char pwr_supply_cnt; //total input pwr supplys
unsigned short inlet_temp[16];
}ACM_BLOCK_E4;
typedef struct
{
unsigned char pwr_supply_cnt; //total input pwr supplys
unsigned short highest_temp[16];
}ACM_BLOCK_E5;
typedef struct
{
unsigned char acm_temp;
unsigned char resv[3];
}ACM_BLOCK_F0;
typedef struct
{
unsigned char ambient_temp;
unsigned char resv[3];
}ACM_BLOCK_F1;
typedef struct
{
unsigned char hdd_backplane_temp;
unsigned char resv[3];
}ACM_BLOCK_F2;
typedef struct
{
unsigned char SEP_temp;
unsigned char resv[3];
}ACM_BLOCK_F3;
typedef struct
{
unsigned char hdd_efuse_temp;
unsigned char resv[3];
}ACM_BLOCK_F4;
typedef struct
{
unsigned char data[256];
}ACM_BLOCK_F5;
typedef struct
{
unsigned int nodes;
}ACM_BLOCK_100;
typedef struct
{
unsigned char fw_component_change[300];
}ACM_BLOCK_101;
typedef struct
{
unsigned char chassis_sn[10];
unsigned char chassis_pn[10];
}ACM_BLOCK_102;
typedef struct
{
unsigned char CM_Creds[512];
}ACM_BLOCK_103;
typedef struct
{
unsigned char CM_Network[287];
}ACM_BLOCK_104;
typedef struct
{
unsigned int request_id;
unsigned char priv_bit_maks[4];//Big endian order from acm for some reasons.
}ACM_BLOCK_105;
#pragma pack()
/*
NOTICE - If you add or remove any blocks then you also have to update the table(acm_idx) in acm.c
*/
typedef struct
{
ACM_BLOCK_0 block_0;
ACM_BLOCK_1 block_1;
ACM_BLOCK_2 block_2;
ACM_BLOCK_3 block_3;
ACM_BLOCK_4 block_4;
ACM_BLOCK_5 block_5;
ACM_BLOCK_6 block_6;
ACM_BLOCK_7 block_7;
ACM_BLOCK_8 block_8;
ACM_BLOCK_9 block_9;
ACM_BLOCK_A block_A;
ACM_BLOCK_B block_B;
ACM_BLOCK_C block_C;
ACM_BLOCK_15 block_15;
ACM_BLOCK_20 block_20;
ACM_BLOCK_23 block_23;
ACM_BLOCK_24 block_24;
ACM_BLOCK_2F block_2F; //special for moonshot
ACM_BLOCK_30 block_30;
ACM_BLOCK_31 block_31;
ACM_BLOCK_32 block_32;
ACM_BLOCK_33 block_33;
ACM_BLOCK_36 block_36;
ACM_BLOCK_37 block_37;
ACM_BLOCK_38 block_38;
ACM_BLOCK_39 block_39;
ACM_BLOCK_3A block_3A;
ACM_BLOCK_3B block_3B;
ACM_BLOCK_40 block_40;
ACM_BLOCK_41 block_41;
ACM_BLOCK_42 block_42;
ACM_BLOCK_43 block_43;
ACM_BLOCK_44 block_44;
ACM_BLOCK_45 block_45;
ACM_BLOCK_46 block_46;
ACM_BLOCK_47 block_47;
ACM_BLOCK_A1 block_A1;
ACM_BLOCK_B0_BF block_B0_BF[16]; //16 pwr supply frus
ACM_BLOCK_C0 block_C0;
ACM_BLOCK_C1 block_C1;
ACM_BLOCK_C2 block_C2;
ACM_BLOCK_C3 block_C3;
ACM_BLOCK_C4 block_C4;
ACM_BLOCK_C5 block_C5;
ACM_BLOCK_C6 block_C6;
ACM_BLOCK_C7 block_C7;
ACM_BLOCK_D1 block_D1;
ACM_BLOCK_D2 block_D2;
ACM_BLOCK_D3 block_D3;
ACM_BLOCK_D4 block_D4;
ACM_BLOCK_D6 block_D6;
ACM_BLOCK_E0 block_E0;
ACM_BLOCK_E1 block_E1;
ACM_BLOCK_E2 block_E2;
ACM_BLOCK_E3 block_E3;
ACM_BLOCK_E4 block_E4;
ACM_BLOCK_E5 block_E5;
ACM_BLOCK_F0 block_F0;
ACM_BLOCK_F1 block_F1;
ACM_BLOCK_F2 block_F2;
ACM_BLOCK_F3 block_F3;
ACM_BLOCK_F4 block_F4;
ACM_BLOCK_F5 block_F5;
ACM_BLOCK_100 block_100;
ACM_BLOCK_101 block_101;
ACM_BLOCK_102 block_102;
ACM_BLOCK_103 block_103;
ACM_BLOCK_104 block_104;
ACM_BLOCK_105 block_105;
}ACM_BLOCKS;
//Block types
#define SINGLE_PACKET 0 //Single packet
#define MULTI_PACKET 1 //Multi-packet
#define INVALID_PKT -1 //Unsupported
typedef struct
{
int type;
void *blk_ptr;
unsigned int blk_size;
}ACM_BLK_INDX;
struct thread_info {
pthread_t thread_id;
int thread_num;
ACM_BLK_INDX *blocks;
};
typedef enum
{
ACM_BLOCK_RD = 1,
ACM_BLOCK_WR = 2
}ACM_CMD;
#pragma pack(1)
typedef struct
{
union
{
unsigned char req_size[2];
unsigned short int big_end_req_sz;
}cmd_size;
unsigned char instruction;
union
{
unsigned char blk_num[2];
unsigned short int big_end_blk_num;
}block_num;
unsigned char data[512]; // rounds out to 8 bytes/long long
}CMD_REQ;
#pragma pack()
#endif