From: andrewfish Date: Thu, 22 Jul 2010 21:21:38 +0000 (+0000) Subject: Port UnixPkg to also support X64. Currently only supports Unix x86_64 ABI. In the... X-Git-Tag: edk2-stable201903~15675 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=b9c8e50e2054fc21c2029db309f813d03ccd6082 Port UnixPkg to also support X64. Currently only supports Unix x86_64 ABI. In the future we can make Sec support x86_64 ABI and the rest of the code support X64 EFI ABI. This will require assembly gaskets to fix the calling convention differences. I currently have noop gaskets in place for x86_64 ABI. This has only been tested on OS X 10.6. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10685 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/UnixPkg/Include/Protocol/UnixThunk.h b/UnixPkg/Include/Protocol/UnixThunk.h index 4141d35662..7b4630bb0b 100644 --- a/UnixPkg/Include/Protocol/UnixThunk.h +++ b/UnixPkg/Include/Protocol/UnixThunk.h @@ -74,7 +74,9 @@ Abstract: // st_size is 64-bit but starts on a 32-bit offset in the structure. The compiler // flags used to produce compatible EFI images, break struct stat // +#ifdef MDE_CPU_IA32 #pragma pack(4) +#endif #if __DARWIN_64_BIT_INO_T @@ -128,7 +130,10 @@ typedef struct stat_fix { } STAT_FIX; #endif -#pragma pack() + +#ifdef MDE_CPU_IA32 +#pragma pack(4) +#endif #else @@ -155,40 +160,75 @@ VOID typedef VOID -(*UnixSetTimer) (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs)); +(*UnixSetTimer) ( + UINT64 PeriodMs, + VOID (*CallBack)(UINT64 DeltaMs) + ); + typedef VOID -(*UnixGetLocalTime) (EFI_TIME *Time); +(*UnixGetLocalTime) ( + EFI_TIME *Time + ); + typedef struct tm * -(*UnixGmTime)(const time_t *timep); +(*UnixGmTime)( + const time_t *timep + ); + typedef long -(*UnixGetTimeZone)(void); +(*UnixGetTimeZone)( + void + ); + typedef int -(*UnixGetDayLight)(void); +(*UnixGetDayLight)( + void + ); + typedef int -(*UnixPoll)(struct pollfd *pfd, int nfds, int timeout); +(*UnixPoll)( + struct pollfd *pfd, + unsigned int nfds, + int timeout + ); + typedef -int -(*UnixRead) (int fd, void *buf, int count); +long +(*UnixRead) ( + int fd, + void *buf, + int count + ); + typedef -int -(*UnixWrite) (int fd, const void *buf, int count); +long +(*UnixWrite) ( + int fd, + const void *buf, + int count + ); + typedef char * (*UnixGetenv) (const char *var); + typedef int (*UnixOpen) (const char *name, int flags, int mode); + typedef off_t (*UnixSeek) (int fd, off_t off, int whence); + typedef int (*UnixFtruncate) (int fd, long int len); + typedef int (*UnixClose) (int fd); @@ -196,45 +236,59 @@ int typedef int (*UnixMkdir)(const char *pathname, mode_t mode); + typedef int (*UnixRmDir)(const char *pathname); + typedef int (*UnixUnLink)(const char *pathname); + typedef int (*UnixGetErrno)(VOID); + typedef DIR * (*UnixOpenDir)(const char *pathname); + typedef void (*UnixRewindDir)(DIR *dir); + typedef struct dirent * (*UnixReadDir)(DIR *dir); + typedef int (*UnixCloseDir)(DIR *dir); + typedef int (*UnixStat)(const char *path, STAT_FIX *buf); + typedef int (*UnixStatFs)(const char *path, struct statfs *buf); + typedef int (*UnixRename)(const char *oldpath, const char *newpath); + typedef time_t (*UnixMkTime)(struct tm *tm); + typedef int (*UnixFSync)(int fd); + typedef int (*UnixChmod)(const char *path, mode_t mode); + typedef int (*UnixUTime)(const char *filename, const struct utimbuf *buf); @@ -282,21 +336,9 @@ int (*UnixTcsetattr) (int __fd, int __optional_actions, __const struct termios *__termios_p); -typedef -VOID * -(*UnixDlopen) (const char *FileName, int Flag); - -typedef -char * -(*UnixDlerror) (VOID); - -typedef -VOID * -(*UnixDlsym) (VOID* Handle, const char* Symbol); - // -// Work functions to enable source level debug in the emulator +// Worker functions to enable source level debug in the emulator // typedef @@ -364,9 +406,6 @@ typedef struct _EFI_UNIX_THUNK_PROTOCOL { UnixCfsetospeed Cfsetospeed; UnixTcgetattr Tcgetattr; UnixTcsetattr Tcsetattr; - UnixDlopen Dlopen; - UnixDlerror Dlerror; - UnixDlsym Dlsym; UnixPeCoffGetEntryPoint PeCoffGetEntryPoint; UnixPeCoffRelocateImageExtraAction PeCoffRelocateImageExtraAction; UnixPeCoffLoaderUnloadImageExtraAction PeCoffUnloadImageExtraAction; diff --git a/UnixPkg/Include/Protocol/UnixUgaIo.h b/UnixPkg/Include/Protocol/UnixUgaIo.h index 4a4798234c..75923f34b9 100644 --- a/UnixPkg/Include/Protocol/UnixUgaIo.h +++ b/UnixPkg/Include/Protocol/UnixUgaIo.h @@ -20,33 +20,41 @@ Abstract: #ifndef _UNIX_UGA_IO_H_ #define _UNIX_UGA_IO_H_ -#define EFI_UNIX_UGA_IO_PROTOCOL_GUID \ - { \ - 0xf2e5e2c6, 0x8985, 0x11db, {0xa1, 0x91, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \ - } +#define EFI_UNIX_UGA_IO_PROTOCOL_GUID {0xf2e5e2c6, 0x8985, 0x11db, {0xa1, 0x91, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } } -struct _EFI_UNIX_UGA_IO_PROTOCOL; typedef struct _EFI_UNIX_UGA_IO_PROTOCOL EFI_UNIX_UGA_IO_PROTOCOL; typedef EFI_STATUS -(*UGAClose)(EFI_UNIX_UGA_IO_PROTOCOL *Uga); +(*UGAClose)( + EFI_UNIX_UGA_IO_PROTOCOL *Uga + ); typedef EFI_STATUS -(*UGASize)(EFI_UNIX_UGA_IO_PROTOCOL *Uga, UINT32 Width, UINT32 Height); +(*UGASize)( + EFI_UNIX_UGA_IO_PROTOCOL *Uga, + UINT32 Width, + UINT32 Height + ); typedef EFI_STATUS -(*UGACheckKey)(EFI_UNIX_UGA_IO_PROTOCOL *Uga); +(*UGACheckKey)( + EFI_UNIX_UGA_IO_PROTOCOL *Uga + ); typedef EFI_STATUS -(*UGAGetKey)(EFI_UNIX_UGA_IO_PROTOCOL *Uga, EFI_INPUT_KEY *key); +(*UGAGetKey)( + EFI_UNIX_UGA_IO_PROTOCOL *Uga, + EFI_INPUT_KEY *key + ); typedef EFI_STATUS -(*UGABlt)(EFI_UNIX_UGA_IO_PROTOCOL *Uga, +(*UGABlt)( + IN EFI_UNIX_UGA_IO_PROTOCOL *Uga, IN EFI_UGA_PIXEL *BltBuffer OPTIONAL, IN EFI_UGA_BLT_OPERATION BltOperation, IN UINTN SourceX, @@ -55,7 +63,8 @@ EFI_STATUS IN UINTN DestinationY, IN UINTN Width, IN UINTN Height, - IN UINTN Delta OPTIONAL); + IN UINTN Delta OPTIONAL + ); struct _EFI_UNIX_UGA_IO_PROTOCOL { VOID *Private; diff --git a/UnixPkg/Sec/Gasket.c b/UnixPkg/Sec/Gasket.c index 9dd5bb20f4..3d5db3b795 100644 --- a/UnixPkg/Sec/Gasket.c +++ b/UnixPkg/Sec/Gasket.c @@ -74,20 +74,20 @@ GasketGetDayLight (void) int -Gasketpoll (struct pollfd *pfd, int nfds, int timeout) +Gasketpoll (struct pollfd *pfd, unsigned int nfds, int timeout) { return GasketUintnUintnUintn (poll, (UINTN)pfd, nfds, timeout); } -int +long Gasketread (int fd, void *buf, int count) { return GasketUintnUintnUintn (read, fd, (UINTN)buf, count); } -int +long Gasketwrite (int fd, const void *buf, int count) { return GasketUintnUintnUintn (write, fd, (UINTN)buf, count); @@ -168,10 +168,11 @@ Gasketopendir (const char *pathname) } -void * +void Gasketrewinddir (DIR *dir) { - return (void *)(UINTN)GasketUintn (rewinddir, (UINTN)dir); + GasketUintn (rewinddir, (UINTN)dir); + return; } @@ -372,7 +373,7 @@ GasketUnixPeCoffRelocateImageExtraAction ( VOID -GasketPeCoffLoaderUnloadImageExtraAction ( +GasketUnixPeCoffUnloadImageExtraAction ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext ) { diff --git a/UnixPkg/Sec/Gasket.h b/UnixPkg/Sec/Gasket.h index f46a663836..de3cfdf9ea 100644 --- a/UnixPkg/Sec/Gasket.h +++ b/UnixPkg/Sec/Gasket.h @@ -33,9 +33,9 @@ void GasketGetLocalTime (EFI_TIME *Time); struct tm *Gasketgmtime (const time_t *clock); long GasketGetTimeZone (void); int GasketGetDayLight (void); -int Gasketpoll (struct pollfd *pfd, int nfds, int timeout); -int Gasketread (int fd, void *buf, int count); -int Gasketwrite (int fd, const void *buf, int count); +int Gasketpoll (struct pollfd *pfd, unsigned int nfds, int timeout); +long Gasketread (int fd, void *buf, int count); +long Gasketwrite (int fd, const void *buf, int count); char *Gasketgetenv (const char *name); int Gasketopen (const char *name, int flags, int mode); off_t Gasketlseek (int fd, off_t off, int whence); @@ -46,7 +46,7 @@ int Gasketrmdir (const char *pathname); int Gasketunlink (const char *pathname); int GasketGetErrno (void); DIR *Gasketopendir (const char *pathname); -void *Gasketrewinddir (DIR *dir); +void Gasketrewinddir (DIR *dir); struct dirent *Gasketreaddir (DIR *dir); int Gasketclosedir (DIR *dir); int Gasketstat (const char *path, STAT_FIX *buf); @@ -88,21 +88,22 @@ GasketUnixPeCoffRelocateImageExtraAction ( ); VOID -GasketPeCoffLoaderUnloadImageExtraAction ( +GasketUnixPeCoffUnloadImageExtraAction ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext ); -int GasketVoid (void *api); -int GasketUintn (void *api, UINTN a); -int GasketUintnUintn (void *api, UINTN a, UINTN b); -int GasketUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c); -int GasketUintnUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c, UINTN d); -int GasketUintn10Args (void *api, UINTN a, UINTN b, UINTN c, UINTN d, UINTN e, UINTN f, UINTN g, UINTN h, UINTN i, UINTN j); -int GasketUint64Uintn (void *api, UINT64 a, UINTN b); +UINTN GasketVoid (void *api); +UINTN GasketUintn (void *api, UINTN a); +UINTN GasketUintnUintn (void *api, UINTN a, UINTN b); +UINTN GasketUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c); +UINTN GasketUintnUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c, UINTN d); +UINTN GasketUintn10Args (void *api, UINTN a, UINTN b, UINTN c, UINTN d, UINTN e, UINTN f, UINTN g, UINTN h, UINTN i, UINTN j); +UINTN GasketUint64Uintn (void *api, UINT64 a, UINTN b); UINT64 GasketUintnUint64Uintn (void *api, UINTN a, UINT64 b, UINTN c); -int GasketUintnUint16 (void *api, UINTN a, UINT16 b); +UINTN GasketUintnUint16 (void *api, UINTN a, UINT16 b); +UINTN ReverseGasketUint64 (void *api, UINT64 a); // // Gasket functions for EFI_UNIX_UGA_IO_PROTOCOL diff --git a/UnixPkg/Sec/Ia32/Gasket.S b/UnixPkg/Sec/Ia32/Gasket.S index f9a2b53faf..caeabf89eb 100644 --- a/UnixPkg/Sec/Ia32/Gasket.S +++ b/UnixPkg/Sec/Ia32/Gasket.S @@ -16,7 +16,7 @@ # on Leopard and _stat$INDOE64 on Snow Leopard. That is why we pass stat() # into one of these gaskets from C code. # -# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+# Copyright (c) 2008 - 2010, Apple Inc. 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 @@ -235,7 +235,23 @@ _GasketUintnUint16: call *%eax leave ret - +.globl _ReverseGasketUint64 +_ReverseGasketUint64: + pushl %ebp + movl %esp, %ebp + subl $56, %esp + movl 12(%ebp), %eax + movl %eax, -32(%ebp) + movl 16(%ebp), %eax + movl %eax, -28(%ebp) + movl 8(%ebp), %eax + movl %eax, -12(%ebp) + movl -32(%ebp), %eax + movl %eax, (%esp) + movl -12(%ebp), %eax + call *%eax + leave + ret .subsections_via_symbols #endif diff --git a/UnixPkg/Sec/Ia32/GasketTemplate.c b/UnixPkg/Sec/Ia32/GasketTemplate.c index c9824de6ba..8ff801d72e 100644 --- a/UnixPkg/Sec/Ia32/GasketTemplate.c +++ b/UnixPkg/Sec/Ia32/GasketTemplate.c @@ -138,5 +138,14 @@ GasketUintnUint16 (void *api, UINTN a, UINT16 b) return func (a, b); } +void +ReverseGasketUint64 (void *api, UINT64 a) +{ + GASKET_UINTN func; + + func = (GASKET_UINTN)api; + func (a); + return; +} diff --git a/UnixPkg/Sec/SecMain.c b/UnixPkg/Sec/SecMain.c index b232f5f549..4d66bfa301 100644 --- a/UnixPkg/Sec/SecMain.c +++ b/UnixPkg/Sec/SecMain.c @@ -827,7 +827,7 @@ Returns: // If the memory buffer could not be allocated at the FD build address // the Fixup is the difference. // - *FixUp = *FdBase - PcdGet32 (PcdUnixFdBaseAddress); + *FixUp = *FdBase - PcdGet64 (PcdUnixFdBaseAddress); } return EFI_SUCCESS; diff --git a/UnixPkg/Sec/UgaX11.c b/UnixPkg/Sec/UgaX11.c index 648d8c28ce..f43c7b44a2 100644 --- a/UnixPkg/Sec/UgaX11.c +++ b/UnixPkg/Sec/UgaX11.c @@ -373,9 +373,10 @@ UgaCheckKey(EFI_UNIX_UGA_IO_PROTOCOL *UgaIo) { UGA_IO_PRIVATE *drv = (UGA_IO_PRIVATE *)UgaIo; HandleEvents(drv); - if (drv->key_count != 0) + + if (drv->key_count != 0) { return EFI_SUCCESS; - else { + } else { /* EFI is certainly polling. Be CPU-friendly. */ msSleep (20); return EFI_NOT_READY; @@ -631,8 +632,8 @@ EFI_STATUS EFIAPI GasketUgaBlt ( XStoreName (drv->display, drv->win, title); } - XSelectInput (drv->display, drv->win, - ExposureMask | KeyPressMask); + XSelectInput (drv->display, drv->win, ExposureMask | KeyPressMask); + drv->gc = DefaultGC (drv->display, drv->screen); *Uga = (EFI_UNIX_UGA_IO_PROTOCOL *)drv; diff --git a/UnixPkg/Sec/UnixThunk.c b/UnixPkg/Sec/UnixThunk.c index 252c7e62a4..08cdd62157 100644 --- a/UnixPkg/Sec/UnixThunk.c +++ b/UnixPkg/Sec/UnixThunk.c @@ -55,8 +55,14 @@ settimer_handler (int sig) - ((UINT64)settimer_timeval.tv_sec * 1000) - (settimer_timeval.tv_usec / 1000); settimer_timeval = timeval; - if (settimer_callback) - (*settimer_callback)(delta); + + if (settimer_callback) { +#ifdef __APPLE__ + ReverseGasketUint64 (settimer_callback, delta); +#else + (*settimer_callback)(delta); +#endif + } } VOID @@ -94,13 +100,18 @@ SetTimer (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs)) void msSleep (unsigned long Milliseconds) { - struct timespec ts; + struct timespec rq, rm; - ts.tv_sec = Milliseconds / 1000; - ts.tv_nsec = (Milliseconds % 1000) * 1000000; + rq.tv_sec = Milliseconds / 1000; + rq.tv_nsec = (Milliseconds % 1000) * 1000000; - while (nanosleep (&ts, &ts) != 0 && errno == EINTR) - ; + while (nanosleep (&rq, &rm) != -1) { + if (errno != EINTR) { + break; + } + rq = rm; + } + } void @@ -174,20 +185,20 @@ EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = { Gasketgmtime, GasketGetTimeZone, GasketGetDayLight, - (UnixPoll)Gasketpoll, - (UnixRead)Gasketread, - (UnixWrite)Gasketwrite, + Gasketpoll, + Gasketread, + Gasketwrite, Gasketgetenv, - (UnixOpen)Gasketopen, - (UnixSeek)Gasketlseek, - (UnixFtruncate)Gasketftruncate, + Gasketopen, + Gasketlseek, + Gasketftruncate, Gasketclose, Gasketmkdir, Gasketrmdir, Gasketunlink, GasketGetErrno, Gasketopendir, - (UnixRewindDir)Gasketrewinddir, + Gasketrewinddir, Gasketreaddir, Gasketclosedir, Gasketstat, @@ -206,14 +217,9 @@ EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = { Gasketcfsetospeed, Gaskettcgetattr, Gaskettcsetattr, - - dlopen, // Update me with a gasket - dlerror, // Update me with a gasket - dlsym, // Update me with a gasket - - SecPeCoffGetEntryPoint, // Update me with a gasket - SecPeCoffRelocateImageExtraAction, // Update me with a gasket - SecPeCoffLoaderUnloadImageExtraAction // Update me with a gasket + GasketUnixPeCoffGetEntryPoint, + GasketUnixPeCoffRelocateImageExtraAction, + GasketUnixPeCoffUnloadImageExtraAction #else msSleep, /* Sleep */ @@ -255,9 +261,6 @@ EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = { cfsetospeed, tcgetattr, tcsetattr, - dlopen, - dlerror, - dlsym, SecPeCoffGetEntryPoint, SecPeCoffRelocateImageExtraAction, SecPeCoffLoaderUnloadImageExtraAction diff --git a/UnixPkg/Sec/X64/Gasket.S b/UnixPkg/Sec/X64/Gasket.S index f912d400b2..fc8166fae5 100644 --- a/UnixPkg/Sec/X64/Gasket.S +++ b/UnixPkg/Sec/X64/Gasket.S @@ -27,10 +27,10 @@ LCFI4: subq $32, %rsp LCFI5: movq %rdi, -24(%rbp) - movl %esi, -28(%rbp) + movq %rsi, -32(%rbp) movq -24(%rbp), %rax movq %rax, -8(%rbp) - movl -28(%rbp), %edi + movq -32(%rbp), %rdi movq -8(%rbp), %rax call *%rax leave @@ -43,15 +43,15 @@ LFB4: LCFI6: movq %rsp, %rbp LCFI7: - subq $32, %rsp + subq $48, %rsp LCFI8: movq %rdi, -24(%rbp) - movl %esi, -28(%rbp) - movl %edx, -32(%rbp) + movq %rsi, -32(%rbp) + movq %rdx, -40(%rbp) movq -24(%rbp), %rax movq %rax, -8(%rbp) - movl -32(%rbp), %esi - movl -28(%rbp), %edi + movq -40(%rbp), %rsi + movq -32(%rbp), %rdi movq -8(%rbp), %rax call *%rax leave @@ -67,14 +67,14 @@ LCFI10: subq $48, %rsp LCFI11: movq %rdi, -24(%rbp) - movl %esi, -28(%rbp) - movl %edx, -32(%rbp) - movl %ecx, -36(%rbp) + movq %rsi, -32(%rbp) + movq %rdx, -40(%rbp) + movq %rcx, -48(%rbp) movq -24(%rbp), %rax movq %rax, -8(%rbp) - movl -36(%rbp), %edx - movl -32(%rbp), %esi - movl -28(%rbp), %edi + movq -48(%rbp), %rdx + movq -40(%rbp), %rsi + movq -32(%rbp), %rdi movq -8(%rbp), %rax call *%rax leave @@ -87,19 +87,19 @@ LFB6: LCFI12: movq %rsp, %rbp LCFI13: - subq $48, %rsp + subq $64, %rsp LCFI14: movq %rdi, -24(%rbp) - movl %esi, -28(%rbp) - movl %edx, -32(%rbp) - movl %ecx, -36(%rbp) - movl %r8d, -40(%rbp) + movq %rsi, -32(%rbp) + movq %rdx, -40(%rbp) + movq %rcx, -48(%rbp) + movq %r8, -56(%rbp) movq -24(%rbp), %rax movq %rax, -8(%rbp) - movl -40(%rbp), %ecx - movl -36(%rbp), %edx - movl -32(%rbp), %esi - movl -28(%rbp), %edi + movq -56(%rbp), %rcx + movq -48(%rbp), %rdx + movq -40(%rbp), %rsi + movq -32(%rbp), %rdi movq -8(%rbp), %rax call *%rax leave @@ -112,35 +112,35 @@ LFB7: LCFI15: movq %rsp, %rbp LCFI16: - subq $80, %rsp + subq $96, %rsp LCFI17: movq %rdi, -24(%rbp) - movl %esi, -28(%rbp) - movl %edx, -32(%rbp) - movl %ecx, -36(%rbp) - movl %r8d, -40(%rbp) - movl %r9d, -44(%rbp) + movq %rsi, -32(%rbp) + movq %rdx, -40(%rbp) + movq %rcx, -48(%rbp) + movq %r8, -56(%rbp) + movq %r9, -64(%rbp) movq -24(%rbp), %rax movq %rax, -8(%rbp) - movl -44(%rbp), %edx - movl -40(%rbp), %ecx - movl -36(%rbp), %esi - movl -32(%rbp), %edi - movl -28(%rbp), %r10d - movl 48(%rbp), %eax - movl %eax, 24(%rsp) - movl 40(%rbp), %eax - movl %eax, 16(%rsp) - movl 32(%rbp), %eax - movl %eax, 8(%rsp) - movl 24(%rbp), %eax - movl %eax, (%rsp) + movq -64(%rbp), %rdx + movq -56(%rbp), %rcx + movq -48(%rbp), %rsi + movq -40(%rbp), %rdi + movq -32(%rbp), %r10 + movq 48(%rbp), %rax + movq %rax, 24(%rsp) + movq 40(%rbp), %rax + movq %rax, 16(%rsp) + movq 32(%rbp), %rax + movq %rax, 8(%rsp) + movq 24(%rbp), %rax + movq %rax, (%rsp) movq -8(%rbp), %rax - movl 16(%rbp), %r9d - movl %edx, %r8d - movl %esi, %edx - movl %edi, %esi - movl %r10d, %edi + movq 16(%rbp), %r9 + movq %rdx, %r8 + movq %rsi, %rdx + movq %rdi, %rsi + movq %r10, %rdi call *%rax leave ret @@ -156,10 +156,10 @@ LCFI19: LCFI20: movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) - movl %edx, -36(%rbp) + movq %rdx, -40(%rbp) movq -24(%rbp), %rax movq %rax, -8(%rbp) - movl -36(%rbp), %esi + movq -40(%rbp), %rsi movq -32(%rbp), %rdi movq -8(%rbp), %rax call *%rax @@ -176,14 +176,14 @@ LCFI22: subq $48, %rsp LCFI23: movq %rdi, -24(%rbp) - movl %esi, -28(%rbp) + movq %rsi, -32(%rbp) movq %rdx, -40(%rbp) - movl %ecx, -44(%rbp) + movq %rcx, -48(%rbp) movq -24(%rbp), %rax movq %rax, -8(%rbp) - movl -44(%rbp), %edx + movq -48(%rbp), %rdx movq -40(%rbp), %rsi - movl -28(%rbp), %edi + movq -32(%rbp), %rdi movq -8(%rbp), %rax call *%rax leave @@ -196,20 +196,39 @@ LFB10: LCFI24: movq %rsp, %rbp LCFI25: - subq $32, %rsp + subq $48, %rsp LCFI26: movq %rdi, -24(%rbp) - movl %esi, -28(%rbp) - movw %dx, -32(%rbp) + movq %rsi, -32(%rbp) + movw %dx, -36(%rbp) movq -24(%rbp), %rax movq %rax, -8(%rbp) - movzwl -32(%rbp), %esi - movl -28(%rbp), %edi + movzwl -36(%rbp), %esi + movq -32(%rbp), %rdi movq -8(%rbp), %rax call *%rax leave ret LFE10: +.globl _ReverseGasketUint64 +_ReverseGasketUint64: +LFB11: + pushq %rbp +LCFI27: + movq %rsp, %rbp +LCFI28: + subq $32, %rsp +LCFI29: + movq %rdi, -24(%rbp) + movq %rsi, -32(%rbp) + movq -24(%rbp), %rax + movq %rax, -8(%rbp) + movq -32(%rbp), %rdi + movq -8(%rbp), %rax + call *%rax + leave + ret +LFE11: .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support EH_frame1: .set L$set$0,LECIE1-LSCIE1 @@ -455,4 +474,29 @@ LASFDE17: .byte 0x6 .align 3 LEFDE17: +.globl _ReverseGasketUint64.eh +_ReverseGasketUint64.eh: +LSFDE19: + .set L$set$37,LEFDE19-LASFDE19 + .long L$set$37 +LASFDE19: + .long LASFDE19-EH_frame1 + .quad LFB11-. + .set L$set$38,LFE11-LFB11 + .quad L$set$38 + .byte 0x0 + .byte 0x4 + .set L$set$39,LCFI27-LFB11 + .long L$set$39 + .byte 0xe + .byte 0x10 + .byte 0x86 + .byte 0x2 + .byte 0x4 + .set L$set$40,LCFI28-LCFI27 + .long L$set$40 + .byte 0xd + .byte 0x6 + .align 3 +LEFDE19: .subsections_via_symbols diff --git a/UnixPkg/Sec/X64/GasketTemplate.c b/UnixPkg/Sec/X64/GasketTemplate.c new file mode 100644 index 0000000000..f9f2785524 --- /dev/null +++ b/UnixPkg/Sec/X64/GasketTemplate.c @@ -0,0 +1,153 @@ +/** @file + Template file used to create Gasket.S + + This file is built on the command line via gcc GasketTemplate.c -S + and it will create GasketTemplate.s and this was used to create + Gasket.S. This builds code for Unix ABI on both sides. To convert + to EFI ABI will require changing the code by hand + +Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+Portions copyright (c) 2008 - 2010, Apple Inc. 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. + +**/ + + +#include +#include + +typedef int8_t INT8; +typedef uint8_t UINT8; +typedef int16_t INT16; +typedef uint16_t UINT16; +typedef int32_t INT32; +typedef uint32_t UINT32; +typedef int64_t INT64; +typedef uint64_t UINT64; +typedef UINT64 UINTN; + + +typedef UINTN (*GASKET_VOID) (); +typedef UINTN (*GASKET_UINTN) (UINTN); +typedef UINTN (*GASKET_UINTN_UINTN) (UINTN, UINTN); +typedef UINTN (*GASKET_UINTN_UINTN_UINTN) (UINTN, UINTN, UINTN); +typedef UINTN (*GASKET_UINTN_UINTN_UINTN_UINTN) (UINTN, UINTN, UINTN, UINTN); +typedef UINTN (*GASKET_UINTN_10ARGS) (UINTN, UINTN, UINTN, UINTN, UINTN, UINTN, UINTN, UINTN, UINTN, UINTN); +typedef UINTN (*GASKET_UINT64_UINTN) (UINT64, UINTN); +typedef UINT64 (*GASKET_UINTN_UINT64_UINTN) (UINTN, UINT64, UINTN); +typedef UINTN (*GASKET_UINTN_UINT16) (UINTN, UINT16); + +UINTN GasketVoid (void *api); +UINTN GasketUintn (void *api, UINTN a); +UINTN GasketUintnUintn (void *api, UINTN a, UINTN b); +UINTN GasketUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c); +UINTN GasketUintnUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c, UINTN d); +UINTN GasketUintn10Args (void *api, UINTN a, UINTN b, UINTN c, UINTN d, UINTN e, UINTN f, UINTN g, UINTN h, UINTN i, UINTN j); +UINTN GasketUint64Uintn (void *api, UINT64 a, UINTN b); +UINT64 GasketUintnUiny64Uintn (void *api, UINTN a, UINT64 b, UINTN c); +UINTN GasketUintnUint16 (void *api, UINTN a, UINT16 b); + + + +UINTN +GasketVoid (void *api) +{ + GASKET_VOID func; + + func = (GASKET_VOID)api; + return func (); +} + +UINTN +GasketUintn (void *api, UINTN a) +{ + GASKET_UINTN func; + + func = (GASKET_UINTN)api; + return func (a); +} + +UINTN +GasketUintnUintn (void *api, UINTN a, UINTN b) +{ + GASKET_UINTN_UINTN func; + + func = (GASKET_UINTN_UINTN)api; + return func (a, b); +} + + +UINTN +GasketUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c) +{ + GASKET_UINTN_UINTN_UINTN func; + + func = (GASKET_UINTN_UINTN_UINTN)api; + return func (a, b, c); +} + +UINTN +GasketUintnUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c, UINTN d) +{ + GASKET_UINTN_UINTN_UINTN_UINTN func; + + func = (GASKET_UINTN_UINTN_UINTN_UINTN)api; + return func (a, b, c, d); +} + +UINTN +GasketUintn10Args (void *api, UINTN a, UINTN b, UINTN c, UINTN d, UINTN e, UINTN f, UINTN g, UINTN h, UINTN i, UINTN j) +{ + GASKET_UINTN_10ARGS func; + + func = (GASKET_UINTN_10ARGS)api; + return func (a, b, c, d, e, f, g, h, i, j); +} + + +UINTN +GasketUint64Uintn (void *api, UINT64 a, UINTN b) +{ + GASKET_UINT64_UINTN func; + + func = (GASKET_UINT64_UINTN)api; + return func (a, b); +} + +UINT64 +GasketUintnUint64Uintn (void *api, UINTN a, UINT64 b, UINTN c) +{ + GASKET_UINTN_UINT64_UINTN func; + + func = (GASKET_UINTN_UINT64_UINTN)api; + return func (a, b, c); +} + +UINTN +GasketUintnUint16 (void *api, UINTN a, UINT16 b) +{ + GASKET_UINTN_UINT16 func; + + func = (GASKET_UINTN_UINT16)api; + return func (a, b); +} + +void +ReverseGasketUint64 (void *api, UINT64 a) +{ + GASKET_UINTN func; + + func = (GASKET_UINTN)api; + func (a); + return; +} + + + + diff --git a/UnixPkg/UnixFirmwareVolumePei/UnixFwh.c b/UnixPkg/UnixFirmwareVolumePei/UnixFwh.c index babae5da21..b135f6dc28 100644 --- a/UnixPkg/UnixFirmwareVolumePei/UnixFwh.c +++ b/UnixPkg/UnixFirmwareVolumePei/UnixFwh.c @@ -117,7 +117,7 @@ Returns: PcdGet32 (PcdFlashNvStorageFtwSpareSize) + PcdGet32 (PcdUnixFlashNvStorageEventLogSize); - BuildFvHob (FdFixUp + PcdGet32 (PcdUnixFlashNvStorageVariableBase), FdSize); + BuildFvHob (FdFixUp + PcdGet64 (PcdUnixFlashNvStorageVariableBase), FdSize); } else { // // For other FD's just map them in. diff --git a/UnixPkg/UnixFlashMapPei/FlashMap.c b/UnixPkg/UnixFlashMapPei/FlashMap.c index 5de98a43b9..059bb34bbe 100644 --- a/UnixPkg/UnixFlashMapPei/FlashMap.c +++ b/UnixPkg/UnixFlashMapPei/FlashMap.c @@ -83,9 +83,9 @@ Returns: return Status; } - PcdSet32 (PcdFlashNvStorageVariableBase, PcdGet32 (PcdUnixFlashNvStorageVariableBase) + (UINT32)FdFixUp); - PcdSet32 (PcdFlashNvStorageFtwWorkingBase, PcdGet32 (PcdUnixFlashNvStorageFtwWorkingBase) + (UINT32)FdFixUp); - PcdSet32 (PcdFlashNvStorageFtwSpareBase, PcdGet32 (PcdUnixFlashNvStorageFtwSpareBase) + (UINT32)FdFixUp); + PcdSet64 (PcdFlashNvStorageVariableBase64, PcdGet64 (PcdUnixFlashNvStorageVariableBase) + FdFixUp); + PcdSet64 (PcdFlashNvStorageFtwWorkingBase64, PcdGet64 (PcdUnixFlashNvStorageFtwWorkingBase) + FdFixUp); + PcdSet64 (PcdFlashNvStorageFtwSpareBase64, PcdGet64 (PcdUnixFlashNvStorageFtwSpareBase) + FdFixUp); return EFI_SUCCESS; } diff --git a/UnixPkg/UnixFlashMapPei/FlashMap.inf b/UnixPkg/UnixFlashMapPei/FlashMap.inf index ace8399917..da9f86182b 100644 --- a/UnixPkg/UnixFlashMapPei/FlashMap.inf +++ b/UnixPkg/UnixFlashMapPei/FlashMap.inf @@ -55,11 +55,11 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwWorkingBase gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwSpareBase diff --git a/UnixPkg/UnixPkg.dec b/UnixPkg/UnixPkg.dec index 06c240a5aa..f803cd7418 100644 --- a/UnixPkg/UnixPkg.dec +++ b/UnixPkg/UnixPkg.dec @@ -59,14 +59,14 @@ gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareVolume|L"..\\Fv\\Fv_Recovery.fd"|VOID*|0x00001009 gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySizeForSecMain|L"64!64"|VOID*|0x0000100c - gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageVariableBase|0x0|UINT32|0x00001014 - gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwSpareBase|0x0|UINT32|0x00001015 - gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwWorkingBase|0x0|UINT32|0x00001016 - gEfiUnixPkgTokenSpaceGuid.PcdUnixFdBaseAddress|0x0|UINT32|0x00001017 + gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageVariableBase|0x0|UINT64|0x00001014 + gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwSpareBase|0x0|UINT64|0x00001015 + gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwWorkingBase|0x0|UINT64|0x00001016 + gEfiUnixPkgTokenSpaceGuid.PcdUnixFdBaseAddress|0x0|UINT64|0x00001017 - gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogBase|0x0|UINT32|0x0000100e + gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogBase|0x0|UINT64|0x0000100e gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogSize|0x0|UINT32|0x0000100f - gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoveryBase|0x0|UINT32|0x00001010 + gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoveryBase|0x0|UINT64|0x00001010 gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoverySize|0x0|UINT32|0x00001011 gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareFdSize|0x0|UINT32|0x00001012 gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareBlockSize|0|UINT32|0x00001013 diff --git a/UnixPkg/UnixPkg.dsc b/UnixPkg/UnixPkg.dsc index 285fe12154..d5c3d81cd5 100644 --- a/UnixPkg/UnixPkg.dsc +++ b/UnixPkg/UnixPkg.dsc @@ -27,7 +27,7 @@ PLATFORM_VERSION = 0.3 DSC_ SPECIFICATION = 0x00010005 OUTPUT_DIRECTORY = Build/Unix - SUPPORTED_ARCHITECTURES = IA32|X64 + SUPPORTED_ARCHITECTURES = IA32 BUILD_TARGETS = DEBUG|RELEASE SKUID_IDENTIFIER = DEFAULT FLASH_DEFINITION = UnixPkg/UnixPkg.fdf @@ -154,6 +154,9 @@ [LibraryClasses.common.UEFI_APPLICATION] PrintLib|MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf +[LibraryClasses.X64] + BaseLib|UnixPkg/Library/UnixBaseLib/UnixBaseLib.inf + ################################################################################ # # Pcd Section - list of all EDK II PCD Entries defined by this Platform. @@ -182,24 +185,19 @@ ################################################################################ [PcdsDynamicDefault.common.DEFAULT] - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0 - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0 - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0 - gEfiGenericPlatformTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0|UINT32|4 - gEfiGenericPlatformTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x0|UINT32|4 - gEfiGenericPlatformTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0|UINT32|4 - gEfiGenericPlatformTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x0|UINT32|4 - gEfiGenericPlatformTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0|UINT32|4 - gEfiGenericPlatformTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x0|UINT32|4 - gEfiUnixPkgTokenSpaceGuid.PcdUnixConsole|L"Bus Driver Console Window"|VOID*|50 - gEfiUnixPkgTokenSpaceGuid.PcdUnixUga|L"UGA Window"|VOID*|50 - gEfiUnixPkgTokenSpaceGuid.PcdUnixFileSystem|L".!../../../../EdkShellBinPkg/Bin/Ia32/Apps"|VOID*|106 - gEfiUnixPkgTokenSpaceGuid.PcdUnixVirtualDisk|L"disk1.img:FW"|VOID*|24 - gEfiUnixPkgTokenSpaceGuid.PcdUnixPhysicalDisk|L"E:RW;245760;512"|VOID*|30 - gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuModel|L"Intel(R) Processor Model"|VOID*|48 - gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuSpeed|L"3000"|VOID*|8 - gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySize|L"64!64"|VOID*|10 - gEfiUnixPkgTokenSpaceGuid.PcdUnixSerialPort|L"/dev/ttyS0!/dev/ttyS1"|VOID*|20 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 + + gEfiUnixPkgTokenSpaceGuid.PcdUnixConsole|L"Bus Driver Console Window" + gEfiUnixPkgTokenSpaceGuid.PcdUnixUga|L"UGA Window" + gEfiUnixPkgTokenSpaceGuid.PcdUnixFileSystem|L".!../../../../EdkShellBinPkg/Bin/Ia32/Apps" + gEfiUnixPkgTokenSpaceGuid.PcdUnixVirtualDisk|L"disk1.img:FW" + gEfiUnixPkgTokenSpaceGuid.PcdUnixPhysicalDisk|L"E:RW;245760;512" + gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuModel|L"Intel(R) Processor Model" + gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuSpeed|L"3000" + gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySize|L"128!128" + gEfiUnixPkgTokenSpaceGuid.PcdUnixSerialPort|L"/dev/ttyS0!/dev/ttyS1" [PcdsDynamicHii.common.DEFAULT] gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|L"Setup"|gEfiUnixSystemConfigGuid|0x0|80 diff --git a/UnixPkg/UnixPkg.fdf b/UnixPkg/UnixPkg.fdf index 23d1d95ca8..81929cfc59 100644 --- a/UnixPkg/UnixPkg.fdf +++ b/UnixPkg/UnixPkg.fdf @@ -243,43 +243,22 @@ INF MdeModulePkg/Application/HelloWorld/HelloWorld.inf #INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf #INF UnixPkg/SnpUnixDxe/SnpUnixDxe.inf +# +# Build from source or use checked in binary +# #INF FatPkg/EnhancedFatDxe/Fat.inf +INF RuleOverride = BINARY USE = IA32 FatBinPkg/EnhancedFatDxe/Fat.inf +# If you build GccShellPkg you can source level debug shell +#FILE APPLICATION = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile) { +# SECTION PE32 =Build/GccShellPkg/DEBUG_XCODE32/IA32/ShellFull.efi +#} +INF RuleOverride = BINARY USE = IA32 EdkShellBinPkg/FullShell/FullShell.inf - -################################################################################ -# -# FILE statements are provided so that a platform integrator can include -# complete EFI FFS files, as well as a method for constructing FFS files -# using curly "{}" brace scoping. The following three FILEs are -# for binary shell, binary fat and logo module. -# -################################################################################ -FILE APPLICATION = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile) { - SECTION COMPRESS PI_STD { - SECTION GUIDED { - SECTION PE32 = EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi -# SECTION PE32 =Build/GccShellPkg/DEBUG_XCODE32/IA32/ShellFull.efi -# SECTION PE32 = Build/Unix/DEBUG_XCODE32/IA32/Ebl.efi - } - } - } - -FILE DRIVER = 961578FE-B6B7-44c3-AF35-6BC705CD2B1F { - SECTION COMPRESS PI_STD { - SECTION GUIDED { - SECTION PE32 = FatBinPkg/EnhancedFatDxe/Ia32/Fat.efi - } - } - } FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) { - SECTION COMPRESS PI_STD { - SECTION GUIDED { - SECTION RAW = MdeModulePkg/Logo/Logo.bmp - } - } - } + SECTION RAW = MdeModulePkg/Logo/Logo.bmp +} ################################################################################ @@ -380,3 +359,20 @@ FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) { } } } + + +[Rule.Common.UEFI_DRIVER.BINARY] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + +[Rule.Common.UEFI_APPLICATION.BINARY] + FILE APPLICATION = $(NAMED_GUID) { + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + diff --git a/UnixPkg/UnixPkgX64.dsc b/UnixPkg/UnixPkgX64.dsc new file mode 100644 index 0000000000..8411eb62a8 --- /dev/null +++ b/UnixPkg/UnixPkgX64.dsc @@ -0,0 +1,324 @@ +## @file +# +# EFI/Framework Emulation Platform with UEFI HII interface supported. +# +# The Emulation Platform can be used to debug individual modules, prior to creating +# a real platform. This also provides an example for how an DSC is created. +# Copyright (c) 2006 - 2010, 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. +# +## + +################################################################################ +# +# Defines Section - statements that will be processed to create a Makefile. +# +################################################################################ +[Defines] + PLATFORM_NAME = Unix + PLATFORM_GUID = 7b3c1fb4-8986-11db-b5b2-0040d02b1835 + PLATFORM_VERSION = 0.3 + DSC_ SPECIFICATION = 0x00010005 + OUTPUT_DIRECTORY = Build/UnixX64 + SUPPORTED_ARCHITECTURES = X64 + BUILD_TARGETS = DEBUG|RELEASE + SKUID_IDENTIFIER = DEFAULT + FLASH_DEFINITION = UnixPkg/UnixPkgX64.fdf + +################################################################################ +# +# SKU Identification section - list of all SKU IDs supported by this Platform. +# +################################################################################ +[SkuIds] + 0|DEFAULT + +################################################################################ +# +# Library Class section - list of all Library Classes needed by this Platform. +# +################################################################################ +[LibraryClasses] + # + # Entry point + # + PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf + # + # Basic + # + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + # + # UEFI & PI + # + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf + # + # Generic Modules + # + UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf + NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf + IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf + UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf + DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf + GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf + SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf + TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf + SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + # + # Platform + # + PlatformBdsLib|UnixPkg/Library/UnixBdsLib/PlatformBds.inf + # + # Misc + # + DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf + +[LibraryClasses.common.USER_DEFINED] + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf + OemHookStatusCodeLib|UnixPkg/Library/PeiUnixOemHookStatusCodeLib/PeiUnixOemHookStatusCodeLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf + +[LibraryClasses.common.PEIM, LibraryClasses.common.PEI_CORE] + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf + PeCoffGetEntryPointLib|UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/EdkUnixPeiPeCoffGetEntryPointLib.inf + PeCoffExtraActionLib|UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.inf + ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf + +[LibraryClasses.common.PEIM] + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + OemHookStatusCodeLib|UnixPkg/Library/PeiUnixOemHookStatusCodeLib/PeiUnixOemHookStatusCodeLib.inf + +[LibraryClasses.common.PEI_CORE] + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + +[LibraryClasses.common.DXE_CORE] + HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf + MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf + PeCoffExtraActionLib|UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf + +[LibraryClasses.common.DXE_SMM_DRIVER] + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf + OemHookStatusCodeLib|UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.UEFI_APPLICATION] + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf + UnixLib|UnixPkg/Library/DxeUnixLib/DxeUnixLib.inf + OemHookStatusCodeLib|UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf + PeCoffExtraActionLib|UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf + +[LibraryClasses.common.UEFI_APPLICATION] + PrintLib|MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf + +[LibraryClasses.X64] + BaseLib|UnixPkg/Library/UnixBaseLib/UnixBaseLib.inf + +################################################################################ +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform. +# +################################################################################ +[PcdsFeatureFlag] + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|FALSE + gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdStatusCodeUseOEM|TRUE + +[PcdsFixedAtBuild] + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000040 + gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x0f + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x1f + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0x0 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x0 + gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareFdSize|0x002a0000 + gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareBlockSize|0x10000 + gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareVolume|L"../FV/FV_RECOVERY.fd" + +################################################################################ +# +# Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform +# +################################################################################ + +[PcdsDynamicDefault.common.DEFAULT] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 + gEfiUnixPkgTokenSpaceGuid.PcdUnixConsole|L"Bus Driver Console Window" + gEfiUnixPkgTokenSpaceGuid.PcdUnixUga|L"UGA Window" + gEfiUnixPkgTokenSpaceGuid.PcdUnixFileSystem|L".!../../../../EdkShellBinPkg/Bin/Ia32/Apps" + gEfiUnixPkgTokenSpaceGuid.PcdUnixVirtualDisk|L"disk1.img:FW" + gEfiUnixPkgTokenSpaceGuid.PcdUnixPhysicalDisk|L"E:RW;245760;512" + gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuModel|L"Intel(R) Processor Model" + gEfiUnixPkgTokenSpaceGuid.PcdUnixCpuSpeed|L"3000" + gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySize|L"128!128" + gEfiUnixPkgTokenSpaceGuid.PcdUnixSerialPort|L"/dev/ttyS0!/dev/ttyS1" + +[PcdsDynamicHii.common.DEFAULT] + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|L"Setup"|gEfiUnixSystemConfigGuid|0x0|80 + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|L"Setup"|gEfiUnixSystemConfigGuid|0x4|25 + gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|10 + +################################################################################################### +# +# Components Section - list of the modules and components that will be processed by compilation +# tools and the EDK II tools to generate PE32/PE32+/Coff image files. +# +# Note: The EDK II DSC file is not used to specify how compiled binary images get placed +# into firmware volume images. This section is just a list of modules to compile from +# source into UEFI-compliant binaries. +# It is the FDF file that contains information on combining binary files into firmware +# volume images, whose concept is beyond UEFI and is described in PI specification. +# Binary modules do not need to be listed in this section, as they should be +# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi), +# Logo (Logo.bmp), and etc. +# There may also be modules listed in this section that are not required in the FDF file, +# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be +# generated for it, but the binary will not be put into any firmware volume. +# +################################################################################################### +[Components.common] + ## + # SEC Phase modules + ## + UnixPkg/Sec/SecMain.inf + + ## + # PEI Phase modules + ## + MdeModulePkg/Core/Pei/PeiMain.inf + MdeModulePkg/Universal/PCD/Pei/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf + UnixPkg/BootModePei/BootModePei.inf + UnixPkg/UnixFlashMapPei/FlashMap.inf + MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + UnixPkg/UnixAutoScanPei/UnixAutoScan.inf + UnixPkg/UnixFirmwareVolumePei/UnixFwh.inf + UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.inf + MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf + + ## + # DXE Phase modules + ## + MdeModulePkg/Core/Dxe/DxeMain.inf { + + NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf + } + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + UnixPkg/MetronomeDxe/Metronome.inf + UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf + UnixPkg/ResetRuntimeDxe/Reset.inf + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + UnixPkg/FvbServicesRuntimeDxe/UnixFwh.inf + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + MdeModulePkg/Universal/EbcDxe/EbcDxe.inf + MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf + UnixPkg/UnixThunkDxe/UnixThunk.inf + UnixPkg/CpuRuntimeDxe/Cpu.inf + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf + UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf + UnixPkg/TimerDxe/Timer.inf + IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf + MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf + MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf + IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf + UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf + + UnixPkg/UnixBlockIoDxe/UnixBlockIo.inf + UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf + UnixPkg/UnixUgaDxe/UnixUga.inf + UnixPkg/UnixConsoleDxe/UnixConsole.inf + UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf + MdeModulePkg/Application/HelloWorld/HelloWorld.inf + + # + # Network stack drivers + # To test network drivers, need network Io driver(SnpNt32Io.dll), please refer to NETWORK-IO Subproject. + # + MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf + MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf + MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf + MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf + MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf + MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf + MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf + MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf + MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf + MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf + + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + MdeModulePkg/Universal/PrintDxe/PrintDxe.inf + MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + FatPkg/EnhancedFatDxe/Fat.inf + diff --git a/UnixPkg/UnixPkgX64.fdf b/UnixPkg/UnixPkgX64.fdf new file mode 100644 index 0000000000..706824d21c --- /dev/null +++ b/UnixPkg/UnixPkgX64.fdf @@ -0,0 +1,376 @@ +## @file +# This is Unix FDF file with UEFI HII features enabled +# +# Copyright (c) 2008 - 2010, 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. +# + +################################################################################ +# +# FD Section +# The [FD] Section is made up of the definition statements and a +# description of what goes into the Flash Device Image. Each FD section +# defines one flash "device" image. A flash device image may be one of +# the following: Removable media bootable image (like a boot floppy +# image,) an Option ROM image (that would be "flashed" into an add-in +# card,) a System "Flash" image (that would be burned into a system's +# flash) or an Update ("Capsule") image that will be used to update and +# existing system flash. +# +################################################################################ +[FD.Fv_Recovery] +# +# In OS X PEIMs are really XIP, so we need to make this address match the malloced +# buffer for the FD (0x41000000). If this address does not match the FV will get +# relocated in place (works, but not a great idea). +# +BaseAddress = 0x41000000|gEfiUnixPkgTokenSpaceGuid.PcdUnixFdBaseAddress #The base address of the FLASH Device. +Size = 0x004a0000|gEfiUnixPkgTokenSpaceGuid.PcdUnixFirmwareFdSize #The size in bytes of the FLASH Device +ErasePolarity = 1 +BlockSize = 0x10000 +NumBlocks = 0x4a + +################################################################################ +# +# Following are lists of FD Region layout which correspond to the locations of different +# images within the flash device. +# +# Regions must be defined in ascending order and may not overlap. +# +# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by +# the pipe "|" character, followed by the size of the region, also in hex with the leading +# "0x" characters. Like: +# Offset|Size +# PcdOffsetCName|PcdSizeCName +# RegionType +# +################################################################################ +0x00000000|0x00480000 +gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoveryBase|gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoverySize +FV = FvRecovery + +0x00480000|0x0000c000 +gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize +#NV_VARIABLE_STORE +DATA = { + ## This is the EFI_FIRMWARE_VOLUME_HEADER + # ZeroVector [] + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + # FileSystemGuid: gEfiSystemNvDataFvGuid = + # { 0xFFF12B8D, 0x7696, 0x4C8B, { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }} + 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C, + 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50, + # FvLength: 0x20000 + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + # Signature "_FVH" #Attributes + 0x5f, 0x46, 0x56, 0x48, 0xff, 0xfe, 0x04, 0x00, + # HeaderLength #CheckSum #ExtHeaderOffset #Reserved #Revision + 0x48, 0x00, 0x36, 0x09, 0x00, 0x00, 0x00, 0x02, + # Blockmap[0]: 2 Blocks * 0x10000 Bytes / Block + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + # Blockmap[1]: End + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ## This is the VARIABLE_STORE_HEADER + #Signature: gEfiVariableGuid = + # { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d }} + 0x16, 0x36, 0xcf, 0xdd, 0x75, 0x32, 0x64, 0x41, + 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d, + #Size: 0xc000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize) - 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) = 0xBFB8 + # This can speed up the Variable Dispatch a bit. + 0xB8, 0xBF, 0x00, 0x00, + #FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32 + 0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +} + +0x0048c000|0x00002000 +#NV_EVENT_LOG +gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogBase|gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageEventLogSize + +0x0048e000|0x00002000 +gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize +#NV_FTW_WORKING +DATA = { + # EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature = gEfiSystemNvDataFvGuid = + # { 0xFFF12B8D, 0x7696, 0x4C8B, { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }} + 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C, + 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50, + # Crc:UINT32 #WorkingBlockValid:1, WorkingBlockInvalid:1, Reserved + 0x77, 0x13, 0x9B, 0xD7, 0xFE, 0xFF, 0xFF, 0xFF, + # WriteQueueSize: UINT64 + 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +} + +0x00490000|0x00010000 +#NV_FTW_SPARE +gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + +################################################################################ +# +# FV Section +# +# [FV] section is used to define what components or modules are placed within a flash +# device file. This section also defines order the components and modules are positioned +# within the image. The [FV] section consists of define statements, set statements and +# module statements. +# +################################################################################ +[FV.FvRecovery] +FvAlignment = 16 #FV alignment and FV attributes setting. +ERASE_POLARITY = 1 +MEMORY_MAPPED = TRUE +STICKY_WRITE = TRUE +LOCK_CAP = TRUE +LOCK_STATUS = TRUE +WRITE_DISABLED_CAP = TRUE +WRITE_ENABLED_CAP = TRUE +WRITE_STATUS = TRUE +WRITE_LOCK_CAP = TRUE +WRITE_LOCK_STATUS = TRUE +READ_DISABLED_CAP = TRUE +READ_ENABLED_CAP = TRUE +READ_STATUS = TRUE +READ_LOCK_CAP = TRUE +READ_LOCK_STATUS = TRUE + +################################################################################ +# +# The INF statements point to EDK component and EDK II module INF files, which will be placed into this FV image. +# Parsing tools will scan the INF file to determine the type of component or module. +# The component or module type is used to reference the standard rules +# defined elsewhere in the FDF file. +# +# The format for INF statements is: +# INF $(PathAndInfFileName) +# +################################################################################ +## +# PEI Phase modules +## +## +# PEI Apriori file example, more PEIM module added later. +## +APRIORI PEI { + INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf + INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf + } +APRIORI DXE { + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + INF IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf + INF UnixPkg/MetronomeDxe/Metronome.inf + } +INF MdeModulePkg/Core/Pei/PeiMain.inf +INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf +INF IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf +INF UnixPkg/BootModePei/BootModePei.inf +INF UnixPkg/UnixFlashMapPei/FlashMap.inf +INF UnixPkg/UnixAutoScanPei/UnixAutoScan.inf +INF UnixPkg/UnixFirmwareVolumePei/UnixFwh.inf +INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf +INF UnixPkg/UnixThunkPpiToProtocolPei/UnixThunkPpiToProtocol.inf +INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf + +## +# DXE Phase modules +## +INF MdeModulePkg/Core/Dxe/DxeMain.inf +INF IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf +INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf +INF UnixPkg/MetronomeDxe/Metronome.inf +INF UnixPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf +INF UnixPkg/ResetRuntimeDxe/Reset.inf +INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf +INF UnixPkg/FvbServicesRuntimeDxe/UnixFwh.inf +INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf +INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf +INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf +INF UnixPkg/UnixThunkDxe/UnixThunk.inf +INF UnixPkg/CpuRuntimeDxe/Cpu.inf +INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf +INF UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf +INF UnixPkg/TimerDxe/Timer.inf +INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf +INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf +INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf +INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf +INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf +INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf +INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf +INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf +INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf +INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf +INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf +INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf +INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf +INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf +INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf +INF IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf +INF UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf + +INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf +INF UnixPkg/UnixBlockIoDxe/UnixBlockIo.inf +INF UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf +INF UnixPkg/UnixUgaDxe/UnixUga.inf +#INF UnixPkg/UnixConsoleDxe/UnixConsole.inf +INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf +INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf +INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf +INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf +INF UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf +INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf +INF MdeModulePkg/Application/HelloWorld/HelloWorld.inf + +# +# Need to port this to UnixPkg +# Network stack drivers +# To test network drivers, need network Io driver(SnpNt32Io.dll), please refer to NETWORK-IO Subproject. +# +#INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf +#INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf +#INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf +#INF MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf +#INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf +#INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf +#INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf +#INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf +#INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf +#INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf +#INF UnixPkg/SnpUnixDxe/SnpUnixDxe.inf + +INF FatPkg/EnhancedFatDxe/Fat.inf + +FILE APPLICATION = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile) { + SECTION PE32 =Build/GccShellPkg/DEBUG_XCODE32/X64/ShellFull.efi + } + +# Note: Warning current X64 port does not use EFI ABI so thease bins will crash +#INF RuleOverride = BINARY USE = X64 FatBinPkg/EnhancedFatDxe/Fat.inf +#INF RuleOverride = BINARY USE = X64 EdkShellBinPkg/FullShell/FullShell.inf + + +FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) { + SECTION RAW = MdeModulePkg/Logo/Logo.bmp + } + + +################################################################################ +# +# Rules are use with the [FV] section's module INF type to define +# how an FFS file is created for a given INF file. The following Rule are the default +# rules for the different module type. User can add the customized rules to define the +# content of the FFS file. +# +################################################################################ + + +############################################################################ +# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section # +############################################################################ +# +#[Rule.Common.DXE_DRIVER] +# FILE DRIVER = $(NAMED_GUID) { +# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex +# COMPRESS PI_STD { +# GUIDED { +# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi +# UI STRING="$(MODULE_NAME)" Optional +# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) +# } +# } +# } +# +############################################################################ + +[Rule.Common.PEI_CORE] + FILE PEI_CORE = $(NAMED_GUID) { + PE32 PE32 Align=32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING ="$(MODULE_NAME)" Optional + VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + +[Rule.Common.PEIM] + FILE PEIM = $(NAMED_GUID) { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 Align=32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + +[Rule.Common.DXE_CORE] + FILE DXE_CORE = $(NAMED_GUID) { + COMPRESS PI_STD { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + } + +[Rule.Common.UEFI_DRIVER] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + } + } + +[Rule.Common.DXE_DRIVER] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + } + } + +[Rule.Common.DXE_RUNTIME_DRIVER] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + } + } + +[Rule.Common.UEFI_APPLICATION] + FILE APPLICATION = $(NAMED_GUID) { + COMPRESS PI_STD { + GUIDED { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + } + } + +[Rule.Common.UEFI_DRIVER.BINARY] + FILE DRIVER = $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + +[Rule.Common.UEFI_APPLICATION.BINARY] + FILE APPLICATION = $(NAMED_GUID) { + PE32 PE32 |.efi + UI STRING="$(MODULE_NAME)" Optional + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } + diff --git a/UnixPkg/Xcode/xcode_project64/xcode_project.xcodeproj/default.pbxuser b/UnixPkg/Xcode/xcode_project64/xcode_project.xcodeproj/default.pbxuser index bca74ac93d..3596a44c26 100644 --- a/UnixPkg/Xcode/xcode_project64/xcode_project.xcodeproj/default.pbxuser +++ b/UnixPkg/Xcode/xcode_project64/xcode_project.xcodeproj/default.pbxuser @@ -152,13 +152,13 @@ showTypeColumn = 0; sourceDirectories = ( ); - startupPath = ../../../Build/Unix/DEBUG_XCODE32/X64; + startupPath = ../../../Build/UnixX64/DEBUG_XCODE32/X64; }; BA11A1020FB10BCE00D06FEC /* SecMain.dll */ = { isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = SecMain.dll; - path = ../../../Build/Unix/DEBUG_XCODE32/X64/SecMain; + path = ../../../Build/UnixX64/DEBUG_XCODE32/X64/SecMain; sourceTree = SOURCE_ROOT; }; BA11A11A0FB10E0700D06FEC /* SecGdbScriptBreak */ = { diff --git a/UnixPkg/build.sh b/UnixPkg/build.sh index 29a844f256..077fb86b81 100755 --- a/UnixPkg/build.sh +++ b/UnixPkg/build.sh @@ -100,7 +100,7 @@ done echo $PATH echo `which build` # Uncomment this if you want to build the shell. -#build -p $WORKSPACE/EdkShellPkg/EdkShellPkg.dsc -a IA32 -t $TARGET_TOOLS $1 $2 $3 $4 $5 $6 $7 $8 -build -p $WORKSPACE/UnixPkg/UnixPkg.dsc -a IA32 -t $TARGET_TOOLS $1 $2 $3 $4 $5 $6 $7 $8 +#build -p $WORKSPACE/GccShellPkg/GccShellPkg.dsc -a IA32 -t $TARGET_TOOLS -n 3 $1 $2 $3 $4 $5 $6 $7 $8 +build -p $WORKSPACE/UnixPkg/UnixPkg.dsc -a IA32 -t $TARGET_TOOLS -n 3 $1 $2 $3 $4 $5 $6 $7 $8 exit $? diff --git a/UnixPkg/build64.sh b/UnixPkg/build64.sh index 6fc9f0c867..90e2b7d025 100755 --- a/UnixPkg/build64.sh +++ b/UnixPkg/build64.sh @@ -53,7 +53,7 @@ case `uname` in esac -BUILD_ROOT_ARCH=$WORKSPACE/Build/Unix/DEBUG_"$TARGET_TOOLS"/X64 +BUILD_ROOT_ARCH=$WORKSPACE/Build/UnixX64/DEBUG_"$TARGET_TOOLS"/X64 if [[ ! -f `which build` || ! -f `which GenFv` ]]; then @@ -80,7 +80,7 @@ do # This .gdbinit script sets a breakpoint that loads symbols for the PE/COFFEE # images that get loaded in SecMain # - cp $WORKSPACE/UnixPkg/.gdbinit $WORKSPACE/Build/Unix/DEBUG_"$TARGET_TOOLS"/X64 + cp $WORKSPACE/UnixPkg/.gdbinit $WORKSPACE/Build/UnixX64/DEBUG_"$TARGET_TOOLS"/X64 ;; esac @@ -100,7 +100,7 @@ done echo $PATH echo `which build` # Uncomment this if you want to build the shell. -#build -p $WORKSPACE/EdkShellPkg/EdkShellPkg.dsc -a X64 -t $TARGET_TOOLS $1 $2 $3 $4 $5 $6 $7 $8 -build -p $WORKSPACE/UnixPkg/UnixPkg.dsc -a X64 -t $TARGET_TOOLS $1 $2 $3 $4 $5 $6 $7 $8 +build -p $WORKSPACE/GccShellPkg/GccShellPkg.dsc -a X64 -t $TARGET_TOOLS -n 3 $1 $2 $3 $4 $5 $6 $7 $8 +build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $TARGET_TOOLS -n 3 $1 $2 $3 $4 $5 $6 $7 $8 exit $?