Help - Search - Members - Calendar
Full Version: How To Make Efi Bootloader
Project OS X Forums > OS X 10.6 (Snow Leopard) > Development
Pages: 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
Slice
QUOTE (гык-sse2 @ Mar 28 2011, 11:42 PM) *
Or installing NullIntelCPUPowerManagement;)
Click to view attachment
LoadTable function works (cheched by replacing main with
CODE
LoadAcpiTableFromFile ("fs0:\\acpitbls\\DSDT.aml");
LoadAcpiTableFromFile ("fs0:\\acpitbls\\FACS.aml");
LoadAcpiTableFromFile ("fs0:\\acpitbls\\APIC.aml");
LoadAcpiTableFromFile ("fs0:\\acpitbls\\HPET.aml");

et cetera except RSDT and FACP), but main doesn't work (didn't debug it, because I spent a day working in Final Cut /* here is the beta - http://www.youtube.com/watch?v=zMnl0UIIYW0 */).
I've accidentally trashed the version of lib.h and lib.c that compile, but don't work.

It needs EfiFileLib, and EfiFileLib needs EblNetworkLib (but I made a version that works without it, but didn't find it useful). Both libraries can be found in EmbeddedPkg.

Thanks for the code. Correct!
Click to view attachment
I see one more problem for future:
The UEFI works with also ACPI1.0 but OSX no! ACPI2.0 needed. For this reason my Chameleon is converted ACPI1.0 to ACPI2.0. It is only bootloader working on my Samsung P29 (good luck to it!).

Hm. I think it should be not application but driver.
гык-sse2
No, a driver can be loaded inside Efildr20, and there is no "current directory" then. So, driver shouldn't be able to use current path. And we can't determine if a drive is our startup drive with Clover, because there may be several USB drives - with different revisions or with XPC.
AcpiTable protocol loads tables to ACPI 1.0b, 2.0 and 3.0.
Gigabyte boards still have ACPI 1.0b, and all bootloaders work with them.
Strange: a table on U90 is named RSDT, and inside it the signature is XSDT...
Slice
QUOTE (гык-sse2 @ Mar 29 2011, 02:02 PM) *
No, a driver can be loaded inside Efildr20, and there is no "current directory" then. So, driver shouldn't be able to use current path. And we can't determine if a drive is our startup drive with Clover, because there may be several USB drives - with different revisions or with XPC.
So there is only manual start of the patcher?
Or begin to make our GUI. I think refit base.
Some problem here. It is GNU EFI and file compiled as in post#1 is not working.
At this moment I will make AcpiTable as driver loading DSDT from boot drive if we can't took a default partition to boot.
Hmm. OsxBdsPlatform knows default partition.
QUOTE
AcpiTable protocol loads tables to ACPI 1.0b, 2.0 and 3.0.
Gigabyte boards still have ACPI 1.0b, and all bootloaders work with them.
It is wrong signature. Really there is ACPI2.0. (I also have Gigabyte)
QUOTE
Strange: a table on U90 is named RSDT, and inside it the signature is XSDT...

As usual.
Don't worry. I was trying to patch this but no changes.
гык-sse2
QUOTE (Slice @ Mar 29 2011, 02:14 PM) *
Some problem here. It is GNU EFI and file compiled as in post#1 is not working.

They wrote that it can be compiled with anything except Apple's gcc.
Maybe MTOC the file?

No, not the OS partition, I speak about partition which Clover was started from.
Slice
QUOTE (гык-sse2 @ Mar 29 2011, 02:28 PM) *
They wrote that it can be compiled with anything except Apple's gcc.
Maybe MTOC the file?

No, not the OS partition, I speak about partition which Clover was started from.

refit compiled with GNU_EFI and works, but some functions is not included so refit stalled.
One of them
CODE
struct _EFI_UNICODE_COLLATION_PROTOCOL {
  EFI_UNICODE_COLLATION_STRICOLL    StriColl;
  EFI_UNICODE_COLLATION_METAIMATCH  MetaiMatch;
  EFI_UNICODE_COLLATION_STRLWR      StrLwr;
  EFI_UNICODE_COLLATION_STRUPR      StrUpr;

  //
  // for supporting fat volumes
  //
  EFI_UNICODE_COLLATION_FATTOSTR    FatToStr;
  EFI_UNICODE_COLLATION_STRTOFAT    StrToFat;
  
  ///
  /// A Null-terminated ASCII string array that contains one or more
  /// language codes. This array is specified in RFC 4646 format.
  ///
  CHAR8                             *SupportedLanguages;
};

To use MetaiMatch we should initialize _EFI_UNICODE_COLLATION_PROTOCOL.
O, no! This way is too hard. One day we must make refit with all ACPI tables loading but for now I want to find more simple solution like reading only DSDT.aml and go forward.
Click to view attachment
гык-sse2
There is a unicode collation library which initializes the protocol and I've located the it in my trashed sources.
It's done like
CODE
rc = gBS->LocateProtocol(
                                                     &gEfiAcpiTableProtocolGuid,
                                                     NULL,
                                                     (VOID **)&AcpiTableProtocol
                                                     );

Loading only one table gives KP, because there is only DSDT and no other tables.

OS X became crazy: if I boot with -v, it enters singleuser mode, if I load tables - it ignores them, if I load them other way - it can't find any except XSDT and MCFG and gives KP, type 4 patch stopped working, there is 1GB free space on a 64MB MemoryStick card...

Rebuilding solved that s'ed problems

now can't open file...
Slice
I don't know if there is a more simple way to ReadFile from current device
CODE
(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
EFI_STATUS Status;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume;
EFI_FILE_HANDLE Root = NULL;

//
// Cache a pointer to the Boot Services Table
//
gBS = SystemTable->BootServices;

//
// Retrieve the Loaded Image Protocol
//
Status = gBS->HandleProtocol (
ImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID*)&LoadedImage
);
ASSERT_EFI_ERROR (Status);

//
// Retrieve the Device Path Protocol from the DeviceHandle from which this driver was loaded
//
Status = gBS->HandleProtocol (
LoadedImage->DeviceHandle,
&gEfiDevicePathProtocolGuid,
(VOID*)&ImageDevicePath
);
ASSERT_EFI_ERROR (Status);

//
// File the file system interface to the device
//
Status = gBS->HandleProtocol (
DeviceHandle,
&gEfiSimpleFileSystemProtocolGuid,
(VOID *) &Volume
);

//
// Open the root directory of the volume
//
if (!EFI_ERROR (Status)) {
Status = Volume->OpenVolume (
Volume,
&Root
);
}

Status = Root->Open (Root, &ThisFile, FileName, EFI_FILE_MODE_READ, 0);
BufferSize = 0;
Info = NULL;
/* Get right size we need to allocate */
Status = ThisFile->GetInfo (
ThisFile,
&gEfiFileInfoGuid,
&BufferSize,
Info
);
if (EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL)
{
goto Done;
}
Status = gBS->AllocatePool (EfiBootServicesData, BufferSize, (VOID **) &Info);
if (EFI_ERROR (Status)) {
goto Done;
}
Status = ThisFile->GetInfo (
ThisFile,
&gEfiFileInfoGuid,
&BufferSize,
Info
);
FileSize = Info->FileSize;
FreePool (Info);

Buffer = AllocateZeroPool(FileSize);
Status = ThisFile->Read (ThisFile, &FileSize, Buffer);
if (ThisFile != NULL) {
ThisFile->Close (ThisFile);
}
if (Root != NULL) {
Root->Close (Root);
}

гык-sse2
It's simple enough, if it doesn't bring a thousand of C files which don't compile.
Does it work?

Strange, everything is strange, "People Are Strange", how "The Doors" sing.
Once tables were read, now they aren't. Long ago they installed correctly and there were six of 'em, now if they eventually get installed, a KP happens, and there are only five tables. I remember the code and the tables that I didn't load. I would be able to see what's happening with debug=0x108, but double display of each symbol makes the panic log to scroll out of the screen.
Oh, what for I didn't make a copy of a working module then!
Slice
QUOTE (гык-sse2 @ Mar 29 2011, 11:22 PM) *
It's simple enough, if it doesn't bring a thousand of C files which don't compile.
Does it work?

Not sure. Two hours I collect this codes from different UEFI sources. Why there if no a simple ReadFile("name.txt") in EDK2?
You need to include Guids and Protocols mentioned above into inf file. And no libs! tongue.gif

More.
We should implement into AppleSim one more variable
CODE
     rc = rs->SetVariable(L"platform-uuid",
                          &gEfiAppleNvramGuid,
                          EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
                          sizeof(CustomSystemID), &CustomSystemID);

What is the data format?
гык-sse2
QUOTE (Slice @ Mar 29 2011, 11:32 PM) *
Not sure. Two hours I collect this codes from different UEFI sources. Why there if no a simple ReadFile("name.txt") in EDK2?
You need to include Guids and Protocols mentioned above into inf file. And no libs! tongue.gif

There is, and I said about it! There is EfiFileLib in EmbeddedPkg which works with Duet too. But it's just reading file and allocating memory, no way to get current path or list of files in a folder.
Slice
QUOTE (гык-sse2 @ Mar 29 2011, 11:55 PM) *
There is, and I said about it! There is EfiFileLib in EmbeddedPkg which works with Duet too. But it's just reading file and allocating memory, no way to get current path or list of files in a folder.

Huge library with FV and TFTP support that we need no. It is better to write once our own procedure.
In future we add here readXML. Really it is ready to use just add.

EDK2 updated
CODE
U    MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
Updated to revision 11448.


One more interesting sources is Shell. There is a procedure to read all files in a folder. And it is compatible with duet while refit no.
гык-sse2
The sixth table was FACP! I thought that I didn't load it, but now I see that XSDT is automatically generated, all tables are loaded, but it can't find DSDT because there's no FACP. It was just a lucky video moment - the camera recorded how text started to appear on the screen. Usually it records double-text, because it starts scrolling.
Slice
Now I am making SMBIOS.
гык-sse2
Where is my post about make error 1? I can't fight with it!
No code errors, but make: *** [/Users/Michael/src/edk2/Build/DuetPkgIA32/DEBUG_XCODE32/IA32/DuetPkg/U90AcpiTables/U90AcpiTables/OUTPUT/U90AcpiTables.obj] Error 1
Maybe too large file?

Thfoo! There was an error that I didn't see! #include <Library/EfiFileLib/EfiFileLib.h>: No such file or directory)))

Oh, yeah! I've loaded 'em! (The key is being output incorrectly)
Slice
Now I know, your problems with Memory and KP are related to SMBIOS type 16,17 that not installed by Duet.
гык-sse2
QUOTE (Slice @ Mar 30 2011, 12:47 PM) *
Now I know, your problems with Memory and KP are related to SMBIOS type 16,17 that not installed by Duet.

On XPC there is "Error getting memory information" in System Profiler, but OS works. So might be only type16.
Slice
Is it possible to get boot-log like we have in Chameleon with bdmesg?
Something like writing into nvram to read after start OS.
гык-sse2
Why do you need it? boot.efi doesn't write anything, and you can output to screen or to a file everything that you want.
Somehow I didn't find the SMBIOS patching procedure in meklort's sources some days ago, but now I've found it in the original mackerintel's source. And understood smth (that tables are not added into existing SMBIOS, but a copy is made instead - like in u90acpitables)
Kabyl
Maybe it's not a good idea to use the AcpiTable and Smbios Protocols for patching after all.

There is another way; which is using gST->ConfigurationTable; for Acpi you can just patch the address in the existing R(X)SDT (size isn't going to change) here a quick test can also be done to actually replace the DSDT with your modified one if it's smaller than the original. Allocating memory for any new tables.

After doing this we'll need to:
CODE
    gST->Hdr.CRC32 = 0;
    gBS->CalculateCrc32(gST, sizeof(EFI_SYSTEM_TABLE), &gST->Hdr.CRC32);


гык-sse2
Hm. It is like in Chameleon, code reuse may be possible.
Slice
QUOTE (Kabyl @ Mar 30 2011, 09:17 PM) *
Maybe it's not a good idea to use the AcpiTable and Smbios Protocols for patching after all.

There is another way; which is using gST->ConfigurationTable; for Acpi you can just patch the address in the existing R(X)SDT (size isn't going to change) here a quick test can also be done to actually replace the DSDT with your modified one if it's smaller than the original. Allocating memory for any new tables.

After doing this we'll need to:
CODE
    gST->Hdr.CRC32 = 0;
    gBS->CalculateCrc32(gST, sizeof(EFI_SYSTEM_TABLE), &gST->Hdr.CRC32);

smile.gif
CODE
        //Slice - correct DSDT in place
        if(len && old_dsdt && new_dsdt && (old_dsdt != new_dsdt)){
            DBG("old_dsdt=%08x new_dsdt=%08x new_len=%d\n", (unsigned int)old_dsdt, (unsigned int)new_dsdt, len);
            bcopy(new_dsdt, old_dsdt, len);
        }


First result with SMBIOS. Dump from ShellFull.efi
smbiosview > smbios.txt
CODE
=========================================================
Type=131, Handle=0xB
Dump Structure as:
Index=10,Length=0xF,Addr=0x5F1E11C7
00000000: 83 06 0B 00 01 06 75 6E-70 74 61 6C 20 00 00     *......unptal ..*

Enter to continue, :q to exit, :[0-3] to change mode, /? for help
$Structure Type:Undefined Value
Format part Len : 6
Structure Handle: 11
Structure Type undefined!


Enter to continue, :q to exit, :[0-3] to change mode, /? for help
$
=========================================================
Type=132, Handle=0xC
Dump Structure as:
Index=11,Length=0xF,Addr=0x5F1E11D6
00000000: 84 06 0C 00 85 00 8B 5C-70 74 61 6C 20 00 00     *.......\ptal ..*

Enter to continue, :q to exit, :[0-3] to change mode, /? for help
$Structure Type:Undefined Value
Format part Len : 6
Structure Handle: 12
Structure Type undefined!

Type 131. cpu-type=(01 06)=0x0601. It is mistake. Seems mobility=false.
Type 132. BusSpeed = 85 00 = 0x0085=133MHz True.
Now I need a method to reassign strings (Board-ID first of all).
Looks like
CODE
  //
  // Record Type 1
  //
  AString = GetSmbiosString (SmbiosTable, SmbiosTable.Type1->ProductName);
  UString = AllocateZeroPool ((AsciiStrLen(AString) + 1) * sizeof(CHAR16) + sizeof(FIRMWARE_PRODUCT_NAME));
  ASSERT (UString != NULL);
  CopyMem (UString, FIRMWARE_PRODUCT_NAME, sizeof(FIRMWARE_PRODUCT_NAME));
  AsciiStrToUnicodeStr (AString, UString + sizeof(FIRMWARE_PRODUCT_NAME) / sizeof(CHAR16) - 1);

Do nothing for SMBIOS as I see no changes in table 1.
NetBoot
QUOTE (Slice @ Mar 29 2011, 03:32 PM) *
Not sure. Two hours I collect this codes from different UEFI sources. Why there if no a simple ReadFile("name.txt") in EDK2?
You need to include Guids and Protocols mentioned above into inf file. And no libs! tongue.gif


Slice,

Check the attached file.

Look in SrcPkg/Library/EfiTestUtilityLib/sread.c

Simple read file

Hope this helps.

Net....

Edit: Had to do some finagling on the compressionClick to view attachment
Slice
QUOTE (NetBoot @ Mar 31 2011, 04:54 AM) *
Slice,

Check the attached file.

Look in SrcPkg/Library/EfiTestUtilityLib/sread.c

Simple read file

Hope this helps.

Net....

Edit: Had to do some finagling on the compressionClick to view attachment

Thank you, very interesting! Looks good, if we can implement these sources in our project without penalty.
tonyd
I am very grateful to ALL you guys - Slice for his fakeSmc - Kabyl for his ATI boot which has run solidly here for many months now, and I am very excited to see you guys working on an EFI boot.

I have been using OS_NinJa's DuelBoot, and the latest 1.5A is really quite stable although needs more work doing to it, but my OSX boots up with 12 spins of the wheel which is half the previous time, and it all just works on my 10.6.7 with Geekbench and DVDplayer being obvious causalities. It does not restart well as I have to remove and replace the USB stick, if I reboot. It's work in progress, but most of all its quite stable.I use a Creative USB device for sound so have no probs with the realtek crap.

The purpose of writing is to ask you to please protect your work in order that you get full credit for your efforts

Brgds & thanks. Tony.

GA_X58A-UD3R(rev2)_12GB DDR3_ATI 5770
гык-sse2
QUOTE (Slice @ Mar 30 2011, 10:55 PM) *
Do nothing for SMBIOS as I see no changes in table 1.

That code gets model from SMBIOS and attaches DUET: prefix for use in setup browser.

That library contains everything!
Slice
OK. This day I was analysing HiiSetString while I need UpdateString. Now all is clear and I continue the work.
What is your success with DSDT?
гык-sse2
QUOTE (Slice @ Mar 31 2011, 08:25 PM) *
OK. This day I was analysing HiiSetString while I need UpdateString. Now all is clear and I continue the work.
What is your success with DSDT?

Not with DSDT, but only with all ACPI tables. No progress, because the term started. That U90 module loads all tables, but they're built into the module. Now will continue development, because don't know how to solve my algebra;)
Slice
I proposed you are on holiday.

I still have a problem with understanding.
CODE
VOID
InstallBaseBoardSmbios            ( //2
IN VOID                  *Smbios
                                 )
{
  SMBIOS_STRUCTURE_POINTER          SmbiosTable;
    EFI_SMBIOS_HANDLE                Handle;

  //
  // BaseBoard (TYPE 2)
  //
  SmbiosTable = GetSmbiosTableFromType ((SMBIOS_TABLE_ENTRY_POINT *)Smbios, 2, 0);
  if (SmbiosTable.Raw == NULL) {
//    DEBUG ((EFI_D_ERROR, "SmbiosTable: Type 2 ( BaseBoard) not found!\n"));
    return;
  }
    Handle = SmbiosTable.Type2->Hdr.Handle;
    gSmbios->UpdateString(gSmbios,
                          &Handle,
                          (UINTN*)&SmbiosTable.Type2->Manufacturer,
                          SMbiosvendor);
  //
  // Log Smbios Record Type2
  //
  LogSmbiosData(gSmbios,(UINT8*)SmbiosTable.Type2);
    return;
}

Doesn't work. angry.gif
гык-sse2
I have problems with understanding everything too)

EfiFileLib is buggy, moving to different code:
it loads DSDT, but can't open other files(!)
no, it's HFSPlus that is preventing them from opening. Loaded fine from FAT32.

Did you manage to add table type16?

Moving to what code?
I can't understand some part of your code, because some variables (ThisFile for example) are not declared. Is it the file that we are opening or a loaded image file?
Slice
Yes, I add all memory tables and now I see correct memory in SetupBrowser while 0Mb before.

If you means my sources about AcpiTables then it is only my attempt to make it compilable: include more and more related files. This is not a good way.
I propose to go another way:
1. Read DSDT.aml only. May be also SSDT-N.aml where n=0..9.
2. Install all tables inside main booter with MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf.
Just replace
CODE
  //
  // Locate the firmware volume protocol
  //
  Status = LocateFvInstanceWithTables (&FwVol);
  if (EFI_ERROR (Status)) {
    return EFI_ABORTED;
  }
  //
  // Read tables from the storage file.
  //

To FileSystem.
3. In future make GUI with full interface to patch any we like (other ACPI tables, other SMBios patches, kernel, kexts, GraphicsEnabler and so on).

A problem with Kernel patch. We have HFSplus readonly, so we can't place patched kernel back. But how can we say to boot.efi use kernel from memory?

Any help here? I want to fill the structure
CODE
enum {
    FW_REGION_RESERVED   = 0,
    FW_REGION_RECOVERY   = 1,
    FW_REGION_MAIN       = 2,       //the memory that DUET.fv occupied
    FW_REGION_NVRAM      = 3,   // the memory of nvram variables
    FW_REGION_CONFIG     = 4,  //for Efivar.bin?
    FW_REGION_DIAGVAULT  = 5, //the memory for kernel-panic info ? Or for bdmesg?
    
    NUM_FLASHMAP_ENTRIES = 8
};


typedef struct {
    UINT32   StartAddress;
    UINT32   EndAddress;
} FW_REGION_INFO;


typedef struct { //kSMBTypeFirmwareVolume
    SMBIOS_STRUCTURE   Hdr;
    UINT8           RegionCount;
    UINT8           Reserved[3];
    UINT32          FirmwareFeatures;
    UINT32          FirmwareFeaturesMask;
    UINT8           RegionType[ NUM_FLASHMAP_ENTRIES ];
    FW_REGION_INFO    FlashMap[ NUM_FLASHMAP_ENTRIES ];
} SMBIOS_TABLE_TYPE128;
Kabyl
QUOTE (Slice @ Mar 31 2011, 06:48 PM) *
I proposed you are on holiday.

I still have a problem with understanding.
CODE
VOID
InstallBaseBoardSmbios            ( //2
IN VOID                  *Smbios
                                 )
{
  SMBIOS_STRUCTURE_POINTER          SmbiosTable;
    EFI_SMBIOS_HANDLE                Handle;

  //
  // BaseBoard (TYPE 2)
  //
  SmbiosTable = GetSmbiosTableFromType ((SMBIOS_TABLE_ENTRY_POINT *)Smbios, 2, 0);
  if (SmbiosTable.Raw == NULL) {
//    DEBUG ((EFI_D_ERROR, "SmbiosTable: Type 2 ( BaseBoard) not found!\n"));
    return;
  }
    Handle = SmbiosTable.Type2->Hdr.Handle;
    gSmbios->UpdateString(gSmbios,
                          &Handle,
                          (UINTN*)&SmbiosTable.Type2->Manufacturer,
                          SMbiosvendor);
  //
  // Log Smbios Record Type2
  //
  LogSmbiosData(gSmbios,(UINT8*)SmbiosTable.Type2);
    return;
}

Doesn't work. angry.gif


You need to call LogSmbiosData() which in turn calls gSmbios->Add() before using gSmbios->UpdateString().

It seems we need to iterate on and gSmbios->Add() all records because SmbiosGenDxe doesn't do the full job.

So to have a patched SMBIOS, we find the original in the HobList (GetSmbiosTablesFromHob()), gSmbios->Add() each record found after patching its data, and we need to make sure not to call gSmbios->UpdateString() on a record before having it added with gSmbios->Add().

SmbiosDxe registers an event to be notified on gEfiEventReadyToBootGuid, and runs gBS->InstallConfigurationTable (&gEfiSmbiosTableGuid, Eps).
гык-sse2
QUOTE (Slice @ Apr 1 2011, 10:31 AM) *
Yes, I add all memory tables and now I see correct memory in SetupBrowser while 0Mb before.

If you means my sources about AcpiTables then it is only my attempt to make it compilable: include more and more related files. This is not a good way.
I propose to go another way:
1. Read DSDT.aml only. May be also SSDT-N.aml where n=0..9.
2. Install all tables inside main booter with MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf.
.
Saying again: a module included into Efildr20 doesn't know where to search for tables. A module loaded from a filesystem will load from its folder.
Slice
QUOTE (modbin @ Apr 1 2011, 09:30 PM) *
There is one thing I don't get. Why can't we all work together? blink.gif

Welcome!

SMBIOS finished
CODE
=========================================================
Type=2, Handle=0xC
Dump Structure as:
Index=11,Length=0x3D,Addr=0x5F1E11BF
00000000: 02 09 0C 00 01 02 03 04-05 41 70 70 6C 65 20 49  *.........Apple I*
00000010: 6E 63 2E 00 4D 61 63 2D-46 34 32 30 38 43 41 39  *nc..Mac-F4208CA9*
00000020: 00 20 20 20 00 57 38 37-32 33 34 4A 48 59 41 34  *.   .W87234JHYA4*
00000030: 00 20 20 20 20 20 20 20-20 20 20 00 00           *.          ..*

Enter to continue, :q to exit, :[0-3] to change mode, /? for help
$Structure Type: Base Board Information
Format part Len : 9
Structure Handle: 12
Manufacturer: Apple Inc.
ProductName: Mac-F4208CA9
Version:    
SerialNumber: W87234JHYA4

Begin loading DSDT to finish my work.
QUOTE
THe KiNG, what's cool?

April 1.
Kabyl
QUOTE (Slice @ Apr 1 2011, 07:01 PM) *
SMBIOS finished

How?
THe KiNG
QUOTE (Slice @ Apr 1 2011, 09:01 PM) *
April 1.

Yeah. tongue.gif
Slice
QUOTE (Kabyl @ Apr 1 2011, 10:27 PM) *
How?

Click to view attachment
If any proposition - please!
Kabyl
QUOTE (Slice @ Apr 2 2011, 05:49 AM) *
Click to view attachment
If any proposition - please!


In GetSystemTablesFromHob() (BdsPlatform.c) you need to skip the SMBIOS table, and let SmbiosDxe install it instead.

I checked your modified OsxBds, you need to restore the old code that moves the SMBIOS table to upper memory, the current location (below 1MB) could cause issues when used with a different memory map.

Ignore that, I just said we need to skip it. smile.gif
Slice
QUOTE (Kabyl @ Apr 2 2011, 12:58 PM) *
In GetSystemTablesFromHob() (BdsPlatform.c) you need to skip the SMBIOS table, and let SmbiosDxe install it instead.

Not sure. First Get from Hob, next Install and patch.
With default SmbiosGenDxe I have only 4 tables, others absent.
Now I have good working SMBIOS: Lion passed PlatformCheck and launch kernel. Wow! Lion kernel works with Yonah! No kernel patch needed for me.
Still problem with ReadFile to install DSDT.

Some correction to AppleSim (sounds like appelsin rus->orange) smile.gif
CODE
struct _APPLE_GETVAR_PROTOCOL {
    EFI_STATUS(EFIAPI *Unknown0)(IN VOID *);
    EFI_STATUS(EFIAPI *Unknown1)(IN VOID *);
    EFI_STATUS(EFIAPI *Unknown2)(IN VOID *);
    EFI_STATUS(EFIAPI *Unknown3)(IN VOID *);
//    EFI_STATUS(EFIAPI *Unknown4)(IN VOID *);
    APPLE_GETVAR_PROTOCOL_GET_DEVICE_PROPS  GetDevProps;
    EFI_STATUS(EFIAPI *Unknown5)(IN VOID *);
};

Must be 6 handles else boot.efi hangs.
Kabyl
QUOTE (Slice @ Apr 2 2011, 10:11 AM) *
Some correction to AppleSim (sounds like appelsin rus->orange) smile.gif
CODE
struct _APPLE_GETVAR_PROTOCOL {
    EFI_STATUS(EFIAPI *Unknown0)(IN VOID *);
    EFI_STATUS(EFIAPI *Unknown1)(IN VOID *);
    EFI_STATUS(EFIAPI *Unknown2)(IN VOID *);
    EFI_STATUS(EFIAPI *Unknown3)(IN VOID *);
//    EFI_STATUS(EFIAPI *Unknown4)(IN VOID *);
    APPLE_GETVAR_PROTOCOL_GET_DEVICE_PROPS  GetDevProps;
    EFI_STATUS(EFIAPI *Unknown5)(IN VOID *);
};

Must be 6 handles else boot.efi hangs.

Great find!
гык-sse2
QUOTE (Slice @ Apr 2 2011, 01:11 PM) *
Still problem with ReadFile to install DSDT.

I'm working every day on file reading, I've successfully got path, but without device name (fs1 in my case).
NetBoot
Here some useful information about the other packages that are in edk2 and why the source is all ways SOURCE_DEBUG

UDK Debugger Tool User Manual Click to view attachment

After reading you'll notice it will be SOURCE_DEBUG_ENABLE

Net....
гык-sse2
I have serial port only on desktop, doesn't have it on the notebook. And USB driver needs debugging too. So two-machine debugging is not for me. And I even switched back to both compiling and testing on the notebook, because the desktop is very noisy thanks to 8600GT.
Slice
QUOTE (гык-sse2 @ Apr 2 2011, 04:12 PM) *
I'm working every day on file reading, I've successfully got path, but without device name (fs1 in my case).

May be try this
CODE
///
/// This protocol converts text to device paths and device nodes.
///
typedef struct {
  EFI_DEVICE_PATH_FROM_TEXT_NODE  ConvertTextToDeviceNode;
  EFI_DEVICE_PATH_FROM_TEXT_PATH  ConvertTextToDevicePath;
} EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL;

extern EFI_GUID gEfiDevicePathFromTextProtocolGuid;
гык-sse2
No, I wanna get text from device path, not vice versa. There is DevicePathToStr function. But it's not that device path (I'm giving it wrong parameter) - I got Acpi(...)/SATA(...)/MBR(...)/Partition(..)/, and wanna get fs0:
I've seen a file that contained functions or definitions of different device path types, but now can't find it...
Slice
EE (Experience Exchange)
Click to view attachment
With this driver manual loaded I have the follow
Click to view attachment
then hangs. Why?

I see correct size of my DSDT.aml
гык-sse2
Try closing the file after installing table. Maybe it's pointer assignment without copying?
Don't know if I return to it today, I'll try to find time.
Slice
Hang here:
CODE
    Print(L"Locate ACPI Protocol with status %x\n", Status);  //printed 0x8000000E
    ASSERT_EFI_ERROR(Status);
    Print(L"Begin InstallAcpiTable\n");  //printed
    
    AcpiTableProtocol->InstallAcpiTable(                                           //hang here
                                        AcpiTableProtocol,
                                        FileBuffer,
                                        FileSize,
                                        &Key
                                        );
    
    Print(L"Finish ACPI patch!\n");  //no this message

Looks like the driver, manually loaded from shell, can not get access to ACPI tables.
0x8000000E = RETURN_NOT_FOUND = 14 | MAX_BIT
Protocol ACPI table not found.

For further development there is good info
CODE
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *mStatusString[] = {
"Success", // RETURN_SUCCESS = 0
"Warning Unknown Glyph", // RETURN_WARN_UNKNOWN_GLYPH = 1
"Warning Delete Failure", // RETURN_WARN_DELETE_FAILURE = 2
"Warning Write Failure", // RETURN_WARN_WRITE_FAILURE = 3
"Warning Buffer Too Small", // RETURN_WARN_BUFFER_TOO_SMALL = 4
"Load Error", // RETURN_LOAD_ERROR = 1 | MAX_BIT
"Invalid Parameter", // RETURN_INVALID_PARAMETER = 2 | MAX_BIT
"Unsupported", // RETURN_UNSUPPORTED = 3 | MAX_BIT
"Bad Buffer Size", // RETURN_BAD_BUFFER_SIZE = 4 | MAX_BIT
"Buffer Too Small", // RETURN_BUFFER_TOO_SMALL, = 5 | MAX_BIT
"Not Ready", // RETURN_NOT_READY = 6 | MAX_BIT
"Device Error", // RETURN_DEVICE_ERROR = 7 | MAX_BIT
"Write Protected", // RETURN_WRITE_PROTECTED = 8 | MAX_BIT
"Out of Resources", // RETURN_OUT_OF_RESOURCES = 9 | MAX_BIT
"Volume Corrupt", // RETURN_VOLUME_CORRUPTED = 10 | MAX_BIT
"Volume Full", // RETURN_VOLUME_FULL = 11 | MAX_BIT
"No Media", // RETURN_NO_MEDIA = 12 | MAX_BIT
"Media changed", // RETURN_MEDIA_CHANGED = 13 | MAX_BIT
"Not Found", // RETURN_NOT_FOUND = 14 | MAX_BIT
"Access Denied", // RETURN_ACCESS_DENIED = 15 | MAX_BIT
"No Response", // RETURN_NO_RESPONSE = 16 | MAX_BIT
"No mapping", // RETURN_NO_MAPPING = 17 | MAX_BIT
"Time out", // RETURN_TIMEOUT = 18 | MAX_BIT
"Not started", // RETURN_NOT_STARTED = 19 | MAX_BIT
"Already started", // RETURN_ALREADY_STARTED = 20 | MAX_BIT
"Aborted", // RETURN_ABORTED = 21 | MAX_BIT
"ICMP Error", // RETURN_ICMP_ERROR = 22 | MAX_BIT
"TFTP Error", // RETURN_TFTP_ERROR = 23 | MAX_BIT
"Protocol Error" // RETURN_PROTOCOL_ERROR = 24 | MAX_BIT
};


EDITED:
AcpiTableDxe was not included into Duet ohmy.gif
Kabyl
QUOTE (Slice @ Apr 3 2011, 01:20 PM) *
EDITED:
AcpiTableDxe was not included into Duet ohmy.gif

smile.gif
And try to install the FADT before the DSDT (althout the code should handle it just fine).

Make sure you skip this in the Bds, just like you did with the SMBIOS.
Slice
QUOTE (Kabyl @ Apr 3 2011, 06:12 PM) *
smile.gif
And try to install the FADT before the DSDT (althout the code should handle it just fine).

Make sure you skip this in the Bds, just like you did with the SMBIOS.

There is more complex problem:
1. Without AcpiTableDxe I have no protocol, but I have all legacy ACPI tables. Can't change it.
2. With AcpiTableDxe I have clear tables, generated from zero. Damned Tiano!!
Kabyl
QUOTE (Slice @ Apr 3 2011, 04:09 PM) *
There is more complex problem:
1. Without AcpiTableDxe I have no protocol, but I have all legacy ACPI tables. Can't change it.
2. With AcpiTableDxe I have clear tables, generated from zero. Damned Tiano!!

I would think of that as options, either:
1. find the RSDP in the HobList, allocate appropriate memory type and patch then add to the configuration tables, or,
2. iterate on RSDP (also found in the HobList) and Install each table (this is easier IMO).
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.