Revision: 19103
          http://sourceforge.net/p/edk2/code/19103
Author:   timhe
Date:     2015-12-03 07:59:57 +0000 (Thu, 03 Dec 2015)
Log Message:
-----------
Vlv2TbltDevicePkg: Add SsdtUpdate Application to 

update Ssdt table to ACPI table.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Shifei Lu <[email protected]>
Reviewed-by: Tim He <[email protected]>

Modified Paths:
--------------
    branches/UDK2014.SP1/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
    branches/UDK2014.SP1/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
    branches/UDK2014.SP1/Vlv2TbltDevicePkg/PlatformPkgX64.dsc

Added Paths:
-----------
    branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/
    branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.asl
    branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.c
    branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.h
    branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.inf

Added: 
branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.asl
===================================================================
--- 
branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.asl    
                            (rev 0)
+++ 
branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.asl    
    2015-12-03 07:59:57 UTC (rev 19103)
@@ -0,0 +1,28 @@
+/** @file
+  The definition block in ACPI table for Genernal device.
+
+  Copyright (c) 2015, 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 
+  which 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, 
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+DefinitionBlock (
+  "Gene.aml",
+  "SSDT",
+   2,
+  "INTEL ",
+  "GeneTabl",
+  0x1000
+  )
+{
+  Scope (\_SB)
+  {
+  }
+}

Added: 
branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.c
===================================================================
--- branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.c  
                        (rev 0)
+++ branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.c  
2015-12-03 07:59:57 UTC (rev 19103)
@@ -0,0 +1,200 @@
+/** @file
+  Update SSDT table to ACPI table.
+
+  Copyright (c) 2013 - 2015, 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 
+  which 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, 
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "SsdtUpdate.h"
+
+FV_INPUT_DATA mInputData = {0};
+
+/**
+  Read file data from given file name.
+
+  @param[in]  FileName    Pointer the readed given file name.
+  @param[out] Buffer      The buffer which read the given file name's data.
+  @param[out] BufferSize  The buffer size which read the given file name's 
data.
+
+  @retval EFI_SUCCESS     The file data is successfully readed.
+  @retval EFI_ERROR       The file data is unsuccessfully readed.
+
+**/
+STATIC
+EFI_STATUS
+ReadFileData (
+  IN  CHAR16   *FileName,
+  OUT UINT8    **Buffer,
+  OUT UINT32   *BufferSize
+  )
+{
+  EFI_STATUS             Status;
+  SHELL_FILE_HANDLE      FileHandle;
+  UINT64                 Size;
+  VOID                   *NewBuffer;
+  UINTN                  ReadSize;
+
+  FileHandle = NULL;
+  NewBuffer = NULL;
+  Size = 0;
+
+  Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ, 0);
+  if (EFI_ERROR (Status)) {
+    goto Done;
+  }
+
+  Status = FileHandleIsDirectory (FileHandle);
+  if (!EFI_ERROR (Status)) {
+    Status = EFI_NOT_FOUND;
+    goto Done;
+  }
+
+  Status = FileHandleGetSize (FileHandle, &Size);
+  if (EFI_ERROR (Status)) {
+    goto Done;
+  }
+
+  NewBuffer = AllocatePool ((UINTN) Size);
+
+  ReadSize = (UINTN) Size;
+  Status = FileHandleRead (FileHandle, &ReadSize, NewBuffer);
+  if (EFI_ERROR (Status)) {
+    goto Done;
+  } else if (ReadSize != (UINTN) Size) {
+    Status = EFI_INVALID_PARAMETER;
+    goto Done;
+  }
+
+Done:
+  if (FileHandle != NULL) {
+    ShellCloseFile (&FileHandle);
+  }
+
+  if (EFI_ERROR (Status)) {
+    if (NewBuffer != NULL) {
+      FreePool (NewBuffer);
+    }
+  } else {
+    *Buffer = NewBuffer;
+    *BufferSize = (UINT32) Size;
+  }
+
+  return Status;
+}
+
+/**
+  Initialize and publish device in ACPI table.
+
+  @param[in] Table          The pointer to the ACPI table which will be 
published. 
+  @param[in] TableSize      The size of ACPI table which will be published.
+
+  @retval   EFI_SUCCESS     The ACPI table is published successfully.
+  @retval   Others          The ACPI table is not published.
+
+**/
+EFI_STATUS
+PublishAcpiTable (
+  IN UINT8       *Table,
+  IN UINT32      TableSize
+  )
+{
+  EFI_STATUS                     Status;
+  EFI_ACPI_TABLE_PROTOCOL        *AcpiTable;
+  UINTN                          TableKey;
+
+  //
+  // Basic check ::TODO: Add check here!!!!!!!!!!!!!!!!!
+  //
+  //ASSERT (Table->OemTableId == SIGNATURE_64 ('E', 'v', 'e', 'r', 'T', 'a', 
'b', 'l'));
+
+  //
+  // Publish the  ACPI table
+  //
+  Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) 
&AcpiTable);
+  DEBUG((EFI_D_INFO, " Publish ACPI Table-3\n"));
+  ASSERT_EFI_ERROR (Status);
+
+  TableKey = 0;
+  Status = AcpiTable->InstallAcpiTable (
+                        AcpiTable,
+                        (EFI_ACPI_DESCRIPTION_HEADER*) Table,
+                        TableSize,
+                        &TableKey
+                        );
+  DEBUG((EFI_D_INFO, " Publish ACPI Table-4\n"));
+  ASSERT_EFI_ERROR (Status);
+
+  return Status;
+}
+
+/**
+  Init device 
+  
+  @retval EFI_SUCCESS     Init Devices successfully
+  @retval Others          Some error occurs 
+
+**/
+EFI_STATUS
+InitDevice (
+  )
+{
+  //
+  // Add device Init here if needed
+  //
+  return EFI_SUCCESS;
+}
+
+/**
+  UEFI application entry point which has an interface similar to a
+  standard C main function.
+
+  The ShellCEntryLib library instance wrappers the actual UEFI application
+  entry point and calls this ShellAppMain function.
+
+  @param[in] Argc        The number of items in Argv.
+  @param[in] Argv        Array of pointers to strings.
+
+  @retval
+**/
+INTN
+EFIAPI
+ ShellAppMain (
+  IN UINTN Argc,
+  IN CHAR16 **Argv
+  )
+{
+  EFI_STATUS                     Status;
+  UINT8                          *FileBuffer;
+  UINT32                         TableSize;
+  
+  TableSize         = 0;
+  FileBuffer        = NULL;
+
+  //
+  // Necessary device Initialization
+  //
+  Status = InitDevice();
+  if (EFI_ERROR (Status)) {
+    return EFI_DEVICE_ERROR;
+  }
+
+  StrCpy (mInputData.FileName, Argv[1]);
+  Status = ReadFileData (mInputData.FileName, &FileBuffer, &TableSize);
+  
+  //
+  // Update and publish ACPI table
+  //
+  Status = PublishAcpiTable (FileBuffer, TableSize);
+  ASSERT_EFI_ERROR (Status);
+  
+  return Status;
+  }
+

Added: 
branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.h
===================================================================
--- branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.h  
                        (rev 0)
+++ branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.h  
2015-12-03 07:59:57 UTC (rev 19103)
@@ -0,0 +1,39 @@
+/** @file
+  The header file for update SSDT table to ACPI table.
+  
+  Copyright (c) 2015, 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 
+  which 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, 
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <PiDxe.h>
+#include <IndustryStandard/Acpi.h>
+
+#include <Protocol/AcpiTable.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DxeServicesLib.h>
+#include <Library/ShellLib.h>
+#include <Library/UefiApplicationEntryPoint.h>
+#include <Library/FileHandleLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+#define INPUT_STRING_LEN    255
+#define INPUT_STRING_SIZE   (INPUT_STRING_LEN + 1)
+
+typedef struct {
+  BOOLEAN   UpdateFromFile;
+  CHAR16    FileName[INPUT_STRING_SIZE];
+} FV_INPUT_DATA;
+

Added: 
branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.inf
===================================================================
--- 
branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.inf    
                            (rev 0)
+++ 
branches/UDK2014.SP1/Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.inf    
    2015-12-03 07:59:57 UTC (rev 19103)
@@ -0,0 +1,64 @@
+## @file
+#  This application add SSDT table into ACPI table.
+# 
+#  Copyright (c) 2015, 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
+#  which 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,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = SsdtUpdate
+  FILE_GUID                      = 6527d4b8-8f0f-4c02-9e78-8338cb6f0875
+  MODULE_TYPE                    = UEFI_APPLICATION
+  PI_SPECIFICATION_VERSION       = 0x0001000A
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = ShellCEntryLib
+
+[Sources]
+  SsdtUpdate.h
+  SsdtUpdate.c
+  SsdtUpdate.asl
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  ShellPkg/ShellPkg.dec
+  
+
+[LibraryClasses]
+  BaseLib
+  BaseMemoryLib
+  UefiBootServicesTableLib
+  DebugLib
+  DxeServicesLib
+  UefiApplicationEntryPoint
+  FileHandleLib
+  ShellCEntryLib
+  ShellLib
+  UefiBootServicesTableLib
+  MemoryAllocationLib
+  
+[Guids]
+
+[Protocols]
+  gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
+
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision
+  
+##[FeaturePcd]
+
+[Depex]
+  gEfiAcpiTableProtocolGuid

Modified: branches/UDK2014.SP1/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
===================================================================
--- branches/UDK2014.SP1/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc        
2015-12-03 03:27:13 UTC (rev 19102)
+++ branches/UDK2014.SP1/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc        
2015-12-03 07:59:57 UTC (rev 19103)
@@ -1517,6 +1517,7 @@
 !endif
 
   Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf
+  Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.inf
 
 [BuildOptions]
 #

Modified: branches/UDK2014.SP1/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
===================================================================
--- branches/UDK2014.SP1/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc  2015-12-03 
03:27:13 UTC (rev 19102)
+++ branches/UDK2014.SP1/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc  2015-12-03 
07:59:57 UTC (rev 19103)
@@ -1507,6 +1507,7 @@
 !endif
 
   Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf
+  Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.inf
 
 [BuildOptions]
 #

Modified: branches/UDK2014.SP1/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
===================================================================
--- branches/UDK2014.SP1/Vlv2TbltDevicePkg/PlatformPkgX64.dsc   2015-12-03 
03:27:13 UTC (rev 19102)
+++ branches/UDK2014.SP1/Vlv2TbltDevicePkg/PlatformPkgX64.dsc   2015-12-03 
07:59:57 UTC (rev 19103)
@@ -1507,6 +1507,7 @@
 !endif
 
   Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf
+  Vlv2TbltDevicePkg/Application/SsdtUpdate/SsdtUpdate.inf
 
 [BuildOptions]
 #


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to