]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c
ShellPkg/hexeditor: Use CpuIo for memory access
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / HexEdit / MemImage.c
index 300c67f0d4fe4ed611eaa98473c879d858e4fcce..fce9bbe0e66c4a2c4568a3c1468dd9fdef4e10b3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Functions to deal with Mem buffer\r
   \r
-  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>\r
+  Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved. <BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -27,8 +27,6 @@ extern HEFI_EDITOR_GLOBAL_EDITOR  HMainEditor;
 HEFI_EDITOR_MEM_IMAGE             HMemImage;\r
 HEFI_EDITOR_MEM_IMAGE             HMemImageBackupVar;\r
 \r
-EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL   DummyPciRootBridgeIo;\r
-\r
 //\r
 // for basic initialization of HDiskImage\r
 //\r
@@ -38,54 +36,6 @@ HEFI_EDITOR_MEM_IMAGE             HMemImageConst = {
   0\r
 };\r
 \r
-/**\r
-  Empty function.  always returns the same.\r
-\r
-  @param[in] This        Ignored.\r
-  @param[in] Width       Ignored.\r
-  @param[in] Address     Ignored.\r
-  @param[in] Count       Ignored.\r
-  @param[in, out] Buffer Ignored.\r
-\r
-  @retval EFI_UNSUPPORTED.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DummyMemRead (\r
-  IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL              * This,\r
-  IN     EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH    Width,\r
-  IN     UINT64                                   Address,\r
-  IN     UINTN                                    Count,\r
-  IN OUT VOID                                     *Buffer\r
-  )\r
-{\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
-/**\r
-  Empty function.  always returns the same.\r
-\r
-  @param[in] This        Ignored.\r
-  @param[in] Width       Ignored.\r
-  @param[in] Address     Ignored.\r
-  @param[in] Count       Ignored.\r
-  @param[in, out] Buffer Ignored.\r
-\r
-  @retval EFI_UNSUPPORTED.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DummyMemWrite (\r
-  IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL              * This,\r
-  IN     EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH    Width,\r
-  IN     UINT64                                   Address,\r
-  IN     UINTN                                    Count,\r
-  IN OUT VOID                                     *Buffer\r
-  )\r
-{\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
 /**\r
   Initialization function for HDiskImage.\r
 \r
@@ -105,21 +55,10 @@ HMemImageInit (
   CopyMem (&HMemImage, &HMemImageConst, sizeof (HMemImage));\r
 \r
   Status = gBS->LocateProtocol (\r
-                &gEfiPciRootBridgeIoProtocolGuid,\r
+                &gEfiCpuIo2ProtocolGuid,\r
                 NULL,\r
                 (VOID**)&HMemImage.IoFncs\r
                 );\r
-  if (Status == EFI_NOT_FOUND) {\r
-    //\r
-    // For NT32, no EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL is available\r
-    // Use Dummy PciRootBridgeIo for memory access\r
-    //\r
-    ZeroMem (&DummyPciRootBridgeIo, sizeof (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL));\r
-    DummyPciRootBridgeIo.Mem.Read  = DummyMemRead;\r
-    DummyPciRootBridgeIo.Mem.Write = DummyMemWrite;\r
-    HMemImage.IoFncs = &DummyPciRootBridgeIo;\r
-    Status = EFI_SUCCESS;\r
-  }\r
   if (!EFI_ERROR (Status)) {\r
     return EFI_SUCCESS;\r
   } else {\r