Chameleon

Chameleon Commit Details

Date:2010-08-30 18:55:26 (9 years 1 month ago)
Author:Azimutz
Commit:453
Parents: 452
Message:From trunk's rev 450: "Applied Azimutz's fake_efi changes for setting up EFI32/64 system tables." Azi is a grown man now :P Just cleaning comments, etc...
Changes:
M/branches/azimutz/CleanCut/doc-azi/CHANGES.txt
M/branches/azimutz/Chazileon/i386/libsaio/fake_efi.c
M/branches/azimutz/CleanCut/i386/libsaio/fake_efi.c

File differences

branches/azimutz/Chazileon/i386/libsaio/fake_efi.c
7575
7676
7777
78
78
7979
8080
8181
82
82
8383
8484
85
85
8686
8787
88
88
8989
9090
91
92
91
92
9393
9494
9595
9696
97
97
9898
99
99
100100
101101
102102
......
154154
155155
156156
157
157
158158
159159
160160
......
271271
272272
273273
274
274
275275
276276
277277
......
391391
392392
393393
394
394
395395
396396
397397
......
402402
403403
404404
405
405
406406
407407
408408
409409
410410
411
411
412412
413413
414414
......
428428
429429
430430
431
431
432432
433433
434434
435
436
435
436
437437
438438
439439
......
551551
552552
553553
554
554
555555
556556
557557
......
569569
570570
571571
572
572
573573
574574
575575
......
676676
677677
678678
679
680679
680
681681
682
683
684682
685683
686684
687685
688
686
689687
690688
691689
......
707705
708706
709707
710
708
711709
712710
713
711
714712
715713
716714
* Fake EFI implementation
*/
// Identify ourselves as the EFI firmware vendor
/* Identify ourselves as the EFI firmware vendor */
static EFI_CHAR16 const FIRMWARE_VENDOR[] = {'C','h','a','m','e','l','e','o','n','_','2','.','0', 0};
static EFI_UINT32 const FIRMWARE_REVISION = 132; /* FIXME: Find a constant for this. */
// Default platform system_id (fix by IntVar)
/* Default platform system_id (fix by IntVar) */
static EFI_CHAR8 const SYSTEM_ID[] = "0123456789ABCDEF"; //random value gen by uuidgen
// Just a ret instruction
/* Just a ret instruction */
static uint8_t const VOIDRET_INSTRUCTIONS[] = {0xc3};
// movl $0x80000003,%eax; ret
/* movl $0x80000003,%eax; ret */
static uint8_t const UNSUPPORTEDRET_INSTRUCTIONS[] = {0xb8, 0x03, 0x00, 0x00, 0x80, 0xc3};
EFI_SYSTEM_TABLE_32 *gST32 = NULL; //Azi:efi32/64
EFI_SYSTEM_TABLE_64 *gST64 = NULL; //||
EFI_SYSTEM_TABLE_32 *gST32 = NULL;
EFI_SYSTEM_TABLE_64 *gST64 = NULL;
Node *gEfiConfigurationTableNode = NULL;
extern EFI_STATUS addConfigurationTable(EFI_GUID const *pGuid, void *table, char const *alias)
{
EFI_UINTN i = 0; //Azi:efi32/64
EFI_UINTN i = 0;
//Azi:efi32/64 - like this, cpu's with em64t will use EFI64 on pre 10.6 systems,
//Azi: as is, cpu's with em64t will use EFI64 on pre 10.6 systems,
// wich seems to cause no problem. In case it does, force i386 arch.
if (archCpuType == CPU_TYPE_I386)
{
* also take care to set efiMode = 32.
*/
void setupEfiTables32(void) //Azi:efi32/64
void setupEfiTables32(void)
{
// We use the fake_efi_pages struct so that we only need to do one kernel
// memory allocation for all needed EFI data. Otherwise, small allocations
// knows not to save the pages. It even checks to make sure its nonzero.
}
void setupEfiTables64(void) //Azi:efi32/64
void setupEfiTables64(void)
{
struct fake_efi_pages
{
* FSB Frequency detection
*/
// These should be const but DT__AddProperty takes char*
/* These should be const but DT__AddProperty takes char* */
static const char const TSC_Frequency_prop[] = "TSCFrequency";
static const char const FSB_Frequency_prop[] = "FSBFrequency";
static const char const CPU_Frequency_prop[] = "CPUFrequency";
static uint64_t smbios_p; //Azi: asereBLN
// From Foundation/Efi/Guid/Smbios/SmBios.c
/* From Foundation/Efi/Guid/Smbios/SmBios.c */
EFI_GUID const gEfiSmbiosTableGuid = EFI_SMBIOS_TABLE_GUID;
#define SMBIOS_RANGE_START0x000F0000
#define SMBIOS_RANGE_END0x000FFFFF
// '_SM_' in little endian:
/* '_SM_' in little endian: */
#define SMBIOS_ANCHOR_UINT32_LE 0x5f4d535f
#define EFI_ACPI_TABLE_GUID \
* Fake EFI implementation
*/
// These should be const but DT__AddProperty takes char*
/* These should be const but DT__AddProperty takes char* */
static const char const FIRMWARE_REVISION_PROP[] = "firmware-revision";
static const char const FIRMWARE_ABI_PROP[] = "firmware-abi";
static const char const FIRMWARE_VENDOR_PROP[] = "firmware-vendor";
static const char const FIRMWARE_ABI_32_PROP_VALUE[] = "EFI32"; //Azi:efi32/64
static const char const FIRMWARE_ABI_64_PROP_VALUE[] = "EFI64"; //||
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";
// too so we might as well create it so we have a pointer for it too.
node = DT__AddChild(node, "efi");
if (archCpuType == CPU_TYPE_I386) //Azi:efi32/64
if (archCpuType == CPU_TYPE_I386)
{
DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_32_PROP_VALUE), (char*)FIRMWARE_ABI_32_PROP_VALUE);
}
// is set up. That is, name and table properties
Node *runtimeServicesNode = DT__AddChild(node, "runtime-services");
if (archCpuType == CPU_TYPE_I386) //Azi:efi32/64
if (archCpuType == CPU_TYPE_I386)
{
// The value of the table property is the 32-bit physical address for the RuntimeServices table.
// Since the EFI system table already has a pointer to it, we simply use the address of that pointer
static void setupEfiConfigurationTable()
{
// reminder: EFI_PTR64
smbios_p = (EFI_PTR32)getSmbios(SMBIOS_PATCHED);
addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, NULL);
addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, "SMBIOS_P"); //Azi:efi32/64 - give an "alias" to this stuff :)
// Setup ACPI with DSDT overrides (mackerintel's patch)
setupAcpi();
// We've obviously changed the count.. so fix up the CRC32
if (archCpuType == CPU_TYPE_I386) //Azi:efi32/64
if (archCpuType == CPU_TYPE_I386)
{
gST32->Hdr.CRC32 = 0;
gST32->Hdr.CRC32 = crc32(0L, gST32, gST32->Hdr.HeaderSize);
setup_pci_devs(root_pci_dev);
// load smbios.plist file if any
setupSmbiosConfigFile("smbios.plist"); //Azi: smbios plist default name.
setupSmbiosConfigFile("smbios.plist");
// Initialize the base table
if (archCpuType == CPU_TYPE_I386) //Azi:efi32/64
if (archCpuType == CPU_TYPE_I386)
{
setupEfiTables32();
}
branches/azimutz/CleanCut/doc-azi/CHANGES.txt
1818
1919
2020
21
22
2123
2224
2325
Motif: fixes http://forge.voodooprojects.org/p/chameleon/issues/21/.
Note: included on the trunk at revs 449 & 450 :) Thanks!
---------------//---------------//---------------
- (rev 320)
branches/azimutz/CleanCut/i386/libsaio/fake_efi.c
676676
677677
678678
679
679
680680
681681
682682
static void setupEfiConfigurationTable()
{
smbios_p = (EFI_PTR32)getSmbios(SMBIOS_PATCHED);
addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, "SMBIOS_P"); //Azi: give an "alias" to this stuff?
addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, NULL);
// Setup ACPI with DSDT overrides (mackerintel's patch)
setupAcpi();

Archive Download the corresponding diff file

Revision: 453