public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/S3SaveState: Extract arguments in correct order
@ 2017-10-09  7:13 Ruiyu Ni
  2017-10-09  7:35 ` Zeng, Star
  0 siblings, 1 reply; 2+ messages in thread
From: Ruiyu Ni @ 2017-10-09  7:13 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng

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>
Cc: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c    | 6 +++---
 MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
index efc0ef9140..d73005156c 100644
--- a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
+++ b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
@@ -1,7 +1,7 @@
 /** @file
   Implementation for S3 Boot Script Saver state driver.
 
-  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions
@@ -210,10 +210,10 @@ BootScriptWritePciCfg2Write (
   UINT16                Segment;
 
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+  Segment     = VA_ARG (Marker, UINT16);
   Address     = VA_ARG (Marker, UINT64);
   Count       = VA_ARG (Marker, UINTN);
   Buffer      = VA_ARG (Marker, UINT8 *);
-  Segment     = VA_ARG (Marker, UINT16);
 
   return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);
 }
@@ -240,8 +240,8 @@ BootScriptWritePciCfg2ReadWrite (
   UINT8                 *DataMask;
  
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
-  Address     = VA_ARG (Marker, UINT64);
   Segment     = VA_ARG (Marker, UINT16);
+  Address     = VA_ARG (Marker, UINT64);
   Data        = VA_ARG (Marker, UINT8 *);
   DataMask    = VA_ARG (Marker, UINT8 *);
  
diff --git a/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c b/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c
index 0d1580dc35..f397db37fd 100644
--- a/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c
+++ b/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c
@@ -1,7 +1,7 @@
 /** @file
   Implementation for S3 SMM Boot Script Saver state driver.
 
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions
@@ -209,10 +209,10 @@ BootScriptWritePciCfg2Write (
   UINT16                Segment;
 
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+  Segment     = VA_ARG (Marker, UINT16);
   Address     = VA_ARG (Marker, UINT64);
   Count       = VA_ARG (Marker, UINTN);
   Buffer      = VA_ARG (Marker, UINT8 *);
-  Segment     = VA_ARG (Marker, UINT16);
 
   return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);
 }
@@ -239,8 +239,8 @@ BootScriptWritePciCfg2ReadWrite (
   UINT8                 *DataMask;
  
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
-  Address     = VA_ARG (Marker, UINT64);
   Segment     = VA_ARG (Marker, UINT16);
+  Address     = VA_ARG (Marker, UINT64);
   Data        = VA_ARG (Marker, UINT8 *);
   DataMask    = VA_ARG (Marker, UINT8 *);
  
-- 
2.12.2.windows.2



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

* Re: [PATCH] MdeModulePkg/S3SaveState: Extract arguments in correct order
  2017-10-09  7:13 [PATCH] MdeModulePkg/S3SaveState: Extract arguments in correct order Ruiyu Ni
@ 2017-10-09  7:35 ` Zeng, Star
  0 siblings, 0 replies; 2+ messages in thread
From: Zeng, Star @ 2017-10-09  7:35 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: Zeng, Star

Reviewed-by: Star Zeng <star.zeng@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ruiyu Ni
Sent: Monday, October 9, 2017 3:13 PM
To: edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>
Subject: [edk2] [PATCH] MdeModulePkg/S3SaveState: Extract arguments in correct order

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>
Cc: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c    | 6 +++---
 MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
index efc0ef9140..d73005156c 100644
--- a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
+++ b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
@@ -1,7 +1,7 @@
 /** @file
   Implementation for S3 Boot Script Saver state driver.
 
-  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights 
+ reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions @@ -210,10 +210,10 @@ BootScriptWritePciCfg2Write (
   UINT16                Segment;
 
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+  Segment     = VA_ARG (Marker, UINT16);
   Address     = VA_ARG (Marker, UINT64);
   Count       = VA_ARG (Marker, UINTN);
   Buffer      = VA_ARG (Marker, UINT8 *);
-  Segment     = VA_ARG (Marker, UINT16);
 
   return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);  } @@ -240,8 +240,8 @@ BootScriptWritePciCfg2ReadWrite (
   UINT8                 *DataMask;
  
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
-  Address     = VA_ARG (Marker, UINT64);
   Segment     = VA_ARG (Marker, UINT16);
+  Address     = VA_ARG (Marker, UINT64);
   Data        = VA_ARG (Marker, UINT8 *);
   DataMask    = VA_ARG (Marker, UINT8 *);
  
diff --git a/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c b/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c
index 0d1580dc35..f397db37fd 100644
--- a/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c
+++ b/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c
@@ -1,7 +1,7 @@
 /** @file
   Implementation for S3 SMM Boot Script Saver state driver.
 
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights 
+ reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions @@ -209,10 +209,10 @@ BootScriptWritePciCfg2Write (
   UINT16                Segment;
 
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+  Segment     = VA_ARG (Marker, UINT16);
   Address     = VA_ARG (Marker, UINT64);
   Count       = VA_ARG (Marker, UINTN);
   Buffer      = VA_ARG (Marker, UINT8 *);
-  Segment     = VA_ARG (Marker, UINT16);
 
   return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);  } @@ -239,8 +239,8 @@ BootScriptWritePciCfg2ReadWrite (
   UINT8                 *DataMask;
  
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
-  Address     = VA_ARG (Marker, UINT64);
   Segment     = VA_ARG (Marker, UINT16);
+  Address     = VA_ARG (Marker, UINT64);
   Data        = VA_ARG (Marker, UINT8 *);
   DataMask    = VA_ARG (Marker, UINT8 *);
  
--
2.12.2.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


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

end of thread, other threads:[~2017-10-09  7:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-09  7:13 [PATCH] MdeModulePkg/S3SaveState: Extract arguments in correct order Ruiyu Ni
2017-10-09  7:35 ` Zeng, Star

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