Chameleon

Chameleon Commit Details

Date:2010-02-17 21:56:39 (14 years 2 months ago)
Author:Rekursor
Commit:84
Parents: 83
Message:Added more optimization, prepared code to receive a future mem. detection algorithm
Changes:
M/trunk/i386/libsaio/SMBIOS.h
M/trunk/i386/libsaio/smbios_patcher.c
M/trunk/i386/boot2/graphics.c
M/trunk/i386/libsa/libsa.h
M/trunk/i386/libsaio/smbios_patcher.h
M/trunk/i386/libsaio/fake_efi.c
M/trunk/i386/libsaio/platform.h
M/trunk/i386/libsa/printf.c
M/trunk/CHANGES
M/trunk/i386/libsa/string.c
M/trunk/i386/libsaio/pci_root.c

File differences

trunk/CHANGES
1
2
3
4
5
16
27
38
- Factorized code to prepare a dynamic memory detection algorithm ...
- Optimized smbios table address search
- Optimized cursor spinout in textmode if no verbose mode is set
- Added ram table structures definitions
- Added getSmbios() a param permitting to select between orig and new smbios entries
- Changed "Default Partition" behaviour to accept only native system volumes or foreign partitions.
- Added NVIDIA new NVCAP customization support and support for ION gfx cards from aserebln
- Added ATI new framebuffers support and new cards from PCEFI10.6
trunk/i386/libsaio/SMBIOS.h
2323
2424
2525
26
2726
2827
2928
......
3332
3433
3534
36
37
38
39
40
35
36
37
38
39
4140
42
43
44
45
41
42
43
44
4645
4746
4847
49
50
51
52
53
54
48
49
50
51
52
53
5554
5655
5756
58
59
60
61
62
63
64
65
66
57
58
59
60
61
62
63
64
65
6766
6867
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
69117
/* This file is a stripped-down version of the one found in the AppleSMBIOS project.
* Changes:
* - Don't use pragma pack but instead use GCC's packed attribute
* - Remove everything except the entry point structure. We don't need anything else.
*/
#ifndef _LIBSAIO_SMBIOS_H
* Based on System Management BIOS Reference Specification v2.5
*/
typedef UInt8 SMBString;
typedef UInt8 SMBByte;
typedef UInt16 SMBWord;
typedef UInt32 SMBDWord;
typedef UInt64 SMBQWord;
typedef uint8_tSMBString;
typedef uint8_tSMBByte;
typedef uint16_tSMBWord;
typedef uint32_tSMBDWord;
typedef uint64_tSMBQWord;
struct DMIHeader{
SMBByte type;
SMBByte length;
SMBWord handle;
struct DMIHeader {
SMBBytetype;
SMBBytelength;
SMBWordhandle;
} __attribute__((packed));
struct DMIEntryPoint {
SMBByte anchor[5];
SMBByte checksum;
SMBWord tableLength;
SMBDWord tableAddress;
SMBWord structureCount;
SMBByte bcdRevision;
SMBByteanchor[5];
SMBBytechecksum;
SMBWordtableLength;
SMBDWordtableAddress;
SMBWordstructureCount;
SMBBytebcdRevision;
} __attribute__((packed));
struct SMBEntryPoint {
SMBByte anchor[4];
SMBByte checksum;
SMBByte entryPointLength;
SMBByte majorVersion;
SMBByte minorVersion;
SMBWord maxStructureSize;
SMBByte entryPointRevision;
SMBByte formattedArea[5];
struct DMIEntryPoint dmi;
SMBByteanchor[4];
SMBBytechecksum;
SMBByteentryPointLength;
SMBBytemajorVersion;
SMBByteminorVersion;
SMBWordmaxStructureSize;
SMBByteentryPointRevision;
SMBByteformattedArea[5];
struct DMIEntryPointdmi;
} __attribute__((packed));
struct DMIMemoryControllerInfo {/* 3.3.6 Memory Controller Information (Type 5) */
struct DMIHeaderdmiHeader;
SMBByteerrorDetectingMethod;
SMBByteerrorCorrectingCapability;
SMBBytesupportedInterleave;
SMBBytecurrentInterleave;
SMBBytemaxMemoryModuleSize;
SMBWordsupportedSpeeds;
SMBWordsupportedMemoryTypes;
SMBBytememoryModuleVoltage;
SMBBytenumberOfMemorySlots;
} __attribute__((packed));
struct DMIMemoryModuleInfo {/* 3.3.7 Memory Module Information (Type 6) */
struct DMIHeaderdmiHeader;
SMBBytesocketDesignation;
SMBBytebankConnections;
SMBBytecurrentSpeed;
SMBWordcurrentMemoryType;
SMBByteinstalledSize;
SMBByteenabledSize;
SMBByteerrorStatus;
} __attribute__((packed));
struct DMIPhysicalMemoryArray {/* 3.3.17 Physical Memory Array (Type 16) */
struct DMIHeaderdmiHeader;
SMBBytelocation;
SMBByteuse;
SMBBytememoryCorrectionError;
SMBDWordmaximumCapacity;
SMBWordmemoryErrorInformationHandle;
SMBWordnumberOfMemoryDevices;
} __attribute__((packed));
struct DMIMemoryDevice {/* 3.3.18 Memory Device (Type 17) */
struct DMIHeaderdmiHeader;
SMBWordphysicalMemoryArrayHandle;
SMBWordmemoryErrorInformationHandle;
SMBWordtotalWidth;
SMBWorddataWidth;
SMBWordsize;
SMBByteformFactor;
SMBBytedeviceSet;
SMBBytedeviceLocator;
SMBBytebankLocator;
SMBBytememoryType;
SMBWordtypeDetail;
} __attribute__((packed));
#endif /* !_LIBSAIO_SMBIOS_H */
trunk/i386/libsaio/smbios_patcher.c
1313
1414
1515
16
16
1717
1818
1919
......
154154
155155
156156
157
158
159
160
161
157
158
159
160
161
162
163
164
162165
163166
164167
......
166169
167170
168171
169
172
173
170174
171
175
172176
173177
174178
175179
176
177
178
179
180
181
180
181
182
183
184
185
186
187
182188
183189
184190
185191
186192
187193
188
189
190
191
192
193
194
195
196
197
198
199
200
201
194202
195203
196204
197205
198206
199207
200
201
202
203
204
205
208
209
210
211
212
213
214
215
206216
207217
208218
......
249259
250260
251261
252
262
263
264
265
266
267
253268
254
255
269
270
271
272
256273
257274
258
259
260
261
262
263
264
265
266
267
268
269
270
271
275
276
277
278
279
280
272281
273
274
275
276
277
278
279
282
280283
281
284
285
286
282287
283288
284289
......
690695
691696
692697
693
698
694699
695
696
700
701
697702
698
699
700
701
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
702718
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
749
750
751
752
753
754
755
756
757
758
759
760
761
762
#include "SMBIOS.h"
#ifndef DEBUG_SMBIOS
#define DEBUG_SMBIOS 0
#define DEBUG_SMBIOS 1
#endif
#if DEBUG_SMBIOS
static int sm_get_memtype (char *name, int table_num)
{
if (table_num < MAX_RAM_SLOTS &&
Platform.RAM.DIMM[table_num].InUse &&
Platform.RAM.DIMM[table_num].Type != 0)
{
return Platform.RAM.DIMM[table_num].Type;
intmap;
if (table_num < MAX_RAM_SLOTS) {
map = Platform.DMI.DIMM[table_num];
if (Platform.RAM.DIMM[map].InUse && Platform.RAM.DIMM[map].Type != 0) {
DBG("RAM Detected Type = %d\n", Platform.RAM.DIMM[map].Type);
return Platform.RAM.DIMM[map].Type;
}
}
return SMB_MEM_TYPE_DDR2;
}
static int sm_get_memspeed (char *name, int table_num)
{
if (Platform.RAM.Frequency != 0) {
return Platform.RAM.Frequency/1000000;
DBG("RAM Detected Freq = %d\n", Platform.RAM.Frequency/1000000);
return Platform.RAM.Frequency/1000000;
}
return 667;
return 800;
}
static char *sm_get_memvendor (char *name, int table_num)
{
if (table_num < MAX_RAM_SLOTS &&
Platform.RAM.DIMM[table_num].InUse &&
strlen(Platform.RAM.DIMM[table_num].Vendor) > 0)
{
DBG("Vendor[%d]='%s'\n", table_num, Platform.RAM.DIMM[table_num].Vendor);
return Platform.RAM.DIMM[table_num].Vendor;
intmap;
if (table_num < MAX_RAM_SLOTS) {
map = Platform.DMI.DIMM[table_num];
if (Platform.RAM.DIMM[map].InUse && strlen(Platform.RAM.DIMM[map].Vendor) > 0) {
DBG("RAM Detected Vendor[%d]='%s'\n", table_num, Platform.RAM.DIMM[map].Vendor);
return Platform.RAM.DIMM[map].Vendor;
}
}
return "N/A";
}
static char *sm_get_memserial (char *name, int table_num)
{
if (table_num < MAX_RAM_SLOTS &&
Platform.RAM.DIMM[table_num].InUse &&
strlen(Platform.RAM.DIMM[table_num].SerialNo) > 0)
{
DBG("SerialNo[%d]='%s'\n", table_num, Platform.RAM.DIMM[table_num].SerialNo);
return Platform.RAM.DIMM[table_num].SerialNo;
intmap;
if (table_num < MAX_RAM_SLOTS) {
map = Platform.DMI.DIMM[table_num];
if (Platform.RAM.DIMM[map].InUse && strlen(Platform.RAM.DIMM[map].SerialNo) > 0) {
DBG("RAM Detected SerialNo[%d]='%s'\n", table_num, Platform.RAM.DIMM[map].SerialNo);
return Platform.RAM.DIMM[map].SerialNo;
}
}
return "N/A";
}
static char *sm_get_mempartno (char *name, int table_num)
{
if (table_num < MAX_RAM_SLOTS &&
Platform.RAM.DIMM[table_num].InUse &&
strlen(Platform.RAM.DIMM[table_num].PartNo) > 0)
{
DBG("PartNo[%d]='%s'\n", table_num, Platform.RAM.DIMM[table_num].PartNo);
return Platform.RAM.DIMM[table_num].PartNo;
intmap;
if (table_num < MAX_RAM_SLOTS) {
map = Platform.DMI.DIMM[table_num];
if (Platform.RAM.DIMM[map].InUse && strlen(Platform.RAM.DIMM[map].PartNo) > 0) {
DBG("Ram Detected PartNo[%d]='%s'\n", table_num, Platform.RAM.DIMM[map].PartNo);
return Platform.RAM.DIMM[map].PartNo;
}
}
return "N/A";
}
{.type=132,.len=0x06,.numfunc=sm_one}
};
struct SMBEntryPoint *getAddressOfSmbiosTable(void)
// getting smbios addr with fast compare ops, late checksum testing ...
#define COMPARE_DWORD(a,b) ( *((u_int32_t *) a) == *((u_int32_t *) b) )
static const char * const SMTAG = "_SM_";
static const char* const DMITAG= "_DMI_";
static struct SMBEntryPoint *getAddressOfSmbiosTable(void)
{
/* First see if we can even find the damn SMBIOS table
* The logic here is to start at 0xf0000 and end at 0xfffff iterating 16 bytes at a time looking
struct SMBEntryPoint*smbios;
/*
* The logic is to start at 0xf0000 and end at 0xfffff iterating 16 bytes at a time looking
* for the SMBIOS entry-point structure anchor (literal ASCII "_SM_").
*/
void *smbios_addr = (void*)SMBIOS_RANGE_START;
for (; (smbios_addr<=(void*)SMBIOS_RANGE_END) && (*(uint32_t*)smbios_addr!=SMBIOS_ANCHOR_UINT32_LE); smbios_addr+=16) ;
if (smbios_addr <= (void*)SMBIOS_RANGE_END) {
/* NOTE: The specification does not specifically state what to do in the event of finding an
* SMBIOS anchor on an invalid table. It might be better to move this code into the for loop
* so that searching can continue.
*/
uint8_t csum = checksum8(smbios_addr, sizeof(struct SMBEntryPoint));
/* The table already contains the checksum so we merely need to see if its checksum is now zero. */
if (csum != 0) {
printf("Found SMBIOS anchor but bad table checksum. Assuming no SMBIOS.\n");
sleep(5);
smbios_addr = 0;
smbios = (struct SMBEntryPoint*) SMBIOS_RANGE_START;
while (smbios <= (struct SMBEntryPoint *)SMBIOS_RANGE_END) {
if (COMPARE_DWORD(smbios->anchor, SMTAG) && COMPARE_DWORD(smbios->dmi.anchor, DMITAG) &&
checksum8(smbios, sizeof(struct SMBEntryPoint)) == 0)
{
return smbios;
}
} else {
/* If this happens, it's possible that a PnP BIOS call can be done to retrieve the address of the table.
* The latest versions of the spec state that modern programs should not even attempt to do this.
*/
printf("Unable to find SMBIOS table.\n");
sleep(5);
smbios_addr = 0;
smbios = (((void*) smbios) + 16);
}
return smbios_addr;
printf("ERROR: Unable to find SMBIOS!\n");
sleep(5);
return NULL;
}
/* Compute necessary space requirements for new smbios */
verbose("Patched DMI Table\n");
}
struct SMBEntryPoint *getSmbios(void)
struct SMBEntryPoint *getSmbios(int which)
{
struct SMBEntryPoint *orig_address;
struct SMBEntryPoint *new_address;
static struct SMBEntryPoint *orig = NULL; // cached
static struct SMBEntryPoint *patched = NULL; // cached
orig_address=getAddressOfSmbiosTable();
new_address = smbios_dry_run(orig_address);
smbios_real_run(orig_address, new_address);
return new_address;
if (orig == NULL) orig = getAddressOfSmbiosTable();
switch (which) {
case SMBIOS_ORIGINAL:
return orig;
case SMBIOS_PATCHED:
if (patched == NULL) {
patched = smbios_dry_run(orig);
smbios_real_run(orig, patched);
}
return patched;
default:
printf("ERROR: invalid option for getSmbios() !!\n");
return NULL;
}
}
/**
* Get a table structure entry from a type specification and a smbios address
* return NULL if table is not found
*/
struct DMIHeader *getSmbiosTableStructure(struct SMBEntryPoint*smbios, int type, int min_length)
{
struct DMIHeader * dmihdr=NULL;
bool found = false;
SMBByte* p;
int i;
if (smbios == NULL || type < 0 ) return NULL;
#if DEBUG_SMBIOS
printf(">>> SMBIOSAddr=0x%08x\n", smbios);
printf(">>> DMI: addr=0x%08x, len=0x%d, count=%d\n", smbios->dmi.tableAddress,
smbios->dmi.tableLength, smbios->dmi.structureCount);
#endif
p = (SMBByte *) smbios->dmi.tableAddress;
for (i=0; i < smbios->dmi.structureCount && p + 4 <= (SMBByte *)smbios->dmi.tableAddress + smbios->dmi.tableLength; i++)
{
dmihdr = (struct DMIHeader *) p;
#if DEBUG_SMBIOS
verbose(">>>>>> DMI(%d): type=0x%02x, len=0x%d\n",i,dmihdr->type,dmihdr->length);
#endif
if (dmihdr->length < 4 || dmihdr->type == 127 /* EOT */) break;
if (dmihdr->type == type) /* 3.3.2 System Information */
{
if (dmihdr->length >= min_length) found = true;
break;
}
p = p + dmihdr->length;
while ((p - (SMBByte *)smbios->dmi.tableAddress + 1 < smbios->dmi.tableLength) && (p[0] != 0x00 || p[1] != 0x00))
{
p++;
}
p += 2;
}
#if DEBUG_SMBIOS
printf("DMI header found for table type %d, length = %d\n", type, dmihdr->type, dmihdr->length);
#endif
return found ? dmihdr : NULL;
}
trunk/i386/libsaio/smbios_patcher.h
11
22
33
4
5
6
47
58
69
......
811
912
1013
11
12
13
1414
1515
16
17
18
19
16
2017
21
22
23
2418
2519
2620
27
28
21
22
2923
3024
3125
32
33
34
26
27
28
3529
3630
3731
3832
39
40
33
34
4135
42
43
44
45
46
47
36
37
38
39
4840
4941
5042
5143
52
53
54
44
45
46
5547
5648
57
58
59
49
50
51
52
53
6054
/*
* Copyright 2008 mackerintel
*/
/*
* AsereBLN: cleanup
*/
#ifndef __LIBSAIO_SMBIOS_PATCHER_H
#define __LIBSAIO_SMBIOS_PATCHER_H
#include "libsaio.h"
#include "SMBIOS.h"
extern EFI_GUID gEfiAcpiTableGuid;
extern EFI_GUID gEfiAcpi20TableGuid;
/* From Foundation/Efi/Guid/Smbios/SmBios.h */
/* Modified to wrap Data4 array init with {} */
#define EFI_SMBIOS_TABLE_GUID \
{ \
0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} \
}
#define EFI_SMBIOS_TABLE_GUID {0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d}}
/* From Foundation/Efi/Guid/Smbios/SmBios.c */
//EFI_GUID const gEfiSmbiosTableGuid = EFI_SMBIOS_TABLE_GUID;
#define SMBIOS_RANGE_START 0x000F0000
#define SMBIOS_RANGE_END 0x000FFFFF
/* '_SM_' in little endian: */
#define SMBIOS_ANCHOR_UINT32_LE 0x5f4d535f
#define SMBIOS_ORIGINAL0
#define SMBIOS_PATCHED1
struct smbios_table_header
{
uint8_t type;
uint8_t length;
uint16_t handle;
uint8_ttype;
uint8_tlength;
uint16_thandle;
} __attribute__ ((packed));
struct smbios_property
{
char *name;
uint8_t table_type;
char*name;
uint8_ttable_type;
enum {SMSTRING, SMWORD, SMBYTE, SMOWORD} value_type;
int offset;
//union {
int (*auto_int) (char *name, int table_num);
char * (*auto_str) (char *name, int table_num);
char * (*auto_oword) (char *name, int table_num);
//};
intoffset;
int(*auto_int) (char *name, int table_num);
char*(*auto_str) (char *name, int table_num);
char*(*auto_oword) (char *name, int table_num);
};
struct smbios_table_description
{
uint8_t type;
int len;
int (*numfunc)(int tablen);
uint8_ttype;
intlen;
int(*numfunc)(int tablen);
};
extern struct SMBEntryPoint *getAddressOfSmbiosTable(void);
extern struct SMBEntryPoint *getSmbios(void);
/** call with flag SMBIOS_ORIGINAL to get orig. entrypoint
or call with flag SMBIOS_PATCHED to get patched smbios entrypoint
*/
extern struct DMIHeader *getSmbiosTableStructure(struct SMBEntryPoint*smbios, int type, int min_length);
extern struct SMBEntryPoint*getSmbios(int);
#endif /* !__LIBSAIO_SMBIOS_PATCHER_H */
trunk/i386/libsaio/pci_root.c
8080
8181
8282
83
83
8484
8585
8686
{
verbose("No DSDT found, using 0 as uid value.\n");
rootuid = 0;
return rootuid;
goto out;
}
fsize = file_size(fd);
trunk/i386/libsaio/platform.h
11
22
3
34
45
56
......
6364
6465
6566
66
67
68
6769
6870
6971
7072
73
74
75
7176
7277
7378
7479
7580
7681
77
7882
7983
8084
......
97101
98102
99103
104
100105
101106
102107
103108
104109
105
106
110
111
112
113
114
115
116
107117
108118
109119
/*
* platform.h
* AsereBLN: reworked and extended
*
*/
#define SMB_MEM_CHANNEL_TRIPLE3
/* Maximum number of ram slots */
#define MAX_RAM_SLOTS8
#define MAX_RAM_SLOTS12
#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
/* Maximum number of SPD bytes */
#define MAX_SPD_SIZE256
/* Size of SMBIOS UUID in bytes */
#define UUID_LEN16
typedef struct _RamSlotInfo_t {
boolInUse;
uint8_tType;
charVendor[64];
charPartNo[64];
charSerialNo[16];
uint8_tspd[MAX_SPD_SIZE];
} RamSlotInfo_t;
typedef struct _PlatformInfo_t {
uint32_tBrandString[16];// 48 Byte Branding String
uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
} CPU;
struct RAM {
RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
uint64_tFrequency;// Ram Frequency
} RAM;
uint8_t Type; // JrCs: System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FADT: PM_Profile)
struct DMI {
intMaxMemorySlots;// number of memory slots polulated by SMBIOS
intCntMemorySlots;// number of memory slots counted
intMemoryModules;// number of memory modules installed
intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
} DMI;
uint8_tType;// System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile)
} PlatformInfo_t;
extern PlatformInfo_t Platform;
trunk/i386/libsaio/fake_efi.c
1818
1919
2020
21
21
2222
2323
2424
......
284284
285285
286286
287
288
289
290
291
292
293
294287
295288
296289
......
346339
347340
348341
349
350
351342
352343
353344
354345
355
356346
357
347
358348
359349
360
361
362
363
350
351
364352
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
353
354
395355
396356
397357
......
527487
528488
529489
530
490
531491
532492
533493
#include "pci.h"
#include "sl.h"
extern struct SMBEntryPoint * getSmbios();
extern struct SMBEntryPoint * getSmbios(int which); // now cached
extern void setup_pci_devs(pci_dt_t *pci_dt);
/*
* SMBIOS
*/
/* From Foundation/Efi/Guid/Smbios/SmBios.h */
/* Modified to wrap Data4 array init with {} */
#define EFI_SMBIOS_TABLE_GUID \
{ \
0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} \
}
/* From Foundation/Efi/Guid/Smbios/SmBios.c */
EFI_GUID const gEfiSmbiosTableGuid = EFI_SMBIOS_TABLE_GUID;
return dst;
}
#define DEBUG_SMBIOS 0
/* Get the SystemID from the bios dmi info */
static EFI_CHAR8* getSmbiosUUID()
{
struct SMBEntryPoint*smbios;
struct DMIHeader*dmihdr;
SMBByte*p;
inti, found, isZero, isOnes;
inti, isZero, isOnes;
static EFI_CHAR8 uuid[UUID_LEN];
smbios = getAddressOfSmbiosTable();/* checks for _SM_ anchor and table header checksum */
if (memcmp( &smbios->dmi.anchor[0], "_DMI_", 5) != 0) {
return 0;
}
smbios = getSmbios(SMBIOS_PATCHED);/* checks for _SM_ anchor and table header checksum */
if (smbios==NULL) return 0; // getSmbios() return a non null value if smbios is found
#if DEBUG_SMBIOS
verbose(">>> SMBIOSAddr=0x%08x\n", smbios);
verbose(">>> DMI: addr=0x%08x, len=0x%d, count=%d\n", smbios->dmi.tableAddress,
smbios->dmi.tableLength, smbios->dmi.structureCount);
#endif
i = 0;
found = 0;
p = (SMBByte *) smbios->dmi.tableAddress;
while (i < smbios->dmi.structureCount && p + 4 <= (SMBByte *)smbios->dmi.tableAddress + smbios->dmi.tableLength)
{
dmihdr = (struct DMIHeader *) p;
#if DEBUG_SMBIOS
verbose(">>>>>> DMI(%d): type=0x%02x, len=0x%d\n",i,dmihdr->type,dmihdr->length);
#endif
if (dmihdr->length < 4 || dmihdr->type == 127 /* EOT */) break;
if (dmihdr->type == 1) /* 3.3.2 System Information */
{
if (dmihdr->length >= 0x19) found = 1;
break;
}
p = p + dmihdr->length;
while ((p - (SMBByte *)smbios->dmi.tableAddress + 1 < smbios->dmi.tableLength) && (p[0] != 0x00 || p[1] != 0x00))
{
p++;
}
p += 2;
i++;
}
if (!found) return 0;
p = (SMBByte *) getSmbiosTableStructure(smbios, 1, 0x19); /* Type 1: (3.3.2) System Information */
if (p==NULL) return NULL;
verbose("Found SMBIOS System Information Table 1\n");
p += 8;
/* Installs all the needed configuration table entries */
void setupEfiConfigurationTable()
{
smbios_p = (EFI_PTR32)getSmbios();
smbios_p = (EFI_PTR32)getSmbios(SMBIOS_PATCHED);
addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, NULL);
// Setup ACPI with DSDT overrides (mackerintel's patch)
trunk/i386/boot2/graphics.c
11721172
11731173
11741174
1175
11761175
11771176
11781177
......
11811180
11821181
11831182
1184
1185
1186
1183
11871184
11881185
11891186
......
11981195
11991196
12001197
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
12121213
12131214
12141215
// Display and clear the activity indicator.
static char indicator[] = {'-', '\\', '|', '/', '-', '\\', '|', '/', '\0'};
#define kNumIndicators (sizeof(indicator) - 1)
// To prevent a ridiculously fast-spinning indicator,
// ensure a minimum of 1/9 sec between animation frames.
void
spinActivityIndicator(int sectors)
{
static unsigned long lastTickTime = 0;
unsigned long currentTickTime = time18();
static char string[3] = {'\0', '\b', '\0'};
static unsigned long lastTickTime = 0, currentTickTime;
if (previewTotalSectors && previewSaveunder)
{
return;
}
if (currentTickTime < lastTickTime + MIN_TICKS)
return;
else
lastTickTime = currentTickTime;
if ( getVideoMode() == VGA_TEXT_MODE )
{
if (currentIndicator >= kNumIndicators) currentIndicator = 0;
string[0] = indicator[currentIndicator++];
verbose(string);
}
if (gVerboseMode) {
currentTickTime = time18(); // late binding
if (currentTickTime < lastTickTime + MIN_TICKS) {
return;
} else {
lastTickTime = currentTickTime;
}
if (getVideoMode() == VGA_TEXT_MODE) {
if (currentIndicator >= sizeof(indicator)) {
currentIndicator = 0;
}
printf("%c\b", indicator[currentIndicator++]);
}
}
}
void
trunk/i386/libsa/libsa.h
9191
9292
9393
94
9495
9596
9697
extern int strlen(const char * str);
extern char * strcat(char * s1, const char * s2);
extern char * strncat(char * s1, const char * s2, size_t n);
extern char * strdup(const char *s1);
#if STRNCASECMP
extern int strncasecmp(const char * s1, const char * s2, size_t n);
trunk/i386/libsa/printf.c
4545
4646
4747
48
4849
4950
5051
......
5657
5758
5859
59
60
6061
6162
6263
}
/*VARARGS1*/
/* now slprintf() return the length of the string as in man sprintf()*/
int sprintf(char * str, const char * fmt, ...)
{
va_list ap;
prf(fmt, ap, sputc, &pi);
*pi.str = '\0';
va_end(ap);
return 0;
return (pi.str - str);
}
/*VARARGS1*/
trunk/i386/libsa/string.c
241241
242242
243243
244
245
246
247
248
244249
245250
246251
return(strncat(s1, s2, strlen(s2)));
}
char *strdup(const char *s1)
{
return strcpy(malloc(strlen(s1) + 1), s1);
}
#if STRNCASECMP
int strncasecmp(const char *s1, const char *s2, size_t len)
{

Archive Download the corresponding diff file

Revision: 84