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
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
|
/*
* gbe/gbe.c
* This file is part of the ich9deblob utility from the libreboot project
*
* Copyright (C) 2014 Steve Shenton <sgsit@libreboot.org>
* 2014,2019 Leah Rowe <info@minifree.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Provide gbe related functions.
*/
/* structs describing the data from gbe region */
#include "gbe.h"
/*
* ---------------------------------------------------------------------
* Gbe functions:
* ---------------------------------------------------------------------
*/
/* gbe checksum calculation (algorithm based on datasheet) */
uint16_t gbeGetChecksumFrom4kBuffer(uint16_t* gbeWord, uint16_t desiredValue, int gbeRegionBase)
{
int wordOffset;
uint16_t total = 0;
for (wordOffset = 0; wordOffset < 0x3F; wordOffset++)
total += gbeWord[wordOffset + (gbeRegionBase>>1)];
return desiredValue - total;
}
/* checksum calculation for 4k gbe struct (algorithm based on datasheet) */
uint16_t gbeGetChecksumFrom4kStruct(struct GBEREGIONRECORD_4K gbeStruct4k, uint16_t desiredValue)
{
return gbeGetChecksumFrom4kBuffer((uint16_t*)&gbeStruct4k, desiredValue, 0);
}
/* modify the gbe region extracted from a factory.rom dump */
struct GBEREGIONRECORD_8K deblobbedGbeStructFromFactory(struct GBEREGIONRECORD_8K gbeStruct8k)
{
unsigned int i;
/*
* http://www.intel.co.uk/content/dam/doc/application-note/82573-nvm-map-appl-note.pdf
* That is a datasheet for a later chipset. Word 40H-53H seems (as per this datasheet) to be for AMT.
* Writing over it doesn't seem to cause any harm, since the ME/AMT is already removed in libreboot.
*/
for(i = 0; i < sizeof(gbeStruct8k.backup.padding); i++) {
gbeStruct8k.backup.padding[i] = 0xFF; /* FF is correct. In the struct, this is a char buffer. */
} /* We really only need to do this for words 40h-53h, but let's just nuke the whole lot. It's all 0xFF anyway. */
/* Fix the checksum */
gbeStruct8k.backup.checkSum = gbeGetChecksumFrom4kStruct(gbeStruct8k.backup, GBECHECKSUMTOTAL);
/* Main Gbe region on X200 (as shipped by Lenovo) is broken. Fix it by over-writing it with the contents of the backup */
memcpy(&gbeStruct8k.main, &gbeStruct8k.backup, GBEREGIONSIZE_4K);
return gbeStruct8k;
}
/*
* ---------------------------------------------------------------------
* C code generator (self-writing code)
* ---------------------------------------------------------------------
*/
/*
* Generate a C (.h) header file for the C source file made by notCreatedCFileFromGbeStruct4k()
*
* Output it to a file.
*/
int notCreatedHFileForGbeCFile(char* outFileName, char* cFileName)
{
remove(outFileName); /* Remove the old file before continuing */
/* Open the file that will be written to */
FILE* fp = fopen(outFileName, "w+");
/* ------------------------------ */
fprintf(fp, "/* %s: generated C code from ich9deblob */\n", outFileName);
fprintf(fp, "/* .h header file for the gbe-generating C code (%s) */\n\n", cFileName);
fprintf(fp, "#ifndef ICH9GEN_MKGBE_H\n");
fprintf(fp, "#define ICH9GEN_MKGBE_H\n\n");
fprintf(fp, "#include <stdio.h>\n");
fprintf(fp, "#include <string.h>\n");
fprintf(fp, "#include \"../gbe/gbe.h\"\n\n");
fprintf(fp, "struct GBEREGIONRECORD_4K generatedGbeStruct4k();\n");
fprintf(fp, "struct GBEREGIONRECORD_8K generatedGbeStruct8k();\n\n");
fprintf(fp, "#endif\n");
/* ------------------------------ */
fclose(fp); /* Always close the file when done. */
return 0;
}
/*
* Generate a C source file that initializes the same data from a given
* 4KiB Gbe data structure.
*
* It will simply copy the 4KiB struct at the end to make a full 8KiB struct.
* So just pass a working 4KiB Gbe struct here and you're good to go.
*
* Output it to a file.
*/
int notCreatedCFileFromGbeStruct4k(struct GBEREGIONRECORD_4K gbeStruct4k, char* outFileName, char* headerFileName)
{
int i;
int paddingSize;
int paddingIdentical;
remove(outFileName); /* Remove the old file before continuing */
/* Open the file that will be written to */
FILE* fp = fopen(outFileName, "w+");
/* ------------------------------ */
fprintf(fp, "/* %s: generated C code from ich9deblob */\n", outFileName);
fprintf(fp, "/* .c source file for the gbe-generating C code */\n\n");
fprintf(fp, "#include \"%s\"\n\n", headerFileName);
fprintf(fp, "/* Generate a 4KiB Gbe struct, with default values. */\n");
fprintf(fp, "/* Read ../gbe/gbe.h for an explanation of the default values used here */\n\n");
fprintf(fp, "struct GBEREGIONRECORD_4K generatedGbeStruct4k()\n");
fprintf(fp, "{\n");
fprintf(fp, " int i;\n");
fprintf(fp, " struct GBEREGIONRECORD_4K gbeStruct4k;\n");
fprintf(fp, "\n");
/* Words 00h to 02h: MAC Address */
fprintf(fp, " /* MAC address (words 00h to 02h) */\n");
fprintf(fp, " /* see ../gbe/gbe.c */\n");
for (i = 0; i < 6; i++) {
fprintf(fp, " gbeStruct4k.macAddress[%d] = 0x%02x;\n", i, gbeStruct4k.macAddress[i]);
}
fprintf(fp, "\n");
/* Word 03h (Reserved) */
fprintf(fp, " /* Word 03h (Reserved) */\n");
fprintf(fp, " gbeStruct4k.reservedWord03h.reserved1_0 = 0x%02x;\n", gbeStruct4k.reservedWord03h.reserved1_0);
fprintf(fp, " gbeStruct4k.reservedWord03h.reserved1_1 = 0x%01x;\n", gbeStruct4k.reservedWord03h.reserved1_1);
fprintf(fp, " gbeStruct4k.reservedWord03h.ibaLom = 0x%01x;\n", gbeStruct4k.reservedWord03h.ibaLom);
fprintf(fp, " gbeStruct4k.reservedWord03h.reserved2 = 0x%01x;\n", gbeStruct4k.reservedWord03h.reserved2);
fprintf(fp, "\n");
/* Word 04h (Reserved) */
fprintf(fp, " /* Word 04h (Reserved) */\n");
fprintf(fp, " gbeStruct4k.reservedWord04h = 0x%04x;\n", gbeStruct4k.reservedWord04h);
fprintf(fp, "\n");
/* Word 05h (Image Version Information) */
fprintf(fp, " /* Word 05h (Image Version Information) */\n");
fprintf(fp, " gbeStruct4k.imageVersionInformation = 0x%04x;\n", gbeStruct4k.imageVersionInformation);
fprintf(fp, "\n");
/* Words 06h and 07h (Reserved) */
fprintf(fp, " /* Words 06h and 07h (Reserved) */\n");
for (i = 0; i < 2; i++) {
fprintf(fp, " gbeStruct4k.reservedWords06h07h[%d] = 0x%04x;\n", i, gbeStruct4k.reservedWords06h07h[i]);
}
fprintf(fp, "\n");
/* Words 08h and 09h (PBA Low and PBA High) */
fprintf(fp, " /* Word 08h and 09h (PBA Low and PBA High) */\n");
fprintf(fp, " gbeStruct4k.pbaLow = 0x%04x;\n", gbeStruct4k.pbaLow);
fprintf(fp, " gbeStruct4k.pbaHigh = 0x%04x;\n", gbeStruct4k.pbaHigh);
fprintf(fp, "\n");
/* Word 0Ah (PCI Initialization Control Word) */
fprintf(fp, " /* Word 0Ah (PCI Initialization Control Word) */\n");
fprintf(fp, " gbeStruct4k.pciInitializationControlWord.loadVendorDeviceId = 0x%01x;\n", gbeStruct4k.pciInitializationControlWord.loadVendorDeviceId);
fprintf(fp, " gbeStruct4k.pciInitializationControlWord.loadSubsystemId = 0x%01x;\n", gbeStruct4k.pciInitializationControlWord.loadSubsystemId);
fprintf(fp, " gbeStruct4k.pciInitializationControlWord.reserved1 = 0x%01x;\n", gbeStruct4k.pciInitializationControlWord.reserved1);
fprintf(fp, " gbeStruct4k.pciInitializationControlWord.reserved2 = 0x%01x;\n", gbeStruct4k.pciInitializationControlWord.reserved2);
fprintf(fp, " gbeStruct4k.pciInitializationControlWord.pmEnable = 0x%01x;\n", gbeStruct4k.pciInitializationControlWord.pmEnable);
fprintf(fp, " gbeStruct4k.pciInitializationControlWord.auxPwr = 0x%01x;\n", gbeStruct4k.pciInitializationControlWord.auxPwr);
fprintf(fp, " gbeStruct4k.pciInitializationControlWord.reserved3 = 0x%01x;\n", gbeStruct4k.pciInitializationControlWord.reserved3);
fprintf(fp, " gbeStruct4k.pciInitializationControlWord.reserved4 = 0x%01x;\n", gbeStruct4k.pciInitializationControlWord.reserved4);
fprintf(fp, "\n");
/* Word 0Bh (Subsystem ID) */
fprintf(fp, " /* Word 0Bh (Subsystem ID) */\n");
fprintf(fp, " gbeStruct4k.subsystemId = 0x%04x;\n", gbeStruct4k.subsystemId);
fprintf(fp, "\n");
/* Word 0Ch (Subsystem Vendor ID) */
fprintf(fp, " /* Word 0Ch (Subsystem Vendor ID) */\n");
fprintf(fp, " gbeStruct4k.subsystemVendorId = 0x%04x;\n", gbeStruct4k.subsystemVendorId);
fprintf(fp, "\n");
/* Word 0Dh (Device ID) */
fprintf(fp, " /* Word 0Dh (Device ID) */\n");
fprintf(fp, " gbeStruct4k.deviceId = 0x%04x;\n", gbeStruct4k.deviceId);
fprintf(fp, "\n");
/* Word 0Eh (Vendor ID) */
fprintf(fp, " /* Word 0Eh (Vendor ID) */\n");
fprintf(fp, " gbeStruct4k.vendorId = 0x%04x;\n", gbeStruct4k.vendorId);
fprintf(fp, "\n");
/* Word 0Fh (Device Revision ID) */
fprintf(fp, " /* Word 0Fh (Device Revision ID) */\n");
fprintf(fp, " gbeStruct4k.deviceRevId = 0x%04x;\n", gbeStruct4k.deviceRevId);
fprintf(fp, "\n");
/* Word 10h (LAN Power Consumption) */
fprintf(fp, " /* Word 10h (LAN Power Consumption) */\n");
fprintf(fp, " gbeStruct4k.lanPowerConsumption.lanD3Power = 0x%02x;\n", gbeStruct4k.lanPowerConsumption.lanD3Power);
fprintf(fp, " gbeStruct4k.lanPowerConsumption.reserved = 0x%01x;\n", gbeStruct4k.lanPowerConsumption.reserved);
fprintf(fp, " gbeStruct4k.lanPowerConsumption.lanD0Power = 0x%02x;\n", gbeStruct4k.lanPowerConsumption.lanD0Power);
fprintf(fp, "\n");
/* Words 11h and 12h (Reserved) */
fprintf(fp, " /* Words 11h and 12h (Reserved) */\n");
for (i = 0; i < 2; i++) {
fprintf(fp, " gbeStruct4k.reservedWords11h12h[%d] = 0x%04x;\n", i, gbeStruct4k.reservedWords11h12h[i]);
}
fprintf(fp, "\n");
/* Word 13h (Shared Initialization Control Word) */
fprintf(fp, " /* Word 13h (Shared Initialization Control Word) */\n");
fprintf(fp, " gbeStruct4k.sharedInitializationControlWord.reserved1 = 0x%01x;\n", gbeStruct4k.sharedInitializationControlWord.reserved1);
fprintf(fp, " gbeStruct4k.sharedInitializationControlWord.forceDuplex = 0x%01x;\n", gbeStruct4k.sharedInitializationControlWord.forceDuplex);
fprintf(fp, " gbeStruct4k.sharedInitializationControlWord.forceSpeedEnable = 0x%01x;\n", gbeStruct4k.sharedInitializationControlWord.forceSpeedEnable);
fprintf(fp, " gbeStruct4k.sharedInitializationControlWord.reserved2_0 = 0x%01x;\n", gbeStruct4k.sharedInitializationControlWord.reserved2_0);
fprintf(fp, " gbeStruct4k.sharedInitializationControlWord.reserved2_1 = 0x%01x;\n", gbeStruct4k.sharedInitializationControlWord.reserved2_1);
fprintf(fp, " gbeStruct4k.sharedInitializationControlWord.phyPowerDownEnable = 0x%01x;\n", gbeStruct4k.sharedInitializationControlWord.phyPowerDownEnable);
fprintf(fp, " gbeStruct4k.sharedInitializationControlWord.reserved3 = 0x%01x;\n", gbeStruct4k.sharedInitializationControlWord.reserved3);
fprintf(fp, " gbeStruct4k.sharedInitializationControlWord.reserved4 = 0x%01x;\n", gbeStruct4k.sharedInitializationControlWord.reserved4);
fprintf(fp, " gbeStruct4k.sharedInitializationControlWord.sign = 0x%01x;\n", gbeStruct4k.sharedInitializationControlWord.sign);
fprintf(fp, "\n");
/* Word 14h (Extended Configuration Control Word 1) */
fprintf(fp, " /* Word 14h (Extended Configuration Control Word 1) */\n");
fprintf(fp, " gbeStruct4k.extendedConfigurationControlWord1.extendedConfigurationPointer = 0x%03x;\n", gbeStruct4k.extendedConfigurationControlWord1.extendedConfigurationPointer);
fprintf(fp, " gbeStruct4k.extendedConfigurationControlWord1.oemWriteEnable = 0x%01x;\n", gbeStruct4k.extendedConfigurationControlWord1.oemWriteEnable);
fprintf(fp, " gbeStruct4k.extendedConfigurationControlWord1.reserved1 = 0x%01x;\n", gbeStruct4k.extendedConfigurationControlWord1.reserved1);
fprintf(fp, " gbeStruct4k.extendedConfigurationControlWord1.reserved2 = 0x%01x;\n", gbeStruct4k.extendedConfigurationControlWord1.reserved2);
fprintf(fp, " gbeStruct4k.extendedConfigurationControlWord1.reserved3 = 0x%01x;\n", gbeStruct4k.extendedConfigurationControlWord1.reserved3);
fprintf(fp, "\n");
/* Word 15h (Extended Configuration Control Word 2) */
fprintf(fp, " /* Word 15h (Extended Configuration Control Word 2) */\n");
fprintf(fp, " gbeStruct4k.extendedConfigurationControlWord2.reserved = 0x%02x;\n", gbeStruct4k.extendedConfigurationControlWord2.reserved);
fprintf(fp, " gbeStruct4k.extendedConfigurationControlWord2.extendedPhyLength = 0x%02x;\n", gbeStruct4k.extendedConfigurationControlWord2.extendedPhyLength);
fprintf(fp, "\n");
/* Word 16h (Extended Configuration Control Word 3) */
fprintf(fp, " /* Word 16h (Extended Configuration Control Word 3) */\n");
fprintf(fp, " gbeStruct4k.extendedConfigurationControlWord3 = 0x%04x;\n", gbeStruct4k.extendedConfigurationControlWord3);
fprintf(fp, "\n");
/* Word 17h (LED 1 Configuration and Power Management) */
fprintf(fp, " /* Word 17h (LED 1 Configuration and Power Management) */\n");
fprintf(fp, " gbeStruct4k.ledCtl1.led1Mode = 0x%01x;\n", gbeStruct4k.ledCtl1.led1Mode);
fprintf(fp, " gbeStruct4k.ledCtl1.reserved1 = 0x%01x;\n", gbeStruct4k.ledCtl1.reserved1);
fprintf(fp, " gbeStruct4k.ledCtl1.led1BlinkMode = 0x%01x;\n", gbeStruct4k.ledCtl1.led1BlinkMode);
fprintf(fp, " gbeStruct4k.ledCtl1.led1Invert = 0x%01x;\n", gbeStruct4k.ledCtl1.led1Invert);
fprintf(fp, " gbeStruct4k.ledCtl1.led1Blink = 0x%01x;\n", gbeStruct4k.ledCtl1.led1Blink);
fprintf(fp, " gbeStruct4k.ledCtl1.reserved2 = 0x%01x;\n", gbeStruct4k.ledCtl1.reserved2);
fprintf(fp, " gbeStruct4k.ledCtl1.lpluEnable = 0x%01x;\n", gbeStruct4k.ledCtl1.lpluEnable);
fprintf(fp, " gbeStruct4k.ledCtl1.lpluEnableNonD0a = 0x%01x;\n", gbeStruct4k.ledCtl1.lpluEnableNonD0a);
fprintf(fp, " gbeStruct4k.ledCtl1.gbeDisableNonD0a = 0x%01x;\n", gbeStruct4k.ledCtl1.gbeDisableNonD0a);
fprintf(fp, " gbeStruct4k.ledCtl1.reserved3 = 0x%01x;\n", gbeStruct4k.ledCtl1.reserved3);
fprintf(fp, " gbeStruct4k.ledCtl1.gbeDisable = 0x%01x;\n", gbeStruct4k.ledCtl1.gbeDisable);
fprintf(fp, " gbeStruct4k.ledCtl1.reserved4 = 0x%01x;\n", gbeStruct4k.ledCtl1.reserved4);
fprintf(fp, "\n");
/* Word 18h (LED 0 and 2 Configuration Defaults) */
fprintf(fp, " /* Word 18h (LED 0 and 2 Configuration Defaults) */\n");
fprintf(fp, " gbeStruct4k.ledCtl02.led0Mode = 0x%01x;\n", gbeStruct4k.ledCtl02.led0Mode);
fprintf(fp, " gbeStruct4k.ledCtl02.reserved1 = 0x%01x;\n", gbeStruct4k.ledCtl02.reserved1);
fprintf(fp, " gbeStruct4k.ledCtl02.led0BlinkMode = 0x%01x;\n", gbeStruct4k.ledCtl02.led0BlinkMode);
fprintf(fp, " gbeStruct4k.ledCtl02.led0Invert = 0x%01x;\n", gbeStruct4k.ledCtl02.led0Invert);
fprintf(fp, " gbeStruct4k.ledCtl02.led0Blink = 0x%01x;\n", gbeStruct4k.ledCtl02.led0Blink);
fprintf(fp, " gbeStruct4k.ledCtl02.led2Mode = 0x%01x;\n", gbeStruct4k.ledCtl02.led2Mode);
fprintf(fp, " gbeStruct4k.ledCtl02.reserved2 = 0x%01x;\n", gbeStruct4k.ledCtl02.reserved2);
fprintf(fp, " gbeStruct4k.ledCtl02.led2BlinkMode = 0x%01x;\n", gbeStruct4k.ledCtl02.led2BlinkMode);
fprintf(fp, " gbeStruct4k.ledCtl02.led2Invert = 0x%01x;\n", gbeStruct4k.ledCtl02.led2Invert);
fprintf(fp, " gbeStruct4k.ledCtl02.led2Blink = 0x%01x;\n", gbeStruct4k.ledCtl02.led2Blink);
fprintf(fp, "\n");
/* Word 19h (Reserved) */
fprintf(fp, " /* Word 19h (Reserved) */\n");
fprintf(fp, " gbeStruct4k.reservedWord19h = 0x%04x;\n", gbeStruct4k.reservedWord19h);
fprintf(fp, "\n");
/* Word 1Ah (Reserved) */
fprintf(fp, " /* Word 1Ah (Reserved) */\n");
fprintf(fp, " gbeStruct4k.reservedWord1Ah = 0x%04x;\n", gbeStruct4k.reservedWord1Ah);
fprintf(fp, "\n");
/* Word 1Bh (Reserved) */
fprintf(fp, " /* Word 1Bh (Reserved) */\n");
fprintf(fp, " gbeStruct4k.reservedWord1Bh = 0x%04x;\n", gbeStruct4k.reservedWord1Bh);
fprintf(fp, "\n");
/* Word 1Ch (Reserved) */
fprintf(fp, " /* Word 1Ch (Reserved) */\n");
fprintf(fp, " gbeStruct4k.reservedWord1Ch = 0x%04x;\n", gbeStruct4k.reservedWord1Ch);
fprintf(fp, "\n");
/* Word 1Dh (Reserved) */
fprintf(fp, " /* Word 1Dh (Reserved) */\n");
fprintf(fp, " gbeStruct4k.reservedWord1Dh = 0x%04x;\n", gbeStruct4k.reservedWord1Dh);
fprintf(fp, "\n");
/* Word 1Eh (Device ID for Intel 82567LM gigabit ethernet controller) */
fprintf(fp, " /* Word 1Eh (Device ID for Intel 82567LM gigabit ethernet controller) */\n");
fprintf(fp, " gbeStruct4k._82567lmDeviceId = 0x%04x;\n", gbeStruct4k._82567lmDeviceId);
fprintf(fp, "\n");
/* Word 1Fh (Device ID for Intel 82567LF gigabit ethernet controller) */
fprintf(fp, " /* Word 1Fh (Device ID for Intel 82567LF gigabit ethernet controller) */\n");
fprintf(fp, " gbeStruct4k._82567lfDeviceId = 0x%04x;\n", gbeStruct4k._82567lfDeviceId);
fprintf(fp, "\n");
/* Word 20h (Reserved) */
fprintf(fp, " /* Word 20h (Reserved) */\n");
fprintf(fp, " gbeStruct4k.reservedWord20h = 0x%04x;\n", gbeStruct4k.reservedWord20h);
fprintf(fp, "\n");
/* Word 21h (Device ID for Intel 82567V gigabit ethernet controller) */
fprintf(fp, " /* Word 21h (Device ID for Intel 82567V gigabit ethernet controller) */\n");
fprintf(fp, " gbeStruct4k._82567vDeviceId = 0x%04x;\n", gbeStruct4k._82567vDeviceId);
fprintf(fp, "\n");
/* Word 22h (Reserved) */
fprintf(fp, " /* Word 22h (Reserved) */\n");
fprintf(fp, " gbeStruct4k.reservedWord22h = 0x%04x;\n", gbeStruct4k.reservedWord22h);
fprintf(fp, "\n");
/* Word 23h (Reserved) */
fprintf(fp, " /* Word 23h (Reserved) */\n");
fprintf(fp, " gbeStruct4k.reservedWord23h = 0x%04x;\n", gbeStruct4k.reservedWord23h);
fprintf(fp, "\n");
/* Words 24h to 2Fh (Reserved) */
fprintf(fp, " /* Words 24h to 2Fh (Reserved) */\n");
for (i = 0; i < 12; i++) {
fprintf(fp, " gbeStruct4k.reservedWords24to2Fh[%d] = 0x%04x;\n", i, gbeStruct4k.reservedWords24to2Fh[i]);
}
fprintf(fp, "\n");
/* Words 30h to 3Eh (PXE Software Region) */
fprintf(fp, " /* Words 30h to 3Eh (PXE Software Region) */\n");
fprintf(fp, " /* Boot Agent Main Setup Options (Word 30h) */\n");
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.protocolSelect = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.protocolSelect);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved1 = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved1);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.defaultBootSelection = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.defaultBootSelection);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved2 = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved2);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.promptTime = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.promptTime);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.displaySetupMessage = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.displaySetupMessage);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved3 = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved3);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.forceSpeed = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.forceSpeed);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.forceFullDuplex = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.forceFullDuplex);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved4 = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved4);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.efiPresence = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.efiPresence);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.pxePresence = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.pxePresence);
fprintf(fp, " /* Boot Agent Configuration Customization Options (Word 31h) */\n");
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableSetupMenu = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableSetupMenu);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableTitleMessage = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableTitleMessage);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableProtocolSelect = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableProtocolSelect);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableBootSelection = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableBootSelection);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableLegacyWakeupSupport = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableLegacyWakeupSupport);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableFlashUpdate = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableFlashUpdate);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.reserved1 = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.reserved1);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.ibaBootOrderSetupMode = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.ibaBootOrderSetupMode);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.reserved2 = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.reserved2);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.signature = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.signature);
fprintf(fp, " /* Boot Agent Configuration Customization Options (Word 32h) */\n");
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions32h.buildNumber = 0x%02x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions32h.buildNumber);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions32h.minorVersionNumber = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions32h.minorVersionNumber);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions32h.majorVersionNumber = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions32h.majorVersionNumber);
fprintf(fp, " /* IBA Capabilities (Word 33h) */\n");
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.baseCodePresent = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.baseCodePresent);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.undiCapabilityPresent = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.undiCapabilityPresent);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.reserved1 = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.reserved1);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.efiUndiCapabilityPresent = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.efiUndiCapabilityPresent);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.reserved2_0 = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.reserved2_0);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.reserved2_1 = 0x%02x;\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.reserved2_1);
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.signature = 0x%01x;\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.signature);
fprintf(fp, " /* Padding (Words 34h to 3Eh) */\n");
for (i = 0; i < 11; i++) {
fprintf(fp, " gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[%d] = 0x%04x;\n", i, gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[i]);
}
fprintf(fp, "\n");
/* Word 3Fh (Checksum) */
fprintf(fp, " /* Word 3Fh (Checksum) */\n");
fprintf(fp, " gbeStruct4k.checkSum = gbeGetChecksumFrom4kStruct(gbeStruct4k, GBECHECKSUMTOTAL);\n");
fprintf(fp, "\n");
/* The rest of Gbe is just padding */
paddingSize = sizeof(gbeStruct4k.padding);
paddingIdentical = 1; /* Assume that it's all 0xFF, then try to disprove it */
for (i = 0; i < paddingSize; i++) { /* check whether contents differ */
if (gbeStruct4k.padding[i] != 0xFF) {
paddingIdentical = 0;
break;
}
}
if (!paddingIdentical) {
fprintf(fp, " /* The rest of Gbe (word 40h or byte 80h onwards) is just padding */\n");
for (i = 0; i < paddingSize; i++) { /* contents are not all 0xFF, just spit them all out one by one */
fprintf(fp, " gbeStruct4k.padding[%d] = 0x%02x;\n", i, gbeStruct4k.padding[i]);
}
} else { /* contents are all 0xFF. Generate a small for loop that sets them all to 0xFF */
fprintf(fp, " /* The rest of Gbe (word 40h or byte 80h onwards) is just padding (0xFF) */\n");
fprintf(fp, " for (i = 0; i < %d; i++) {\n", paddingSize);
fprintf(fp, " gbeStruct4k.padding[i] = 0xFF;\n");
fprintf(fp, " }\n");
}
fprintf(fp, "\n");
fprintf(fp, " return gbeStruct4k;\n");
fprintf(fp, "}\n\n");
fprintf(fp, "struct GBEREGIONRECORD_8K generatedGbeStruct8k()\n");
fprintf(fp, "{\n");
fprintf(fp, " struct GBEREGIONRECORD_8K gbeStruct8k;\n");
fprintf(fp, " gbeStruct8k.main = generatedGbeStruct4k();\n");
fprintf(fp, " memcpy(&gbeStruct8k.backup, &gbeStruct8k.main, GBEREGIONSIZE_4K);\n");
fprintf(fp, " return gbeStruct8k;\n");
fprintf(fp, "}\n\n");
/* ------------------------------ */
fclose(fp); /* Always close the file when done. */
return 0;
}
int showGbeData(struct GBEREGIONRECORD_4K gbeStruct4k)
{
int i;
printf("GbE REGION\n");
printf("==========\n");
printf("A *word*, in this context, means two 8-bit bytes.\n\n");
printf("**MAC address** (words 00h to 02h) = ");
for (i = 0; i < 6; i++) {
printf("%02x", gbeStruct4k.macAddress[i]);
if (i!=5) printf(":");
}
printf("\n\n");
printf("Word 03h (Reserved)\n");
printf("-------------------\n\n");
printf("- reserved1_0 = 0x%02x\n", gbeStruct4k.reservedWord03h.reserved1_0);
printf("- reserved1_1 = 0x%01x\n", gbeStruct4k.reservedWord03h.reserved1_1);
printf("- IBA Lom = 0x%01x\n", gbeStruct4k.reservedWord03h.ibaLom);
printf("- reserved2 = 0x%01x\n\n", gbeStruct4k.reservedWord03h.reserved2);
printf("Word 04h (Reserved)\n");
printf("-------------------\n\n");
printf("- reservedWord04h = 0x%04x\n\n", gbeStruct4k.reservedWord04h);
/* Word 05h (Image Version Information) */
printf("Word 05h (Image Version Information)\n");
printf("------------------------------------\n\n");
printf("- Image Version Information = 0x%04x\n\n", gbeStruct4k.imageVersionInformation);
printf("Words 06h and 07h (Reserved)\n");
printf("----------------------------\n\n");
for (i = 0; i < 2; i++) {
printf("- Offset %d = 0x%04x\n", i, gbeStruct4k.reservedWords06h07h[i]);
}
printf("\n");
/* Words 08h and 09h (PBA Low and PBA High) */
printf("Word 08h and 09h (PBA Low and PBA High)\n");
printf("---------------------------------------\n\n");
printf("- pbaLow = 0x%04x\n", gbeStruct4k.pbaLow);
printf("- pbaHigh = 0x%04x\n\n", gbeStruct4k.pbaHigh);
printf("Word 0Ah (PCI Initialization Control Word)\n");
printf("------------------------------------------\n\n");
printf("- Load Vendor Device ID = 0x%01x\n", gbeStruct4k.pciInitializationControlWord.loadVendorDeviceId);
printf("- Load Subsystem ID = 0x%01x\n", gbeStruct4k.pciInitializationControlWord.loadSubsystemId);
printf("- reserved1 = 0x%01x\n", gbeStruct4k.pciInitializationControlWord.reserved1);
printf("- reserved2 = 0x%01x\n", gbeStruct4k.pciInitializationControlWord.reserved2);
printf("- PM Enable = 0x%01x\n", gbeStruct4k.pciInitializationControlWord.pmEnable);
printf("- Auxillary Power = 0x%01x\n", gbeStruct4k.pciInitializationControlWord.auxPwr);
printf("- reserved3 = 0x%01x\n", gbeStruct4k.pciInitializationControlWord.reserved3);
printf("- reserved4 = 0x%01x\n\n", gbeStruct4k.pciInitializationControlWord.reserved4);
printf("Word 0Bh (Subsystem ID)\n");
printf("-----------------------\n\n");
printf("- Subsystem ID = 0x%04x\n\n", gbeStruct4k.subsystemId);
printf("Word 0Ch (Subsystem Vendor ID)\n");
printf("------------------------------\n\n");
printf("- Subsystem Vendor ID = 0x%04x\n\n", gbeStruct4k.subsystemVendorId);
printf("Word 0Dh (Device ID)\n");
printf("--------------------\n\n");
printf("- Device ID = 0x%04x\n\n", gbeStruct4k.deviceId);
printf("Word 0Eh (Vendor ID)\n");
printf("--------------------\n\n");
printf("- Vendor ID = 0x%04x\n\n", gbeStruct4k.vendorId);
printf("Word 0Fh (Device Revision ID)\n");
printf("-----------------------------\n\n");
printf("- Device Revision ID = 0x%04x\n\n", gbeStruct4k.deviceRevId);
printf("Word 10h (LAN Power Consumption)\n");
printf("--------------------------------\n\n");
printf("- LAN D3 Power = 0x%02x\n", gbeStruct4k.lanPowerConsumption.lanD3Power);
printf("- reserved = 0x%01x\n", gbeStruct4k.lanPowerConsumption.reserved);
printf("- LAN D0 Power = 0x%02x\n\n", gbeStruct4k.lanPowerConsumption.lanD0Power);
printf("Words 11h and 12h (Reserved)\n");
printf("----------------------------\n\n");
for (i = 0; i < 2; i++) {
printf("- Offset %d = 0x%04x\n", i, gbeStruct4k.reservedWords11h12h[i]);
}
printf("\n");
/* Word 13h (Shared Initialization Control Word) */
printf("Word 13h (Shared Initialization Control Word)\n");
printf("---------------------------------------------\n\n");
printf("- reserved1 = 0x%01x\n", gbeStruct4k.sharedInitializationControlWord.reserved1);
printf("- Force Duplex = 0x%01x\n", gbeStruct4k.sharedInitializationControlWord.forceDuplex);
printf("- Force Speed Enable = 0x%01x\n", gbeStruct4k.sharedInitializationControlWord.forceSpeedEnable);
printf("- reserved2_0 = 0x%01x\n", gbeStruct4k.sharedInitializationControlWord.reserved2_0);
printf("- reserved2_1 = 0x%01x\n", gbeStruct4k.sharedInitializationControlWord.reserved2_1);
printf("- PHY Power Down Enable = 0x%01x\n", gbeStruct4k.sharedInitializationControlWord.phyPowerDownEnable);
printf("- reserved3 = 0x%01x\n", gbeStruct4k.sharedInitializationControlWord.reserved3);
printf("- reserved4 = 0x%01x\n", gbeStruct4k.sharedInitializationControlWord.reserved4);
printf("- Sign = 0x%01x\n\n", gbeStruct4k.sharedInitializationControlWord.sign);
printf("Word 14h (Extended Configuration Control Word 1)\n");
printf("------------------------------------------------\n\n");
printf("- Extended Configuration Pointer = 0x%03x\n", gbeStruct4k.extendedConfigurationControlWord1.extendedConfigurationPointer);
printf("- OEM Write Enable = 0x%01x\n", gbeStruct4k.extendedConfigurationControlWord1.oemWriteEnable);
printf("- reserved1 = 0x%01x\n", gbeStruct4k.extendedConfigurationControlWord1.reserved1);
printf("- reserved2 = 0x%01x\n", gbeStruct4k.extendedConfigurationControlWord1.reserved2);
printf("- reserved3 = 0x%01x\n\n", gbeStruct4k.extendedConfigurationControlWord1.reserved3);
printf("Word 15h (Extended Configuration Control Word 2)\n");
printf("------------------------------------------------\n\n");
printf("- reserved = 0x%02x\n", gbeStruct4k.extendedConfigurationControlWord2.reserved);
printf("- Extended PHY Length = 0x%02x\n\n", gbeStruct4k.extendedConfigurationControlWord2.extendedPhyLength);
printf("Word 16h (Extended Configuration Control Word 3)\n");
printf("------------------------------------------------\n\n");
printf("- Extended Configuration Control Word 3 = 0x%04x\n\n", gbeStruct4k.extendedConfigurationControlWord3);
printf("Word 17h (LED 1 Configuration and Power Management)\n");
printf("---------------------------------------------------\n\n");
printf("- LED1 Mode = 0x%01x\n", gbeStruct4k.ledCtl1.led1Mode);
printf("- reserved1 = 0x%01x\n", gbeStruct4k.ledCtl1.reserved1);
printf("- LED1 Blink Mode = 0x%01x\n", gbeStruct4k.ledCtl1.led1BlinkMode);
printf("- LED1 Invert = 0x%01x\n", gbeStruct4k.ledCtl1.led1Invert);
printf("- LED1 Blink = 0x%01x\n", gbeStruct4k.ledCtl1.led1Blink);
printf("- reserved2 = 0x%01x\n", gbeStruct4k.ledCtl1.reserved2);
printf("- LPLU Enable = 0x%01x\n", gbeStruct4k.ledCtl1.lpluEnable);
printf("- LPLU Enable Non-D0a = 0x%01x\n", gbeStruct4k.ledCtl1.lpluEnableNonD0a);
printf("- GbE Disable Non-D0a = 0x%01x\n", gbeStruct4k.ledCtl1.gbeDisableNonD0a);
printf("- reserved3 = 0x%01x\n", gbeStruct4k.ledCtl1.reserved3);
printf("- GbE Disable = 0x%01x\n", gbeStruct4k.ledCtl1.gbeDisable);
printf("- reserved4 = 0x%01x\n\n", gbeStruct4k.ledCtl1.reserved4);
printf("Word 18h (LED 0 and 2 Configuration Defaults)\n");
printf("---------------------------------------------\n\n");
printf("- LED0 Mode = 0x%01x\n", gbeStruct4k.ledCtl02.led0Mode);
printf("- reserved1 = 0x%01x\n", gbeStruct4k.ledCtl02.reserved1);
printf("- LED0 Blink Mode = 0x%01x\n", gbeStruct4k.ledCtl02.led0BlinkMode);
printf("- LED0 Invert = 0x%01x\n", gbeStruct4k.ledCtl02.led0Invert);
printf("- LED0 Blink = 0x%01x\n", gbeStruct4k.ledCtl02.led0Blink);
printf("- LED2 Mode = 0x%01x\n", gbeStruct4k.ledCtl02.led2Mode);
printf("- reserved2 = 0x%01x\n", gbeStruct4k.ledCtl02.reserved2);
printf("- LED2 Blink Mode = 0x%01x\n", gbeStruct4k.ledCtl02.led2BlinkMode);
printf("- LED2 Invert = 0x%01x\n", gbeStruct4k.ledCtl02.led2Invert);
printf("- LED2 Blink = 0x%01x\n\n", gbeStruct4k.ledCtl02.led2Blink);
printf("Word 19h (Reserved)\n");
printf("-------------------\n\n");
printf("- reservedWord19h = 0x%04x\n\n", gbeStruct4k.reservedWord19h);
printf("Word 1Ah (Reserved)\n");
printf("-------------------\n\n");
printf("- reservedWord1Ah = 0x%04x\n\n", gbeStruct4k.reservedWord1Ah);
printf("Word 1Bh (Reserved)\n");
printf("-------------------\n\n");
printf("- reservedWord1Bh = 0x%04x\n\n", gbeStruct4k.reservedWord1Bh);
printf("Word 1Ch (Reserved)\n");
printf("-------------------\n\n");
printf("- reservedWord1Ch = 0x%04x\n\n", gbeStruct4k.reservedWord1Ch);
printf("Word 1Dh (Reserved)\n");
printf("-------------------\n\n");
printf("- reservedWord1Dh = 0x%04x\n\n", gbeStruct4k.reservedWord1Dh);
printf("Word 1Eh (Device ID for Intel 82567LM gigabit ethernet controller)\n");
printf("------------------------------------------------------------------\n\n");
printf("- 82567LM Device ID = 0x%04x\n\n", gbeStruct4k._82567lmDeviceId);
printf("Word 1Fh (Device ID for Intel 82567LF gigabit ethernet controller)\n");
printf("------------------------------------------------------------------\n\n");
printf("- 82567LF Device ID = 0x%04x\n\n", gbeStruct4k._82567lfDeviceId);
printf("Word 20h (Reserved)\n");
printf("-------------------\n\n");
printf("- reservedWord20h = 0x%04x\n\n", gbeStruct4k.reservedWord20h);
printf("Word 21h (Device ID for Intel 82567V gigabit ethernet controller)\n");
printf("-----------------------------------------------------------------\n\n");
printf("- 82567V Device ID = 0x%04x\n\n", gbeStruct4k._82567vDeviceId);
printf("Word 22h (Reserved)\n");
printf("-------------------\n\n");
printf("- reservedWord22h = 0x%04x\n\n", gbeStruct4k.reservedWord22h);
printf("Word 23h (Reserved)\n");
printf("-------------------\n\n");
printf("- reservedWord23h = 0x%04x\n\n", gbeStruct4k.reservedWord23h);
printf("Words 24h to 2Fh (Reserved)\n");
printf("---------------------------\n\n");
for (i = 0; i < 12; i++) {
printf("- Offset %d = 0x%04x\n", i, gbeStruct4k.reservedWords24to2Fh[i]);
}
printf("\n");
printf("Words 30h to 3Eh (PXE Software Region)\n");
printf("--------------------------------------\n\n");
printf("Boot Agent Main Setup Options (Word 30h):\n\n");
printf("- Protocol Select = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.protocolSelect);
printf("- reserved1 = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved1);
printf("- Default Boot Selection = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.defaultBootSelection);
printf("- reserved2 = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved2);
printf("- Prompt Time = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.promptTime);
printf("- Display Setup Message = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.displaySetupMessage);
printf("- reserved3 = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved3);
printf("- Force Speed = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.forceSpeed);
printf("- Force Full Duplex = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.forceFullDuplex);
printf("- reserved4 = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved4);
printf("- EFI Presence = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.efiPresence);
printf("- PXE Presence = 0x%01x\n\n", gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.pxePresence);
printf("Boot Agent Configuration Customization Options (Word 31h):\n\n");
printf("- Disable Setup Menu = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableSetupMenu);
printf("- Disable Title Message = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableTitleMessage);
printf("- Disable Protocol Select = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableProtocolSelect);
printf("- Disable Boot Selection = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableBootSelection);
printf("- Disable Legacy Wakeup Support = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableLegacyWakeupSupport);
printf("- Disable Flash Update = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableFlashUpdate);
printf("- reserved1 = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.reserved1);
printf("- IBA Boot Order Setup Mode = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.ibaBootOrderSetupMode);
printf("- reserved2 = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.reserved2);
printf("- Signature = 0x%01x\n\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.signature);
printf("Boot Agent Configuration Customization Options (Word 32h):\n\n");
printf("- Build Number = 0x%02x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions32h.buildNumber);
printf("- Minor Version Number = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions32h.minorVersionNumber);
printf("- Major Version Number = 0x%01x\n\n", gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions32h.majorVersionNumber);
printf("IBA Capabilities (Word 33h):\n\n");
printf("- Base Code Present = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.baseCodePresent);
printf("- UNDI Capability Present = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.undiCapabilityPresent);
printf("- reserved1 = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.reserved1);
printf("- EFI UndiCapabilityPresent = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.efiUndiCapabilityPresent);
printf("- reserved2_0 = 0x%01x\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.reserved2_0);
printf("- reserved2_1 = 0x%02x\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.reserved2_1);
printf("- Signature = 0x%01x\n\n", gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.signature);
printf("Padding (Words 34h to 3Eh):\n\n");
for (i = 0; i < 11; i++) {
printf("- Offset %d = 0x%04x\n", i, gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[i]);
}
printf("\n");
printf("Word 3Fh (Checksum):\n\n");
printf("- Check Sum = 0x%04x\n\n", gbeStruct4k.checkSum);
printf("The rest of this section is irrelevant. It can all be set to 0xFF.\n\n");
return 0;
}
/*
* ---------------------------------------------------------------------
* Debugging functions:
* ---------------------------------------------------------------------
*/
/*
* show debugging info: show calculated (correct) gbe checksum and what
* is actually stored, in a 4K gbe struct. Only for a single region.
*/
void printGbeChecksumDataFromStruct4k(struct GBEREGIONRECORD_4K gbeStruct4k, char* romName, char* regionName)
{
printf(
"%s Gbe (%s): calculated Gbe checksum: 0x%hx and actual GBe checksum: 0x%hx\n",
romName,
regionName,
gbeGetChecksumFrom4kStruct(gbeStruct4k, GBECHECKSUMTOTAL),
gbeStruct4k.checkSum
);
return;
}
/*
* show debugging info: show calculated (correct) gbe checksum and what
* is actually stored, in a 8K gbe struct. Do so for main and backup regions.
*/
void printGbeChecksumDataFromStruct8k(struct GBEREGIONRECORD_8K gbeStruct8k, char* romName)
{
printGbeChecksumDataFromStruct4k(gbeStruct8k.main, romName, "main");
printGbeChecksumDataFromStruct4k(gbeStruct8k.backup, romName, "backup");
return;
}
|