public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools/EfiRom: supply missing machine type lookup strings
@ 2016-09-08 19:55 Laszlo Ersek
  2016-09-08 20:39 ` Ard Biesheuvel
  0 siblings, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2016-09-08 19:55 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu

"EfiRom --dump" does not recognize the 0x8664 machine type:

>   EFI ROM header contents
>     EFI Signature          0x0EF1
>     Compression Type       0x0001 (compressed)
>     Machine type           0x8664 (unknown)
>     Subsystem              0x000B (EFI boot service driver)
>     EFI image offset       0x0050 (@0xF650)

Add lookup strings for the remaining EFI_IMAGE_MACHINE_* numeric macros
that can be found in
"BaseTools/Source/C/Include/IndustryStandard/PeImage.h".

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 BaseTools/Source/C/EfiRom/EfiRom.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/BaseTools/Source/C/EfiRom/EfiRom.h b/BaseTools/Source/C/EfiRom/EfiRom.h
index 1214700826de..461963b4a701 100644
--- a/BaseTools/Source/C/EfiRom/EfiRom.h
+++ b/BaseTools/Source/C/EfiRom/EfiRom.h
@@ -117,6 +117,9 @@ static STRING_LOOKUP  mMachineTypes[] = {
   { EFI_IMAGE_MACHINE_IA32, "IA32" },
   { EFI_IMAGE_MACHINE_IA64, "IA64" },
   { EFI_IMAGE_MACHINE_EBC, "EBC" },
+  { EFI_IMAGE_MACHINE_X64, "X64" },
+  { EFI_IMAGE_MACHINE_ARMT, "ARMT" },
+  { EFI_IMAGE_MACHINE_AARCH64, "AARCH64" },
   { 0, NULL }
 };
 
-- 
2.9.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] BaseTools/EfiRom: supply missing machine type lookup strings
  2016-09-08 19:55 [PATCH] BaseTools/EfiRom: supply missing machine type lookup strings Laszlo Ersek
@ 2016-09-08 20:39 ` Ard Biesheuvel
  2016-09-08 21:30   ` Laszlo Ersek
  0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2016-09-08 20:39 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: edk2-devel@lists.01.org, Liming Gao

On 8 September 2016 at 20:55, Laszlo Ersek <lersek@redhat.com> wrote:
> "EfiRom --dump" does not recognize the 0x8664 machine type:
>
>>   EFI ROM header contents
>>     EFI Signature          0x0EF1
>>     Compression Type       0x0001 (compressed)
>>     Machine type           0x8664 (unknown)
>>     Subsystem              0x000B (EFI boot service driver)
>>     EFI image offset       0x0050 (@0xF650)
>
> Add lookup strings for the remaining EFI_IMAGE_MACHINE_* numeric macros
> that can be found in
> "BaseTools/Source/C/Include/IndustryStandard/PeImage.h".
>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  BaseTools/Source/C/EfiRom/EfiRom.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/BaseTools/Source/C/EfiRom/EfiRom.h b/BaseTools/Source/C/EfiRom/EfiRom.h
> index 1214700826de..461963b4a701 100644
> --- a/BaseTools/Source/C/EfiRom/EfiRom.h
> +++ b/BaseTools/Source/C/EfiRom/EfiRom.h
> @@ -117,6 +117,9 @@ static STRING_LOOKUP  mMachineTypes[] = {
>    { EFI_IMAGE_MACHINE_IA32, "IA32" },
>    { EFI_IMAGE_MACHINE_IA64, "IA64" },
>    { EFI_IMAGE_MACHINE_EBC, "EBC" },
> +  { EFI_IMAGE_MACHINE_X64, "X64" },
> +  { EFI_IMAGE_MACHINE_ARMT, "ARMT" },

Just 'ARM', please? PE/COFF has multiple machine types for ARM, but
EFI only uses this one for ARM (0x1c2)

With that change,

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Thanks,
Ard.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] BaseTools/EfiRom: supply missing machine type lookup strings
  2016-09-08 20:39 ` Ard Biesheuvel
@ 2016-09-08 21:30   ` Laszlo Ersek
  2016-09-09  2:54     ` Gao, Liming
  0 siblings, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2016-09-08 21:30 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: edk2-devel@lists.01.org, Liming Gao

On 09/08/16 22:39, Ard Biesheuvel wrote:
> On 8 September 2016 at 20:55, Laszlo Ersek <lersek@redhat.com> wrote:
>> "EfiRom --dump" does not recognize the 0x8664 machine type:
>>
>>>   EFI ROM header contents
>>>     EFI Signature          0x0EF1
>>>     Compression Type       0x0001 (compressed)
>>>     Machine type           0x8664 (unknown)
>>>     Subsystem              0x000B (EFI boot service driver)
>>>     EFI image offset       0x0050 (@0xF650)
>>
>> Add lookup strings for the remaining EFI_IMAGE_MACHINE_* numeric macros
>> that can be found in
>> "BaseTools/Source/C/Include/IndustryStandard/PeImage.h".
>>
>> Cc: Liming Gao <liming.gao@intel.com>
>> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>> ---
>>  BaseTools/Source/C/EfiRom/EfiRom.h | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/BaseTools/Source/C/EfiRom/EfiRom.h b/BaseTools/Source/C/EfiRom/EfiRom.h
>> index 1214700826de..461963b4a701 100644
>> --- a/BaseTools/Source/C/EfiRom/EfiRom.h
>> +++ b/BaseTools/Source/C/EfiRom/EfiRom.h
>> @@ -117,6 +117,9 @@ static STRING_LOOKUP  mMachineTypes[] = {
>>    { EFI_IMAGE_MACHINE_IA32, "IA32" },
>>    { EFI_IMAGE_MACHINE_IA64, "IA64" },
>>    { EFI_IMAGE_MACHINE_EBC, "EBC" },
>> +  { EFI_IMAGE_MACHINE_X64, "X64" },
>> +  { EFI_IMAGE_MACHINE_ARMT, "ARMT" },
> 
> Just 'ARM', please? PE/COFF has multiple machine types for ARM, but
> EFI only uses this one for ARM (0x1c2)
> 
> With that change,
> 
> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

I wasn't sure if we wanted to use the edk2 architecture identifiers
here, or the last _FOO substrings from the macro names verbatim.

One fact that supported just picking _FOO is:

"BaseTools/Source/C/Include/IndustryStandard/PeImage.h" has two mappings
for Itanium (different macro name, same replacement text):

#define EFI_IMAGE_MACHINE_IA64      IMAGE_FILE_MACHINE_IA64
#define EFI_IMAGE_MACHINE_IPF       IMAGE_FILE_MACHINE_IA64

The identifier that you can find in the edk2 INF files is IPF, not IA64,
but the above lookup strings include IA64, not IPF. This suggested that
the _FOO suffixes were authoritative, not the arch identifiers that we
use in the DSC / INF etc files.

I'm fine either way, but I would like to hear back from the BaseTools
maintainers too. Because, if we go with ARM, but keep IA64 (rather than
IPF), then that's a (differently) inconsistent situation. And if we
change IA64 to IPF as well, then downstream scripts that presumably
parse the output might break... Fun...

For now I prefer ARMT. Ugly but self-consistent (within the tool). If
Liming / Yonghong agree with you, I'll be happy to repost.

Thanks!
Laszlo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] BaseTools/EfiRom: supply missing machine type lookup strings
  2016-09-08 21:30   ` Laszlo Ersek
@ 2016-09-09  2:54     ` Gao, Liming
  0 siblings, 0 replies; 4+ messages in thread
From: Gao, Liming @ 2016-09-09  2:54 UTC (permalink / raw)
  To: Laszlo Ersek, Ard Biesheuvel; +Cc: edk2-devel@lists.01.org

Laszlo:
  UEFI spec defines machine type short-name for each machine type in Table 12 UEFI Image Types of 3.5.1.1 Removable Media Boot Behavior. I suggest we follow the name in UEFI spec. In this table, AArch32 architecture BOOTARM.EFI, AArch64 architecture BOOTAA64.EFI. So, AArch32 name is ARM, AArch64 name is AA64.

Thanks
Liming
From: Laszlo Ersek [mailto:lersek@redhat.com]
Sent: Friday, September 09, 2016 5:30 AM
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: edk2-devel@lists.01.org <edk2-devel@ml01.01.org>; Gao, Liming <liming.gao@intel.com>
Subject: Re: [edk2] [PATCH] BaseTools/EfiRom: supply missing machine type lookup strings

On 09/08/16 22:39, Ard Biesheuvel wrote:
> On 8 September 2016 at 20:55, Laszlo Ersek wrote:
>> "EfiRom --dump" does not recognize the 0x8664 machine type:
>>
>>> EFI ROM header contents
>>> EFI Signature 0x0EF1
>>> Compression Type 0x0001 (compressed)
>>> Machine type 0x8664 (unknown)
>>> Subsystem 0x000B (EFI boot service driver)
>>> EFI image offset 0x0050 (@0xF650)
>>
>> Add lookup strings for the remaining EFI_IMAGE_MACHINE_* numeric macros
>> that can be found in
>> "BaseTools/Source/C/Include/IndustryStandard/PeImage.h".
>>
>> Cc: Liming Gao
>> Cc: Yonghong Zhu
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Laszlo Ersek
>> ---
>> BaseTools/Source/C/EfiRom/EfiRom.h | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/BaseTools/Source/C/EfiRom/EfiRom.h b/BaseTools/Source/C/EfiRom/EfiRom.h
>> index 1214700826de..461963b4a701 100644
>> --- a/BaseTools/Source/C/EfiRom/EfiRom.h
>> +++ b/BaseTools/Source/C/EfiRom/EfiRom.h
>> @@ -117,6 +117,9 @@ static STRING_LOOKUP mMachineTypes[] = {
>> { EFI_IMAGE_MACHINE_IA32, "IA32" },
>> { EFI_IMAGE_MACHINE_IA64, "IA64" },
>> { EFI_IMAGE_MACHINE_EBC, "EBC" },
>> + { EFI_IMAGE_MACHINE_X64, "X64" },
>> + { EFI_IMAGE_MACHINE_ARMT, "ARMT" },
>
> Just 'ARM', please? PE/COFF has multiple machine types for ARM, but
> EFI only uses this one for ARM (0x1c2)
>
> With that change,
>
> Reviewed-by: Ard Biesheuvel

I wasn't sure if we wanted to use the edk2 architecture identifiers
here, or the last _FOO substrings from the macro names verbatim.

One fact that supported just picking _FOO is:

"BaseTools/Source/C/Include/IndustryStandard/PeImage.h" has two mappings
for Itanium (different macro name, same replacement text):

#define EFI_IMAGE_MACHINE_IA64 IMAGE_FILE_MACHINE_IA64
#define EFI_IMAGE_MACHINE_IPF IMAGE_FILE_MACHINE_IA64

The identifier that you can find in the edk2 INF files is IPF, not IA64,
but the above lookup strings include IA64, not IPF. This suggested that
the _FOO suffixes were authoritative, not the arch identifiers that we
use in the DSC / INF etc files.

I'm fine either way, but I would like to hear back from the BaseTools
maintainers too. Because, if we go with ARM, but keep IA64 (rather than
IPF), then that's a (differently) inconsistent situation. And if we
change IA64 to IPF as well, then downstream scripts that presumably
parse the output might break... Fun...

For now I prefer ARMT. Ugly but self-consistent (within the tool). If
Liming / Yonghong agree with you, I'll be happy to repost.

Thanks!
Laszlo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-09  2:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-08 19:55 [PATCH] BaseTools/EfiRom: supply missing machine type lookup strings Laszlo Ersek
2016-09-08 20:39 ` Ard Biesheuvel
2016-09-08 21:30   ` Laszlo Ersek
2016-09-09  2:54     ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox