move header files in MdeModulePkg\Core\Dxe except DxeMain.h into their corresponding sub-module directories. It is used to provide good modularity.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5949 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
eric_tian 2008-09-23 07:35:34 +00:00
parent 1046284db9
commit ec90508b3d
30 changed files with 322 additions and 419 deletions

View File

@ -1,84 +0,0 @@
/** @file
Support functions for managing debug image info table when loading and unloading
images.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. 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.
**/
#ifndef __DEBUG_IMAGE_INFO_H__
#define __DEBUG_IMAGE_INFO_H__
#define FOUR_MEG_ALIGNMENT 0x400000
#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *))
/**
Creates and initializes the DebugImageInfo Table. Also creates the configuration
table and registers it into the system table.
Note:
This function allocates memory, frees it, and then allocates memory at an
address within the initial allocation. Since this function is called early
in DXE core initialization (before drivers are dispatched), this should not
be a problem.
**/
VOID
CoreInitializeDebugImageInfoTable (
VOID
);
/**
Update the CRC32 in the Debug Table.
Since the CRC32 service is made available by the Runtime driver, we have to
wait for the Runtime Driver to be installed before the CRC32 can be computed.
This function is called elsewhere by the core when the runtime architectural
protocol is produced.
**/
VOID
CoreUpdateDebugTableCrc32 (
VOID
);
/**
Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
the table if it's not large enough to accomidate another entry.
@param ImageInfoType type of debug image information
@param LoadedImage pointer to the loaded image protocol for the image being
loaded
@param ImageHandle image handle for the image being loaded
**/
VOID
CoreNewDebugImageInfoEntry (
IN UINT32 ImageInfoType,
IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,
IN EFI_HANDLE ImageHandle
);
/**
Removes and frees an entry from the DebugImageInfo Table.
@param ImageHandle image handle for the image being unloaded
**/
VOID
CoreRemoveDebugImageInfoEntry (
EFI_HANDLE ImageHandle
);
#endif

View File

@ -80,16 +80,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Library/ReportStatusCodeLib.h> #include <Library/ReportStatusCodeLib.h>
#include "DebugImageInfo.h"
#include "Library.h"
#include "FwVolBlock.h"
#include "FwVolDriver.h"
#include "Gcd.h"
#include "Imem.h"
#include "Image.h"
#include "Event.h"
#include "Handle.h"
// //
// attributes for reserved memory before it is promoted to system memory // attributes for reserved memory before it is promoted to system memory
// //
@ -916,6 +906,20 @@ CoreRegisterProtocolNotify (
); );
/**
Removes all the events in the protocol database that match Event.
@param Event The event to search for in the protocol
database.
@return EFI_SUCCESS when done searching the entire database.
**/
EFI_STATUS
CoreUnregisterProtocolNotify (
IN EFI_EVENT Event
);
/** /**
Locates the requested handle(s) and returns them in Buffer. Locates the requested handle(s) and returns them in Buffer.
@ -2307,4 +2311,157 @@ CloseSectionStream (
IN UINTN StreamHandleToClose IN UINTN StreamHandleToClose
); );
/**
Creates and initializes the DebugImageInfo Table. Also creates the configuration
table and registers it into the system table.
Note:
This function allocates memory, frees it, and then allocates memory at an
address within the initial allocation. Since this function is called early
in DXE core initialization (before drivers are dispatched), this should not
be a problem.
**/
VOID
CoreInitializeDebugImageInfoTable (
VOID
);
/**
Update the CRC32 in the Debug Table.
Since the CRC32 service is made available by the Runtime driver, we have to
wait for the Runtime Driver to be installed before the CRC32 can be computed.
This function is called elsewhere by the core when the runtime architectural
protocol is produced.
**/
VOID
CoreUpdateDebugTableCrc32 (
VOID
);
/**
Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
the table if it's not large enough to accomidate another entry.
@param ImageInfoType type of debug image information
@param LoadedImage pointer to the loaded image protocol for the image being
loaded
@param ImageHandle image handle for the image being loaded
**/
VOID
CoreNewDebugImageInfoEntry (
IN UINT32 ImageInfoType,
IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,
IN EFI_HANDLE ImageHandle
);
/**
Removes and frees an entry from the DebugImageInfo Table.
@param ImageHandle image handle for the image being unloaded
**/
VOID
CoreRemoveDebugImageInfoEntry (
EFI_HANDLE ImageHandle
);
/**
This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
@param ImageHandle The image handle.
@param SystemTable The system table.
@retval EFI_SUCCESS Successfully initialized firmware volume block
driver.
**/
EFI_STATUS
EFIAPI
FwVolBlockDriverInit (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
This routine produces a firmware volume block protocol on a given
buffer.
@param BaseAddress base address of the firmware volume image
@param Length length of the firmware volume image
@param ParentHandle handle of parent firmware volume, if this image
came from an FV image file in another firmware
volume (ala capsules)
@param FvProtocol Firmware volume block protocol produced.
@retval EFI_VOLUME_CORRUPTED Volume corrupted.
@retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
@retval EFI_SUCCESS Successfully produced a FVB protocol on given
buffer.
**/
EFI_STATUS
ProduceFVBProtocolOnBuffer (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length,
IN EFI_HANDLE ParentHandle,
OUT EFI_HANDLE *FvProtocol OPTIONAL
);
/**
Raising to the task priority level of the mutual exclusion
lock, and then acquires ownership of the lock.
@param Lock The lock to acquire
@return Lock owned
**/
VOID
CoreAcquireLock (
IN EFI_LOCK *Lock
);
/**
Initialize a basic mutual exclusion lock. Each lock
provides mutual exclusion access at it's task priority
level. Since there is no-premption (at any TPL) or
multiprocessor support, acquiring the lock only consists
of raising to the locks TPL.
@param Lock The EFI_LOCK structure to initialize
@retval EFI_SUCCESS Lock Owned.
@retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
**/
EFI_STATUS
CoreAcquireLockOrFail (
IN EFI_LOCK *Lock
);
/**
Releases ownership of the mutual exclusion lock, and
restores the previous task priority level.
@param Lock The lock to release
@return Lock unowned
**/
VOID
CoreReleaseLock (
IN EFI_LOCK *Lock
);
#endif #endif

View File

@ -29,19 +29,11 @@
# VALID_ARCHITECTURES = IA32 X64 IPF # VALID_ARCHITECTURES = IA32 X64 IPF
[Sources.common] [Sources.common]
Library.h
Imem.h
Image.h
Handle.h
Gcd.h
FwVolDriver.h
FwVolBlock.h
Event.h
DxeMain.h DxeMain.h
DebugImageInfo.h
SectionExtraction/CoreSectionExtraction.c SectionExtraction/CoreSectionExtraction.c
Image/ImageFile.c Image/ImageFile.c
Image/Image.c Image/Image.c
Image/Image.h
Misc/DebugImageInfo.c Misc/DebugImageInfo.c
Misc/Stall.c Misc/Stall.c
Misc/SetWatchdogTimer.c Misc/SetWatchdogTimer.c
@ -51,19 +43,25 @@
Hand/Notify.c Hand/Notify.c
Hand/Locate.c Hand/Locate.c
Hand/Handle.c Hand/Handle.c
Hand/Handle.h
Gcd/Gcd.c Gcd/Gcd.c
Gcd/Gcd.h
Mem/Pool.c Mem/Pool.c
Mem/Page.c Mem/Page.c
Mem/MemData.c Mem/MemData.c
Mem/Imem.h
FwVolBlock/FwVolBlock.c FwVolBlock/FwVolBlock.c
FwVolBlock/FwVolBlock.h
FwVol/FwVolWrite.c FwVol/FwVolWrite.c
FwVol/FwVolRead.c FwVol/FwVolRead.c
FwVol/FwVolAttrib.c FwVol/FwVolAttrib.c
FwVol/Ffs.c FwVol/Ffs.c
FwVol/FwVol.c FwVol/FwVol.c
FwVol/FwVolDriver.h
Event/Tpl.c Event/Tpl.c
Event/Timer.c Event/Timer.c
Event/Event.c Event/Event.c
Event/Event.h
Dispatcher/Dependency.c Dispatcher/Dependency.c
Dispatcher/Dispatcher.c Dispatcher/Dispatcher.c
DxeMain/DxeProtocolNotify.c DxeMain/DxeProtocolNotify.c

View File

@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "DxeMain.h" #include "DxeMain.h"
#include "Event.h"
/// ///
/// gEfiCurrentTpl - Current Task priority level /// gEfiCurrentTpl - Current Task priority level

View File

@ -15,7 +15,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __EVENT_H__ #ifndef __EVENT_H__
#define __EVENT_H__ #define __EVENT_H__
#define VALID_TPL(a) ((a) <= TPL_HIGH_LEVEL) #define VALID_TPL(a) ((a) <= TPL_HIGH_LEVEL)
extern UINTN gEventPending;
// //
// EFI_EVENT // EFI_EVENT
@ -25,37 +28,30 @@ typedef struct {
UINTN Signature; UINTN Signature;
UINT32 Type; UINT32 Type;
UINT32 SignalCount; UINT32 SignalCount;
///
// /// Entry if the event is registered to be signalled
// Entry if the event is registered to be signalled ///
//
LIST_ENTRY SignalLink; LIST_ENTRY SignalLink;
///
// /// Notification information for this event
// Notification information for this event ///
//
EFI_TPL NotifyTpl; EFI_TPL NotifyTpl;
EFI_EVENT_NOTIFY NotifyFunction; EFI_EVENT_NOTIFY NotifyFunction;
VOID *NotifyContext; VOID *NotifyContext;
EFI_GUID EventGroup; EFI_GUID EventGroup;
LIST_ENTRY NotifyLink; LIST_ENTRY NotifyLink;
BOOLEAN ExFlag; BOOLEAN ExFlag;
///
// /// A list of all runtime events
// A list of all runtime events ///
//
EFI_RUNTIME_EVENT_ENTRY RuntimeData; EFI_RUNTIME_EVENT_ENTRY RuntimeData;
///
// /// Information by event type
// Information by event type ///
//
union { union {
// ///
// For timer events /// For timer events
// ///
struct { struct {
LIST_ENTRY Link; LIST_ENTRY Link;
UINT64 TriggerTime; UINT64 TriggerTime;
@ -83,10 +79,6 @@ CoreDispatchEventNotifies (
); );
//
// Exported functions
//
/** /**
Initializes timer support. Initializes timer support.
@ -96,13 +88,4 @@ CoreInitializeTimer (
VOID VOID
); );
//
// extern data declarations
//
extern EFI_LOCK gEventQueueLock;
extern UINTN gEventPending;
extern LIST_ENTRY gEventQueue[];
extern LIST_ENTRY gEventSignalQueue;
#endif #endif

View File

@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "DxeMain.h" #include "DxeMain.h"
#include "Event.h"
// //
// Internal data // Internal data

View File

@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "Event.h"
/** /**
Set Interrupt State. Set Interrupt State.

View File

@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "DxeMain.h" #include "DxeMain.h"
#include "FwVolDriver.h"
/** /**

View File

@ -15,8 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "FwVolDriver.h"
#define KEYSIZE sizeof (UINTN)
// //
// Protocol notify related globals // Protocol notify related globals
@ -35,7 +35,7 @@ FV_DEVICE mFvDevice = {
FvReadFileSection, FvReadFileSection,
FvWriteFile, FvWriteFile,
FvGetNextFile, FvGetNextFile,
KEYSIZE, sizeof (UINTN),
NULL, NULL,
FvGetVolumeInfo, FvGetVolumeInfo,
FvSetVolumeInfo FvSetVolumeInfo

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "FwVolDriver.h"
/** /**

View File

@ -313,17 +313,6 @@ FvSetVolumeInfo (
IN CONST VOID *Buffer IN CONST VOID *Buffer
); );
//
//Internal functions
//
typedef enum {
EfiCheckSumUint8 = 0,
EfiCheckSumUint16 = 1,
EfiCheckSumUint32 = 2,
EfiCheckSumUint64 = 3,
EfiCheckSumMaximum = 4
} EFI_CHECKSUM_TYPE;
/** /**

View File

@ -13,10 +13,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "FwVolDriver.h"
/*++ /**
Required Alignment Alignment Value in FFS Alignment Value in
Required Alignment Alignment Value in FFS Alignment Value in
(bytes) Attributes Field Firmware Volume Interfaces (bytes) Attributes Field Firmware Volume Interfaces
1 0 0 1 0 0
2 0 1 2 0 1
@ -29,9 +29,7 @@ Required Alignment Alignment Value in FFS Alignment Value in
4 KB 5 12 4 KB 5 12
32 KB 6 15 32 KB 6 15
64 KB 7 16 64 KB 7 16
**/
--*/
UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16}; UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16};

View File

@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "FwVolDriver.h"
/** /**

View File

@ -16,6 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "FwVolBlock.h"
EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = { EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = {
@ -511,9 +512,7 @@ ProduceFVBProtocolOnBuffer (
/** /**
This routine is the driver initialization entry point. It initializes the This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
libraries, consumes FV hobs and NT_NON_MM_FV environment variable and
produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
@param ImageHandle The image handle. @param ImageHandle The image handle.
@param SystemTable The system table. @param SystemTable The system table.

View File

@ -19,11 +19,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define FVB_DEVICE_SIGNATURE EFI_SIGNATURE_32('_','F','V','B') #define FVB_DEVICE_SIGNATURE EFI_SIGNATURE_32('_','F','V','B')
typedef struct { typedef struct {
UINTN Base; UINTN Base;
UINTN Length; UINTN Length;
} LBA_CACHE; } LBA_CACHE;
typedef struct { typedef struct {
MEMMAP_DEVICE_PATH MemMapDevPath; MEMMAP_DEVICE_PATH MemMapDevPath;
EFI_DEVICE_PATH_PROTOCOL EndDevPath; EFI_DEVICE_PATH_PROTOCOL EndDevPath;
@ -41,32 +43,11 @@ typedef struct {
EFI_PHYSICAL_ADDRESS BaseAddress; EFI_PHYSICAL_ADDRESS BaseAddress;
} EFI_FW_VOL_BLOCK_DEVICE; } EFI_FW_VOL_BLOCK_DEVICE;
#define FVB_DEVICE_FROM_THIS(a) \ #define FVB_DEVICE_FROM_THIS(a) \
CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE) CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
/**
This routine is the driver initialization entry point. It initializes the
libraries, consumes FV hobs and NT_NON_MM_FV environment variable and
produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
@param ImageHandle The image handle.
@param SystemTable The system table.
@retval EFI_SUCCESS Successfully initialized firmware volume block
driver.
**/
EFI_STATUS
EFIAPI
FwVolBlockDriverInit (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/** /**
Retrieves Volume attributes. No polarity translations are done. Retrieves Volume attributes. No polarity translations are done.
@ -252,49 +233,5 @@ FwVolBlockGetBlockSize (
IN OUT UINTN *NumberOfBlocks IN OUT UINTN *NumberOfBlocks
); );
/**
This routine is the driver initialization entry point. It initializes the
libraries, consumes FV hobs and NT_NON_MM_FV environment variable and
produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
@param ImageHandle The image handle.
@param SystemTable The system table.
@retval EFI_SUCCESS Successfully initialized firmware volume block
driver.
**/
EFI_STATUS
EFIAPI
FwVolBlockDriverInit (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
This routine produces a firmware volume block protocol on a given
buffer.
@param BaseAddress base address of the firmware volume image
@param Length length of the firmware volume image
@param ParentHandle handle of parent firmware volume, if this image
came from an FV image file in another firmware
volume (ala capsules)
@param FvProtocol Firmware volume block protocol produced.
@retval EFI_VOLUME_CORRUPTED Volume corrupted.
@retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
@retval EFI_SUCCESS Successfully produced a FVB protocol on given
buffer.
**/
EFI_STATUS
ProduceFVBProtocolOnBuffer (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length,
IN EFI_HANDLE ParentHandle,
OUT EFI_HANDLE *FvProtocol OPTIONAL
);
#endif #endif

View File

@ -15,6 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "Gcd.h"
#define MINIMUM_INITIAL_MEMORY_SIZE 0x10000 #define MINIMUM_INITIAL_MEMORY_SIZE 0x10000

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "Handle.h"
// //

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "Handle.h"
// //

View File

@ -16,52 +16,64 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define _HAND_H_ #define _HAND_H_
//
// IHANDLE - contains a list of protocol handles
//
#define EFI_HANDLE_SIGNATURE EFI_SIGNATURE_32('h','n','d','l') #define EFI_HANDLE_SIGNATURE EFI_SIGNATURE_32('h','n','d','l')
///
/// IHANDLE - contains a list of protocol handles
///
typedef struct { typedef struct {
UINTN Signature; UINTN Signature;
LIST_ENTRY AllHandles; // All handles list of IHANDLE /// All handles list of IHANDLE
LIST_ENTRY Protocols; // List of PROTOCOL_INTERFACE's for this handle LIST_ENTRY AllHandles;
UINTN LocateRequest; // /// List of PROTOCOL_INTERFACE's for this handle
UINT64 Key; // The Handle Database Key value when this handle was last created or modified LIST_ENTRY Protocols;
UINTN LocateRequest;
/// The Handle Database Key value when this handle was last created or modified
UINT64 Key;
} IHANDLE; } IHANDLE;
#define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE) #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)
//
// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
// database. Each handler that supports this protocol is listed, along
// with a list of registered notifies.
//
#define PROTOCOL_ENTRY_SIGNATURE EFI_SIGNATURE_32('p','r','t','e') #define PROTOCOL_ENTRY_SIGNATURE EFI_SIGNATURE_32('p','r','t','e')
///
/// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
/// database. Each handler that supports this protocol is listed, along
/// with a list of registered notifies.
///
typedef struct { typedef struct {
UINTN Signature; UINTN Signature;
LIST_ENTRY AllEntries; // Link Entry inserted to mProtocolDatabase /// Link Entry inserted to mProtocolDatabase
EFI_GUID ProtocolID; // ID of the protocol LIST_ENTRY AllEntries;
LIST_ENTRY Protocols; // All protocol interfaces /// ID of the protocol
LIST_ENTRY Notify; // Registerd notification handlers EFI_GUID ProtocolID;
/// All protocol interfaces
LIST_ENTRY Protocols;
/// Registerd notification handlers
LIST_ENTRY Notify;
} PROTOCOL_ENTRY; } PROTOCOL_ENTRY;
//
// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked
// with a protocol interface structure
//
#define PROTOCOL_INTERFACE_SIGNATURE EFI_SIGNATURE_32('p','i','f','c') #define PROTOCOL_INTERFACE_SIGNATURE EFI_SIGNATURE_32('p','i','f','c')
///
/// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked
/// with a protocol interface structure
///
typedef struct { typedef struct {
UINTN Signature; UINTN Signature;
LIST_ENTRY Link; // Link on IHANDLE.Protocols /// Link on IHANDLE.Protocols
IHANDLE *Handle; // Back pointer LIST_ENTRY Link;
LIST_ENTRY ByProtocol; // Link on PROTOCOL_ENTRY.Protocols /// Back pointer
PROTOCOL_ENTRY *Protocol; // The protocol ID IHANDLE *Handle;
VOID *Interface; // The interface value /// Link on PROTOCOL_ENTRY.Protocols
LIST_ENTRY ByProtocol;
LIST_ENTRY OpenList; // OPEN_PROTOCOL_DATA list. /// The protocol ID
PROTOCOL_ENTRY *Protocol;
/// The interface value
VOID *Interface;
/// OPEN_PROTOCOL_DATA list
LIST_ENTRY OpenList;
UINTN OpenListCount; UINTN OpenListCount;
} PROTOCOL_INTERFACE; } PROTOCOL_INTERFACE;
@ -70,7 +82,8 @@ typedef struct {
typedef struct { typedef struct {
UINTN Signature; UINTN Signature;
LIST_ENTRY Link; //Link on PROTOCOL_INTERFACE.OpenList ///Link on PROTOCOL_INTERFACE.OpenList
LIST_ENTRY Link;
EFI_HANDLE AgentHandle; EFI_HANDLE AgentHandle;
EFI_HANDLE ControllerHandle; EFI_HANDLE ControllerHandle;
@ -79,23 +92,22 @@ typedef struct {
} OPEN_PROTOCOL_DATA; } OPEN_PROTOCOL_DATA;
//
// PROTOCOL_NOTIFY - used for each register notification for a protocol
//
#define PROTOCOL_NOTIFY_SIGNATURE EFI_SIGNATURE_32('p','r','t','n') #define PROTOCOL_NOTIFY_SIGNATURE EFI_SIGNATURE_32('p','r','t','n')
///
/// PROTOCOL_NOTIFY - used for each register notification for a protocol
///
typedef struct { typedef struct {
UINTN Signature; UINTN Signature;
PROTOCOL_ENTRY *Protocol; PROTOCOL_ENTRY *Protocol;
LIST_ENTRY Link; // All notifications for this protocol /// All notifications for this protocol
EFI_EVENT Event; // Event to notify LIST_ENTRY Link;
LIST_ENTRY *Position; // Last position notified /// Event to notify
EFI_EVENT Event;
/// Last position notified
LIST_ENTRY *Position;
} PROTOCOL_NOTIFY; } PROTOCOL_NOTIFY;
//
// Internal prototypes
//
/** /**
@ -165,20 +177,6 @@ CoreRemoveInterfaceFromProtocol (
); );
/**
Removes all the events in the protocol database that match Event.
@param Event The event to search for in the protocol
database.
@return EFI_SUCCESS when done searching the entire database.
**/
EFI_STATUS
CoreUnregisterProtocolNotify (
IN EFI_EVENT Event
);
/** /**
Connects a controller to a driver. Connects a controller to a driver.
@ -265,7 +263,6 @@ CoreValidateHandle (
// //
// Externs // Externs
// //
extern EFI_LOCK gProtocolDatabaseLock; extern EFI_LOCK gProtocolDatabaseLock;
extern LIST_ENTRY gHandleList; extern LIST_ENTRY gHandleList;
extern UINT64 gHandleDatabaseKey; extern UINT64 gHandleDatabaseKey;

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "Handle.h"
// //
// ProtocolRequest - Last LocateHandle request ID // ProtocolRequest - Last LocateHandle request ID

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "Handle.h"
/** /**

View File

@ -13,10 +13,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "Image.h"
// //
// Module Globals // Module Globals
// //
LOADED_IMAGE_PRIVATE_DATA *mCurrentImage = NULL; LOADED_IMAGE_PRIVATE_DATA *mCurrentImage = NULL;
LOAD_PE32_IMAGE_PRIVATE_DATA mLoadPe32PrivateData = { LOAD_PE32_IMAGE_PRIVATE_DATA mLoadPe32PrivateData = {

View File

@ -16,41 +16,48 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef _IMAGE_H_ #ifndef _IMAGE_H_
#define _IMAGE_H_ #define _IMAGE_H_
#define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32('l','d','r','i') #define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32('l','d','r','i')
typedef struct { typedef struct {
UINTN Signature; UINTN Signature;
EFI_HANDLE Handle; // Image handle /// Image handle
UINTN Type; // Image type EFI_HANDLE Handle;
/// Image type
BOOLEAN Started; // If entrypoint has been called UINTN Type;
/// If entrypoint has been called
EFI_IMAGE_ENTRY_POINT EntryPoint; // The image's entry point BOOLEAN Started;
EFI_LOADED_IMAGE_PROTOCOL Info; // loaded image protocol /// The image's entry point
EFI_IMAGE_ENTRY_POINT EntryPoint;
EFI_PHYSICAL_ADDRESS ImageBasePage; // Location in memory /// loaded image protocol
UINTN NumberOfPages; // Number of pages EFI_LOADED_IMAGE_PROTOCOL Info;
/// Location in memory
CHAR8 *FixupData; // Original fixup data EFI_PHYSICAL_ADDRESS ImageBasePage;
/// Number of pages
EFI_TPL Tpl; // Tpl of started image UINTN NumberOfPages;
EFI_STATUS Status; // Status returned by started image /// Original fixup data
CHAR8 *FixupData;
UINTN ExitDataSize; // Size of ExitData from started image /// Tpl of started image
VOID *ExitData; // Pointer to exit data from started image EFI_TPL Tpl;
VOID *JumpBuffer; // Pointer to pool allocation for context save/retore /// Status returned by started image
BASE_LIBRARY_JUMP_BUFFER *JumpContext; // Pointer to buffer for context save/retore EFI_STATUS Status;
UINT16 Machine; // Machine type from PE image /// Size of ExitData from started image
UINTN ExitDataSize;
EFI_EBC_PROTOCOL *Ebc; // EBC Protocol pointer /// Pointer to exit data from started image
VOID *ExitData;
EFI_RUNTIME_IMAGE_ENTRY *RuntimeData; // Runtime image list /// Pointer to pool allocation for context save/retore
VOID *JumpBuffer;
EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath; // Pointer to Loaded Image Device Path Protocl /// Pointer to buffer for context save/retore
BASE_LIBRARY_JUMP_BUFFER *JumpContext;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; // PeCoffLoader ImageContext /// Machine type from PE image
UINT16 Machine;
/// EBC Protocol pointer
EFI_EBC_PROTOCOL *Ebc;
/// Runtime image list
EFI_RUNTIME_IMAGE_ENTRY *RuntimeData;
/// Pointer to Loaded Image Device Path Protocl
EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath;
/// PeCoffLoader ImageContext
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
} LOADED_IMAGE_PRIVATE_DATA; } LOADED_IMAGE_PRIVATE_DATA;
@ -58,12 +65,12 @@ typedef struct {
CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE) CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)
#define LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32('l','p','e','i') #define LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32('l','p','e','i')
typedef struct { typedef struct {
UINTN Signature; UINTN Signature;
EFI_HANDLE Handle; // Image handle /// Image handle
EFI_HANDLE Handle;
EFI_PE32_IMAGE_PROTOCOL Pe32Image; EFI_PE32_IMAGE_PROTOCOL Pe32Image;
} LOAD_PE32_IMAGE_PRIVATE_DATA; } LOAD_PE32_IMAGE_PRIVATE_DATA;
@ -71,7 +78,6 @@ typedef struct {
CR(a, LOAD_PE32_IMAGE_PRIVATE_DATA, Pe32Image, LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE) CR(a, LOAD_PE32_IMAGE_PRIVATE_DATA, Pe32Image, LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE)
// //
// Private Data Types // Private Data Types
// //
@ -84,11 +90,6 @@ typedef struct {
} IMAGE_FILE_HANDLE; } IMAGE_FILE_HANDLE;
//
// Abstractions for reading image contents
//
/** /**
Opens a file for (simple) reading. The simple read abstraction Opens a file for (simple) reading. The simple read abstraction
will access the file either from a memory copy, from a file will access the file either from a memory copy, from a file
@ -149,25 +150,6 @@ CoreReadImageFile (
); );
/**
A function out of date, should be removed.
@param ImageFileHandle Handle of the file to close
**/
VOID
EFIAPI
CoreCloseImageFile (
IN IMAGE_FILE_HANDLE *ImageFileHandle
);
//
// Exported Image functions
//
/** /**
Loads an EFI image into memory and returns a handle to the image with extended parameters. Loads an EFI image into memory and returns a handle to the image with extended parameters.

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "Image.h"
/** /**
Search a handle to a device on a specified device path that supports a specified protocol, Search a handle to a device on a specified device path that supports a specified protocol,

View File

@ -1,68 +0,0 @@
/** @file
Internal functions shared in DxeCore module.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. 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.
**/
#ifndef _DXE_LIBRARY_H_
#define _DXE_LIBRARY_H_
/**
Raising to the task priority level of the mutual exclusion
lock, and then acquires ownership of the lock.
@param Lock The lock to acquire
@return Lock owned
**/
VOID
CoreAcquireLock (
IN EFI_LOCK *Lock
);
/**
Initialize a basic mutual exclusion lock. Each lock
provides mutual exclusion access at it's task priority
level. Since there is no-premption (at any TPL) or
multiprocessor support, acquiring the lock only consists
of raising to the locks TPL.
@param Lock The EFI_LOCK structure to initialize
@retval EFI_SUCCESS Lock Owned.
@retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
**/
EFI_STATUS
CoreAcquireLockOrFail (
IN EFI_LOCK *Lock
);
/**
Releases ownership of the mutual exclusion lock, and
restores the previous task priority level.
@param Lock The lock to release
@return Lock unowned
**/
VOID
CoreReleaseLock (
IN EFI_LOCK *Lock
);
#endif

View File

@ -16,16 +16,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define _IMEM_H_ #define _IMEM_H_
#if defined (MDE_CPU_IPF) #if defined (MDE_CPU_IPF)
// ///
// For Itanium machines make the default allocations 8K aligned /// For Itanium machines make the default allocations 8K aligned
// ///
#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2) #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2)
#define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2) #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2)
#else #else
// ///
// For genric EFI machines make the default allocations 4K aligned /// For genric EFI machines make the default allocations 4K aligned
// ///
#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE) #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)
#define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE) #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "Imem.h"
#define EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE) #define EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "DxeMain.h" #include "DxeMain.h"
#include "Imem.h"
#define POOL_FREE_SIGNATURE EFI_SIGNATURE_32('p','f','r','0') #define POOL_FREE_SIGNATURE EFI_SIGNATURE_32('p','f','r','0')
typedef struct { typedef struct {

View File

@ -24,7 +24,9 @@ EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugInfoTableHeader = {
EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL; EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;
#define FOUR_MEG_ALIGNMENT 0x400000
#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *))
/** /**
Creates and initializes the DebugImageInfo Table. Also creates the configuration Creates and initializes the DebugImageInfo Table. Also creates the configuration