Remove the unused library instance EdkNullCustomizedDecompressLib.
[mirror_edk2.git] / EdkModulePkg / Library / EdkPeCoffLoaderLib / EdkPeCoffLoader.c
1 /*++
2
3 Copyright (c) 2006 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 EdkPeCoffLoader.c
15
16 Abstract:
17
18 Wrap the Base PE/COFF loader with the PE COFF Protocol
19
20
21 --*/
22
23 #include "EdkPeCoffLoaderLibInternals.h"
24
25 EFI_STATUS
26 EFIAPI
27 TianoPeCoffLoaderLibGetImageInfo (
28 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
29 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
30 )
31 {
32 EFI_STATUS Status;
33
34 Status = PeCoffLoaderGetImageInfo (ImageContext);
35 if (EFI_ERROR (Status)) {
36 return Status;
37 }
38
39 switch (ImageContext->ImageType) {
40
41 case EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION:
42 ImageContext->ImageCodeMemoryType = EfiLoaderCode;
43 ImageContext->ImageDataMemoryType = EfiLoaderData;
44 break;
45
46 case EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER:
47 ImageContext->ImageCodeMemoryType = EfiBootServicesCode;
48 ImageContext->ImageDataMemoryType = EfiBootServicesData;
49 break;
50
51 case EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
52 case EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER:
53 ImageContext->ImageCodeMemoryType = EfiRuntimeServicesCode;
54 ImageContext->ImageDataMemoryType = EfiRuntimeServicesData;
55 break;
56
57 default:
58 ImageContext->ImageError = IMAGE_ERROR_INVALID_SUBSYSTEM;
59 return RETURN_UNSUPPORTED;
60 }
61
62 return Status;
63 }
64
65 EFI_STATUS
66 EFIAPI
67 TianoPeCoffLoaderLibLoadImage (
68 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
69 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
70 )
71 {
72 return PeCoffLoaderLoadImage (ImageContext);
73 }
74
75 EFI_STATUS
76 EFIAPI
77 TianoPeCoffLoaderLibRelocateImage (
78 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
79 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
80 )
81 {
82 return PeCoffLoaderRelocateImage (ImageContext);
83 }
84
85
86 EFI_STATUS
87 EFIAPI
88 TianoPeCoffLoaderLibUnloadimage (
89 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
90 IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
91 )
92 {
93 return EFI_SUCCESS;
94 }
95
96
97 EFI_PEI_PE_COFF_LOADER_PROTOCOL mPeiEfiPeiPeCoffLoader = {
98 TianoPeCoffLoaderLibGetImageInfo,
99 TianoPeCoffLoaderLibLoadImage,
100 TianoPeCoffLoaderLibRelocateImage,
101 TianoPeCoffLoaderLibUnloadimage
102 };
103
104 EFI_PEI_PE_COFF_LOADER_PROTOCOL *
105 EFIAPI
106 GetPeCoffLoaderProtocol (
107 )
108 {
109 return &mPeiEfiPeiPeCoffLoader;
110 }
111
112