Chameleon

Chameleon Commit Details

Date:2011-12-01 16:59:55 (12 years 3 months ago)
Author:armel cadet-petit
Commit:1704
Parents: 1703
Message:updated acpicodec
Changes:
M/branches/cparm/i386/modules/ACPICodec/acpi_codec.h
M/branches/cparm/i386/libsaio/convert.c
M/branches/cparm/i386/libsa/Makefile
M/branches/cparm/i386/libsaio/convert.h
M/branches/cparm/i386/boot2/boot.c
M/branches/cparm/i386/libsa/libsa.h
M/branches/cparm/i386/modules/ACPICodec/acpi_codec.c

File differences

branches/cparm/i386/libsaio/convert.c
1010
1111
1212
13
13
1414
1515
1616
/** Transform a 16 bytes hexadecimal value UUID to a string */
const char * getStringFromUUID(const EFI_CHAR8* eUUID)
{
static char msg[UUID_LEN*2 + 8] = "";
static char msg[UUID_STR_LEN] = "";
if (!eUUID) return "";
const unsigned char * uuid = (unsigned char*) eUUID;
sprintf(msg, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
branches/cparm/i386/libsaio/convert.h
1111
1212
1313
14
15
1416
1517
1618
#define UUID_LEN16
#define UUID_STR_LEN UUID_LEN*2 + 8
const char * getStringFromUUID(const EFI_CHAR8* uuid);
EFI_CHAR8* getUUIDFromString(const char *source);
void *convertHexStr2Binary(const char *hexStr, int *outLength);
branches/cparm/i386/boot2/boot.c
162162
163163
164164
165
166
167
168
169
170
171
172
165173
166174
167175
......
169177
170178
171179
180
181
182
172183
173184
174185
......
178189
179190
180191
181
192
182193
183194
184195
}
#endif
#if 0
static inline void exception_error(char *msg, int nb)
{
printf("\r\nException number = %d\r\nmessage = %s\r\n\r\n", nb, msg);
asm volatile ("hlt");
}
#endif
//==========================================================================
//Initializes the runtime. Right now this means zeroing the BSS and initializing malloc.
//
{
zeroBSS();
malloc_init(0, 0, 0, malloc_error);
#if 0
exception_init(exception_error);
#endif
}
//==========================================================================
{
entry_t kernelEntry;
int ret;
bootArgs->kaddr = bootArgs->ksize = 0;
if(gMacOSVersion[3] <= '6')
branches/cparm/i386/modules/ACPICodec/acpi_codec.h
4949
5050
5151
52
53
5254
5355
5456
#define kUpdateACPI"UpdateACPI" /* acpi_codec.c */
#define kUnsafeACPI"UnsafeACPI"/* acpi_codec.c */ //desactive some safe checks that may stop the boot process on some configurations( temporary option )
#define kOnlySignedAml"LoadSignedAmlOnly" /* acpi_codec.c */
#if UNUSED
#define kGenerateFACS"GenerateFACS"/* acpi_codec.c */
#define kOEMFACS"oemFACS"/* acpi_codec.c */
branches/cparm/i386/modules/ACPICodec/acpi_codec.c
4949
5050
5151
52
5253
5354
5455
56
57
5558
5659
5760
......
9396
9497
9598
99
96100
97101
98102
......
536540
537541
538542
543
544
545
546
547
548
549
550
551
552
553
554
555
539556
540557
541558
......
568585
569586
570587
571
588
572589
590
591
592
593
594
595
596
573597
574598
575599
......
52775301
52785302
52795303
5304
52805305
52815306
52825307
......
53195344
53205345
53215346
5347
5348
5349
5350
5351
53225352
53235353
53245354
5325
5355
53265356
53275357
53285358
......
53465376
53475377
53485378
5379
53495380
53505381
53515382
......
53545385
53555386
53565387
5357
5388
5389
53585390
53595391
53605392
#include "xml.h"
#include "pci_root.h"
#include "sl.h"
#include "convert.h"
U64 rsd_p;
ACPI_TABLES acpi_tables;
U32 uuid32;
bool checkOem = false;
#ifndef DEBUG_ACPI
#define DEBUG_ACPI 0
static ACPI_TABLE_RSDP * gen_alloc_rsdp_v2_from_v1(ACPI_TABLE_RSDP *rsdp );
static ACPI_TABLE_RSDT * gen_alloc_rsdt_from_xsdt(ACPI_TABLE_XSDT *xsdt);
static ACPI_TABLE_XSDT * gen_alloc_xsdt_from_rsdt(ACPI_TABLE_RSDT *rsdt);
static void MakeUuidAdler32(void);
static void *loadACPITable(char *dirspec, char *filename );
static int generate_cpu_map_from_acpi(ACPI_TABLE_DSDT * DsdtPointer);
static ACPI_GENERIC_ADDRESS FillGASStruct(U32 Address, U8 Length);
return xsdt_conv;
}
static void MakeUuidAdler32(void)
{
uuid32 = 0;
const char *uuidStr = getStringFromUUID(Platform->sysid);
if (strlen(uuidStr))
{
uuid32 = OSSwapHostToBigInt32(adler32( (unsigned char *) uuidStr, UUID_STR_LEN ));
}
}
static void *loadACPITable(char *dirspec, char *filename )
{
int fd = -1;
close (fd);
ACPI_TABLE_HEADER * header = (ACPI_TABLE_HEADER *)tableAddr;
ACPI_TABLE_HEADER * header = (ACPI_TABLE_HEADER *)tableAddr;
if ((checkOem == true) && (header->OemRevision != uuid32) )
{
DBG("Bad signature aka Oem Revision (0x%08lx) for Aml file (%s), it should be 0x%08lx, file skipped !!\n", header->OemRevision, acpi_file, uuid32);
free(tableAddr);
return (void*)0ul;
}
if (GetChecksum(header, header->Length) == 0)
{
DBG("Found valid AML file : %s", filename);
#if BUILD_ACPI_TSS
gen_tsta=(U32)getBoolForKey(kGenerateTStates, &tmpval, &bootInfo->bootConfig)&&tmpval;
#endif
checkOem=getBoolForKey(kOnlySignedAml, &tmpval, &bootInfo->bootConfig)&&tmpval;
}
{
if (acpidir_found == true)
{
if (checkOem == true)
{
MakeUuidAdler32();
}
struct dirstuff* moduleDir = opendir(dirspec);
while(readdir(moduleDir, (const char**)&name, &flags, &time) >= 0)
{
if((strcmp(&name[strlen(name) - sizeof("aml")], ".aml") == 0) && ((strlen(dirspec)+strlen(name)) < 512))
if((strstr(name, ".aml")) && ((strlen(dirspec)+strlen(name)) < 512))
{
// Some simple verifications to save time in case of those tables simply named as follow:
if ((strncmp(name, "RSDT", 4) == 0) || (strncmp(name, "rsdt", 4) == 0) ||
}
else
{
DBG("Max nb of allowed aml files reached, exiting .");
break;
}
}
#if DEBUG_ACPI
else
{
DBG("Ignoring %s\n", name);
printf("Ignoring %s\n", name);
}
#endif
branches/cparm/i386/libsa/libsa.h
3131
3232
3333
34
35
36
3437
3538
3639
......
165168
166169
167170
171
172
173
174
175
168176
169177
170178
#include <stdarg.h>
#include <stddef.h>
#include <stdbool.h>
#if 0
#include "C_Exception.h"
#endif
/*
* ctype stuff (aserebln)
extern void srand (unsigned int seed);
/*
* C_Exception.c
*
*/
extern voidexception_init (void (*exception_err_fn)(char *, int));
/*
* getsegbyname.c
branches/cparm/i386/libsa/Makefile
2626
2727
2828
29
29
3030
3131
3232
VPATH = $(OBJROOT):$(SYMROOT)
SA_OBJS = prf.o printf.o zalloc.o \
SA_OBJS = prf.o printf.o zalloc.o\
string.o strtol.o error.o \
setjmp.o qsort.o efi_tables.o

Archive Download the corresponding diff file

Revision: 1704