[SeaBIOS] [PATCH v2 7/9] LegacyBios.h: Add missing pack() pragma

Jiaxun Yang posted 9 patches 2 weeks, 4 days ago
There is a newer version of this series
[SeaBIOS] [PATCH v2 7/9] LegacyBios.h: Add missing pack() pragma
Posted by Jiaxun Yang 2 weeks, 4 days ago
To match #pragma pack(1) at begining of this file.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 src/std/LegacyBios.h | 238 ++++++++++++++++++++++++++-------------------------
 1 file changed, 120 insertions(+), 118 deletions(-)

diff --git a/src/std/LegacyBios.h b/src/std/LegacyBios.h
index 5170c37865fc573d54a06c8b1140a353721daec7..04fbc350abe6cf90e5643293c4e6fbd70739b536 100644
--- a/src/std/LegacyBios.h
+++ b/src/std/LegacyBios.h
@@ -10,12 +10,12 @@
 	environment. Reverse thunk is the code that does the opposite.
 
 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available under 
-the terms and conditions of the BSD License that accompanies this distribution.  
+This program and the accompanying materials are licensed and made available under
+the terms and conditions of the BSD License that accompanies this distribution.
 The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.                                          
-    
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
   @par Revision Reference:
@@ -28,7 +28,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define _EFI_LEGACY_BIOS_H_
 
 ///
-/// 
+///
 ///
 #pragma pack(1)
 
@@ -51,75 +51,75 @@ typedef struct {
   /// 1 is "F," byte 2 is "E," and byte 3 is "$" and is normally accessed as a DWORD or UINT32.
   ///
   UINT32                            Signature;
-  
+
   ///
   /// The value required such that byte checksum of TableLength equals zero.
   ///
   UINT8                             TableChecksum;
-  
+
   ///
   /// The length of this table.
   ///
   UINT8                             TableLength;
-  
+
   ///
   /// The major EFI revision for which this table was generated.
-  /// 
+  ///
   UINT8                             EfiMajorRevision;
-  
+
   ///
   /// The minor EFI revision for which this table was generated.
   ///
   UINT8                             EfiMinorRevision;
-  
+
   ///
   /// The major revision of this table.
   ///
   UINT8                             TableMajorRevision;
-  
+
   ///
   /// The minor revision of this table.
   ///
   UINT8                             TableMinorRevision;
-  
+
   ///
   /// Reserved for future usage.
   ///
   UINT16                            Reserved;
-  
+
   ///
   /// The segment of the entry point within the traditional BIOS for Compatibility16 functions.
   ///
   UINT16                            Compatibility16CallSegment;
-  
+
   ///
   /// The offset of the entry point within the traditional BIOS for Compatibility16 functions.
   ///
   UINT16                            Compatibility16CallOffset;
-  
+
   ///
-  /// The segment of the entry point within the traditional BIOS for EfiCompatibility 
+  /// The segment of the entry point within the traditional BIOS for EfiCompatibility
   /// to invoke the PnP installation check.
   ///
   UINT16                            PnPInstallationCheckSegment;
-  
+
   ///
-  /// The Offset of the entry point within the traditional BIOS for EfiCompatibility 
+  /// The Offset of the entry point within the traditional BIOS for EfiCompatibility
   /// to invoke the PnP installation check.
   ///
   UINT16                            PnPInstallationCheckOffset;
-  
+
   ///
-  /// EFI system resources table. Type EFI_SYSTEM_TABLE is defined in the IntelPlatform 
+  /// EFI system resources table. Type EFI_SYSTEM_TABLE is defined in the IntelPlatform
   ///Innovation Framework for EFI Driver Execution Environment Core Interface Specification (DXE CIS).
   ///
-  UINT32                            EfiSystemTable; 
-  
+  UINT32                            EfiSystemTable;
+
   ///
   /// The address of an OEM-provided identifier string. The string is null terminated.
   ///
   UINT32                            OemIdStringPointer;
-  
+
   ///
   /// The 32-bit physical address where ACPI RSD PTR is stored within the traditional
   /// BIOS. The remained of the ACPI tables are located at their EFI addresses. The size
@@ -127,93 +127,93 @@ typedef struct {
   /// RSD PTR with either the ACPI 1.0b or 2.0 values.
   ///
   UINT32                            AcpiRsdPtrPointer;
-  
+
   ///
   /// The OEM revision number. Usage is undefined but provided for OEM module usage.
   ///
   UINT16                            OemRevision;
-  
+
   ///
   /// The 32-bit physical address where INT15 E820 data is stored within the traditional
   /// BIOS. The EfiCompatibility code will fill in the E820Pointer value and copy the
   /// data to the indicated area.
   ///
   UINT32                            E820Pointer;
-  
+
   ///
   /// The length of the E820 data and is filled in by the EfiCompatibility code.
   ///
   UINT32                            E820Length;
-  
+
   ///
   /// The 32-bit physical address where the $PIR table is stored in the traditional BIOS.
   /// The EfiCompatibility code will fill in the IrqRoutingTablePointer value and
   /// copy the data to the indicated area.
   ///
   UINT32                            IrqRoutingTablePointer;
-  
+
   ///
   /// The length of the $PIR table and is filled in by the EfiCompatibility code.
   ///
   UINT32                            IrqRoutingTableLength;
-  
+
   ///
   /// The 32-bit physical address where the MP table is stored in the traditional BIOS.
-  /// The EfiCompatibility code will fill in the MpTablePtr value and copy the data 
+  /// The EfiCompatibility code will fill in the MpTablePtr value and copy the data
   /// to the indicated area.
   ///
   UINT32                            MpTablePtr;
-  
+
   ///
   /// The length of the MP table and is filled in by the EfiCompatibility code.
   ///
   UINT32                            MpTableLength;
-  
+
   ///
   /// The segment of the OEM-specific INT table/code.
-  /// 
+  ///
   UINT16                            OemIntSegment;
-  
+
   ///
   /// The offset of the OEM-specific INT table/code.
   ///
   UINT16                            OemIntOffset;
-  
+
   ///
   /// The segment of the OEM-specific 32-bit table/code.
   ///
   UINT16                            Oem32Segment;
-  
+
   ///
   /// The offset of the OEM-specific 32-bit table/code.
   ///
   UINT16                            Oem32Offset;
-  
+
   ///
   /// The segment of the OEM-specific 16-bit table/code.
   ///
   UINT16                            Oem16Segment;
-  
+
   ///
   /// The offset of the OEM-specific 16-bit table/code.
   ///
   UINT16                            Oem16Offset;
-  
+
   ///
   /// The segment of the TPM binary passed to 16-bit CSM.
   ///
   UINT16                            TpmSegment;
-  
+
   ///
   /// The offset of the TPM binary passed to 16-bit CSM.
   ///
   UINT16                            TpmOffset;
-  
+
   ///
   /// A pointer to a string identifying the independent BIOS vendor.
   ///
   UINT32                            IbvPointer;
-  
+
   ///
   /// This field is NULL for all systems not supporting PCI Express. This field is the base
   /// value of the start of the PCI Express memory-mapped configuration registers and
@@ -223,7 +223,7 @@ typedef struct {
   /// Functions.
   ///
   UINT32                            PciExpressBase;
-  
+
   ///
   /// Maximum PCI bus number assigned.
   ///
@@ -251,12 +251,12 @@ typedef struct {
 } EFI_COMPATIBILITY16_TABLE;
 
 ///
-/// Functions provided by the CSM binary which communicate between the EfiCompatibility 
+/// Functions provided by the CSM binary which communicate between the EfiCompatibility
 /// and Compatability16 code.
 ///
-/// Inconsistent with the specification here: 
-/// The member's name started with "Compatibility16" [defined in Intel Framework 
-/// Compatibility Support Module Specification / 0.97 version] 
+/// Inconsistent with the specification here:
+/// The member's name started with "Compatibility16" [defined in Intel Framework
+/// Compatibility Support Module Specification / 0.97 version]
 /// has been changed to "Legacy16" since keeping backward compatible.
 ///
 typedef enum {
@@ -269,7 +269,7 @@ typedef enum {
   ///   AX = Return Status codes
   ///
   Legacy16InitializeYourself    = 0x0000,
-  
+
   ///
   /// Causes the Compatibility16 BIOS to perform any drive number translations to match the boot sequence.
   /// Input:
@@ -279,18 +279,18 @@ typedef enum {
   ///   AX = Returned status codes
   ///
   Legacy16UpdateBbs             = 0x0001,
-  
+
   ///
   /// Allows the Compatibility16 code to perform any final actions before booting. The Compatibility16
   /// code is read/write.
   /// Input:
   ///   AX = Compatibility16PrepareToBoot
-  ///   ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure  
+  ///   ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure
   /// Return:
   ///   AX = Returned status codes
   ///
   Legacy16PrepareToBoot         = 0x0002,
-  
+
   ///
   /// Causes the Compatibility16 BIOS to boot. The Compatibility16 code is Read/Only.
   /// Input:
@@ -299,7 +299,7 @@ typedef enum {
   ///   AX = Returned status codes
   ///
   Legacy16Boot                  = 0x0003,
-  
+
   ///
   /// Allows the Compatibility16 code to get the last device from which a boot was attempted. This is
   /// stored in CMOS and is the priority number of the last attempted boot device.
@@ -310,7 +310,7 @@ typedef enum {
   ///   BX = Priority number of the boot device.
   ///
   Legacy16RetrieveLastBootDevice = 0x0004,
-  
+
   ///
   /// Allows the Compatibility16 code rehook INT13, INT18, and/or INT19 after dispatching a legacy OpROM.
   /// Input:
@@ -321,7 +321,7 @@ typedef enum {
   ///   BX = Number of non-BBS-compliant devices found. Equals 0 if BBS compliant.
   ///
   Legacy16DispatchOprom         = 0x0005,
-  
+
   ///
   /// Finds a free area in the 0xFxxxx or 0xExxxx region of the specified length and returns the address
   /// of that region.
@@ -338,7 +338,7 @@ typedef enum {
   ///   DS:BX = Address of the region
   ///
   Legacy16GetTableAddress       = 0x0006,
-  
+
   ///
   /// Enables the EfiCompatibility module to do any nonstandard processing of keyboard LEDs or state.
   /// Input:
@@ -351,7 +351,7 @@ typedef enum {
   ///     AX = Returned status codes
   ///
   Legacy16SetKeyboardLeds       = 0x0007,
-  
+
   ///
   /// Enables the EfiCompatibility module to install an interrupt handler for PCI mass media devices that
   /// do not have an OpROM associated with them. An example is SATA.
@@ -380,8 +380,8 @@ typedef struct {
   UINT32  BbsTablePointer;              ///< A pointer to the BBS table.
   UINT16  RuntimeSegment;               ///< The segment where the OpROM can be relocated to. If this value is 0x0000, this
                                         ///< means that the relocation of this run time code is not supported.
-                                        ///< Inconsistent with specification here: 
-                                        ///< The member's name "OpromDestinationSegment" [defined in Intel Framework Compatibility Support Module Specification / 0.97 version] 
+                                        ///< Inconsistent with specification here:
+                                        ///< The member's name "OpromDestinationSegment" [defined in Intel Framework Compatibility Support Module Specification / 0.97 version]
                                         ///< has been changed to "RuntimeSegment" since keeping backward compatible.
 
 } EFI_DISPATCH_OPROM_TABLE;
@@ -394,52 +394,52 @@ typedef struct {
   /// Starting address of memory under 1 MB. The ending address is assumed to be 640 KB or 0x9FFFF.
   ///
   UINT32                            BiosLessThan1MB;
-  
+
   ///
   /// The starting address of the high memory block.
   ///
   UINT32                            HiPmmMemory;
-  
+
   ///
   /// The length of high memory block.
   ///
   UINT32                            HiPmmMemorySizeInBytes;
-  
+
   ///
   /// The segment of the reverse thunk call code.
   ///
   UINT16                            ReverseThunkCallSegment;
-  
+
   ///
   /// The offset of the reverse thunk call code.
   ///
   UINT16                            ReverseThunkCallOffset;
-  
+
   ///
   /// The number of E820 entries copied to the Compatibility16 BIOS.
   ///
   UINT32                            NumberE820Entries;
-  
+
   ///
   /// The amount of usable memory above 1 MB, e.g., E820 type 1 memory.
   ///
   UINT32                            OsMemoryAbove1Mb;
-  
+
   ///
   /// The start of thunk code in main memory. Memory cannot be used by BIOS or PMM.
   ///
   UINT32                            ThunkStart;
-  
+
   ///
   /// The size of the thunk code.
   ///
   UINT32                            ThunkSizeInBytes;
-  
+
   ///
   /// Starting address of memory under 1 MB.
   ///
   UINT32                            LowPmmMemory;
-  
+
   ///
   /// The length of low Memory block.
   ///
@@ -530,40 +530,40 @@ typedef struct {
   /// per IDE controller. The IdentifyDrive is per drive. Index 0 is master and index
   /// 1 is slave.
   ///
-  UINT16                            Status;   
-  
+  UINT16                            Status;
+
   ///
   /// PCI bus of IDE controller.
   ///
   UINT32                            Bus;
-  
+
   ///
   /// PCI device of IDE controller.
   ///
   UINT32                            Device;
-  
+
   ///
   /// PCI function of IDE controller.
   ///
   UINT32                            Function;
-  
+
   ///
   /// Command ports base address.
   ///
   UINT16                            CommandBaseAddress;
-  
+
   ///
   /// Control ports base address.
   ///
   UINT16                            ControlBaseAddress;
-  
+
   ///
   /// Bus master address.
   ///
   UINT16                            BusMasterAddress;
-  
+
   UINT8                             HddIrq;
-  
+
   ///
   /// Data that identifies the drive data; one per possible attached drive.
   ///
@@ -591,7 +591,7 @@ typedef struct {
   UINT16                            Enabled : 1;        ///< If 0, ignore this entry.
   UINT16                            Failed : 1;         ///< 0 = Not known if boot failure occurred.
                                                         ///< 1 = Boot attempted failed.
-  
+
   ///
   /// State of media present.
   ///   00 = No bootable media is present in the device.
@@ -611,64 +611,64 @@ typedef struct {
   /// The boot priority for this boot device. Values are defined below.
   ///
   UINT16                            BootPriority;
-  
+
   ///
   /// The PCI bus for this boot device.
   ///
   UINT32                            Bus;
-  
+
   ///
   /// The PCI device for this boot device.
   ///
   UINT32                            Device;
-  
+
   ///
   /// The PCI function for the boot device.
   ///
   UINT32                            Function;
-  
+
   ///
   /// The PCI class for this boot device.
   ///
   UINT8                             Class;
-  
+
   ///
   /// The PCI Subclass for this boot device.
   ///
   UINT8                             SubClass;
-  
+
   ///
   /// Segment:offset address of an ASCIIZ description string describing the manufacturer.
   ///
   UINT16                            MfgStringOffset;
-  
+
   ///
   /// Segment:offset address of an ASCIIZ description string describing the manufacturer.
-  ///  
+  ///
   UINT16                            MfgStringSegment;
-  
+
   ///
   /// BBS device type. BBS device types are defined below.
   ///
   UINT16                            DeviceType;
-  
+
   ///
   /// Status of this boot device. Type BBS_STATUS_FLAGS is defined below.
   ///
   BBS_STATUS_FLAGS                  StatusFlags;
-  
+
   ///
   /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for
   /// BCV devices.
   ///
   UINT16                            BootHandlerOffset;
-  
+
   ///
   /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for
   /// BCV devices.
-  ///  
+  ///
   UINT16                            BootHandlerSegment;
-  
+
   ///
   /// Segment:offset address of an ASCIIZ description string describing this device.
   ///
@@ -678,38 +678,38 @@ typedef struct {
   /// Segment:offset address of an ASCIIZ description string describing this device.
   ///
   UINT16                            DescStringSegment;
-  
+
   ///
   /// Reserved.
   ///
   UINT32                            InitPerReserved;
-  
+
   ///
   /// The use of these fields is IBV dependent. They can be used to flag that an OpROM
   /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
   /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
   ///
   UINT32                            AdditionalIrq13Handler;
-  
+
   ///
   /// The use of these fields is IBV dependent. They can be used to flag that an OpROM
   /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
   /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
-  ///  
+  ///
   UINT32                            AdditionalIrq18Handler;
-  
+
   ///
   /// The use of these fields is IBV dependent. They can be used to flag that an OpROM
   /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
   /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
-  ///  
+  ///
   UINT32                            AdditionalIrq19Handler;
-  
+
   ///
   /// The use of these fields is IBV dependent. They can be used to flag that an OpROM
   /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
   /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
-  ///  
+  ///
   UINT32                            AdditionalIrq40Handler;
   UINT8                             AssignedDriveNumber;
   UINT32                            AdditionalIrq41Handler;
@@ -749,17 +749,17 @@ typedef struct {
   /// values are reserved for future usage.
   ///
   UINT16                            Type : 3;
-  
+
   ///
   /// The size of "port" in bits. Defined values are below.
   ///
   UINT16                            PortGranularity : 3;
-  
+
   ///
   /// The size of data in bits. Defined values are below.
   ///
   UINT16                            DataGranularity : 3;
-  
+
   ///
   /// Reserved for future use.
   ///
@@ -824,17 +824,17 @@ typedef struct {
   /// SMM_ATTRIBUTES is defined below.
   ///
   SMM_ATTRIBUTES                    SmmAttributes;
-  
+
   ///
   /// Function Soft SMI is to perform. Type SMM_FUNCTION is defined below.
   ///
   SMM_FUNCTION                      SmmFunction;
-  
+
   ///
   /// SmmPort size depends upon SmmAttributes and ranges from2 bytes to 16 bytes.
   ///
   UINT8                             SmmPort;
-  
+
   ///
   /// SmmData size depends upon SmmAttributes and ranges from2 bytes to 16 bytes.
   ///
@@ -857,18 +857,18 @@ typedef struct {
   /// This bit set indicates that the ServiceAreaData is valid.
   ///
   UINT8                             DirectoryServiceValidity : 1;
-  
+
   ///
   /// This bit set indicates to use the Reserve Area Boot Code Address (RACBA) only if
   /// DirectoryServiceValidity is 0.
   ///
   UINT8                             RabcaUsedFlag : 1;
-  
+
   ///
   /// This bit set indicates to execute hard disk diagnostics.
   ///
   UINT8                             ExecuteHddDiagnosticsFlag : 1;
-  
+
   ///
   /// Reserved for future use. Set to 0.
   ///
@@ -884,35 +884,35 @@ typedef struct {
   /// UDC_ATTRIBUTES is defined below.
   ///
   UDC_ATTRIBUTES                    Attributes;
-  
+
   ///
   /// This field contains the zero-based device on which the selected
-  /// ServiceDataArea is present. It is 0 for master and 1 for the slave device.  
+  /// ServiceDataArea is present. It is 0 for master and 1 for the slave device.
   ///
   UINT8                             DeviceNumber;
-  
+
   ///
   /// This field contains the zero-based index into the BbsTable for the parent device.
   /// This index allows the user to reference the parent device information such as PCI
   /// bus, device function.
   ///
   UINT8                             BbsTableEntryNumberForParentDevice;
-  
+
   ///
   /// This field contains the zero-based index into the BbsTable for the boot entry.
   ///
   UINT8                             BbsTableEntryNumberForBoot;
-  
+
   ///
   /// This field contains the zero-based index into the BbsTable for the HDD diagnostics entry.
   ///
   UINT8                             BbsTableEntryNumberForHddDiag;
-  
+
   ///
   /// The raw Beer data.
   ///
   UINT8                             BeerData[128];
-  
+
   ///
   /// The raw data of selected service area.
   ///
@@ -982,4 +982,6 @@ typedef struct {
   UINT16                            SecondaryBusMaster; ///< The secondary device bus master I/O base.
 } EFI_LEGACY_INSTALL_PCI_HANDLER;
 
+#pragma pack()
+
 #endif

-- 
2.43.0

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH v2 7/9] LegacyBios.h: Add missing pack() pragma
Posted by Michael Tokarev 2 weeks, 4 days ago
On 03.09.2025 09:51, Jiaxun Yang wrote:
> To match #pragma pack(1) at begining of this file.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>   src/std/LegacyBios.h | 238 ++++++++++++++++++++++++++-------------------------
>   1 file changed, 120 insertions(+), 118 deletions(-)

You're adding a single line to the end of the file.  But there
are 118 other changes, which are unrelated.

The other changes (changing line endings) should be in a separate
patch.

Thanks,

/mjt

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org