Chameleon

Chameleon Commit Details

Date:2011-12-08 14:37:00 (12 years 4 months ago)
Author:armel cadet-petit
Commit:1714
Parents: 1713
Message:updated acpicodec
Changes:
M/branches/cparm/i386/libsaio/hfs.c
M/branches/cparm/i386/libsaio/SMBIOS.h
M/branches/cparm/i386/libsaio/sl.h
M/branches/cparm/i386/libsaio/fake_efi.c
M/branches/cparm/i386/modules/ACPICodec/acpi_codec.c
M/branches/cparm/CHANGES
M/branches/cparm/i386/libsaio/Makefile
M/branches/cparm/i386/libsaio/smbios.c

File differences

branches/cparm/CHANGES
1
12
23
34
- Added an option to the check Oem revision of aml files (by adler32 of unique machine id or adler32 of motherboard model), can be useful with multiple machines (a command line tool able to patch the aml files will be available soon)
- Improved smbios support for some Intel Xeon models
- BETA : Sync'd ati engine with the trunk
branches/cparm/i386/libsaio/hfs.c
7676
7777
7878
79
80
81
7982
8083
8184
......
300303
301304
302305
303
304
305306
307
308
309
310
311
312
313
306314
307315
308316
#endif /* !__i386__ */
unsigned long HFSLoadVerbose = 1;
static long ReadFile(void *file, uint64_t *length, void *base, uint64_t offset);
static long GetCatalogEntryInfo(void *entry, long *flags, long *time,
FinderInfo *finderInfo, long *infoValid);
}
getDeviceDescription(ih, devStr);
verbose("Read HFS%s file: [%s/%s] %d bytes.\n",
(gIsHFSPlus ? "+" : ""), devStr, filePath, (uint32_t)length);
if (HFSLoadVerbose) {
verbose("Read HFS%s file: [%s/%s] %d bytes.\n",
(gIsHFSPlus ? "+" : ""), devStr, filePath, (uint32_t)length);
} else if (HFSLoadVerbose == 0) {
HFSLoadVerbose = 1;
}
return length;
}
branches/cparm/i386/libsaio/Makefile
4343
4444
4545
46
47
46
47
4848
49
50
51
52
53
54
4955
50
56
5157
5258
53
59
5460
5561
5662
......
94100
95101
96102
97
103
98104
99105
100106
......
114120
115121
116122
123
124
125
117126
118127
119128
device_inject.o pci_root.o \
convert.o acpi_tools.o smbios.o smp-imps.o
# example for acpicodec
#CFLAGS += acpi_codec.o acpicode.o ACPICodec.o acpidecode.o
# example for AcpiCodec
#SAIO_OBJS += acpi_codec.o acpicode.o ACPICodec.o acpidecode.o
# example for AcpiPatcher
#SAIO_OBJS += aml_generator.o acpi_patcher.o AcpiPatcher.o
# example for GE
#SAIO_OBJS += nvidia.o ati.o gma.o GraphicsEnabler.o
# example for SMBiosGetters
#CFLAGS += mysmbios.o smbios_decode.o smbios_getters.o SMBiosGetters.o
#SAIO_OBJS += mysmbios.o smbios_decode.o smbios_getters.o SMBiosGetters.o
# example for GUI
#CFLAGS += graphic_utils.o gui.o rand.o picopng.o GUI_module.o
#SAIO_OBJS += graphic_utils.o gui.o picopng.o GUI_module.o
# Options enabled by default:
#CFLAGS += -DNO_WIN_SUPPORT # -7200 bytes
#SIG = $(SYMROOT)/sig
all embedtheme: $(DIRS_NEEDED) libsaio.h $(LIBS)
all embedtheme: $(DIRS_NEEDED) libsaio.h embedded.h $(LIBS)
#libsaio_static.a: $(SAIO_OBJS)
#rm -f $(SYMROOT)/$@
ar q $(SYMROOT)/$(@F) $^
ranlib $(SYMROOT)/$(@F)
embedded.h:
@cd $(SYMROOT)/../../doc && xxd -i BootHelp.txt > $(SYMROOT)/embedded.h
#saio_internal.h: saio_external.h
#saio_table.c: saio_external.h
#saio_defs.h: saio_external.h
branches/cparm/i386/libsaio/SMBIOS.h
3737
3838
3939
40
4041
4142
4243
#define thePlatformName 1
#define theProducBoard 2
extern int readSMBIOS(int value); // value copied into the platform structure
extern char* readDefaultPlatformName(void);
#define SMBIOS_RANGE_START0x000F0000
#define SMBIOS_RANGE_END0x000FFFFF
branches/cparm/i386/libsaio/sl.h
6262
6363
6464
65
6566
6667
6768
extern void * gFSLoadAddress;
extern cpu_type_t archCpuType;
extern unsigned long HFSLoadVerbose;
cpu_type_t detectCpuType ();
#endif /* !__LIBSAIO_SL_H */
branches/cparm/i386/libsaio/smbios.c
4949
5050
5151
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
52101
53102
54103
return orig;
}
/* get product Name from original SMBIOS */
char* readDefaultPlatformName(void)
{
SMBEntryPoint *eps = getSmbiosOriginal();
if (eps == NULL) return NULL;
uint8_t *structPtr = (uint8_t *)eps->dmi.tableAddress;
SMBStructHeader *structHeader = (SMBStructHeader *)structPtr;
for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)
{
switch (structHeader->type)
{
case kSMBTypeSystemInformation:
{
uint8_t *stringPtr = (uint8_t *)structHeader + structHeader->length;
uint8_t field = ((SMBSystemInformation *)structHeader)->productName;
if (!field)
return NULL;
for (field--; field != 0 && strlen((char *)stringPtr) > 0;
field--, stringPtr = (uint8_t *)((uint32_t)stringPtr + strlen((char *)stringPtr) + 1));
//DBG("original SMBIOS Product name: %s\n",(char *)stringPtr);
if (stringPtr)
return (char *)stringPtr;
else
return NULL;
break;
}
default:
break;
}
structPtr = (uint8_t *)((uint32_t)structHeader + structHeader->length);
for (; ((uint16_t *)structPtr)[0] != 0; structPtr++);
if (((uint16_t *)structPtr)[0] == 0)
structPtr += 2;
structHeader = (SMBStructHeader *)structPtr;
}
return NULL;
}
/* get UUID or product Name from original SMBIOS, stripped version of kabyl's readSMBIOSInfo */
int readSMBIOS(int value)
{
branches/cparm/i386/libsaio/fake_efi.c
511511
512512
513513
514
514515
515516
516517
517518
518519
519520
521
520522
521523
522524
......
788790
789791
790792
793
794
795
796
797
798
799
800
801
802
791803
792804
793805
static const char const FIRMWARE_DEV_PROP[] = "firmware-maintener";
static const char const FIRMWARE_PUBLISH_PROP[] = "firmware-publisher";
static const char const FIRMWARE_ABI_32_PROP_VALUE[] = "EFI32";
static const char const FIRMWARE_ABI_64_PROP_VALUE[] = "EFI64";
static const char const SYSTEM_ID_PROP[] = "system-id";
static const char const SYSTEM_SERIAL_PROP[] = "SystemSerialNumber";
static const char const SYSTEM_TYPE_PROP[] = "system-type";
static const char const MODEL_PROP[] = "Model";
static const char const MOTHERBOARD_NAME_PROP[] = "motherboard-name";
/*
DT__AddProperty(efiNode, FIRMWARE_DEV_PROP, strlen(FIRMWARE_MAINTENER)+1, FIRMWARE_MAINTENER);
DT__AddProperty(efiNode, FIRMWARE_PUBLISH_PROP, strlen(FIRMWARE_PUBLISHER)+1, FIRMWARE_PUBLISHER);
{
// Export it for later use
char * DefaultPlatform = readDefaultPlatformName();
if (DefaultPlatform)
{
DT__AddProperty(efiNode, MOTHERBOARD_NAME_PROP, strlen(DefaultPlatform)+1, DefaultPlatform);
}
}
// Set up the /efi/configuration-table node which will eventually have several child nodes for
// all of the configuration tables needed by various kernel extensions.
gEfiConfigurationTableNode = DT__AddChild(efiNode, "configuration-table");
branches/cparm/i386/modules/ACPICodec/acpi_codec.c
5454
5555
5656
57
5758
5859
5960
......
9091
9192
9293
94
9395
9496
9597
9698
9799
98100
99
100
101
102
101103
102104
103105
......
248250
249251
250252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
251269
252270
253271
......
540558
541559
542560
543
561
544562
563
564
565
566
567
568
569
570
571
545572
546573
547574
......
553580
554581
555582
556
583
557584
558585
559586
......
563590
564591
565592
593
566594
567595
568596
......
587615
588616
589617
590
618
591619
592
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
593658
594
659
595660
596661
662
663
597664
598665
599
600
601
666
667
668
602669
603670
604671
......
609676
610677
611678
679
680
681
682
683
612684
613
614
615
616685
617686
618687
......
21052174
21062175
21072176
2108
2177
21092178
21102179
21112180
......
28922961
28932962
28942963
2895
2896
2897
2964
2965
2966
28982967
28992968
29002969
......
29272996
29282997
29292998
2930
2931
2932
2999
3000
3001
29333002
29343003
29353004
......
29623031
29633032
29643033
2965
2966
2967
3034
3035
3036
29683037
29693038
29703039
......
53465415
53475416
53485417
5349
5418
53505419
53515420
53525421
......
53685437
53695438
53705439
5371
5440
53725441
53735442
53745443
U64 rsd_p;
ACPI_TABLES acpi_tables;
U32 uuid32;
U32 Model32;
bool checkOem = false;
#ifndef DEBUG_ACPI
#endif
static ACPI_TABLE_HEADER * get_new_table_in_list(U32 *new_table_list, U32 Signature, U8 *retIndex );
static U8 get_number_of_tables_in_list(U32 *new_table_list, U32 Signature );
static U8 get_0ul_index_in_list(U32 *new_table_list, bool reserved );
static void sanitize_new_table_list(U32 *new_table_list );
static void move_table_list_to_kmem(U32 *new_table_list );
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 void MakeAcpiSgn(void);
static void *loadACPITable(U32 *new_table_list, char *dirspec, char *filename );
static int generate_cpu_map_from_acpi(ACPI_TABLE_DSDT * DsdtPointer);
static ACPI_GENERIC_ADDRESS FillGASStruct(U32 Address, U8 Length);
static U32 process_xsdt (ACPI_TABLE_RSDP *rsdp_mod , U32 *new_table_list);
return (void*)0ul;
}
static U8 get_number_of_tables_in_list(U32 *new_table_list, U32 Signature )
{
ACPI_TABLE_HEADER **table_array = (ACPI_TABLE_HEADER **) new_table_list;
U8 index ;
U8 InstalledTables = 0;
for (index = 0; index < (MAX_ACPI_TABLE + RESERVED_AERA); index++)
{
if (*(U32 *) (table_array[index]->Signature) == Signature)
{
InstalledTables++ ;
}
}
return InstalledTables;
}
static U8 get_0ul_index_in_list(U32 *new_table_list, bool reserved )
{
U8 index ;
return xsdt_conv;
}
static void MakeUuidAdler32(void)
static void MakeAcpiSgn(void)
{
char * DefaultplatformName = NULL;
Model32 = 0;
if (DefaultplatformName = readDefaultPlatformName())
{
Model32 = OSSwapHostToBigInt32(adler32( (unsigned char *) DefaultplatformName, strlen(DefaultplatformName)));
}
uuid32 = 0;
const char *uuidStr = getStringFromUUID(Platform->sysid);
}
static void *loadACPITable(char *dirspec, char *filename )
static void *loadACPITable(U32 *new_table_list, char *dirspec, char *filename )
{
int fd = -1;
char acpi_file[512];
sprintf(acpi_file, "%s%s",dirspec, filename);
HFSLoadVerbose = 0;
fd=open(acpi_file);
if (fd<0)
ACPI_TABLE_HEADER * header = (ACPI_TABLE_HEADER *)tableAddr;
if ((checkOem == true) && (header->OemRevision != uuid32) )
if (*(U32*)(header->Signature) != NAMESEG("SSDT"))
{
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);
U8 dummy = 0;
if (get_new_table_in_list(new_table_list, *(U32*)(header->Signature), &dummy))
{
#if DEBUG_ACPI
printf("Warning: A ");
print_nameseg(*(U32*) (header->Signature));
printf(" Aml file is already loaded and registred, file skipped !!\n");
#endif
free(tableAddr);
return (void*)0ul;
}
}
else
{
if (get_number_of_tables_in_list(new_table_list, NAMESEG("SSDT")) >= MAX_SSDT_TABLE)
{
DBG("Warning: Max number of SSDT aml files reached, file skipped !!\n");
free(tableAddr);
return (void*)0ul;
}
}
if (checkOem == true)
{
if (header->OemRevision == Model32)
{
goto continue_loading;
}
if (header->OemRevision == uuid32)
{
goto continue_loading;
}
DBG("Bad signature aka Oem Revision (0x%08lx) for Aml file (%s), file skipped !!\n", header->OemRevision, acpi_file);
DBG("uuid32 (0x%08lx) , model32 (0x%08lx)\n", uuid32, Model32);
free(tableAddr);
return (void*)0ul;
return (void*)0ul;
}
continue_loading:
if (GetChecksum(header, header->Length) == 0)
{
DBG("Found valid AML file : %s", filename);
DBG(" ( %s ) read and stored at: %x", acpi_file, tableAddr);
DBG("\n");
DBG("Found valid AML file : %s ", filename);
printf("[ %s ] read and stored at: %x", acpi_file, tableAddr);
printf("\n");
return tableAddr;
}
else
return (void*)0ul;
}
}
else
{
printf("Couldn't allocate memory for table %s\n", acpi_file);
close (fd);
}
printf("Couldn't allocate memory for table %s\n", acpi_file);
close (fd);
return (void *)0ul ;
}
}
*/
bool sta = BuildCoreIPstateInfo(cpu);
U32 sta = BuildCoreIPstateInfo(cpu);
if (sta)
{
DBG("_PSS PGK generated successfully\n");
ACPI_MADT_LOCAL_APIC_NMI *nmi = current;
current = nmi + 1;
/*
if (!(nmi->IntiFlags & ACPI_MADT_ENABLED))
continue;
*/
if (!(nmi->IntiFlags & ACPI_MADT_ENABLED))
continue;
*/
if (LOCAL_APIC_NMI_CNT >= nb_cpu)
continue;
ACPI_MADT_LOCAL_SAPIC *sapic = current;
current = sapic + 1;
/*
if (!(sapic->LapicFlags & ACPI_MADT_ENABLED))
continue;
*/
if (!(sapic->LapicFlags & ACPI_MADT_ENABLED))
continue;
*/
if (LOCAL_SAPIC_CNT >= nb_cpu)
continue;
ACPI_MADT_INTERRUPT_SOURCE *intsrc = current;
current = intsrc + 1;
/*
if (!(intsrc->IntiFlags & ACPI_MADT_ENABLED))
continue;
*/
if (!(intsrc->IntiFlags & ACPI_MADT_ENABLED))
continue;
*/
if (INT_SRC_CNT >= nb_cpu)
continue;
{
if (checkOem == true)
{
MakeUuidAdler32();
MakeAcpiSgn();
}
struct dirstuff* moduleDir = opendir(dirspec);
}
DBG("* Attempting to load acpi table: %s\n", name);
if ( (new_table_list[i]=(U32)loadACPITable(dirspec,name)))
if ( (new_table_list[i]=(U32)loadACPITable(new_table_list,dirspec,name)))
{
if (i < MAX_ACPI_TABLE)
{

Archive Download the corresponding diff file

Revision: 1714