Initialize DuetPkg ...

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4416 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2
2007-12-21 08:48:38 +00:00
parent a09aa7e27a
commit ca162103da
35 changed files with 5316 additions and 0 deletions

187
DuetPkg/Include/CpuIA32.h Normal file
View File

@@ -0,0 +1,187 @@
/*++
Copyright (c) 2006, Intel Corporation. All rights reserved.
This software and associated documentation (if any) is furnished
under a license and may only be used or copied in accordance
with the terms of the license. Except as permitted by such
license, no part of this software or documentation may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any means without the express written consent of
Intel Corporation.
Module Name:
CpuIA32.h
Abstract:
Basic Definition for IA32 Architecture.
--*/
#ifndef _CPU_IA32_H_
#define _CPU_IA32_H_
typedef struct {
UINT32 RegEax;
UINT32 RegEbx;
UINT32 RegEcx;
UINT32 RegEdx;
} EFI_CPUID_REGISTER;
#pragma pack(1)
//
// Definition for IA32 microcode format
//
typedef struct {
UINT32 HeaderVersion;
UINT32 UpdateRevision;
UINT32 Date;
UINT32 ProcessorId;
UINT32 Checksum;
UINT32 LoaderRevision;
UINT32 ProcessorFlags;
UINT32 DataSize;
UINT32 TotalSize;
UINT8 Reserved[12];
} EFI_CPU_MICROCODE_HEADER;
typedef struct {
UINT32 ExtendedSignatureCount;
UINT32 ExtendedTableChecksum;
UINT8 Reserved[12];
} EFI_CPU_MICROCODE_EXTENDED_TABLE_HEADER;
typedef struct {
UINT32 ProcessorSignature;
UINT32 ProcessorFlag;
UINT32 ProcessorChecksum;
} EFI_CPU_MICROCODE_EXTENDED_TABLE;
//
// The MS compiler doesn't handle QWORDs very well. So break
// them into DWORDs to circumvent the problem.
//
typedef union _MSR_REGISTER {
UINT64 Qword;
struct _DWORDS {
UINT32 Low;
UINT32 High;
} Dwords;
struct _BYTES {
UINT8 FirstByte;
UINT8 SecondByte;
UINT8 ThirdByte;
UINT8 FouthByte;
UINT8 FifthByte;
UINT8 SixthByte;
UINT8 SeventhByte;
UINT8 EighthByte;
} Bytes;
} MSR_REGISTER;
#pragma pack()
//
// Definition for CPUID Index
//
#define EFI_CPUID_SIGNATURE 0x0
#define EFI_CPUID_VERSION_INFO 0x1
#define EFI_CPUID_CACHE_INFO 0x2
#define EFI_CPUID_SERIAL_NUMBER 0x3
#define EFI_CPUID_EXTENDED_FUNCTION 0x80000000
#define EFI_CPUID_EXTENDED_CPU_SIG 0x80000001
#define EFI_CPUID_BRAND_STRING1 0x80000002
#define EFI_CPUID_BRAND_STRING2 0x80000003
#define EFI_CPUID_BRAND_STRING3 0x80000004
#define EFI_CPUID_ADDRESS_SIZE 0x80000008
//
// Definition for MSR address
//
#define EFI_MSR_IA32_PLATFORM_ID 0x17
#define EFI_MSR_IA32_APIC_BASE 0x1B
#define EFI_MSR_EBC_HARD_POWERON 0x2A
#define EFI_MSR_EBC_SOFT_POWERON 0x2B
#define EFI_MSR_EBC_FREQUENCY_ID 0x2C
#define MSR_IA32_FEATURE_CONTROL 0x3A
#define EFI_MSR_IA32_BIOS_UPDT_TRIG 0x79
#define EFI_MSR_IA32_BIOS_SIGN_ID 0x8B
#define EFI_MSR_PSB_CLOCK_STATUS 0xCD
#define MSR_EXT_CONFIG 0xEE
#define EFI_IA32_MCG_CAP 0x179
#define EFI_IA32_MCG_CTL 0x17B
#define EFI_MSR_IA32_PERF_STS 0x198
#define EFI_MSR_IA32_PERF_CTL 0x199
#define EFI_MSR_IA32_CLOCK_MODULATION 0x19A
#define MSR_IA32_THERMAL_INTERRUPT 0x19B
#define EFI_MSR_IA32_THERM_STATUS 0x19C
#define EFI_MSR_GV_THERM 0x19D
#define MSR_IA32_MISC_ENABLE 0x1A0
#define MSR_PIC_SENS_CFG 0x1AA
#define EFI_IA32_MC0_CTL 0x400
#define EFI_IA32_MC0_STATUS 0x401
#define MSR_PECI_CONTROL 0x5A0
//
// Definition for MTRR address and related values
//
#define EFI_IA32_MTRR_FIX64K_00000 0x250
#define EFI_IA32_MTRR_FIX16K_80000 0x258
#define EFI_IA32_MTRR_FIX16K_A0000 0x259
#define EFI_IA32_MTRR_FIX4K_C0000 0x268
#define EFI_IA32_MTRR_FIX4K_C8000 0x269
#define EFI_IA32_MTRR_FIX4K_D0000 0x26A
#define EFI_IA32_MTRR_FIX4K_D8000 0x26B
#define EFI_IA32_MTRR_FIX4K_E0000 0x26C
#define EFI_IA32_MTRR_FIX4K_E8000 0x26D
#define EFI_IA32_MTRR_FIX4K_F0000 0x26E
#define EFI_IA32_MTRR_FIX4K_F8000 0x26F
#define EFI_CACHE_VARIABLE_MTRR_BASE 0x200
#define EFI_CACHE_VARIABLE_MTRR_END 0x20F
#define EFI_CACHE_IA32_MTRR_DEF_TYPE 0x2FF
#define EFI_CACHE_VALID_ADDRESS 0xFFFFFF000
#define EFI_MSR_VALID_MASK 0xFFFFFFFFF
#define EFI_CACHE_MTRR_VALID 0x800
#define EFI_CACHE_FIXED_MTRR_VALID 0x400
#define EFI_CACHE_UNCACHEABLE 0
#define EFI_CACHE_WRITECOMBINING 1
#define EFI_CACHE_WRITETHROUGH 4
#define EFI_CACHE_WRITEPROTECTED 5
#define EFI_CACHE_WRITEBACK 6
//
// Definition for Local APIC registers and related values
//
#define LOCAL_APIC_LVT_TIMER 0x320
#define LOCAL_APIC_TIMER_INIT_COUNT 0x380
#define LOCAL_APIC_TIMER_COUNT 0x390
#define LOCAL_APIC_TIMER_DIVIDE 0x3E0
#define DELIVERY_MODE_FIXED 0x0
#define DELIVERY_MODE_LOWEST_PRIORITY 0x1
#define DELIVERY_MODE_SMI 0x2
#define DELIVERY_MODE_REMOTE_READ 0x3
#define DELIVERY_MODE_NMI 0x4
#define DELIVERY_MODE_INIT 0x5
#define DELIVERY_MODE_SIPI 0x6
#define TRIGGER_MODE_EDGE 0x0
#define TRIGGER_MODE_LEVEL 0x1
//
// CPU System Memory Map Definition
//
#define CPU_MSI_MEMORY_BASE 0xFEE00000
#define CPU_MSI_MEMORY_SIZE 0x100000
#endif

View File

@@ -0,0 +1,127 @@
/*++
Copyright (c) 2004 - 2007, Intel Corporation
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.
Module Name:
EfiFlashMap.h
Abstract:
Defines for the EFI Flash Map functionality
--*/
#ifndef _EFI_FLASHMAP_H_
#define _EFI_FLASHMAP_H_
//
// Definition for flash map GUIDed HOBs
//
typedef UINT32 EFI_FLASH_AREA_ATTRIBUTES;
#define EFI_FLASH_AREA_FV 0x0001
#define EFI_FLASH_AREA_SUBFV 0x0002
#define EFI_FLASH_AREA_MEMMAPPED_FV 0x0004
#define EFI_FLASH_AREA_REQUIRED 0x0008
#define EFI_FLASH_AREA_CORRUPT 0x0010
typedef UINT8 EFI_FLASH_AREA_TYPE;
#define EFI_FLASH_AREA_RECOVERY_BIOS 0x0 // Recovery code
#define EFI_FLASH_AREA_MAIN_BIOS 0x1 // Regular BIOS code
#define EFI_FLASH_AREA_PAL_B 0x2 // PAL-B
#define EFI_FLASH_AREA_RESERVED_03 0x3 // Reserved for backwards compatibility
#define EFI_FLASH_AREA_RESERVED_04 0x4 // Reserved for backwards compatibility
#define EFI_FLASH_AREA_DMI_FRU 0x5 // DMI FRU information
#define EFI_FLASH_AREA_OEM_BINARY 0x6 // OEM Binary Code/data
#define EFI_FLASH_AREA_RESERVED_07 0x7 // Reserved for backwards compatibility
#define EFI_FLASH_AREA_RESERVED_08 0x8 // Reserved for backwards compatibility
#define EFI_FLASH_AREA_RESERVED_09 0x9 // Reserved for backwards compatibility
#define EFI_FLASH_AREA_RESERVED_0A 0x0a // Reserved for backwards compatibility
#define EFI_FLASH_AREA_EFI_VARIABLES 0x0b // EFI variables
#define EFI_FLASH_AREA_MCA_LOG 0x0c // MCA error log
#define EFI_FLASH_AREA_SMBIOS_LOG 0x0d // SMBIOS error log
#define EFI_FLASH_AREA_FTW_BACKUP 0x0e // A backup block during FTW operations
#define EFI_FLASH_AREA_FTW_STATE 0x0f // State information during FTW operations
#define EFI_FLASH_AREA_UNUSED 0x0fd // Not used
#define EFI_FLASH_AREA_GUID_DEFINED 0x0fe // Usage defined by a GUID
#pragma pack(1)
//
// An individual sub-area Entry.
// A single flash area may consist of more than one sub-area.
//
typedef struct {
EFI_FLASH_AREA_ATTRIBUTES Attributes;
UINT32 Reserved;
EFI_PHYSICAL_ADDRESS Base;
EFI_PHYSICAL_ADDRESS Length;
EFI_GUID FileSystem;
} EFI_FLASH_SUBAREA_ENTRY;
typedef struct {
UINT8 Reserved[3];
EFI_FLASH_AREA_TYPE AreaType;
EFI_GUID AreaTypeGuid;
UINT32 NumEntries;
EFI_FLASH_SUBAREA_ENTRY Entries[1];
} EFI_FLASH_MAP_ENTRY_DATA;
typedef struct {
UINT8 Reserved[3];
EFI_FLASH_AREA_TYPE AreaType;
EFI_GUID AreaTypeGuid;
UINT32 NumberOfEntries;
EFI_FLASH_SUBAREA_ENTRY Entries[1];
//
// Extended Hob data.
//
// VolumeId and FilePath indicating a unique file.
//
UINT32 VolumeId;
CHAR16 FilePath[256];
UINT32 ActuralSize;
UINT32 Offset;
} EFI_FLASH_MAP_FS_ENTRY_DATA;
typedef struct {
EFI_HOB_GENERIC_HEADER Header;
EFI_GUID Name;
UINT8 Reserved[3];
EFI_FLASH_AREA_TYPE AreaType;
EFI_GUID AreaTypeGuid;
UINT32 NumEntries;
EFI_FLASH_SUBAREA_ENTRY Entries[1];
} EFI_HOB_FLASH_MAP_ENTRY_TYPE;
//
// Internal definitions
//
typedef struct {
UINT8 Reserved[3];
EFI_FLASH_AREA_TYPE AreaType;
EFI_GUID AreaTypeGuid;
UINT32 NumberOfEntries;
EFI_FLASH_SUBAREA_ENTRY SubAreaData;
} EFI_FLASH_AREA_HOB_DATA;
typedef struct {
UINTN Base;
UINTN Length;
EFI_FLASH_AREA_ATTRIBUTES Attributes;
EFI_FLASH_AREA_TYPE AreaType;
UINT8 Reserved[3];
EFI_GUID AreaTypeGuid;
} EFI_FLASH_AREA_DATA;
#pragma pack()
#endif // #ifndef _EFI_FLASHMAP_H_

View File

@@ -0,0 +1,59 @@
/*++
Copyright (c) 2006, Intel Corporation
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.
Module Name:
EfiLdrHandoff.h
Abstract:
Revision History:
--*/
#ifndef _EFILDR_HANDOFF_H_
#define _EFILDR_HANDOFF_H_
#include <Base.h>
#include <Uefi.h>
#define EFILDR_BASE_SEGMENT 0x2000
#define EFILDR_LOAD_ADDRESS (EFILDR_BASE_SEGMENT << 4)
#define EFILDR_HEADER_ADDRESS (EFILDR_LOAD_ADDRESS+0x2000)
#define EFILDR_CB_VA 0x00
typedef struct _EFILDRHANDOFF {
UINTN MemDescCount;
EFI_MEMORY_DESCRIPTOR *MemDesc;
VOID *BfvBase;
UINTN BfvSize;
VOID *DxeIplImageBase;
UINTN DxeIplImageSize;
VOID *DxeCoreImageBase;
UINTN DxeCoreImageSize;
VOID *DxeCoreEntryPoint;
} EFILDRHANDOFF;
typedef struct {
UINT32 CheckSum;
UINT32 Offset;
UINT32 Length;
UINT8 FileName[52];
} EFILDR_IMAGE;
typedef struct {
UINT32 Signature;
UINT32 HeaderCheckSum;
UINT32 FileLength;
UINT32 NumberOfImages;
} EFILDR_HEADER;
#endif

View File

@@ -0,0 +1,44 @@
/*++
Copyright (c) 2007, Intel Corporation
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.
Module Name:
FlashLayout.h
Abstract:
Platform specific flash layout
--*/
#ifndef _EFI_FLASH_LAYOUT
#define _EFI_FLASH_LAYOUT
#include "EfiFlashMap.h"
//
// Firmware Volume Information for DUET
//
#define FV_BLOCK_SIZE 0x10000
#define FV_BLOCK_MASK 0x0FFFF
#define EFI_RUNTIME_UPDATABLE_FV_HEADER_LENGTH (sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY))
#define NV_STORAGE_SIZE 0x4000
#define NV_STORAGE_FVB_SIZE ((NV_STORAGE_SIZE + EFI_RUNTIME_UPDATABLE_FV_HEADER_LENGTH + FV_BLOCK_MASK) & ~FV_BLOCK_MASK)
#define NV_STORAGE_FVB_BLOCK_NUM (NV_STORAGE_FVB_SIZE / FV_BLOCK_SIZE)
#define NV_FTW_WORKING_SIZE 0x2000
#define NV_FTW_SPARE_SIZE 0x10000
#define NV_FTW_FVB_SIZE ((NV_FTW_WORKING_SIZE + NV_FTW_SPARE_SIZE + EFI_RUNTIME_UPDATABLE_FV_HEADER_LENGTH + FV_BLOCK_MASK) & ~FV_BLOCK_MASK)
#define NV_FTW_FVB_BLOCK_NUM (NV_FTW_FVB_SIZE / FV_BLOCK_SIZE)
#define NV_STORAGE_FILE_PATH L"\\Efivar.bin"
#endif // _EFI_FLASH_LAYOUT

View File

@@ -0,0 +1,127 @@
/*++
Copyright (c) 2006 - 2007, Intel Corporation
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.
Module Name:
AcpiDescription.h
Abstract:
GUIDs used for ACPI Description
--*/
#ifndef _EFI_ACPI_DESCRIPTION_H_
#define _EFI_ACPI_DESCRIPTION_H_
#define EFI_ACPI_DESCRIPTION_GUID \
{ \
0x3c699197, 0x93c, 0x4c69, 0xb0, 0x6b, 0x12, 0x8a, 0xe3, 0x48, 0x1d, 0xc9 \
}
typedef struct {
UINT8 AddressSpaceId;
UINT8 RegisterBitWidth;
UINT8 RegisterBitOffset;
UINT8 AccessSize;
UINT64 Address;
} EFI_ACPI_GENERIC_ADDRESS_STRUCTURE;
#define ACPI_ADDRESS_ID_MEMORY 0
#define ACPI_ADDRESS_ID_IO 1
#define ACPI_ADDRESS_ID_PCI 2
#define ACPI_ADDRESS_ID_EC 3
#define ACPI_ADDRESS_ID_SMBUS 4
#define ACPI_ADDRESS_ACCESS_ANY 0
#define ACPI_ADDRESS_ACCESS_BYTE 1
#define ACPI_ADDRESS_ACCESS_WORD 2
#define ACPI_ADDRESS_ACCESS_DWORD 3
#define ACPI_ADDRESS_ACCESS_QWORD 4
//
// Following structure defines ACPI Description information.
// This information is platform specific, may be consumed by DXE generic driver.
//
#pragma pack(1)
typedef struct _EFI_ACPI_DESCRIPTION {
//
// For Timer
//
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE PM_TMR_BLK;
UINT8 PM_TMR_LEN;
UINT8 TMR_VAL_EXT;
//
// For RTC
//
UINT8 DAY_ALRM;
UINT8 MON_ALRM;
UINT8 CENTURY;
//
// For Reset
//
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE RESET_REG;
UINT8 RESET_VALUE;
//
// For Shutdown
//
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE PM1a_EVT_BLK;
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE PM1b_EVT_BLK;
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE PM1a_CNT_BLK;
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE PM1b_CNT_BLK;
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE PM2_CNT_BLK;
UINT8 PM1_EVT_LEN;
UINT8 PM1_CNT_LEN;
UINT8 PM2_CNT_LEN;
UINT8 SLP_TYPa;
UINT8 SLP_TYPb;
//
// For sleep
//
UINT8 SLP1_TYPa;
UINT8 SLP1_TYPb;
UINT8 SLP2_TYPa;
UINT8 SLP2_TYPb;
UINT8 SLP3_TYPa;
UINT8 SLP3_TYPb;
UINT8 SLP4_TYPa;
UINT8 SLP4_TYPb;
//
// GPE
//
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE GPE0_BLK;
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE GPE1_BLK;
UINT8 GPE0_BLK_LEN;
UINT8 GPE1_BLK_LEN;
UINT8 GPE1_BASE;
//
// IAPC Boot Arch
//
UINT16 IAPC_BOOT_ARCH;
//
// Flags
//
UINT32 Flags;
} EFI_ACPI_DESCRIPTION;
#pragma pack()
extern EFI_GUID gEfiAcpiDescriptionGuid;
#endif

View File

@@ -0,0 +1,33 @@
/*++
Copyright (c) 2004, Intel Corporation
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.
Module Name:
FlashMapHob.h
Abstract:
GUID used for Flash Map HOB entries in the HOB list.
--*/
#ifndef _FLASH_MAP_HOB_GUID_H_
#define _FLASH_MAP_HOB_GUID_H_
//
// Definitions for Flash Map
//
#define EFI_FLASH_MAP_HOB_GUID \
{ 0xb091e7d2, 0x5a0, 0x4198, 0x94, 0xf0, 0x74, 0xb7, 0xb8, 0xc5, 0x54, 0x59 }
extern EFI_GUID gEfiFlashMapHobGuid;
#endif // _FLASH_MAP_HOB_GUID_H_

View File

@@ -0,0 +1,46 @@
/*++
Copyright (c) 2006, Intel Corporation
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.
Module Name:
PciExpressBaseAddress.h
Abstract:
GUIDs used for PciExpress Base Address
--*/
#ifndef _EFI_PCI_EXPRESS_BASE_ADDRESS_H_
#define _EFI_PCI_EXPRESS_BASE_ADDRESS_H_
#define EFI_PCI_EXPRESS_BASE_ADDRESS_GUID \
{ \
0x3677d529, 0x326f, 0x4603, 0xa9, 0x26, 0xea, 0xac, 0xe0, 0x1d, 0xcb, 0xb0 \
}
//
// Following structure defines PCI Express Base Address information.
// This information is platform specific, and built into hob in PEI phase.
// It can be consumed by PEI PCI driver and DXE PCI driver.
//
#pragma pack(1)
typedef struct _EFI_PCI_EXPRESS_BASE_ADDRESS_INFORMATION {
UINT32 HostBridgeNumber;
UINT32 RootBridgeNumber;
UINT64 PciExpressBaseAddress;
} EFI_PCI_EXPRESS_BASE_ADDRESS_INFORMATION;
#pragma pack()
extern EFI_GUID gEfiPciExpressBaseAddressGuid;
#endif