]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/S3SaveState: Extract arguments in correct order
authorRuiyu Ni <ruiyu.ni@intel.com>
Mon, 9 Oct 2017 07:12:36 +0000 (15:12 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Tue, 10 Oct 2017 05:23:10 +0000 (13:23 +0800)
EFI_BOOT_SCRIPT_WRITE() interface is a var-arg interface.

Spec defines the order of parameters for
EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE as below:

  typedef
  EFI_STATUS
  (EFIAPI *EFI_BOOT_SCRIPT_WRITE) (
    IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
    IN UINT16 OpCode,
    IN EFI_BOOT_SCRIPT_WIDTH Width,
    IN UINT16 Segment,
    IN UINT64 Address,
    IN UINTN Count,
    IN VOID *Buffer
  );

But implementation assumes Segment is in the very end, after Buffer.
Similar spec/implementation gaps are also found for
EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE.

The patch fixes the implementation to extract the arguments in
correct order.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c

index efc0ef91406463bc72a33cfde9e2788eec7bb519..d73005156cc6e172a1e6ff35c892d4218bb1759f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation for S3 Boot Script Saver state driver.\r
 \r
 /** @file\r
   Implementation for S3 Boot Script Saver state driver.\r
 \r
-  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions\r
@@ -210,10 +210,10 @@ BootScriptWritePciCfg2Write (
   UINT16                Segment;\r
 \r
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
   UINT16                Segment;\r
 \r
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
+  Segment     = VA_ARG (Marker, UINT16);\r
   Address     = VA_ARG (Marker, UINT64);\r
   Count       = VA_ARG (Marker, UINTN);\r
   Buffer      = VA_ARG (Marker, UINT8 *);\r
   Address     = VA_ARG (Marker, UINT64);\r
   Count       = VA_ARG (Marker, UINTN);\r
   Buffer      = VA_ARG (Marker, UINT8 *);\r
-  Segment     = VA_ARG (Marker, UINT16);\r
 \r
   return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);\r
 }\r
 \r
   return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);\r
 }\r
@@ -240,8 +240,8 @@ BootScriptWritePciCfg2ReadWrite (
   UINT8                 *DataMask;\r
  \r
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
   UINT8                 *DataMask;\r
  \r
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
-  Address     = VA_ARG (Marker, UINT64);\r
   Segment     = VA_ARG (Marker, UINT16);\r
   Segment     = VA_ARG (Marker, UINT16);\r
+  Address     = VA_ARG (Marker, UINT64);\r
   Data        = VA_ARG (Marker, UINT8 *);\r
   DataMask    = VA_ARG (Marker, UINT8 *);\r
  \r
   Data        = VA_ARG (Marker, UINT8 *);\r
   DataMask    = VA_ARG (Marker, UINT8 *);\r
  \r
index 0d1580dc35abbbd8f29dc33fa8eda2fd8443fda9..f397db37fdc055c67e1171b9fcd2cfd325cbd437 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation for S3 SMM Boot Script Saver state driver.\r
 \r
 /** @file\r
   Implementation for S3 SMM Boot Script Saver state driver.\r
 \r
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions\r
@@ -209,10 +209,10 @@ BootScriptWritePciCfg2Write (
   UINT16                Segment;\r
 \r
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
   UINT16                Segment;\r
 \r
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
+  Segment     = VA_ARG (Marker, UINT16);\r
   Address     = VA_ARG (Marker, UINT64);\r
   Count       = VA_ARG (Marker, UINTN);\r
   Buffer      = VA_ARG (Marker, UINT8 *);\r
   Address     = VA_ARG (Marker, UINT64);\r
   Count       = VA_ARG (Marker, UINTN);\r
   Buffer      = VA_ARG (Marker, UINT8 *);\r
-  Segment     = VA_ARG (Marker, UINT16);\r
 \r
   return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);\r
 }\r
 \r
   return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);\r
 }\r
@@ -239,8 +239,8 @@ BootScriptWritePciCfg2ReadWrite (
   UINT8                 *DataMask;\r
  \r
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
   UINT8                 *DataMask;\r
  \r
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
-  Address     = VA_ARG (Marker, UINT64);\r
   Segment     = VA_ARG (Marker, UINT16);\r
   Segment     = VA_ARG (Marker, UINT16);\r
+  Address     = VA_ARG (Marker, UINT64);\r
   Data        = VA_ARG (Marker, UINT8 *);\r
   DataMask    = VA_ARG (Marker, UINT8 *);\r
  \r
   Data        = VA_ARG (Marker, UINT8 *);\r
   DataMask    = VA_ARG (Marker, UINT8 *);\r
  \r