flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Testing E820 ACPI 3.0 compatibility

Author
Thread Post new topic Reply to topic
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 21 Nov 2006, 11:55
Hello,

You may or may not know that the latest ACPI specification defines INT 15h AX=E820h with extended attributes. I've yet to encounter such a machine. I am posting my code in hopes that someone here may have a machine that does. Please read the source files for instructions on usage. When you post your results please use this format:

MB Make, Model, and CPU: MSI 7A266 Athlon 3000+
BIOS make and date: AMI 7/01/2003


Description:
Download
Filename: E820.zip
Filesize: 12 KB
Downloaded: 619 Time(s)

Post 21 Nov 2006, 11:55
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 21 Nov 2006, 13:56
Motherboard: MSI K8N SLI Platinum (MS-7100); 09/09/2005-MS-7100-6A61FM4BC-00
CPU: AMD Athlon64 3200+ (S939)
BIOS: Phoenix - AwardBIOS v6.00PG; W7100NMS V3.7 090905 09:59:32

Code:
E820 - 1.00.1 Attempt to see E820 information... -smiddy

E820: 
hSz    Base Address   -  Memory Length    -    Memory Type     - ExtAttr
14 : 0000000000000000 - 000000000009F800h -  Available to OS    
14 : 00000000000F0000 - 0000000000010000h -  Reserved Memory    
14 : 00000000FEC00000 - 0000000001400000h -  Reserved Memory    
14 : 00000000E0000000 - 0000000010000000h -  Reserved Memory    
14 : 000000003FFF3000 - 000000000000D000h -  ACPI Reclaim Memory
14 : 000000003FFF0000 - 0000000000003000h -  ACPI NVS Memory    
14 : 000000000009F800 - 0000000000000800h -  Reserved Memory    
14 : 0000000000100000 - 000000003FEF0000h -  Available to OS    
-------------------------------------------------------------------------------
   : Total Memory     :         3FF8F800h -  1,073,281,024 bytes.
-------------------------------------------------------------------------------
    

Tested under a DOS 6.21
Post 21 Nov 2006, 13:56
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 21 Nov 2006, 18:51
Thanks LocoDelAssembly! It is interesting that your machine being as new as it is doesn't support the extended attributes.

It looks like you EBDA is bigger than mine too.

WOW, and some of the records are out of sequence, perhaps I need to put a sorting algorithm in there, eh?
Post 21 Nov 2006, 18:51
View user's profile Send private message Reply with quote
arafel



Joined: 29 Aug 2006
Posts: 131
Location: Jerusalem, Israel
arafel 21 Nov 2006, 18:56
ASUSTek TUV4X, PIII EB 933MHz
Award 07/04/2002
Code:
E820 - 1.00.1 Attempt to see E820 information... -smiddy

E820: 
hSz    Base Address   -  Memory Length    -    Memory Type     - ExtAttr
14 : 0000000000000000 - 000000000009FC00h -  Available to OS    
14 : 000000000009FC00 - 0000000000000400h -  Reserved Memory    
14 : 00000000000F0000 - 0000000000010000h -  Reserved Memory    
14 : 0000000000100000 - 000000003FEEC000h -  Available to OS    
14 : 000000003FFEC000 - 0000000000003000h -  ACPI Reclaim Memory
14 : 000000003FFEF000 - 0000000000010000h -  Reserved Memory    
14 : 000000003FFFF000 - 0000000000001000h -  ACPI NVS Memory    
14 : 00000000FFFF0000 - 0000000000010000h -  Reserved Memory    
-------------------------------------------------------------------------------
   : Total Memory     :         3FF8BC00h -  1,073,265,664 bytes.
-------------------------------------------------------------------------------    

ASRock 775Dual-880Pro, P4 531 3.0GHz
AMI 06/16/2006
Code:
E820 - 1.00.1 Attempt to see E820 information... -smiddy

E820: 
hSz    Base Address   -  Memory Length    -    Memory Type     - ExtAttr
14 : 0000000000000000 - 000000000009FC00h -  Available to OS    
14 : 000000000009FC00 - 0000000000000400h -  Reserved Memory    
14 : 00000000000E6000 - 000000000001A000h -  Reserved Memory    
14 : 0000000000100000 - 000000003FEB0000h -  Available to OS    
14 : 000000003FFB0000 - 0000000000010000h -  ACPI Reclaim Memory
14 : 000000003FFC0000 - 0000000000030000h -  ACPI NVS Memory    
14 : 000000003FFF0000 - 0000000000010000h -  Reserved Memory    
14 : 00000000FEE00000 - 0000000000001000h -  Reserved Memory    
14 : 00000000FF780000 - 0000000000880000h -  Reserved Memory    
-------------------------------------------------------------------------------
   : Total Memory     :         3FF4FC00h -  1,073,019,904 bytes.
-------------------------------------------------------------------------------    
Post 21 Nov 2006, 18:56
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 21 Nov 2006, 19:07
Quote:
WOW, and some of the records are out of sequence, perhaps I need to put a sorting algorithm in there, eh?


Hey you're right, mmmm, then if I continue with http://board.flatassembler.net/topic.php?p=43144#43144 some day now I know that I don't need to insert the records in sequence which certanly it's a much easy task Very Happy
Post 21 Nov 2006, 19:07
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 21 Nov 2006, 19:08
Thanks arafel! Your AMI BIOS is very surprising too.
Post 21 Nov 2006, 19:08
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 21 Nov 2006, 19:51
LocoDelAssembly wrote:
Quote:
WOW, and some of the records are out of sequence, perhaps I need to put a sorting algorithm in there, eh?


Hey you're right, mmmm, then if I continue with http://board.flatassembler.net/topic.php?p=43144#43144 some day now I know that I don't need to insert the records in sequence which certanly it's a much easy task Very Happy


I breifly read through the thread and that is interesting information. Thanks! I must have been elsewhere when that was posted. I suspect that the earlier version are using a combination of ways to determine RAM, like a probe or something else. Where XP is exclusively using E820. Interesting!

I have developed a memory determination routine for my own OS that uses CMOS, INT 12h, INT 15h AX=E820, AX=E801, and AH=88, SMBIOS, PnP, and Probing. Both PnP and E820 return a map of sorts and should be compatible, but most times they are not. Oddly too, PnP results work under V86 mode so you can find out what RAM is there via a dos box in windows (at least in XP).
Post 21 Nov 2006, 19:51
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 21 Nov 2006, 20:26
Thanks for the tip, I'll try this weekend to make some time to work on this.
Post 21 Nov 2006, 20:26
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 22 Nov 2006, 00:30
ASUS A8N SLI Premium ACPI BIOS Revision 1009
10/21/2005-NF-CK804-A8NSLI-P-00
AMD64x2 4400+, 2048MB DDR400 RAM, 4x512MB blocks

Code:
E820 - 1.00.1 Attempt to see E820 information... -smiddy

E820: 
hSz    Base Address   -  Memory Length    -    Memory Type     - ExtAttr
14 : 0000000000000000 - 000000000009D000h -  Available to OS    
14 : 00000000000F0000 - 0000000000010000h -  Reserved Memory    
14 : 00000000FEC00000 - 0000000001400000h -  Reserved Memory    
14 : 00000000E0000000 - 0000000010000000h -  Reserved Memory    
14 : 000000007FFF3000 - 000000000000D000h -  ACPI Reclaim Memory
14 : 000000007FFF0000 - 0000000000003000h -  ACPI NVS Memory    
14 : 000000000009D000 - 0000000000003000h -  Reserved Memory    
14 : 0000000000100000 - 000000007FEF0000h -  Available to OS    
-------------------------------------------------------------------------------
   : Total Memory     :         7FF8D000h -  2,147,012,608 bytes.
-------------------------------------------------------------------------------
    
Post 22 Nov 2006, 00:30
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 22 Nov 2006, 02:39
LocoDelAssembly wrote:
Thanks for the tip, I'll try this weekend to make some time to work on this.


When I get the chance I'll PM you the PnP source I have, which should provide a decent starting point.
Post 22 Nov 2006, 02:39
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 22 Nov 2006, 02:43
f0dder, excellent post. I am bemiffed by the randomness of the output. I have expected BIOS' with your date to be capable of 18h bytes too, but there ya go!
Post 22 Nov 2006, 02:43
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 22 Nov 2006, 15:04
Well, I guess "reserved memory" depends on your chipset - memory mapped devices and such? Weird that these don't get mapped higher, though.
Post 22 Nov 2006, 15:04
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 22 Nov 2006, 15:44
should this work under windoze, or just pure DOS?
Post 22 Nov 2006, 15:44
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 22 Nov 2006, 15:53
Pure DOS, the E820 stuff isn't emulated by NTVDM.
Post 22 Nov 2006, 15:53
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 22 Nov 2006, 16:38
f0dder wrote:
Well, I guess "reserved memory" depends on your chipset - memory mapped devices and such? Weird that these don't get mapped higher, though.


I think part of the lower memory stuff is due to compatibility with older software.
Post 22 Nov 2006, 16:38
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 22 Nov 2006, 16:42
vid wrote:
should this work under windoze, or just pure DOS?


f0dder wrote:
Pure DOS, the E820 stuff isn't emulated by NTVDM.


Yep, pure DOS, or boot it from a floppy. One person I think is trying it from a USB drive.

Perhas I should include the code for Plug & Play interface so there is a comparison. Also Plug & Play interface is compatible with the Dos Box within Windows (at least in XP).
Post 22 Nov 2006, 16:42
View user's profile Send private message Reply with quote
Flat12



Joined: 25 Jan 2013
Posts: 9
Flat12 06 Dec 2024, 10:36
Hi. I need this tool work on CMD in Windows WinPE 3.1 64-bit
If detect E820 table - then stdout "Boot is BIOS Mode"
If no E820 table - then stdout "Boot is UEFI Mode"

RW-Everything 64-bit work OK and display warning - but only in GUI mode. CMD not display this warning only string E820 Table and nothing:

Code:
rw /nologo /stdout /command=e820
E820 Table
_    


I need to detect using the CMD script in what mode WinPE has started - BIOS or UEFI

P.S. Maybe is other tool to detect boot mode?


Description:
Filesize: 157.28 KB
Viewed: 287 Time(s)

CMD_E820_UEFI.png


Description:
Filesize: 46.82 KB
Viewed: 293 Time(s)

E820_UEFI.png


Post 06 Dec 2024, 10:36
View user's profile Send private message Reply with quote
Core i7



Joined: 14 Nov 2024
Posts: 12
Location: Socket in motherboard
Core i7 06 Dec 2024, 15:38
This information can be queried from WMI. Here is an example that displays all the data, although you can also query selectively by listing the required fields separated by commas:

Code:
C:\ wmic bios get /format:list

BIOSVersion          = 7529MS - 20091125
Caption              = Default System BIOS
CurrentLanguage      = en|US|iso8859-1
Description          = Default System BIOS
InstallableLanguages = 1
Manufacturer         = American Megatrends Inc.
Name                 = Default System BIOS
PrimaryBIOS          = TRUE
ReleaseDate          = 20091125000000.000000+000
SMBIOSBIOSVersion    = V4.4
SMBIOSMajorVersion   = 2
SMBIOSMinorVersion   = 6
SMBIOSPresent        = TRUE
SoftwareElementState = 3
Status               = OK
TargetOS             = 0    
Post 06 Dec 2024, 15:38
View user's profile Send private message Reply with quote
Flat12



Joined: 25 Jan 2013
Posts: 9
Flat12 06 Dec 2024, 16:30
@Core i7

Sorry, but I don't see it to write whether it is UEFI or Legacy - it only shows another BIOS name.
Test on VMware Workstation:

UEFI_WMIC.log
Code:
BiosCharacteristics={4,7,9,11,48,49,50,51,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}
BIOSVersion={"INTEL  - 6040000"}
BuildNumber=
Caption=Default System BIOS
CodeSet=
CurrentLanguage=
Description=Default System BIOS
IdentificationCode=
InstallableLanguages=
InstallDate=
LanguageEdition=
ListOfLanguages=
Manufacturer=VMware, Inc.
Name=Default System BIOS
OtherTargetOS=
PrimaryBIOS=TRUE
ReleaseDate=20111108000000.000000+000
SerialNumber=VMware-56 4d c3 da ea cc e8 94-0f 5e cd f3 23 e8 f8 93
SMBIOSBIOSVersion=VMW71.00V.0.B64.1111080139
SMBIOSMajorVersion=2
SMBIOSMinorVersion=6
SMBIOSPresent=TRUE
SoftwareElementID=Default System BIOS
SoftwareElementState=3
Status=OK
TargetOperatingSystem=0
Version=INTEL  - 6040000    


BIOS_WMIC.log
Code:
BiosCharacteristics={4,7,8,9,10,11,12,14,15,16,19,26,27,28,29,30,32,39,40,41,42,50,57,58}
BIOSVersion={"INTEL  - 6040000","PhoenixBIOS 4.0 Release 6.0     "}
BuildNumber=
Caption=PhoenixBIOS 4.0 Release 6.0     
CodeSet=
CurrentLanguage=
Description=PhoenixBIOS 4.0 Release 6.0     
IdentificationCode=
InstallableLanguages=
InstallDate=
LanguageEdition=
ListOfLanguages=
Manufacturer=Phoenix Technologies LTD
Name=PhoenixBIOS 4.0 Release 6.0     
OtherTargetOS=
PrimaryBIOS=TRUE
ReleaseDate=20110602000000.000000+000
SerialNumber=VMware-56 4d c3 da ea cc e8 94-0f 5e cd f3 23 e8 f8 93
SMBIOSBIOSVersion=6.00
SMBIOSMajorVersion=2
SMBIOSMinorVersion=4
SMBIOSPresent=TRUE
SoftwareElementID=PhoenixBIOS 4.0 Release 6.0     
SoftwareElementState=3
Status=OK
TargetOperatingSystem=0
Version=INTEL  - 6040000    
Post 06 Dec 2024, 16:30
View user's profile Send private message Reply with quote
Flat12



Joined: 25 Jan 2013
Posts: 9
Flat12 06 Dec 2024, 17:10
OK, I found fantastic simply tool Smile

How to identify if systems are booted into UEFI or BIOS mode in WinPE
I don't have an answer through WMI, but I did write a utility I could use in WinPE to see if the system executing the binary is UEFI or not
detectefi.cpp & detectefi.exe

This works Smile

Code:
/* Compile this with cl.exe from MS SDK, e.g. 'cl efidetect.cpp', that is all. */
/* IBM(c) 2011 EPL license http://www.eclipse.org/legal/epl-v10.html */

#include <windows.h>
#include <stdio.h>


int main(int argc, char* argv[])
{
        GetFirmwareEnvironmentVariableA("","{00000000-0000-0000-0000-000000000000}",NULL,0);
        if (GetLastError() == ERROR_INVALID_FUNCTION) { // This.. is.. LEGACY BIOOOOOOOOS....
                printf("Legacy");
                return 1;
        } else {
                printf("UEFI");
                return 0;
        }
        return 0;
}
    


Description:
Filesize: 157.3 KB
Viewed: 241 Time(s)

detectefi_UEFI.png


Description:
Filesize: 157.43 KB
Viewed: 241 Time(s)

detectefi_Legacy.png


Post 06 Dec 2024, 17:10
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.