Index: head/lib/libc/gen/nlist.c =================================================================== --- head/lib/libc/gen/nlist.c (revision 292622) +++ head/lib/libc/gen/nlist.c (revision 292623) @@ -1,404 +1,404 @@ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); #include "namespace.h" #include #include #include #include #include #include #include #include #include #include #include "un-namespace.h" -/* There is no a.out support on arm64 */ -#ifndef __aarch64__ +/* i386 is the only current FreeBSD architecture that used a.out format. */ +#ifdef __i386__ #define _NLIST_DO_AOUT #endif #define _NLIST_DO_ELF #ifdef _NLIST_DO_ELF #include #include #endif int __fdnlist(int, struct nlist *); int __aout_fdnlist(int, struct nlist *); int __elf_fdnlist(int, struct nlist *); int __elf_is_okay__(Elf_Ehdr *); int nlist(const char *name, struct nlist *list) { int fd, n; fd = _open(name, O_RDONLY | O_CLOEXEC, 0); if (fd < 0) return (-1); n = __fdnlist(fd, list); (void)_close(fd); return (n); } static struct nlist_handlers { int (*fn)(int fd, struct nlist *list); } nlist_fn[] = { #ifdef _NLIST_DO_AOUT { __aout_fdnlist }, #endif #ifdef _NLIST_DO_ELF { __elf_fdnlist }, #endif }; int __fdnlist(int fd, struct nlist *list) { int n = -1; unsigned int i; for (i = 0; i < sizeof(nlist_fn) / sizeof(nlist_fn[0]); i++) { n = (nlist_fn[i].fn)(fd, list); if (n != -1) break; } return (n); } #define ISLAST(p) (p->n_un.n_name == 0 || p->n_un.n_name[0] == 0) #ifdef _NLIST_DO_AOUT int __aout_fdnlist(int fd, struct nlist *list) { struct nlist *p, *symtab; caddr_t strtab, a_out_mmap; off_t stroff, symoff; u_long symsize; int nent; struct exec * exec; struct stat st; /* check that file is at least as large as struct exec! */ if ((_fstat(fd, &st) < 0) || (st.st_size < sizeof(struct exec))) return (-1); /* Check for files too large to mmap. */ if (st.st_size > SIZE_T_MAX) { errno = EFBIG; return (-1); } /* * Map the whole a.out file into our address space. * We then find the string table withing this area. * We do not just mmap the string table, as it probably * does not start at a page boundary - we save ourselves a * lot of nastiness by mmapping the whole file. * * This gives us an easy way to randomly access all the strings, * without making the memory allocation permanent as with * malloc/free (i.e., munmap will return it to the system). */ a_out_mmap = mmap(NULL, (size_t)st.st_size, PROT_READ, MAP_PRIVATE, fd, (off_t)0); if (a_out_mmap == MAP_FAILED) return (-1); exec = (struct exec *)a_out_mmap; if (N_BADMAG(*exec)) { munmap(a_out_mmap, (size_t)st.st_size); return (-1); } symoff = N_SYMOFF(*exec); symsize = exec->a_syms; stroff = symoff + symsize; /* find the string table in our mmapped area */ strtab = a_out_mmap + stroff; symtab = (struct nlist *)(a_out_mmap + symoff); /* * clean out any left-over information for all valid entries. * Type and value defined to be 0 if not found; historical * versions cleared other and desc as well. Also figure out * the largest string length so don't read any more of the * string table than we have to. * * XXX clearing anything other than n_type and n_value violates * the semantics given in the man page. */ nent = 0; for (p = list; !ISLAST(p); ++p) { p->n_type = 0; p->n_other = 0; p->n_desc = 0; p->n_value = 0; ++nent; } while (symsize > 0) { int soff; symsize-= sizeof(struct nlist); soff = symtab->n_un.n_strx; if (soff != 0 && (symtab->n_type & N_STAB) == 0) for (p = list; !ISLAST(p); p++) if (!strcmp(&strtab[soff], p->n_un.n_name)) { p->n_value = symtab->n_value; p->n_type = symtab->n_type; p->n_desc = symtab->n_desc; p->n_other = symtab->n_other; if (--nent <= 0) break; } symtab++; } munmap(a_out_mmap, (size_t)st.st_size); return (nent); } #endif #ifdef _NLIST_DO_ELF static void elf_sym_to_nlist(struct nlist *, Elf_Sym *, Elf_Shdr *, int); /* * __elf_is_okay__ - Determine if ehdr really * is ELF and valid for the target platform. * * WARNING: This is NOT an ELF ABI function and * as such its use should be restricted. */ int __elf_is_okay__(Elf_Ehdr *ehdr) { int retval = 0; /* * We need to check magic, class size, endianess, * and version before we look at the rest of the * Elf_Ehdr structure. These few elements are * represented in a machine independant fashion. */ if (IS_ELF(*ehdr) && ehdr->e_ident[EI_CLASS] == ELF_TARG_CLASS && ehdr->e_ident[EI_DATA] == ELF_TARG_DATA && ehdr->e_ident[EI_VERSION] == ELF_TARG_VER) { /* Now check the machine dependant header */ if (ehdr->e_machine == ELF_TARG_MACH && ehdr->e_version == ELF_TARG_VER) retval = 1; } return retval; } int __elf_fdnlist(int fd, struct nlist *list) { struct nlist *p; Elf_Off symoff = 0, symstroff = 0; Elf_Size symsize = 0, symstrsize = 0; Elf_Ssize cc, i; int nent = -1; int errsave; Elf_Sym sbuf[1024]; Elf_Sym *s; Elf_Ehdr ehdr; char *strtab = NULL; Elf_Shdr *shdr = NULL; Elf_Size shdr_size; void *base; struct stat st; /* Make sure obj is OK */ if (lseek(fd, (off_t)0, SEEK_SET) == -1 || _read(fd, &ehdr, sizeof(Elf_Ehdr)) != sizeof(Elf_Ehdr) || !__elf_is_okay__(&ehdr) || _fstat(fd, &st) < 0) return (-1); /* calculate section header table size */ shdr_size = ehdr.e_shentsize * ehdr.e_shnum; /* Make sure it's not too big to mmap */ if (shdr_size > SIZE_T_MAX) { errno = EFBIG; return (-1); } /* mmap section header table */ base = mmap(NULL, (size_t)shdr_size, PROT_READ, MAP_PRIVATE, fd, (off_t)ehdr.e_shoff); if (base == MAP_FAILED) return (-1); shdr = (Elf_Shdr *)base; /* * Find the symbol table entry and it's corresponding * string table entry. Version 1.1 of the ABI states * that there is only one symbol table but that this * could change in the future. */ for (i = 0; i < ehdr.e_shnum; i++) { if (shdr[i].sh_type == SHT_SYMTAB) { symoff = shdr[i].sh_offset; symsize = shdr[i].sh_size; symstroff = shdr[shdr[i].sh_link].sh_offset; symstrsize = shdr[shdr[i].sh_link].sh_size; break; } } /* Check for files too large to mmap. */ if (symstrsize > SIZE_T_MAX) { errno = EFBIG; goto done; } /* * Map string table into our address space. This gives us * an easy way to randomly access all the strings, without * making the memory allocation permanent as with malloc/free * (i.e., munmap will return it to the system). */ base = mmap(NULL, (size_t)symstrsize, PROT_READ, MAP_PRIVATE, fd, (off_t)symstroff); if (base == MAP_FAILED) goto done; strtab = (char *)base; /* * clean out any left-over information for all valid entries. * Type and value defined to be 0 if not found; historical * versions cleared other and desc as well. Also figure out * the largest string length so don't read any more of the * string table than we have to. * * XXX clearing anything other than n_type and n_value violates * the semantics given in the man page. */ nent = 0; for (p = list; !ISLAST(p); ++p) { p->n_type = 0; p->n_other = 0; p->n_desc = 0; p->n_value = 0; ++nent; } /* Don't process any further if object is stripped. */ if (symoff == 0) goto done; if (lseek(fd, (off_t) symoff, SEEK_SET) == -1) { nent = -1; goto done; } while (symsize > 0 && nent > 0) { cc = MIN(symsize, sizeof(sbuf)); if (_read(fd, sbuf, cc) != cc) break; symsize -= cc; for (s = sbuf; cc > 0 && nent > 0; ++s, cc -= sizeof(*s)) { char *name; struct nlist *p; name = strtab + s->st_name; if (name[0] == '\0') continue; for (p = list; !ISLAST(p); p++) { if ((p->n_un.n_name[0] == '_' && strcmp(name, p->n_un.n_name+1) == 0) || strcmp(name, p->n_un.n_name) == 0) { elf_sym_to_nlist(p, s, shdr, ehdr.e_shnum); if (--nent <= 0) break; } } } } done: errsave = errno; if (strtab != NULL) munmap(strtab, symstrsize); if (shdr != NULL) munmap(shdr, shdr_size); errno = errsave; return (nent); } /* * Convert an Elf_Sym into an nlist structure. This fills in only the * n_value and n_type members. */ static void elf_sym_to_nlist(struct nlist *nl, Elf_Sym *s, Elf_Shdr *shdr, int shnum) { nl->n_value = s->st_value; switch (s->st_shndx) { case SHN_UNDEF: case SHN_COMMON: nl->n_type = N_UNDF; break; case SHN_ABS: nl->n_type = ELF_ST_TYPE(s->st_info) == STT_FILE ? N_FN : N_ABS; break; default: if (s->st_shndx >= shnum) nl->n_type = N_UNDF; else { Elf_Shdr *sh = shdr + s->st_shndx; nl->n_type = sh->sh_type == SHT_PROGBITS ? (sh->sh_flags & SHF_WRITE ? N_DATA : N_TEXT) : (sh->sh_type == SHT_NOBITS ? N_BSS : N_UNDF); } break; } if (ELF_ST_BIND(s->st_info) == STB_GLOBAL || ELF_ST_BIND(s->st_info) == STB_WEAK) nl->n_type |= N_EXT; } #endif /* _NLIST_DO_ELF */ Index: head/sys/boot/efi/include/amd64/efibind.h =================================================================== --- head/sys/boot/efi/include/amd64/efibind.h (revision 292622) +++ head/sys/boot/efi/include/amd64/efibind.h (revision 292623) @@ -1,271 +1,271 @@ /* $FreeBSD$ */ /*++ Copyright (c) 1999 - 2003 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: efefind.h Abstract: EFI to compile bindings Revision History --*/ #pragma pack() #ifdef __FreeBSD__ #include #else // // Basic int types of various widths // #if (__STDC_VERSION__ < 199901L ) - // No ANSI C 1999/2000 stdint.h integer width declarations + // No ANSI C 1999/2000 stdint.h integer width declarations #if _MSC_EXTENSIONS - // Use Microsoft C compiler integer width declarations + // Use Microsoft C compiler integer width declarations typedef unsigned __int64 uint64_t; typedef __int64 int64_t; typedef unsigned __int32 uint32_t; typedef __int32 int32_t; typedef unsigned short uint16_t; typedef short int16_t; typedef unsigned char uint8_t; typedef char int8_t; - #else + #else #ifdef UNIX_LP64 - // Use LP64 programming model from C_FLAGS for integer width declarations + // Use LP64 programming model from C_FLAGS for integer width declarations typedef unsigned long uint64_t; typedef long int64_t; typedef unsigned int uint32_t; typedef int int32_t; typedef unsigned short uint16_t; typedef short int16_t; typedef unsigned char uint8_t; typedef char int8_t; #else - // Assume P64 programming model from C_FLAGS for integer width declarations + // Assume P64 programming model from C_FLAGS for integer width declarations typedef unsigned long long uint64_t; typedef long long int64_t; typedef unsigned int uint32_t; typedef int int32_t; typedef unsigned short uint16_t; typedef short int16_t; typedef unsigned char uint8_t; typedef char int8_t; #endif #endif #endif #endif /* __FreeBSD__ */ // // Basic EFI types of various widths // #ifndef ACPI_THREAD_ID /* ACPI's definitions are fine */ #define ACPI_USE_SYSTEM_INTTYPES 1 /* Tell ACPI we've defined types */ typedef uint64_t UINT64; typedef int64_t INT64; #ifndef _BASETSD_H_ typedef uint32_t UINT32; typedef int32_t INT32; #endif typedef uint16_t UINT16; typedef int16_t INT16; typedef uint8_t UINT8; typedef int8_t INT8; #endif #undef VOID #define VOID void typedef int64_t INTN; typedef uint64_t UINTN; #ifdef EFI_NT_EMULATOR #define POST_CODE(_Data) -#else +#else #ifdef EFI_DEBUG #define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al #else #define POST_CODE(_Data) - #endif + #endif #endif #define EFIERR(a) (0x8000000000000000 | a) #define EFI_ERROR_MASK 0x8000000000000000 -#define EFIERR_OEM(a) (0xc000000000000000 | a) +#define EFIERR_OEM(a) (0xc000000000000000 | a) #define BAD_POINTER 0xFBFBFBFBFBFBFBFB #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF #define BREAKPOINT() __asm { int 3 } // // Pointers must be aligned to these address to function // #define MIN_ALIGNMENT_SIZE 4 #define ALIGN_VARIABLE(Value ,Adjustment) \ (UINTN)Adjustment = 0; \ if((UINTN)Value % MIN_ALIGNMENT_SIZE) \ (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ Value = (UINTN)Value + (UINTN)Adjustment // // Define macros to build data structure signatures from characters. // #define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) #define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) #define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) // // EFIAPI - prototype calling convention for EFI function pointers // BOOTSERVICE - prototype for implementation of a boot service interface // RUNTIMESERVICE - prototype for implementation of a runtime service interface // RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service -// RUNTIME_CODE - pragma macro for declaring runtime code +// RUNTIME_CODE - pragma macro for declaring runtime code // #ifdef __amd64__ #define EFIAPI __attribute__((ms_abi)) #endif -#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options +#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options #if _MSC_EXTENSIONS - #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler + #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler #else - #define EFIAPI // Substitute expresion to force C calling convention + #define EFIAPI // Substitute expresion to force C calling convention #endif #endif #define BOOTSERVICE //#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a //#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a #define RUNTIMESERVICE #define RUNTIMEFUNCTION #define RUNTIME_CODE(a) alloc_text("rtcode", a) #define BEGIN_RUNTIME_DATA() data_seg("rtdata") #define END_RUNTIME_DATA() data_seg("") #define VOLATILE volatile -#define MEMORY_FENCE() +#define MEMORY_FENCE() #ifdef EFI_NO_INTERFACE_DECL #define EFI_FORWARD_DECLARATION(x) #define EFI_INTERFACE_DECL(x) #else #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x #define EFI_INTERFACE_DECL(x) typedef struct x #endif #ifdef EFI_NT_EMULATOR // // To help ensure proper coding of integrated drivers, they are // compiled as DLLs. In NT they require a dll init entry pointer. // The macro puts a stub entry point into the DLL so it will load. // #define EFI_DRIVER_ENTRY_POINT(InitFunction) \ EFI_STATUS \ InitFunction ( \ EFI_HANDLE ImageHandle, \ EFI_SYSTEM_TABLE *SystemTable \ ); \ \ UINTN \ __stdcall \ _DllMainCRTStartup ( \ UINTN Inst, \ UINTN reason_for_call, \ VOID *rserved \ ) \ { \ return 1; \ } \ \ int \ __declspec( dllexport ) \ __cdecl \ InitializeDriver ( \ void *ImageHandle, \ void *SystemTable \ ) \ { \ return InitFunction(ImageHandle, SystemTable); \ } #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, NULL) + (_if)->LoadInternal(type, name, NULL) -#else // EFI_NT_EMULATOR +#else // EFI_NT_EMULATOR // // When build similiar to FW, then link everything together as // one big module. // #define EFI_DRIVER_ENTRY_POINT(InitFunction) #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ (_if)->LoadInternal(type, name, entry) -#endif // EFI_FW_NT +#endif // EFI_FW_NT #ifdef __FreeBSD__ #define INTERFACE_DECL(x) struct x #else // // Some compilers don't support the forward reference construct: // typedef struct XXXXX // // The following macro provide a workaround for such cases. // #ifdef NO_INTERFACE_DECL #define INTERFACE_DECL(x) #else #define INTERFACE_DECL(x) typedef struct x #endif #endif /* __FreeBSD__ */ #if _MSC_EXTENSIONS #pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP #endif Index: head/sys/boot/efi/include/amd64/pe.h =================================================================== --- head/sys/boot/efi/include/amd64/pe.h (revision 292622) +++ head/sys/boot/efi/include/amd64/pe.h (revision 292623) @@ -1,591 +1,591 @@ /* $FreeBSD$ */ -/* +/* PE32+ header file */ #ifndef _PE_H #define _PE_H #define IMAGE_DOS_SIGNATURE 0x5A4D // MZ #define IMAGE_OS2_SIGNATURE 0x454E // NE #define IMAGE_OS2_SIGNATURE_LE 0x454C // LE -#define IMAGE_NT_SIGNATURE 0x00004550 // PE00 +#define IMAGE_NT_SIGNATURE 0x00004550 // PE00 #define IMAGE_EDOS_SIGNATURE 0x44454550 // PEED typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header UINT16 e_magic; // Magic number UINT16 e_cblp; // Bytes on last page of file UINT16 e_cp; // Pages in file UINT16 e_crlc; // Relocations UINT16 e_cparhdr; // Size of header in paragraphs UINT16 e_minalloc; // Minimum extra paragraphs needed UINT16 e_maxalloc; // Maximum extra paragraphs needed UINT16 e_ss; // Initial (relative) SS value UINT16 e_sp; // Initial SP value UINT16 e_csum; // Checksum UINT16 e_ip; // Initial IP value UINT16 e_cs; // Initial (relative) CS value UINT16 e_lfarlc; // File address of relocation table UINT16 e_ovno; // Overlay number UINT16 e_res[4]; // Reserved words UINT16 e_oemid; // OEM identifier (for e_oeminfo) UINT16 e_oeminfo; // OEM information; e_oemid specific UINT16 e_res2[10]; // Reserved words UINT32 e_lfanew; // File address of new exe header } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header UINT16 ne_magic; // Magic number UINT8 ne_ver; // Version number UINT8 ne_rev; // Revision number UINT16 ne_enttab; // Offset of Entry Table UINT16 ne_cbenttab; // Number of bytes in Entry Table UINT32 ne_crc; // Checksum of whole file UINT16 ne_flags; // Flag UINT16 UINT16 ne_autodata; // Automatic data segment number UINT16 ne_heap; // Initial heap allocation UINT16 ne_stack; // Initial stack allocation UINT32 ne_csip; // Initial CS:IP setting UINT32 ne_sssp; // Initial SS:SP setting UINT16 ne_cseg; // Count of file segments UINT16 ne_cmod; // Entries in Module Reference Table UINT16 ne_cbnrestab; // Size of non-resident name table UINT16 ne_segtab; // Offset of Segment Table UINT16 ne_rsrctab; // Offset of Resource Table UINT16 ne_restab; // Offset of resident name table UINT16 ne_modtab; // Offset of Module Reference Table UINT16 ne_imptab; // Offset of Imported Names Table UINT32 ne_nrestab; // Offset of Non-resident Names Table UINT16 ne_cmovent; // Count of movable entries UINT16 ne_align; // Segment alignment shift count UINT16 ne_cres; // Count of resource segments UINT8 ne_exetyp; // Target Operating system UINT8 ne_flagsothers; // Other .EXE flags UINT16 ne_pretthunks; // offset to return thunks UINT16 ne_psegrefbytes; // offset to segment ref. bytes UINT16 ne_swaparea; // Minimum code swap area size UINT16 ne_expver; // Expected Windows version number } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER; // // File header format. // typedef struct _IMAGE_FILE_HEADER { UINT16 Machine; UINT16 NumberOfSections; UINT32 TimeDateStamp; UINT32 PointerToSymbolTable; UINT32 NumberOfSymbols; UINT16 SizeOfOptionalHeader; UINT16 Characteristics; } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; #define IMAGE_SIZEOF_FILE_HEADER 20 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file. #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references). #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file. #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file. #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed. #define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine. #define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file #define IMAGE_FILE_SYSTEM 0x1000 // System File. #define IMAGE_FILE_DLL 0x2000 // File is a DLL. #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed. #define IMAGE_FILE_MACHINE_UNKNOWN 0 #define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386. #define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian #define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian #define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP #define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian #define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine // // Directory format. // typedef struct _IMAGE_DATA_DIRECTORY { UINT32 VirtualAddress; UINT32 Size; } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 // // Optional header format. // typedef struct _IMAGE_OPTIONAL_HEADER { // // Standard fields. // UINT16 Magic; UINT8 MajorLinkerVersion; UINT8 MinorLinkerVersion; UINT32 SizeOfCode; UINT32 SizeOfInitializedData; UINT32 SizeOfUninitializedData; UINT32 AddressOfEntryPoint; UINT32 BaseOfCode; UINT32 BaseOfData; - + // // NT additional fields. // UINT32 ImageBase; UINT32 SectionAlignment; UINT32 FileAlignment; UINT16 MajorOperatingSystemVersion; UINT16 MinorOperatingSystemVersion; UINT16 MajorImageVersion; UINT16 MinorImageVersion; UINT16 MajorSubsystemVersion; UINT16 MinorSubsystemVersion; UINT32 Reserved1; UINT32 SizeOfImage; UINT32 SizeOfHeaders; UINT32 CheckSum; UINT16 Subsystem; UINT16 DllCharacteristics; UINT32 SizeOfStackReserve; UINT32 SizeOfStackCommit; UINT32 SizeOfHeapReserve; UINT32 SizeOfHeapCommit; UINT32 LoaderFlags; UINT32 NumberOfRvaAndSizes; IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER; typedef struct _IMAGE_ROM_OPTIONAL_HEADER { UINT16 Magic; UINT8 MajorLinkerVersion; UINT8 MinorLinkerVersion; UINT32 SizeOfCode; UINT32 SizeOfInitializedData; UINT32 SizeOfUninitializedData; UINT32 AddressOfEntryPoint; UINT32 BaseOfCode; UINT32 BaseOfData; UINT32 BaseOfBss; UINT32 GprMask; UINT32 CprMask[4]; UINT32 GpValue; } IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER; #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 typedef struct _IMAGE_NT_HEADERS { UINT32 Signature; IMAGE_FILE_HEADER FileHeader; IMAGE_OPTIONAL_HEADER OptionalHeader; } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS; typedef struct _IMAGE_ROM_HEADERS { IMAGE_FILE_HEADER FileHeader; IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; } IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS; #define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \ ((UINT32)ntheader + \ FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \ ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \ )) // Subsystem Values #define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem. #define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem. #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem. #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem. #define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem. #define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix character subsystem. // Directory Entries #define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory #define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory #define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table #define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP) #define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory // // Section header format. // #define IMAGE_SIZEOF_SHORT_NAME 8 typedef struct _IMAGE_SECTION_HEADER { UINT8 Name[IMAGE_SIZEOF_SHORT_NAME]; union { UINT32 PhysicalAddress; UINT32 VirtualSize; } Misc; UINT32 VirtualAddress; UINT32 SizeOfRawData; UINT32 PointerToRawData; UINT32 PointerToRelocations; UINT32 PointerToLinenumbers; UINT16 NumberOfRelocations; UINT16 NumberOfLinenumbers; UINT32 Characteristics; } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; #define IMAGE_SIZEOF_SECTION_HEADER 40 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved. #define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code. #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data. #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data. #define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved. #define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information. #define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image. #define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat. #define IMAGE_SCN_ALIGN_1BYTES 0x00100000 // #define IMAGE_SCN_ALIGN_2BYTES 0x00200000 // #define IMAGE_SCN_ALIGN_4BYTES 0x00300000 // #define IMAGE_SCN_ALIGN_8BYTES 0x00400000 // #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified. #define IMAGE_SCN_ALIGN_32BYTES 0x00600000 // #define IMAGE_SCN_ALIGN_64BYTES 0x00700000 // #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded. #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable. #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable. #define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable. #define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable. #define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable. #define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable. // // Symbol format. // #define IMAGE_SIZEOF_SYMBOL 18 // // Section values. // // Symbols have a section number of the section in which they are // defined. Otherwise, section numbers have the following meanings: // #define IMAGE_SYM_UNDEFINED (UINT16)0 // Symbol is undefined or is common. #define IMAGE_SYM_ABSOLUTE (UINT16)-1 // Symbol is an absolute value. #define IMAGE_SYM_DEBUG (UINT16)-2 // Symbol is a special debug item. // // Type (fundamental) values. // #define IMAGE_SYM_TYPE_NULL 0 // no type. #define IMAGE_SYM_TYPE_VOID 1 // #define IMAGE_SYM_TYPE_CHAR 2 // type character. #define IMAGE_SYM_TYPE_SHORT 3 // type short integer. #define IMAGE_SYM_TYPE_INT 4 // #define IMAGE_SYM_TYPE_LONG 5 // #define IMAGE_SYM_TYPE_FLOAT 6 // #define IMAGE_SYM_TYPE_DOUBLE 7 // #define IMAGE_SYM_TYPE_STRUCT 8 // #define IMAGE_SYM_TYPE_UNION 9 // #define IMAGE_SYM_TYPE_ENUM 10 // enumeration. #define IMAGE_SYM_TYPE_MOE 11 // member of enumeration. #define IMAGE_SYM_TYPE_BYTE 12 // #define IMAGE_SYM_TYPE_WORD 13 // #define IMAGE_SYM_TYPE_UINT 14 // #define IMAGE_SYM_TYPE_DWORD 15 // // // Type (derived) values. // #define IMAGE_SYM_DTYPE_NULL 0 // no derived type. #define IMAGE_SYM_DTYPE_POINTER 1 // pointer. #define IMAGE_SYM_DTYPE_FUNCTION 2 // function. #define IMAGE_SYM_DTYPE_ARRAY 3 // array. // // Storage classes. // #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1 #define IMAGE_SYM_CLASS_NULL 0 #define IMAGE_SYM_CLASS_AUTOMATIC 1 #define IMAGE_SYM_CLASS_EXTERNAL 2 #define IMAGE_SYM_CLASS_STATIC 3 #define IMAGE_SYM_CLASS_REGISTER 4 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 5 #define IMAGE_SYM_CLASS_LABEL 6 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8 #define IMAGE_SYM_CLASS_ARGUMENT 9 #define IMAGE_SYM_CLASS_STRUCT_TAG 10 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11 #define IMAGE_SYM_CLASS_UNION_TAG 12 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 13 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14 #define IMAGE_SYM_CLASS_ENUM_TAG 15 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16 #define IMAGE_SYM_CLASS_REGISTER_PARAM 17 #define IMAGE_SYM_CLASS_BIT_FIELD 18 #define IMAGE_SYM_CLASS_BLOCK 100 #define IMAGE_SYM_CLASS_FUNCTION 101 #define IMAGE_SYM_CLASS_END_OF_STRUCT 102 #define IMAGE_SYM_CLASS_FILE 103 // new #define IMAGE_SYM_CLASS_SECTION 104 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105 // type packing constants #define N_BTMASK 017 #define N_TMASK 060 #define N_TMASK1 0300 #define N_TMASK2 0360 #define N_BTSHFT 4 #define N_TSHIFT 2 // MACROS // // Communal selection types. // #define IMAGE_COMDAT_SELECT_NODUPLICATES 1 #define IMAGE_COMDAT_SELECT_ANY 2 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 // // Relocation format. // typedef struct _IMAGE_RELOCATION { UINT32 VirtualAddress; UINT32 SymbolTableIndex; UINT16 Type; } IMAGE_RELOCATION; #define IMAGE_SIZEOF_RELOCATION 10 // // I386 relocation types. // #define IMAGE_REL_I386_ABSOLUTE 0 // Reference is absolute, no relocation is necessary #define IMAGE_REL_I386_DIR16 01 // Direct 16-bit reference to the symbols virtual address #define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit reference to the symbols virtual address #define IMAGE_REL_I386_DIR32 06 // Direct 32-bit reference to the symbols virtual address #define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit reference to the symbols virtual address, base not included #define IMAGE_REL_I386_SEG12 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address #define IMAGE_REL_I386_SECTION 012 #define IMAGE_REL_I386_SECREL 013 #define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address // // MIPS relocation types. // #define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is absolute, no relocation is necessary #define IMAGE_REL_MIPS_REFHALF 01 #define IMAGE_REL_MIPS_REFWORD 02 #define IMAGE_REL_MIPS_JMPADDR 03 #define IMAGE_REL_MIPS_REFHI 04 #define IMAGE_REL_MIPS_REFLO 05 #define IMAGE_REL_MIPS_GPREL 06 #define IMAGE_REL_MIPS_LITERAL 07 #define IMAGE_REL_MIPS_SECTION 012 #define IMAGE_REL_MIPS_SECREL 013 #define IMAGE_REL_MIPS_REFWORDNB 042 #define IMAGE_REL_MIPS_PAIR 045 // // Alpha Relocation types. // #define IMAGE_REL_ALPHA_ABSOLUTE 0x0 #define IMAGE_REL_ALPHA_REFLONG 0x1 #define IMAGE_REL_ALPHA_REFQUAD 0x2 #define IMAGE_REL_ALPHA_GPREL32 0x3 #define IMAGE_REL_ALPHA_LITERAL 0x4 #define IMAGE_REL_ALPHA_LITUSE 0x5 #define IMAGE_REL_ALPHA_GPDISP 0x6 #define IMAGE_REL_ALPHA_BRADDR 0x7 #define IMAGE_REL_ALPHA_HINT 0x8 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9 #define IMAGE_REL_ALPHA_REFHI 0xA #define IMAGE_REL_ALPHA_REFLO 0xB #define IMAGE_REL_ALPHA_PAIR 0xC #define IMAGE_REL_ALPHA_MATCH 0xD #define IMAGE_REL_ALPHA_SECTION 0xE #define IMAGE_REL_ALPHA_SECREL 0xF #define IMAGE_REL_ALPHA_REFLONGNB 0x10 // // IBM PowerPC relocation types. // #define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP #define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address #define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address #define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2 (branch absolute) #define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address #define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load doubleword) #define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted left 2 (branch relative) #define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted left 2 (br cond relative) #define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base #define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted left 2 (load doubleword) #define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base #define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an image sectionhdr) #define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number #define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction iff symbol is glue code #define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address is TOC restore instruction #define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in IMAGE_RELOCATION.Type // Flag bits in IMAGE_RELOCATION.TYPE #define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than adding it #define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict branch taken #define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict branch not taken #define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data in toc) // // Based relocation format. // typedef struct _IMAGE_BASE_RELOCATION { UINT32 VirtualAddress; UINT32 SizeOfBlock; // UINT16 TypeOffset[1]; } IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION; #define IMAGE_SIZEOF_BASE_RELOCATION 8 // // Based relocation types. // #define IMAGE_REL_BASED_ABSOLUTE 0 #define IMAGE_REL_BASED_HIGH 1 #define IMAGE_REL_BASED_LOW 2 #define IMAGE_REL_BASED_HIGHLOW 3 #define IMAGE_REL_BASED_HIGHADJ 4 #define IMAGE_REL_BASED_MIPS_JMPADDR 5 #define IMAGE_REL_BASED_DIR64 10 // // Line number format. // typedef struct _IMAGE_LINENUMBER { union { UINT32 SymbolTableIndex; // Symbol table index of function name if Linenumber is 0. UINT32 VirtualAddress; // Virtual address of line number. } Type; UINT16 Linenumber; // Line number. } IMAGE_LINENUMBER; #define IMAGE_SIZEOF_LINENUMBER 6 // // Archive format. // #define IMAGE_ARCHIVE_START_SIZE 8 #define IMAGE_ARCHIVE_START "!\n" #define IMAGE_ARCHIVE_END "`\n" #define IMAGE_ARCHIVE_PAD "\n" #define IMAGE_ARCHIVE_LINKER_MEMBER "/ " #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { UINT8 Name[16]; // File member name - `/' terminated. UINT8 Date[12]; // File member date - decimal. UINT8 UserID[6]; // File member user id - decimal. UINT8 GroupID[6]; // File member group id - decimal. UINT8 Mode[8]; // File member mode - octal. UINT8 Size[10]; // File member size - decimal. UINT8 EndHeader[2]; // String to end header. } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 // // DLL support. // // // Export Format // typedef struct _IMAGE_EXPORT_DIRECTORY { UINT32 Characteristics; UINT32 TimeDateStamp; UINT16 MajorVersion; UINT16 MinorVersion; UINT32 Name; UINT32 Base; UINT32 NumberOfFunctions; UINT32 NumberOfNames; UINT32 *AddressOfFunctions; UINT32 *AddressOfNames; UINT32 *AddressOfNameOrdinals; } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; // // Import Format // typedef struct _IMAGE_IMPORT_BY_NAME { UINT16 Hint; UINT8 Name[1]; } IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME; typedef struct _IMAGE_THUNK_DATA { union { UINT32 Function; UINT32 Ordinal; PIMAGE_IMPORT_BY_NAME AddressOfData; } u1; } IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA; #define IMAGE_ORDINAL_FLAG 0x80000000 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0) #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff) typedef struct _IMAGE_IMPORT_DESCRIPTOR { UINT32 Characteristics; UINT32 TimeDateStamp; UINT32 ForwarderChain; UINT32 Name; PIMAGE_THUNK_DATA FirstThunk; } IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR; #endif Index: head/sys/boot/efi/include/arm64/efibind.h =================================================================== --- head/sys/boot/efi/include/arm64/efibind.h (revision 292622) +++ head/sys/boot/efi/include/arm64/efibind.h (revision 292623) @@ -1,219 +1,219 @@ /* $FreeBSD$ */ /*++ Copyright (c) 1999 - 2003 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: efefind.h Abstract: EFI to compile bindings Revision History --*/ #pragma pack() #ifdef __FreeBSD__ #include #else // // Basic int types of various widths // #if (__STDC_VERSION__ < 199901L ) - // No ANSI C 1999/2000 stdint.h integer width declarations + // No ANSI C 1999/2000 stdint.h integer width declarations #if _MSC_EXTENSIONS - // Use Microsoft C compiler integer width declarations + // Use Microsoft C compiler integer width declarations typedef unsigned __int64 uint64_t; typedef __int64 int64_t; typedef unsigned __int32 uint32_t; typedef __int32 int32_t; typedef unsigned __int16 uint16_t; typedef __int16 int16_t; typedef unsigned __int8 uint8_t; typedef __int8 int8_t; - #else + #else #ifdef UNIX_LP64 - // Use LP64 programming model from C_FLAGS for integer width declarations + // Use LP64 programming model from C_FLAGS for integer width declarations typedef unsigned long uint64_t; typedef long int64_t; typedef unsigned int uint32_t; typedef int int32_t; typedef unsigned short uint16_t; typedef short int16_t; typedef unsigned char uint8_t; typedef char int8_t; #else - // Assume P64 programming model from C_FLAGS for integer width declarations + // Assume P64 programming model from C_FLAGS for integer width declarations typedef unsigned long long uint64_t; typedef long long int64_t; typedef unsigned int uint32_t; typedef int int32_t; typedef unsigned short uint16_t; typedef short int16_t; typedef unsigned char uint8_t; typedef char int8_t; #endif #endif #endif #endif /* __FreeBSD__ */ // // Basic EFI types of various widths // typedef uint64_t UINT64; typedef int64_t INT64; typedef uint32_t UINT32; typedef int32_t INT32; typedef uint16_t UINT16; typedef int16_t INT16; typedef uint8_t UINT8; typedef int8_t INT8; #undef VOID #define VOID void typedef int64_t INTN; typedef uint64_t UINTN; //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // BugBug: Code to debug // #define BIT63 0x8000000000000000 -#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63) +#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63) #define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) ) - -// + +// // Macro's with casts make this much easier to use and read. // #define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port))) #define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data)) // // BugBug: End Debug Code!!! //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #define EFIERR(a) (0x8000000000000000 | a) #define EFI_ERROR_MASK 0x8000000000000000 -#define EFIERR_OEM(a) (0xc000000000000000 | a) +#define EFIERR_OEM(a) (0xc000000000000000 | a) #define BAD_POINTER 0xFBFBFBFBFBFBFBFB #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF -#pragma intrinsic (__break) +#pragma intrinsic (__break) #define BREAKPOINT() __break(0) // // Pointers must be aligned to these address to function // you will get an alignment fault if this value is less than 8 // #define MIN_ALIGNMENT_SIZE 8 #define ALIGN_VARIABLE(Value , Adjustment) \ (UINTN) Adjustment = 0; \ if((UINTN)Value % MIN_ALIGNMENT_SIZE) \ (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ Value = (UINTN)Value + (UINTN)Adjustment // // Define macros to create data structure signatures. // #define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) #define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) #define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) // // EFIAPI - prototype calling convention for EFI function pointers // BOOTSERVICE - prototype for implementation of a boot service interface // RUNTIMESERVICE - prototype for implementation of a runtime service interface // RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service -// RUNTIME_CODE - pragma macro for declaring runtime code +// RUNTIME_CODE - pragma macro for declaring runtime code // -#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options +#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options #if _MSC_EXTENSIONS - #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler + #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler #else - #define EFIAPI // Substitute expresion to force C calling convention + #define EFIAPI // Substitute expresion to force C calling convention #endif #endif #define BOOTSERVICE #define RUNTIMESERVICE #define RUNTIMEFUNCTION #define RUNTIME_CODE(a) alloc_text("rtcode", a) #define BEGIN_RUNTIME_DATA() data_seg("rtdata") #define END_RUNTIME_DATA() data_seg() #define VOLATILE volatile // // BugBug: Need to find out if this is portable accross compliers. // -void __mfa (void); -#pragma intrinsic (__mfa) +void __mfa (void); +#pragma intrinsic (__mfa) #define MEMORY_FENCE() __mfa() #ifdef EFI_NO_INTERFACE_DECL #define EFI_FORWARD_DECLARATION(x) #define EFI_INTERFACE_DECL(x) #else #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x #define EFI_INTERFACE_DECL(x) typedef struct x #endif // // When build similiar to FW, then link everything together as // one big module. // #define EFI_DRIVER_ENTRY_POINT(InitFunction) #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ (_if)->LoadInternal(type, name, entry) // entry(NULL, ST) #ifdef __FreeBSD__ #define INTERFACE_DECL(x) struct x #else // // Some compilers don't support the forward reference construct: // typedef struct XXXXX // // The following macro provide a workaround for such cases. // #ifdef NO_INTERFACE_DECL #define INTERFACE_DECL(x) #else #define INTERFACE_DECL(x) typedef struct x #endif #endif Index: head/sys/boot/efi/include/efi.h =================================================================== --- head/sys/boot/efi/include/efi.h (revision 292622) +++ head/sys/boot/efi/include/efi.h (revision 292623) @@ -1,63 +1,63 @@ /* $FreeBSD$ */ /*++ Copyright (c) 1999 - 2002 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: efi.h Abstract: Public EFI header files Revision History --*/ // // Build flags on input // EFI32 // EFI_DEBUG - Enable debugging code // EFI_NT_EMULATOR - Building for running under NT // #ifndef _EFI_INCLUDE_ #define _EFI_INCLUDE_ #define EFI_FIRMWARE_VENDOR L"INTEL" #define EFI_FIRMWARE_MAJOR_REVISION 14 #define EFI_FIRMWARE_MINOR_REVISION 62 #define EFI_FIRMWARE_REVISION ((EFI_FIRMWARE_MAJOR_REVISION <<16) | (EFI_FIRMWARE_MINOR_REVISION)) #include "efibind.h" #include "efidef.h" #include "efidevp.h" #include "efiprot.h" #include "eficon.h" #include "efiser.h" #include "efi_nii.h" #include "efipxebc.h" #include "efinet.h" #include "efiapi.h" #include "efifs.h" #include "efierr.h" #include "efigop.h" -#define EFI_STRINGIZE(a) #a -#define EFI_PROTOCOL_DEFINITION(a) EFI_STRINGIZE(Protocol/a/a.h) +#define EFI_STRINGIZE(a) #a +#define EFI_PROTOCOL_DEFINITION(a) EFI_STRINGIZE(Protocol/a/a.h) -#define EFI_GUID_DEFINITION(a) EFI_STRINGIZE(Guid/a/a##.h) +#define EFI_GUID_DEFINITION(a) EFI_STRINGIZE(Guid/a/a##.h) #define EFI_GUID_STRING(guidpointer, shortstring, longstring) #endif Index: head/sys/boot/efi/include/efi_nii.h =================================================================== --- head/sys/boot/efi/include/efi_nii.h (revision 292622) +++ head/sys/boot/efi/include/efi_nii.h (revision 292623) @@ -1,86 +1,86 @@ /* $FreeBSD$ */ #ifndef _EFI_NII_H #define _EFI_NII_H /*++ Copyright (c) 1999 - 2002 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: efi_nii.h Abstract: Revision history: 2000-Feb-18 M(f)J GUID updated. Structure order changed for machine word alignment. Added StringId[4] to structure. - + 2000-Feb-14 M(f)J Genesis. --*/ #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL \ { 0xE18541CD, 0xF755, 0x4f73, 0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29 } #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_31 \ { 0x1ACED566, 0x76ED, 0x4218, 0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89 } #define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION 0x00010000 #define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION_31 0x00010001 typedef enum { EfiNetworkInterfaceUndi = 1 } EFI_NETWORK_INTERFACE_TYPE; typedef struct { UINT64 Revision; // Revision of the network interface identifier protocol interface. UINT64 ID; // Address of the first byte of the identifying structure for this // network interface. This is set to zero if there is no structure. // // For PXE/UNDI this is the first byte of the !PXE structure. UINT64 ImageAddr; // Address of the UNrelocated driver/ROM image. This is set // to zero if there is no driver/ROM image. // // For 16-bit UNDI, this is the first byte of the option ROM in // upper memory. // // For 32/64-bit S/W UNDI, this is the first byte of the EFI ROM // image. // // For H/W UNDI, this is set to zero. UINT32 ImageSize; // Size of the UNrelocated driver/ROM image of this network interface. // This is set to zero if there is no driver/ROM image. CHAR8 StringId[4]; // 4 char ASCII string to go in class identifier (option 60) in DHCP // and Boot Server discover packets. // For EfiNetworkInterfaceUndi this field is "UNDI". // For EfiNetworkInterfaceSnp this field is "SNPN". UINT8 Type; UINT8 MajorVer; UINT8 MinorVer; // Information to be placed into the PXE DHCP and Discover packets. // This is the network interface type and version number that will // be placed into DHCP option 94 (client network interface identifier). BOOLEAN Ipv6Supported; UINT8 IfNum; // interface number to be used with pxeid structure } EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE; extern EFI_GUID NetworkInterfaceIdentifierProtocol; extern EFI_GUID NetworkInterfaceIdentifierProtocol_31; #endif // _EFI_NII_H Index: head/sys/boot/efi/include/efidebug.h =================================================================== --- head/sys/boot/efi/include/efidebug.h (revision 292622) +++ head/sys/boot/efi/include/efidebug.h (revision 292623) @@ -1,118 +1,118 @@ /* $FreeBSD$ */ #ifndef _EFI_DEBUG_H #define _EFI_DEBUG_H /*++ Copyright (c) 1999 - 2002 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: efidebug.h Abstract: EFI library debug functions Revision History --*/ extern UINTN EFIDebug; #if EFI_DEBUG #define DBGASSERT(a) DbgAssert(__FILE__, __LINE__, #a) #define DEBUG(a) DbgPrint a - + #else #define DBGASSERT(a) #define DEBUG(a) - + #endif #if EFI_DEBUG_CLEAR_MEMORY #define DBGSETMEM(a,l) SetMem(a,l,(CHAR8)BAD_POINTER) #else #define DBGSETMEM(a,l) #endif #define D_INIT 0x00000001 // Initialization style messages #define D_WARN 0x00000002 // Warnings #define D_LOAD 0x00000004 // Load events #define D_FS 0x00000008 // EFI File system #define D_POOL 0x00000010 // Alloc & Free's #define D_PAGE 0x00000020 // Alloc & Free's #define D_INFO 0x00000040 // Verbose #define D_VARIABLE 0x00000100 // Variable #define D_VAR 0x00000100 // Variable -#define D_BM 0x00000400 // Boot Manager +#define D_BM 0x00000400 // Boot Manager #define D_BLKIO 0x00001000 // BlkIo Driver #define D_BLKIO_ULTRA 0x00002000 // BlkIo Driver #define D_NET 0x00004000 // SNI Driver #define D_NET_ULTRA 0x00008000 // SNI Driver #define D_UNDI 0x00010000 // UNDI Driver #define D_LOADFILE 0x00020000 // UNDI Driver #define D_EVENT 0x00080000 // Event messages #define D_ERROR 0x80000000 // Error #define D_RESERVED 0x7ff40A80 // Bits not reserved above // // Current Debug level of the system, value of EFIDebug // //#define EFI_DBUG_MASK (D_ERROR | D_WARN | D_LOAD | D_BLKIO | D_INIT) #define EFI_DBUG_MASK (D_ERROR) // // // #if EFI_DEBUG #define ASSERT(a) if(!(a)) DBGASSERT(a) #define ASSERT_LOCKED(l) if(!(l)->Lock) DBGASSERT(l not locked) #define ASSERT_STRUCT(p,t) DBGASSERT(t not structure), p #else - #define ASSERT(a) - #define ASSERT_LOCKED(l) - #define ASSERT_STRUCT(p,t) + #define ASSERT(a) + #define ASSERT_LOCKED(l) + #define ASSERT_STRUCT(p,t) #endif // // Prototypes // INTN DbgAssert ( CHAR8 *file, INTN lineno, CHAR8 *string ); INTN DbgPrint ( INTN mask, CHAR8 *format, ... ); #endif Index: head/sys/boot/efi/include/efidef.h =================================================================== --- head/sys/boot/efi/include/efidef.h (revision 292622) +++ head/sys/boot/efi/include/efidef.h (revision 292623) @@ -1,205 +1,205 @@ /* $FreeBSD$ */ #ifndef _EFI_DEF_H #define _EFI_DEF_H /*++ Copyright (c) 1999 - 2002 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: efidef.h Abstract: EFI definitions Revision History --*/ typedef UINT16 CHAR16; typedef UINT8 CHAR8; #ifndef ACPI_THREAD_ID /* ACPI's definitions are fine */ typedef UINT8 BOOLEAN; #endif #ifndef TRUE #define TRUE ((BOOLEAN) 1) #define FALSE ((BOOLEAN) 0) #endif #ifndef NULL #define NULL ((VOID *) 0) #endif typedef UINTN EFI_STATUS; typedef UINT64 EFI_LBA; typedef UINTN EFI_TPL; typedef VOID *EFI_HANDLE; typedef VOID *EFI_EVENT; // // Prototype argument decoration for EFI parameters to indicate // their direction // // IN - argument is passed into the function // OUT - argument (pointer) is returned from the function // OPTIONAL - argument is optional // #ifndef IN #define IN #define OUT #define OPTIONAL #endif // // A GUID // -typedef struct { +typedef struct { UINT32 Data1; UINT16 Data2; UINT16 Data3; - UINT8 Data4[8]; + UINT8 Data4[8]; } EFI_GUID; // // Time // -typedef struct { +typedef struct { UINT16 Year; // 1998 - 20XX UINT8 Month; // 1 - 12 UINT8 Day; // 1 - 31 UINT8 Hour; // 0 - 23 UINT8 Minute; // 0 - 59 UINT8 Second; // 0 - 59 UINT8 Pad1; UINT32 Nanosecond; // 0 - 999,999,999 INT16 TimeZone; // -1440 to 1440 or 2047 UINT8 Daylight; UINT8 Pad2; } EFI_TIME; // Bit definitions for EFI_TIME.Daylight #define EFI_TIME_ADJUST_DAYLIGHT 0x01 #define EFI_TIME_IN_DAYLIGHT 0x02 // Value definition for EFI_TIME.TimeZone #define EFI_UNSPECIFIED_TIMEZONE 0x07FF // // Networking // typedef struct { UINT8 Addr[4]; } EFI_IPv4_ADDRESS; typedef struct { UINT8 Addr[16]; } EFI_IPv6_ADDRESS; typedef struct { UINT8 Addr[32]; } EFI_MAC_ADDRESS; // // Memory // typedef UINT64 EFI_PHYSICAL_ADDRESS; typedef UINT64 EFI_VIRTUAL_ADDRESS; typedef enum { AllocateAnyPages, AllocateMaxAddress, AllocateAddress, MaxAllocateType } EFI_ALLOCATE_TYPE; //Preseve the attr on any range supplied. //ConventialMemory must have WB,SR,SW when supplied. //When allocating from ConventialMemory always make it WB,SR,SW //When returning to ConventialMemory always make it WB,SR,SW //When getting the memory map, or on RT for runtime types typedef enum { EfiReservedMemoryType, EfiLoaderCode, EfiLoaderData, EfiBootServicesCode, EfiBootServicesData, EfiRuntimeServicesCode, EfiRuntimeServicesData, EfiConventionalMemory, EfiUnusableMemory, EfiACPIReclaimMemory, EfiACPIMemoryNVS, EfiMemoryMappedIO, EfiMemoryMappedIOPortSpace, EfiPalCode, EfiMaxMemoryType } EFI_MEMORY_TYPE; // possible caching types for the memory range #define EFI_MEMORY_UC 0x0000000000000001 #define EFI_MEMORY_WC 0x0000000000000002 #define EFI_MEMORY_WT 0x0000000000000004 #define EFI_MEMORY_WB 0x0000000000000008 -#define EFI_MEMORY_UCE 0x0000000000000010 +#define EFI_MEMORY_UCE 0x0000000000000010 -// physical memory protection on range +// physical memory protection on range #define EFI_MEMORY_WP 0x0000000000001000 #define EFI_MEMORY_RP 0x0000000000002000 #define EFI_MEMORY_XP 0x0000000000004000 // range requires a runtime mapping #define EFI_MEMORY_RUNTIME 0x8000000000000000 #define EFI_MEMORY_DESCRIPTOR_VERSION 1 typedef struct { UINT32 Type; // Field size is 32 bits followed by 32 bit pad EFI_PHYSICAL_ADDRESS PhysicalStart; // Field size is 64 bits EFI_VIRTUAL_ADDRESS VirtualStart; // Field size is 64 bits UINT64 NumberOfPages; // Field size is 64 bits UINT64 Attribute; // Field size is 64 bits } EFI_MEMORY_DESCRIPTOR; // // International Language // typedef UINT8 ISO_639_2; #define ISO_639_2_ENTRY_SIZE 3 // // // #define EFI_PAGE_SIZE 4096 #define EFI_PAGE_MASK 0xFFF #define EFI_PAGE_SHIFT 12 #define EFI_SIZE_TO_PAGES(a) \ ( ((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0) ) #endif Index: head/sys/boot/efi/include/efidevp.h =================================================================== --- head/sys/boot/efi/include/efidevp.h (revision 292622) +++ head/sys/boot/efi/include/efidevp.h (revision 292623) @@ -1,423 +1,423 @@ /* $FreeBSD$ */ #ifndef _DEVPATH_H #define _DEVPATH_H /*++ Copyright (c) 1999 - 2002 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: devpath.h Abstract: Defines for parsing the EFI Device Path structures Revision History --*/ // // Device Path structures - Section C // typedef struct _EFI_DEVICE_PATH { UINT8 Type; UINT8 SubType; UINT8 Length[2]; } EFI_DEVICE_PATH; #define EFI_DP_TYPE_MASK 0x7F #define EFI_DP_TYPE_UNPACKED 0x80 //#define END_DEVICE_PATH_TYPE 0xff #define END_DEVICE_PATH_TYPE 0x7f //#define END_DEVICE_PATH_TYPE_UNPACKED 0x7f #define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff #define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01 #define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH)) #define DP_IS_END_TYPE(a) #define DP_IS_END_SUBTYPE(a) ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) #define DevicePathType(a) ( ((a)->Type) & EFI_DP_TYPE_MASK ) #define DevicePathSubType(a) ( (a)->SubType ) #define DevicePathNodeLength(a) ( ((a)->Length[0]) | ((a)->Length[1] << 8) ) #define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a))) //#define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE_UNPACKED ) #define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE ) #define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) #define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) ) #define IsDevicePathUnpacked(a) ( (a)->Type & EFI_DP_TYPE_UNPACKED ) #define SetDevicePathNodeLength(a,l) { \ (a)->Length[0] = (UINT8) (l); \ (a)->Length[1] = (UINT8) ((l) >> 8); \ } #define SetDevicePathEndNode(a) { \ (a)->Type = END_DEVICE_PATH_TYPE; \ (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \ (a)->Length[0] = sizeof(EFI_DEVICE_PATH); \ (a)->Length[1] = 0; \ } /* * */ #define HARDWARE_DEVICE_PATH 0x01 #define HW_PCI_DP 0x01 typedef struct _PCI_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT8 Function; UINT8 Device; } PCI_DEVICE_PATH; #define HW_PCCARD_DP 0x02 typedef struct _PCCARD_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT8 FunctionNumber; } PCCARD_DEVICE_PATH; #define HW_MEMMAP_DP 0x03 typedef struct _MEMMAP_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT32 MemoryType; EFI_PHYSICAL_ADDRESS StartingAddress; EFI_PHYSICAL_ADDRESS EndingAddress; } MEMMAP_DEVICE_PATH; #define HW_VENDOR_DP 0x04 typedef struct _VENDOR_DEVICE_PATH { EFI_DEVICE_PATH Header; EFI_GUID Guid; } VENDOR_DEVICE_PATH; #define UNKNOWN_DEVICE_GUID \ { 0xcf31fac5, 0xc24e, 0x11d2, 0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b } typedef struct _UKNOWN_DEVICE_VENDOR_DP { VENDOR_DEVICE_PATH DevicePath; UINT8 LegacyDriveLetter; } UNKNOWN_DEVICE_VENDOR_DEVICE_PATH; #define HW_CONTROLLER_DP 0x05 typedef struct _CONTROLLER_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT32 Controller; } CONTROLLER_DEVICE_PATH; /* * */ #define ACPI_DEVICE_PATH 0x02 #define ACPI_DP 0x01 typedef struct _ACPI_HID_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT32 HID; UINT32 UID; } ACPI_HID_DEVICE_PATH; #define ACPI_EXTENDED_DP 0x02 typedef struct _ACPI_EXTENDED_HID_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT32 HID; UINT32 UID; UINT32 CID; } ACPI_EXTENDED_HID_DEVICE_PATH; // // EISA ID Macro // EISA ID Definition 32-bits // bits[15:0] - three character compressed ASCII EISA ID. // bits[31:16] - binary number // Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z' // -#define PNP_EISA_ID_CONST 0x41d0 -#define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16)) +#define PNP_EISA_ID_CONST 0x41d0 +#define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16)) #define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId))) #define EFI_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId))) #define PNP_EISA_ID_MASK 0xffff #define EISA_ID_TO_NUM(_Id) ((_Id) >> 16) /* * */ -#define MESSAGING_DEVICE_PATH 0x03 +#define MESSAGING_DEVICE_PATH 0x03 #define MSG_ATAPI_DP 0x01 typedef struct _ATAPI_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT8 PrimarySecondary; UINT8 SlaveMaster; UINT16 Lun; } ATAPI_DEVICE_PATH; #define MSG_SCSI_DP 0x02 typedef struct _SCSI_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT16 Pun; - UINT16 Lun; + UINT16 Lun; } SCSI_DEVICE_PATH; #define MSG_FIBRECHANNEL_DP 0x03 typedef struct _FIBRECHANNEL_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT32 Reserved; UINT64 WWN; UINT64 Lun; } FIBRECHANNEL_DEVICE_PATH; #define MSG_1394_DP 0x04 typedef struct _F1394_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT32 Reserved; UINT64 Guid; } F1394_DEVICE_PATH; #define MSG_USB_DP 0x05 typedef struct _USB_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT8 ParentPortNumber; UINT8 InterfaceNumber; } USB_DEVICE_PATH; #define MSG_USB_CLASS_DP 0x0F typedef struct _USB_CLASS_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT16 VendorId; UINT16 ProductId; UINT8 DeviceClass; UINT8 DeviceSubClass; UINT8 DeviceProtocol; } USB_CLASS_DEVICE_PATH; #define MSG_I2O_DP 0x06 typedef struct _I2O_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT32 Tid; } I2O_DEVICE_PATH; #define MSG_MAC_ADDR_DP 0x0b typedef struct _MAC_ADDR_DEVICE_PATH { EFI_DEVICE_PATH Header; EFI_MAC_ADDRESS MacAddress; UINT8 IfType; } MAC_ADDR_DEVICE_PATH; #define MSG_IPv4_DP 0x0c typedef struct _IPv4_DEVICE_PATH { EFI_DEVICE_PATH Header; EFI_IPv4_ADDRESS LocalIpAddress; EFI_IPv4_ADDRESS RemoteIpAddress; UINT16 LocalPort; UINT16 RemotePort; UINT16 Protocol; BOOLEAN StaticIpAddress; } IPv4_DEVICE_PATH; #define MSG_IPv6_DP 0x0d typedef struct _IPv6_DEVICE_PATH { EFI_DEVICE_PATH Header; EFI_IPv6_ADDRESS LocalIpAddress; EFI_IPv6_ADDRESS RemoteIpAddress; UINT16 LocalPort; UINT16 RemotePort; UINT16 Protocol; BOOLEAN StaticIpAddress; } IPv6_DEVICE_PATH; #define MSG_INFINIBAND_DP 0x09 typedef struct _INFINIBAND_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT32 ResourceFlags; UINT8 PortGid[16]; UINT64 ServiceId; UINT64 TargetPortId; UINT64 DeviceId; } INFINIBAND_DEVICE_PATH; #define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE 0x01 #define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT 0x02 #define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL 0x04 #define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL 0x08 #define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL 0x10 #define MSG_UART_DP 0x0e typedef struct _UART_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT32 Reserved; UINT64 BaudRate; UINT8 DataBits; UINT8 Parity; UINT8 StopBits; } UART_DEVICE_PATH; #define MSG_VENDOR_DP 0x0A /* Use VENDOR_DEVICE_PATH struct */ #define DEVICE_PATH_MESSAGING_PC_ANSI \ { 0xe0c14753, 0xf9be, 0x11d2, 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } #define DEVICE_PATH_MESSAGING_VT_100 \ { 0xdfa66065, 0xb419, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } #define DEVICE_PATH_MESSAGING_VT_100_PLUS \ { 0x7baec70b, 0x57e0, 0x4c76, 0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43 } - + #define DEVICE_PATH_MESSAGING_VT_UTF8 \ - { 0xad15a0d6, 0x8bec, 0x4acf, 0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } + { 0xad15a0d6, 0x8bec, 0x4acf, 0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } #define MEDIA_DEVICE_PATH 0x04 #define MEDIA_HARDDRIVE_DP 0x01 typedef struct _HARDDRIVE_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT32 PartitionNumber; UINT64 PartitionStart; UINT64 PartitionSize; UINT8 Signature[16]; UINT8 MBRType; UINT8 SignatureType; } HARDDRIVE_DEVICE_PATH; #define MBR_TYPE_PCAT 0x01 #define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02 #define SIGNATURE_TYPE_MBR 0x01 #define SIGNATURE_TYPE_GUID 0x02 #define MEDIA_CDROM_DP 0x02 typedef struct _CDROM_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT32 BootEntry; UINT64 PartitionStart; UINT64 PartitionSize; } CDROM_DEVICE_PATH; #define MEDIA_VENDOR_DP 0x03 /* Use VENDOR_DEVICE_PATH struct */ #define MEDIA_FILEPATH_DP 0x04 typedef struct _FILEPATH_DEVICE_PATH { EFI_DEVICE_PATH Header; CHAR16 PathName[1]; } FILEPATH_DEVICE_PATH; #define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName) #define MEDIA_PROTOCOL_DP 0x05 typedef struct _MEDIA_PROTOCOL_DEVICE_PATH { EFI_DEVICE_PATH Header; EFI_GUID Protocol; } MEDIA_PROTOCOL_DEVICE_PATH; #define BBS_DEVICE_PATH 0x05 #define BBS_BBS_DP 0x01 typedef struct _BBS_BBS_DEVICE_PATH { EFI_DEVICE_PATH Header; UINT16 DeviceType; UINT16 StatusFlag; CHAR8 String[1]; } BBS_BBS_DEVICE_PATH; /* DeviceType definitions - from BBS specification */ #define BBS_TYPE_FLOPPY 0x01 #define BBS_TYPE_HARDDRIVE 0x02 #define BBS_TYPE_CDROM 0x03 #define BBS_TYPE_PCMCIA 0x04 #define BBS_TYPE_USB 0x05 #define BBS_TYPE_EMBEDDED_NETWORK 0x06 #define BBS_TYPE_DEV 0x80 #define BBS_TYPE_UNKNOWN 0xFF typedef union { EFI_DEVICE_PATH DevPath; PCI_DEVICE_PATH Pci; PCCARD_DEVICE_PATH PcCard; MEMMAP_DEVICE_PATH MemMap; VENDOR_DEVICE_PATH Vendor; - UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor; + UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor; CONTROLLER_DEVICE_PATH Controller; ACPI_HID_DEVICE_PATH Acpi; ATAPI_DEVICE_PATH Atapi; SCSI_DEVICE_PATH Scsi; FIBRECHANNEL_DEVICE_PATH FibreChannel; F1394_DEVICE_PATH F1394; USB_DEVICE_PATH Usb; USB_CLASS_DEVICE_PATH UsbClass; I2O_DEVICE_PATH I2O; MAC_ADDR_DEVICE_PATH MacAddr; IPv4_DEVICE_PATH Ipv4; IPv6_DEVICE_PATH Ipv6; INFINIBAND_DEVICE_PATH InfiniBand; UART_DEVICE_PATH Uart; HARDDRIVE_DEVICE_PATH HardDrive; CDROM_DEVICE_PATH CD; FILEPATH_DEVICE_PATH FilePath; MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol; BBS_BBS_DEVICE_PATH Bbs; } EFI_DEV_PATH; typedef union { EFI_DEVICE_PATH *DevPath; PCI_DEVICE_PATH *Pci; PCCARD_DEVICE_PATH *PcCard; MEMMAP_DEVICE_PATH *MemMap; VENDOR_DEVICE_PATH *Vendor; - UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownVendor; + UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownVendor; CONTROLLER_DEVICE_PATH *Controller; ACPI_HID_DEVICE_PATH *Acpi; ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi; ATAPI_DEVICE_PATH *Atapi; SCSI_DEVICE_PATH *Scsi; FIBRECHANNEL_DEVICE_PATH *FibreChannel; F1394_DEVICE_PATH *F1394; USB_DEVICE_PATH *Usb; USB_CLASS_DEVICE_PATH *UsbClass; I2O_DEVICE_PATH *I2O; MAC_ADDR_DEVICE_PATH *MacAddr; IPv4_DEVICE_PATH *Ipv4; IPv6_DEVICE_PATH *Ipv6; INFINIBAND_DEVICE_PATH *InfiniBand; UART_DEVICE_PATH *Uart; HARDDRIVE_DEVICE_PATH *HardDrive; FILEPATH_DEVICE_PATH *FilePath; MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol; CDROM_DEVICE_PATH *CD; BBS_BBS_DEVICE_PATH *Bbs; } EFI_DEV_PATH_PTR; #endif Index: head/sys/boot/efi/include/efifs.h =================================================================== --- head/sys/boot/efi/include/efifs.h (revision 292622) +++ head/sys/boot/efi/include/efifs.h (revision 292623) @@ -1,123 +1,123 @@ /* $FreeBSD$ */ #ifndef _EFI_FS_H #define _EFI_FS_H /*++ Copyright (c) 1999 - 2002 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: efifs.h Abstract: EFI File System structures Revision History --*/ // // EFI Partition header (normaly starts in LBA 1) // #define EFI_PARTITION_SIGNATURE 0x5053595320494249 #define EFI_PARTITION_REVISION 0x00010001 #define MIN_EFI_PARTITION_BLOCK_SIZE 512 #define EFI_PARTITION_LBA 1 typedef struct _EFI_PARTITION_HEADER { EFI_TABLE_HEADER Hdr; UINT32 DirectoryAllocationNumber; UINT32 BlockSize; EFI_LBA FirstUsableLba; EFI_LBA LastUsableLba; EFI_LBA UnusableSpace; EFI_LBA FreeSpace; EFI_LBA RootFile; EFI_LBA SecutiryFile; } EFI_PARTITION_HEADER; // // File header // #define EFI_FILE_HEADER_SIGNATURE 0x454c494620494249 #define EFI_FILE_HEADER_REVISION 0x00010000 #define EFI_FILE_STRING_SIZE 260 typedef struct _EFI_FILE_HEADER { EFI_TABLE_HEADER Hdr; UINT32 Class; UINT32 LBALOffset; EFI_LBA Parent; UINT64 FileSize; UINT64 FileAttributes; EFI_TIME FileCreateTime; EFI_TIME FileModificationTime; EFI_GUID VendorGuid; CHAR16 FileString[EFI_FILE_STRING_SIZE]; } EFI_FILE_HEADER; // // Return the file's first LBAL which is in the same // logical block as the file header // #define EFI_FILE_LBAL(a) ((EFI_LBAL *) (((CHAR8 *) (a)) + (a)->LBALOffset)) #define EFI_FILE_CLASS_FREE_SPACE 1 #define EFI_FILE_CLASS_EMPTY 2 #define EFI_FILE_CLASS_NORMAL 3 // // Logical Block Address List - the fundemental block // description structure // #define EFI_LBAL_SIGNATURE 0x4c41424c20494249 #define EFI_LBAL_REVISION 0x00010000 typedef struct _EFI_LBAL { EFI_TABLE_HEADER Hdr; UINT32 Class; EFI_LBA Parent; EFI_LBA Next; UINT32 ArraySize; UINT32 ArrayCount; } EFI_LBAL; -// Array size +// Array size #define EFI_LBAL_ARRAY_SIZE(lbal,offs,blks) \ (((blks) - (offs) - (lbal)->Hdr.HeaderSize) / sizeof(EFI_RL)) // // Logical Block run-length // typedef struct { EFI_LBA Start; UINT64 Length; } EFI_RL; // // Return the run-length structure from an LBAL header // #define EFI_LBAL_RL(a) ((EFI_RL*) (((CHAR8 *) (a)) + (a)->Hdr.HeaderSize)) #endif Index: head/sys/boot/efi/include/efinet.h =================================================================== --- head/sys/boot/efi/include/efinet.h (revision 292622) +++ head/sys/boot/efi/include/efinet.h (revision 292623) @@ -1,348 +1,348 @@ /* $FreeBSD$ */ #ifndef _EFINET_H #define _EFINET_H /*++ Copyright (c) 1999 - 2002 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: efinet.h Abstract: EFI Simple Network protocol Revision History --*/ /////////////////////////////////////////////////////////////////////////////// // // Simple Network Protocol // #define EFI_SIMPLE_NETWORK_PROTOCOL \ { 0xA19832B9, 0xAC25, 0x11D3, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } INTERFACE_DECL(_EFI_SIMPLE_NETWORK); /////////////////////////////////////////////////////////////////////////////// // typedef struct { // // Total number of frames received. Includes frames with errors and // dropped frames. // UINT64 RxTotalFrames; // // Number of valid frames received and copied into receive buffers. // UINT64 RxGoodFrames; // // Number of frames below the minimum length for the media. // This would be <64 for ethernet. // UINT64 RxUndersizeFrames; // // Number of frames longer than the maxminum length for the // media. This would be >1500 for ethernet. // UINT64 RxOversizeFrames; // // Valid frames that were dropped because receive buffers were full. // UINT64 RxDroppedFrames; // // Number of valid unicast frames received and not dropped. // UINT64 RxUnicastFrames; // // Number of valid broadcast frames received and not dropped. // UINT64 RxBroadcastFrames; // // Number of valid mutlicast frames received and not dropped. // UINT64 RxMulticastFrames; // // Number of frames w/ CRC or alignment errors. // UINT64 RxCrcErrorFrames; // // Total number of bytes received. Includes frames with errors // and dropped frames. // UINT64 RxTotalBytes; // // Transmit statistics. // UINT64 TxTotalFrames; UINT64 TxGoodFrames; UINT64 TxUndersizeFrames; UINT64 TxOversizeFrames; UINT64 TxDroppedFrames; UINT64 TxUnicastFrames; UINT64 TxBroadcastFrames; UINT64 TxMulticastFrames; UINT64 TxCrcErrorFrames; UINT64 TxTotalBytes; // // Number of collisions detection on this subnet. // UINT64 Collisions; // // Number of frames destined for unsupported protocol. // UINT64 UnsupportedProtocol; } EFI_NETWORK_STATISTICS; /////////////////////////////////////////////////////////////////////////////// // typedef enum { EfiSimpleNetworkStopped, EfiSimpleNetworkStarted, EfiSimpleNetworkInitialized, EfiSimpleNetworkMaxState } EFI_SIMPLE_NETWORK_STATE; /////////////////////////////////////////////////////////////////////////////// // #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01 #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02 #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10 /////////////////////////////////////////////////////////////////////////////// // #define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01 #define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02 #define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04 #define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08 /////////////////////////////////////////////////////////////////////////////// // #define MAX_MCAST_FILTER_CNT 16 typedef struct { UINT32 State; UINT32 HwAddressSize; UINT32 MediaHeaderSize; UINT32 MaxPacketSize; UINT32 NvRamSize; UINT32 NvRamAccessSize; UINT32 ReceiveFilterMask; UINT32 ReceiveFilterSetting; UINT32 MaxMCastFilterCount; UINT32 MCastFilterCount; EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT]; EFI_MAC_ADDRESS CurrentAddress; EFI_MAC_ADDRESS BroadcastAddress; EFI_MAC_ADDRESS PermanentAddress; UINT8 IfType; BOOLEAN MacAddressChangeable; BOOLEAN MultipleTxSupported; BOOLEAN MediaPresentSupported; BOOLEAN MediaPresent; } EFI_SIMPLE_NETWORK_MODE; /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_START) ( IN struct _EFI_SIMPLE_NETWORK *This ); /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_STOP) ( IN struct _EFI_SIMPLE_NETWORK *This ); /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE) ( IN struct _EFI_SIMPLE_NETWORK *This, IN UINTN ExtraRxBufferSize OPTIONAL, IN UINTN ExtraTxBufferSize OPTIONAL ); /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_RESET) ( IN struct _EFI_SIMPLE_NETWORK *This, IN BOOLEAN ExtendedVerification ); /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) ( IN struct _EFI_SIMPLE_NETWORK *This ); /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS) ( IN struct _EFI_SIMPLE_NETWORK *This, IN UINT32 Enable, IN UINT32 Disable, IN BOOLEAN ResetMCastFilter, IN UINTN MCastFilterCnt OPTIONAL, IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL ); /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS) ( IN struct _EFI_SIMPLE_NETWORK *This, IN BOOLEAN Reset, IN EFI_MAC_ADDRESS *New OPTIONAL ); /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS) ( IN struct _EFI_SIMPLE_NETWORK *This, IN BOOLEAN Reset, IN OUT UINTN *StatisticsSize OPTIONAL, OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL ); /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC) ( IN struct _EFI_SIMPLE_NETWORK *This, IN BOOLEAN IPv6, IN EFI_IP_ADDRESS *IP, OUT EFI_MAC_ADDRESS *MAC ); /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_NVDATA) ( IN struct _EFI_SIMPLE_NETWORK *This, IN BOOLEAN ReadWrite, IN UINTN Offset, IN UINTN BufferSize, IN OUT VOID *Buffer ); /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS) ( IN struct _EFI_SIMPLE_NETWORK *This, OUT UINT32 *InterruptStatus OPTIONAL, OUT VOID **TxBuf OPTIONAL ); /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT) ( IN struct _EFI_SIMPLE_NETWORK *This, IN UINTN HeaderSize, IN UINTN BufferSize, IN VOID *Buffer, IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL, IN EFI_MAC_ADDRESS *DestAddr OPTIONAL, IN UINT16 *Protocol OPTIONAL ); /////////////////////////////////////////////////////////////////////////////// // -typedef -EFI_STATUS +typedef +EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE) ( IN struct _EFI_SIMPLE_NETWORK *This, OUT UINTN *HeaderSize OPTIONAL, IN OUT UINTN *BufferSize, OUT VOID *Buffer, OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL, OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL, OUT UINT16 *Protocol OPTIONAL ); /////////////////////////////////////////////////////////////////////////////// // #define EFI_SIMPLE_NETWORK_INTERFACE_REVISION 0x00010000 typedef struct _EFI_SIMPLE_NETWORK { UINT64 Revision; EFI_SIMPLE_NETWORK_START Start; EFI_SIMPLE_NETWORK_STOP Stop; EFI_SIMPLE_NETWORK_INITIALIZE Initialize; EFI_SIMPLE_NETWORK_RESET Reset; EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown; EFI_SIMPLE_NETWORK_RECEIVE_FILTERS ReceiveFilters; EFI_SIMPLE_NETWORK_STATION_ADDRESS StationAddress; EFI_SIMPLE_NETWORK_STATISTICS Statistics; EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC MCastIpToMac; EFI_SIMPLE_NETWORK_NVDATA NvData; EFI_SIMPLE_NETWORK_GET_STATUS GetStatus; EFI_SIMPLE_NETWORK_TRANSMIT Transmit; EFI_SIMPLE_NETWORK_RECEIVE Receive; EFI_EVENT WaitForPacket; EFI_SIMPLE_NETWORK_MODE *Mode; } EFI_SIMPLE_NETWORK; #endif /* _EFINET_H */ Index: head/sys/boot/efi/include/efipart.h =================================================================== --- head/sys/boot/efi/include/efipart.h (revision 292622) +++ head/sys/boot/efi/include/efipart.h (revision 292623) @@ -1,69 +1,69 @@ /* $FreeBSD$ */ #ifndef _EFI_PART_H #define _EFI_PART_H /*++ Copyright (c) 1999 - 2002 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: efipart.h - -Abstract: + +Abstract: Info about disk partitions and Master Boot Records Revision History --*/ // // // #define EFI_PARTITION 0xef #define MBR_SIZE 512 #pragma pack(1) typedef struct { UINT8 BootIndicator; UINT8 StartHead; UINT8 StartSector; UINT8 StartTrack; UINT8 OSIndicator; UINT8 EndHead; UINT8 EndSector; UINT8 EndTrack; UINT8 StartingLBA[4]; UINT8 SizeInLBA[4]; } MBR_PARTITION_RECORD; #define EXTRACT_UINT32(D) (UINT32)(D[0] | (D[1] << 8) | (D[2] << 16) | (D[3] << 24)) #define MBR_SIGNATURE 0xaa55 #define MIN_MBR_DEVICE_SIZE 0x80000 #define MBR_ERRATA_PAD 0x40000 // 128 MB -#define MAX_MBR_PARTITIONS 4 +#define MAX_MBR_PARTITIONS typedef struct { UINT8 BootStrapCode[440]; UINT8 UniqueMbrSignature[4]; UINT8 Unknown[2]; MBR_PARTITION_RECORD Partition[MAX_MBR_PARTITIONS]; UINT16 Signature; } MASTER_BOOT_RECORD; #pragma pack() #endif Index: head/sys/boot/efi/include/efipciio.h =================================================================== --- head/sys/boot/efi/include/efipciio.h (revision 292622) +++ head/sys/boot/efi/include/efipciio.h (revision 292623) @@ -1,559 +1,559 @@ /* $FreeBSD$ */ /** @file - EFI PCI I/O Protocol provides the basic Memory, I/O, PCI configuration, + EFI PCI I/O Protocol provides the basic Memory, I/O, PCI configuration, and DMA interfaces that a driver uses to access its PCI controller. 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 + 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. + 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 __PCI_IO_H__ #define __PCI_IO_H__ /// /// Global ID for the PCI I/O Protocol /// #define EFI_PCI_IO_PROTOCOL_GUID \ { \ 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a } \ } typedef struct _EFI_PCI_IO_PROTOCOL EFI_PCI_IO_PROTOCOL; /// /// ******************************************************* /// EFI_PCI_IO_PROTOCOL_WIDTH /// ******************************************************* /// typedef enum { EfiPciIoWidthUint8 = 0, EfiPciIoWidthUint16, EfiPciIoWidthUint32, EfiPciIoWidthUint64, EfiPciIoWidthFifoUint8, EfiPciIoWidthFifoUint16, EfiPciIoWidthFifoUint32, EfiPciIoWidthFifoUint64, EfiPciIoWidthFillUint8, EfiPciIoWidthFillUint16, EfiPciIoWidthFillUint32, EfiPciIoWidthFillUint64, EfiPciIoWidthMaximum } EFI_PCI_IO_PROTOCOL_WIDTH; // // Complete PCI address generater // #define EFI_PCI_IO_PASS_THROUGH_BAR 0xff ///< Special BAR that passes a memory or I/O cycle through unchanged #define EFI_PCI_IO_ATTRIBUTE_MASK 0x077f ///< All the following I/O and Memory cycles #define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001 ///< I/O cycles 0x0000-0x00FF (10 bit decode) #define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002 ///< I/O cycles 0x0100-0x03FF or greater (10 bit decode) #define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004 ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode) #define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008 ///< MEM cycles 0xA0000-0xBFFFF (24 bit decode) #define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010 ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode) #define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020 ///< I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode) #define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040 ///< I/O cycles 0x170-0x177, 0x376, 0x377 (10 bit decode) #define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080 ///< Map a memory range so writes are combined #define EFI_PCI_IO_ATTRIBUTE_IO 0x0100 ///< Enable the I/O decode bit in the PCI Config Header #define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200 ///< Enable the Memory decode bit in the PCI Config Header #define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400 ///< Enable the DMA bit in the PCI Config Header #define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800 ///< Map a memory range so all r/w accesses are cached #define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 ///< Disable a memory range #define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000 ///< Clear for an add-in PCI Device #define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000 ///< Clear for a physical PCI Option ROM accessed through ROM BAR #define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000 ///< Clear for PCI controllers that can not genrate a DAC #define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000 ///< I/O cycles 0x0100-0x03FF or greater (16 bit decode) #define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000 ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (16 bit decode) #define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000 ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (16 bit decode) #define EFI_PCI_DEVICE_ENABLE (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY | EFI_PCI_IO_ATTRIBUTE_BUS_MASTER) #define EFI_VGA_DEVICE_ENABLE (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_IO) /// /// ******************************************************* /// EFI_PCI_IO_PROTOCOL_OPERATION /// ******************************************************* /// typedef enum { /// /// A read operation from system memory by a bus master. /// EfiPciIoOperationBusMasterRead, /// /// A write operation from system memory by a bus master. /// EfiPciIoOperationBusMasterWrite, /// /// Provides both read and write access to system memory by both the processor and a /// bus master. The buffer is coherent from both the processor's and the bus master's point of view. /// EfiPciIoOperationBusMasterCommonBuffer, EfiPciIoOperationMaximum } EFI_PCI_IO_PROTOCOL_OPERATION; /// /// ******************************************************* /// EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION /// ******************************************************* /// typedef enum { /// /// Retrieve the PCI controller's current attributes, and return them in Result. /// EfiPciIoAttributeOperationGet, /// /// Set the PCI controller's current attributes to Attributes. /// EfiPciIoAttributeOperationSet, /// /// Enable the attributes specified by the bits that are set in Attributes for this PCI controller. /// EfiPciIoAttributeOperationEnable, /// /// Disable the attributes specified by the bits that are set in Attributes for this PCI controller. /// EfiPciIoAttributeOperationDisable, /// /// Retrieve the PCI controller's supported attributes, and return them in Result. /// EfiPciIoAttributeOperationSupported, EfiPciIoAttributeOperationMaximum } EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION; /** Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is satisfied or after a defined duration. @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @param Width Signifies the width of the memory or I/O operations. @param BarIndex The BAR index of the standard PCI Configuration header to use as the base address for the memory operation to perform. @param Offset The offset within the selected BAR to start the memory operation. @param Mask Mask used for the polling criteria. @param Value The comparison value used for the polling exit criteria. @param Delay The number of 100 ns units to poll. @param Result Pointer to the last value read from the memory location. @retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria. @retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller. @retval EFI_UNSUPPORTED Offset is not valid for the BarIndex of this PCI controller. @retval EFI_TIMEOUT Delay expired before a match occurred. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. @retval EFI_INVALID_PARAMETER One or more parameters are invalid. **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_POLL_IO_MEM)( IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINT64 Mask, IN UINT64 Value, IN UINT64 Delay, OUT UINT64 *Result ); /** Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space. @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @param Width Signifies the width of the memory or I/O operations. @param BarIndex The BAR index of the standard PCI Configuration header to use as the base address for the memory or I/O operation to perform. @param Offset The offset within the selected BAR to start the memory or I/O operation. @param Count The number of memory or I/O operations to perform. @param Buffer For read operations, the destination buffer to store the results. For write operations, the source buffer to write data from. @retval EFI_SUCCESS The data was read from or written to the PCI controller. @retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller. @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not valid for the PCI BAR specified by BarIndex. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. @retval EFI_INVALID_PARAMETER One or more parameters are invalid. **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_IO_MEM)( IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINTN Count, IN OUT VOID *Buffer ); typedef struct { /// /// Read PCI controller registers in the PCI memory or I/O space. /// EFI_PCI_IO_PROTOCOL_IO_MEM Read; /// /// Write PCI controller registers in the PCI memory or I/O space. /// EFI_PCI_IO_PROTOCOL_IO_MEM Write; } EFI_PCI_IO_PROTOCOL_ACCESS; /** Enable a PCI driver to access PCI controller registers in PCI configuration space. @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @param Width Signifies the width of the memory operations. @param Offset The offset within the PCI configuration space for the PCI controller. @param Count The number of PCI configuration operations to perform. @param Buffer For read operations, the destination buffer to store the results. For write operations, the source buffer to write data from. @retval EFI_SUCCESS The data was read from or written to the PCI controller. @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not valid for the PCI configuration header of the PCI controller. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid. **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_CONFIG)( IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT32 Offset, IN UINTN Count, IN OUT VOID *Buffer ); typedef struct { /// /// Read PCI controller registers in PCI configuration space. /// EFI_PCI_IO_PROTOCOL_CONFIG Read; /// /// Write PCI controller registers in PCI configuration space. /// EFI_PCI_IO_PROTOCOL_CONFIG Write; } EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS; /** Enables a PCI driver to copy one region of PCI memory space to another region of PCI memory space. @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @param Width Signifies the width of the memory operations. @param DestBarIndex The BAR index in the standard PCI Configuration header to use as the base address for the memory operation to perform. @param DestOffset The destination offset within the BAR specified by DestBarIndex to start the memory writes for the copy operation. @param SrcBarIndex The BAR index in the standard PCI Configuration header to use as the base address for the memory operation to perform. @param SrcOffset The source offset within the BAR specified by SrcBarIndex to start the memory reads for the copy operation. @param Count The number of memory operations to perform. Bytes moved is Width size * Count, starting at DestOffset and SrcOffset. @retval EFI_SUCCESS The data was copied from one memory region to another memory region. @retval EFI_UNSUPPORTED DestBarIndex not valid for this PCI controller. @retval EFI_UNSUPPORTED SrcBarIndex not valid for this PCI controller. @retval EFI_UNSUPPORTED The address range specified by DestOffset, Width, and Count is not valid for the PCI BAR specified by DestBarIndex. @retval EFI_UNSUPPORTED The address range specified by SrcOffset, Width, and Count is not valid for the PCI BAR specified by SrcBarIndex. @retval EFI_INVALID_PARAMETER Width is invalid. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_COPY_MEM)( IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 DestBarIndex, IN UINT64 DestOffset, IN UINT8 SrcBarIndex, IN UINT64 SrcOffset, IN UINTN Count ); /** Provides the PCI controller-specific addresses needed to access system memory. @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @param Operation Indicates if the bus master is going to read or write to system memory. @param HostAddress The system memory address to map to the PCI controller. @param NumberOfBytes On input the number of bytes to map. On output the number of bytes that were mapped. @param DeviceAddress The resulting map address for the bus master PCI controller to use to access the hosts HostAddress. @param Mapping A resulting value to pass to Unmap(). @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes. @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer. @retval EFI_INVALID_PARAMETER One or more parameters are invalid. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. @retval EFI_DEVICE_ERROR The system hardware could not map the requested address. **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_MAP)( IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping ); /** Completes the Map() operation and releases any corresponding resources. @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @param Mapping The mapping value returned from Map(). @retval EFI_SUCCESS The range was unmapped. @retval EFI_DEVICE_ERROR The data was not committed to the target system memory. **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_UNMAP)( IN EFI_PCI_IO_PROTOCOL *This, IN VOID *Mapping ); /** Allocates pages that are suitable for an EfiPciIoOperationBusMasterCommonBuffer mapping. @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @param Type This parameter is not used and must be ignored. @param MemoryType The type of memory to allocate, EfiBootServicesData or EfiRuntimeServicesData. @param Pages The number of pages to allocate. @param HostAddress A pointer to store the base system memory address of the allocated range. @param Attributes The requested bit mask of attributes for the allocated range. @retval EFI_SUCCESS The requested memory pages were allocated. @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are MEMORY_WRITE_COMBINE and MEMORY_CACHED. @retval EFI_INVALID_PARAMETER One or more parameters are invalid. @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER)( IN EFI_PCI_IO_PROTOCOL *This, IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT VOID **HostAddress, IN UINT64 Attributes ); /** Frees memory that was allocated with AllocateBuffer(). @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @param Pages The number of pages to free. @param HostAddress The base system memory address of the allocated range. @retval EFI_SUCCESS The requested memory pages were freed. @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages was not allocated with AllocateBuffer(). **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_FREE_BUFFER)( IN EFI_PCI_IO_PROTOCOL *This, IN UINTN Pages, IN VOID *HostAddress ); /** Flushes all PCI posted write transactions from a PCI host bridge to system memory. @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @retval EFI_SUCCESS The PCI posted write transactions were flushed from the PCI host bridge to system memory. @retval EFI_DEVICE_ERROR The PCI posted write transactions were not flushed from the PCI host bridge due to a hardware error. **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_FLUSH)( IN EFI_PCI_IO_PROTOCOL *This ); /** Retrieves this PCI controller's current PCI bus number, device number, and function number. @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @param SegmentNumber The PCI controller's current PCI segment number. @param BusNumber The PCI controller's current PCI bus number. @param DeviceNumber The PCI controller's current PCI device number. @param FunctionNumber The PCI controller's current PCI function number. @retval EFI_SUCCESS The PCI controller location was returned. @retval EFI_INVALID_PARAMETER One or more parameters are invalid. **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_GET_LOCATION)( IN EFI_PCI_IO_PROTOCOL *This, OUT UINTN *SegmentNumber, OUT UINTN *BusNumber, OUT UINTN *DeviceNumber, OUT UINTN *FunctionNumber ); /** Performs an operation on the attributes that this PCI controller supports. The operations include getting the set of supported attributes, retrieving the current attributes, setting the current attributes, enabling attributes, and disabling attributes. @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @param Operation The operation to perform on the attributes for this PCI controller. @param Attributes The mask of attributes that are used for Set, Enable, and Disable operations. @param Result A pointer to the result mask of attributes that are returned for the Get and Supported operations. @retval EFI_SUCCESS The operation on the PCI controller's attributes was completed. @retval EFI_INVALID_PARAMETER One or more parameters are invalid. @retval EFI_UNSUPPORTED one or more of the bits set in Attributes are not supported by this PCI controller or one of its parent bridges when Operation is Set, Enable or Disable. **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES)( IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation, IN UINT64 Attributes, OUT UINT64 *Result OPTIONAL ); /** Gets the attributes that this PCI controller supports setting on a BAR using SetBarAttributes(), and retrieves the list of resource descriptors for a BAR. @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @param BarIndex The BAR index of the standard PCI Configuration header to use as the base address for resource range. The legal range for this field is 0..5. @param Supports A pointer to the mask of attributes that this PCI controller supports setting for this BAR with SetBarAttributes(). @param Resources A pointer to the ACPI 2.0 resource descriptors that describe the current configuration of this BAR of the PCI controller. @retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI controller supports are returned in Supports. If Resources is not NULL, then the ACPI 2.0 resource descriptors that the PCI controller is currently using are returned in Resources. @retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL. @retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller. @retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate Resources. **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES)( IN EFI_PCI_IO_PROTOCOL *This, IN UINT8 BarIndex, OUT UINT64 *Supports, OPTIONAL OUT VOID **Resources OPTIONAL ); /** Sets the attributes for a range of a BAR on a PCI controller. @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. @param Attributes The mask of attributes to set for the resource range specified by BarIndex, Offset, and Length. @param BarIndex The BAR index of the standard PCI Configuration header to use as the base address for resource range. The legal range for this field is 0..5. @param Offset A pointer to the BAR relative base address of the resource range to be modified by the attributes specified by Attributes. @param Length A pointer to the length of the resource range to be modified by the attributes specified by Attributes. @retval EFI_SUCCESS The set of attributes specified by Attributes for the resource range specified by BarIndex, Offset, and Length were set on the PCI controller, and the actual resource range is returned in Offset and Length. @retval EFI_INVALID_PARAMETER Offset or Length is NULL. @retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller. @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the attributes on the resource range specified by BarIndex, Offset, and Length. **/ typedef EFI_STATUS (EFIAPI *EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES)( IN EFI_PCI_IO_PROTOCOL *This, IN UINT64 Attributes, IN UINT8 BarIndex, IN OUT UINT64 *Offset, IN OUT UINT64 *Length ); /// /// The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration, /// and DMA interfaces used to abstract accesses to PCI controllers. /// There is one EFI_PCI_IO_PROTOCOL instance for each PCI controller on a PCI bus. /// A device driver that wishes to manage a PCI controller in a system will have to /// retrieve the EFI_PCI_IO_PROTOCOL instance that is associated with the PCI controller. /// struct _EFI_PCI_IO_PROTOCOL { EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollMem; EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollIo; EFI_PCI_IO_PROTOCOL_ACCESS Mem; EFI_PCI_IO_PROTOCOL_ACCESS Io; EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci; EFI_PCI_IO_PROTOCOL_COPY_MEM CopyMem; EFI_PCI_IO_PROTOCOL_MAP Map; EFI_PCI_IO_PROTOCOL_UNMAP Unmap; EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer; EFI_PCI_IO_PROTOCOL_FREE_BUFFER FreeBuffer; EFI_PCI_IO_PROTOCOL_FLUSH Flush; EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation; EFI_PCI_IO_PROTOCOL_ATTRIBUTES Attributes; EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES GetBarAttributes; EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES SetBarAttributes; /// /// The size, in bytes, of the ROM image. /// UINT64 RomSize; /// /// A pointer to the in memory copy of the ROM image. The PCI Bus Driver is responsible /// for allocating memory for the ROM image, and copying the contents of the ROM to memory. /// The contents of this buffer are either from the PCI option ROM that can be accessed /// through the ROM BAR of the PCI controller, or it is from a platform-specific location. /// The Attributes() function can be used to determine from which of these two sources /// the RomImage buffer was initialized. /// VOID *RomImage; }; extern EFI_GUID gEfiPciIoProtocolGuid; #endif Index: head/sys/boot/efi/include/efiprot.h =================================================================== --- head/sys/boot/efi/include/efiprot.h (revision 292622) +++ head/sys/boot/efi/include/efiprot.h (revision 292623) @@ -1,558 +1,558 @@ /* $FreeBSD$ */ #ifndef _EFI_PROT_H #define _EFI_PROT_H /*++ Copyright (c) 1999 - 2002 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: efiprot.h Abstract: EFI Protocols Revision History --*/ // // Device Path protocol // #define DEVICE_PATH_PROTOCOL \ { 0x9576e91, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } // // Block IO protocol // #define BLOCK_IO_PROTOCOL \ { 0x964e5b21, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } #define EFI_BLOCK_IO_INTERFACE_REVISION 0x00010000 INTERFACE_DECL(_EFI_BLOCK_IO); typedef EFI_STATUS (EFIAPI *EFI_BLOCK_RESET) ( IN struct _EFI_BLOCK_IO *This, IN BOOLEAN ExtendedVerification ); typedef EFI_STATUS (EFIAPI *EFI_BLOCK_READ) ( IN struct _EFI_BLOCK_IO *This, IN UINT32 MediaId, IN EFI_LBA LBA, IN UINTN BufferSize, OUT VOID *Buffer ); typedef EFI_STATUS (EFIAPI *EFI_BLOCK_WRITE) ( IN struct _EFI_BLOCK_IO *This, IN UINT32 MediaId, IN EFI_LBA LBA, IN UINTN BufferSize, IN VOID *Buffer ); typedef EFI_STATUS (EFIAPI *EFI_BLOCK_FLUSH) ( IN struct _EFI_BLOCK_IO *This ); typedef struct { UINT32 MediaId; BOOLEAN RemovableMedia; BOOLEAN MediaPresent; BOOLEAN LogicalPartition; BOOLEAN ReadOnly; BOOLEAN WriteCaching; UINT32 BlockSize; UINT32 IoAlign; EFI_LBA LastBlock; } EFI_BLOCK_IO_MEDIA; typedef struct _EFI_BLOCK_IO { UINT64 Revision; EFI_BLOCK_IO_MEDIA *Media; EFI_BLOCK_RESET Reset; EFI_BLOCK_READ ReadBlocks; EFI_BLOCK_WRITE WriteBlocks; EFI_BLOCK_FLUSH FlushBlocks; } EFI_BLOCK_IO; // // Disk Block IO protocol // #define DISK_IO_PROTOCOL \ { 0xce345171, 0xba0b, 0x11d2, 0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } #define EFI_DISK_IO_INTERFACE_REVISION 0x00010000 INTERFACE_DECL(_EFI_DISK_IO); typedef EFI_STATUS (EFIAPI *EFI_DISK_READ) ( IN struct _EFI_DISK_IO *This, IN UINT32 MediaId, IN UINT64 Offset, IN UINTN BufferSize, OUT VOID *Buffer ); typedef EFI_STATUS (EFIAPI *EFI_DISK_WRITE) ( IN struct _EFI_DISK_IO *This, IN UINT32 MediaId, IN UINT64 Offset, IN UINTN BufferSize, IN VOID *Buffer ); typedef struct _EFI_DISK_IO { UINT64 Revision; EFI_DISK_READ ReadDisk; EFI_DISK_WRITE WriteDisk; } EFI_DISK_IO; // // Simple file system protocol // #define SIMPLE_FILE_SYSTEM_PROTOCOL \ { 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } INTERFACE_DECL(_EFI_FILE_IO_INTERFACE); INTERFACE_DECL(_EFI_FILE_HANDLE); typedef EFI_STATUS (EFIAPI *EFI_VOLUME_OPEN) ( IN struct _EFI_FILE_IO_INTERFACE *This, OUT struct _EFI_FILE_HANDLE **Root ); #define EFI_FILE_IO_INTERFACE_REVISION 0x00010000 typedef struct _EFI_FILE_IO_INTERFACE { UINT64 Revision; EFI_VOLUME_OPEN OpenVolume; } EFI_FILE_IO_INTERFACE; // // // typedef EFI_STATUS (EFIAPI *EFI_FILE_OPEN) ( IN struct _EFI_FILE_HANDLE *File, OUT struct _EFI_FILE_HANDLE **NewHandle, IN CHAR16 *FileName, IN UINT64 OpenMode, IN UINT64 Attributes ); // Open modes #define EFI_FILE_MODE_READ 0x0000000000000001 #define EFI_FILE_MODE_WRITE 0x0000000000000002 #define EFI_FILE_MODE_CREATE 0x8000000000000000 // File attributes #define EFI_FILE_READ_ONLY 0x0000000000000001 #define EFI_FILE_HIDDEN 0x0000000000000002 #define EFI_FILE_SYSTEM 0x0000000000000004 #define EFI_FILE_RESERVIED 0x0000000000000008 #define EFI_FILE_DIRECTORY 0x0000000000000010 #define EFI_FILE_ARCHIVE 0x0000000000000020 #define EFI_FILE_VALID_ATTR 0x0000000000000037 typedef EFI_STATUS (EFIAPI *EFI_FILE_CLOSE) ( IN struct _EFI_FILE_HANDLE *File ); typedef EFI_STATUS (EFIAPI *EFI_FILE_DELETE) ( IN struct _EFI_FILE_HANDLE *File ); typedef EFI_STATUS (EFIAPI *EFI_FILE_READ) ( IN struct _EFI_FILE_HANDLE *File, IN OUT UINTN *BufferSize, OUT VOID *Buffer ); typedef EFI_STATUS (EFIAPI *EFI_FILE_WRITE) ( IN struct _EFI_FILE_HANDLE *File, IN OUT UINTN *BufferSize, IN VOID *Buffer ); typedef EFI_STATUS (EFIAPI *EFI_FILE_SET_POSITION) ( IN struct _EFI_FILE_HANDLE *File, IN UINT64 Position ); typedef EFI_STATUS (EFIAPI *EFI_FILE_GET_POSITION) ( IN struct _EFI_FILE_HANDLE *File, OUT UINT64 *Position ); typedef EFI_STATUS (EFIAPI *EFI_FILE_GET_INFO) ( IN struct _EFI_FILE_HANDLE *File, IN EFI_GUID *InformationType, IN OUT UINTN *BufferSize, OUT VOID *Buffer ); typedef EFI_STATUS (EFIAPI *EFI_FILE_SET_INFO) ( IN struct _EFI_FILE_HANDLE *File, IN EFI_GUID *InformationType, IN UINTN BufferSize, IN VOID *Buffer ); typedef EFI_STATUS (EFIAPI *EFI_FILE_FLUSH) ( IN struct _EFI_FILE_HANDLE *File ); #define EFI_FILE_HANDLE_REVISION 0x00010000 typedef struct _EFI_FILE_HANDLE { UINT64 Revision; EFI_FILE_OPEN Open; EFI_FILE_CLOSE Close; EFI_FILE_DELETE Delete; EFI_FILE_READ Read; EFI_FILE_WRITE Write; EFI_FILE_GET_POSITION GetPosition; EFI_FILE_SET_POSITION SetPosition; EFI_FILE_GET_INFO GetInfo; EFI_FILE_SET_INFO SetInfo; EFI_FILE_FLUSH Flush; } EFI_FILE, *EFI_FILE_HANDLE; // // File information types // #define EFI_FILE_INFO_ID \ { 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } typedef struct { UINT64 Size; UINT64 FileSize; UINT64 PhysicalSize; EFI_TIME CreateTime; EFI_TIME LastAccessTime; EFI_TIME ModificationTime; UINT64 Attribute; CHAR16 FileName[1]; } EFI_FILE_INFO; // // The FileName field of the EFI_FILE_INFO data structure is variable length. // Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to -// be the size of the data structure without the FileName field. The following macro +// be the size of the data structure without the FileName field. The following macro // computes this size correctly no matter how big the FileName array is declared. -// This is required to make the EFI_FILE_INFO data structure ANSI compilant. +// This is required to make the EFI_FILE_INFO data structure ANSI compilant. // #define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName) #define EFI_FILE_SYSTEM_INFO_ID \ { 0x9576e93, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } typedef struct { UINT64 Size; BOOLEAN ReadOnly; UINT64 VolumeSize; UINT64 FreeSpace; UINT32 BlockSize; CHAR16 VolumeLabel[1]; } EFI_FILE_SYSTEM_INFO; // // The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length. // Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs -// to be the size of the data structure without the VolumeLable field. The following macro +// to be the size of the data structure without the VolumeLable field. The following macro // computes this size correctly no matter how big the VolumeLable array is declared. -// This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant. +// This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant. // #define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel) #define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \ { 0xDB47D7D3,0xFE81, 0x11d3, 0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } typedef struct { CHAR16 VolumeLabel[1]; } EFI_FILE_SYSTEM_VOLUME_LABEL_INFO; #define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel) // // Load file protocol // #define LOAD_FILE_PROTOCOL \ { 0x56EC3091, 0x954C, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE); typedef EFI_STATUS (EFIAPI *EFI_LOAD_FILE) ( IN struct _EFI_LOAD_FILE_INTERFACE *This, IN EFI_DEVICE_PATH *FilePath, IN BOOLEAN BootPolicy, IN OUT UINTN *BufferSize, IN VOID *Buffer OPTIONAL ); typedef struct _EFI_LOAD_FILE_INTERFACE { EFI_LOAD_FILE LoadFile; } EFI_LOAD_FILE_INTERFACE; // // Device IO protocol // #define DEVICE_IO_PROTOCOL \ { 0xaf6ac311, 0x84c3, 0x11d2, 0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE); typedef enum { IO_UINT8, IO_UINT16, IO_UINT32, IO_UINT64, // // Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO // MMIO_COPY_UINT8, MMIO_COPY_UINT16, MMIO_COPY_UINT32, MMIO_COPY_UINT64 } EFI_IO_WIDTH; #define EFI_PCI_ADDRESS(bus,dev,func,reg) \ ( (UINT64) ( (((UINTN)bus) << 24) + (((UINTN)dev) << 16) + (((UINTN)func) << 8) + ((UINTN)reg) )) typedef EFI_STATUS (EFIAPI *EFI_DEVICE_IO) ( IN struct _EFI_DEVICE_IO_INTERFACE *This, IN EFI_IO_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT VOID *Buffer ); typedef struct { EFI_DEVICE_IO Read; EFI_DEVICE_IO Write; } EFI_IO_ACCESS; -typedef +typedef EFI_STATUS (EFIAPI *EFI_PCI_DEVICE_PATH) ( IN struct _EFI_DEVICE_IO_INTERFACE *This, IN UINT64 Address, IN OUT EFI_DEVICE_PATH **PciDevicePath ); typedef enum { EfiBusMasterRead, EfiBusMasterWrite, EfiBusMasterCommonBuffer } EFI_IO_OPERATION_TYPE; typedef EFI_STATUS (EFIAPI *EFI_IO_MAP) ( IN struct _EFI_DEVICE_IO_INTERFACE *This, IN EFI_IO_OPERATION_TYPE Operation, IN EFI_PHYSICAL_ADDRESS *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping ); typedef EFI_STATUS (EFIAPI *EFI_IO_UNMAP) ( IN struct _EFI_DEVICE_IO_INTERFACE *This, IN VOID *Mapping ); typedef EFI_STATUS (EFIAPI *EFI_IO_ALLOCATE_BUFFER) ( IN struct _EFI_DEVICE_IO_INTERFACE *This, IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, IN OUT EFI_PHYSICAL_ADDRESS *HostAddress ); typedef EFI_STATUS (EFIAPI *EFI_IO_FLUSH) ( IN struct _EFI_DEVICE_IO_INTERFACE *This ); typedef EFI_STATUS (EFIAPI *EFI_IO_FREE_BUFFER) ( IN struct _EFI_DEVICE_IO_INTERFACE *This, IN UINTN Pages, IN EFI_PHYSICAL_ADDRESS HostAddress ); typedef struct _EFI_DEVICE_IO_INTERFACE { EFI_IO_ACCESS Mem; EFI_IO_ACCESS Io; EFI_IO_ACCESS Pci; EFI_IO_MAP Map; EFI_PCI_DEVICE_PATH PciDevicePath; EFI_IO_UNMAP Unmap; EFI_IO_ALLOCATE_BUFFER AllocateBuffer; EFI_IO_FLUSH Flush; EFI_IO_FREE_BUFFER FreeBuffer; } EFI_DEVICE_IO_INTERFACE; // // Unicode Collation protocol // #define UNICODE_COLLATION_PROTOCOL \ { 0x1d85cd7f, 0xf43d, 0x11d2, 0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } #define UNICODE_BYTE_ORDER_MARK (CHAR16)(0xfeff) INTERFACE_DECL(_EFI_UNICODE_COLLATION_INTERFACE); typedef INTN (EFIAPI *EFI_UNICODE_COLLATION_STRICOLL) ( IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, IN CHAR16 *s1, IN CHAR16 *s2 ); typedef BOOLEAN (EFIAPI *EFI_UNICODE_COLLATION_METAIMATCH) ( IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, IN CHAR16 *String, IN CHAR16 *Pattern ); typedef VOID (EFIAPI *EFI_UNICODE_COLLATION_STRLWR) ( IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, IN OUT CHAR16 *Str ); typedef VOID (EFIAPI *EFI_UNICODE_COLLATION_STRUPR) ( IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, IN OUT CHAR16 *Str ); typedef VOID (EFIAPI *EFI_UNICODE_COLLATION_FATTOSTR) ( IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, IN UINTN FatSize, IN CHAR8 *Fat, OUT CHAR16 *String ); typedef BOOLEAN (EFIAPI *EFI_UNICODE_COLLATION_STRTOFAT) ( IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, IN CHAR16 *String, IN UINTN FatSize, OUT CHAR8 *Fat ); typedef struct _EFI_UNICODE_COLLATION_INTERFACE { // general EFI_UNICODE_COLLATION_STRICOLL StriColl; EFI_UNICODE_COLLATION_METAIMATCH MetaiMatch; EFI_UNICODE_COLLATION_STRLWR StrLwr; EFI_UNICODE_COLLATION_STRUPR StrUpr; // for supporting fat volumes EFI_UNICODE_COLLATION_FATTOSTR FatToStr; EFI_UNICODE_COLLATION_STRTOFAT StrToFat; CHAR8 *SupportedLanguages; } EFI_UNICODE_COLLATION_INTERFACE; #endif Index: head/sys/boot/efi/include/efipxebc.h =================================================================== --- head/sys/boot/efi/include/efipxebc.h (revision 292622) +++ head/sys/boot/efi/include/efipxebc.h (revision 292623) @@ -1,472 +1,472 @@ /* $FreeBSD$ */ #ifndef _EFIPXEBC_H #define _EFIPXEBC_H /*++ Copyright (c) 1999 - 2002 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: efipxebc.h Abstract: EFI PXE Base Code Protocol Revision History --*/ // // PXE Base Code protocol // #define EFI_PXE_BASE_CODE_PROTOCOL \ { 0x03c4e603, 0xac28, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } INTERFACE_DECL(_EFI_PXE_BASE_CODE); #define DEFAULT_TTL 8 #define DEFAULT_ToS 0 // // Address definitions // typedef union { UINT32 Addr[4]; EFI_IPv4_ADDRESS v4; EFI_IPv6_ADDRESS v6; } EFI_IP_ADDRESS; typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT; // // Packet definitions // typedef struct { UINT8 BootpOpcode; UINT8 BootpHwType; UINT8 BootpHwAddrLen; UINT8 BootpGateHops; UINT32 BootpIdent; UINT16 BootpSeconds; UINT16 BootpFlags; UINT8 BootpCiAddr[4]; UINT8 BootpYiAddr[4]; UINT8 BootpSiAddr[4]; UINT8 BootpGiAddr[4]; UINT8 BootpHwAddr[16]; UINT8 BootpSrvName[64]; UINT8 BootpBootFile[128]; UINT32 DhcpMagik; UINT8 DhcpOptions[56]; } EFI_PXE_BASE_CODE_DHCPV4_PACKET; // TBD in EFI v1.1 //typedef struct { // UINT8 reserved; //} EFI_PXE_BASE_CODE_DHCPV6_PACKET; typedef union { UINT8 Raw[1472]; EFI_PXE_BASE_CODE_DHCPV4_PACKET Dhcpv4; // EFI_PXE_BASE_CODE_DHCPV6_PACKET Dhcpv6; } EFI_PXE_BASE_CODE_PACKET; typedef struct { UINT8 Type; UINT8 Code; UINT16 Checksum; union { UINT32 reserved; UINT32 Mtu; UINT32 Pointer; struct { UINT16 Identifier; UINT16 Sequence; } Echo; } u; UINT8 Data[494]; } EFI_PXE_BASE_CODE_ICMP_ERROR; typedef struct { UINT8 ErrorCode; CHAR8 ErrorString[127]; } EFI_PXE_BASE_CODE_TFTP_ERROR; // // IP Receive Filter definitions // #define EFI_PXE_BASE_CODE_MAX_IPCNT 8 typedef struct { UINT8 Filters; UINT8 IpCnt; UINT16 reserved; EFI_IP_ADDRESS IpList[EFI_PXE_BASE_CODE_MAX_IPCNT]; } EFI_PXE_BASE_CODE_IP_FILTER; #define EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP 0x0001 #define EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST 0x0002 #define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS 0x0004 #define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST 0x0008 // // ARP Cache definitions // typedef struct { EFI_IP_ADDRESS IpAddr; EFI_MAC_ADDRESS MacAddr; } EFI_PXE_BASE_CODE_ARP_ENTRY; typedef struct { EFI_IP_ADDRESS IpAddr; EFI_IP_ADDRESS SubnetMask; EFI_IP_ADDRESS GwAddr; } EFI_PXE_BASE_CODE_ROUTE_ENTRY; // // UDP definitions // #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP 0x0001 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT 0x0002 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP 0x0004 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT 0x0008 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER 0x0010 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT 0x0020 // // Discover() definitions // -#define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP 0 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP 0 #define EFI_PXE_BASE_CODE_BOOT_TYPE_MS_WINNT_RIS 1 #define EFI_PXE_BASE_CODE_BOOT_TYPE_INTEL_LCM 2 #define EFI_PXE_BASE_CODE_BOOT_TYPE_DOSUNDI 3 #define EFI_PXE_BASE_CODE_BOOT_TYPE_NEC_ESMPRO 4 #define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_WSoD 5 #define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_LCCM 6 #define EFI_PXE_BASE_CODE_BOOT_TYPE_CA_UNICENTER_TNG 7 #define EFI_PXE_BASE_CODE_BOOT_TYPE_HP_OPENVIEW 8 #define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_9 9 #define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_10 10 #define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_11 11 #define EFI_PXE_BASE_CODE_BOOT_TYPE_NOT_USED_12 12 #define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_INSTALL 13 #define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_BOOT 14 #define EFI_PXE_BASE_CODE_BOOT_TYPE_REMBO 15 #define EFI_PXE_BASE_CODE_BOOT_TYPE_BEOBOOT 16 // // 17 through 32767 are reserved // 32768 through 65279 are for vendor use // 65280 through 65534 are reserved // #define EFI_PXE_BASE_CODE_BOOT_TYPE_PXETEST 65535 #define EFI_PXE_BASE_CODE_BOOT_LAYER_MASK 0x7FFF #define EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL 0x0000 #define EFI_PXE_BASE_CODE_BOOT_LAYER_CREDENTIALS 0x8000 typedef struct { UINT16 Type; BOOLEAN AcceptAnyResponse; UINT8 Reserved; EFI_IP_ADDRESS IpAddr; } EFI_PXE_BASE_CODE_SRVLIST; typedef struct { BOOLEAN UseMCast; BOOLEAN UseBCast; BOOLEAN UseUCast; BOOLEAN MustUseList; EFI_IP_ADDRESS ServerMCastIp; UINT16 IpCnt; EFI_PXE_BASE_CODE_SRVLIST SrvList[1]; } EFI_PXE_BASE_CODE_DISCOVER_INFO; // // Mtftp() definitions // typedef enum { EFI_PXE_BASE_CODE_TFTP_FIRST, EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, EFI_PXE_BASE_CODE_TFTP_READ_FILE, EFI_PXE_BASE_CODE_TFTP_WRITE_FILE, EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY, EFI_PXE_BASE_CODE_MTFTP_GET_FILE_SIZE, EFI_PXE_BASE_CODE_MTFTP_READ_FILE, EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY, EFI_PXE_BASE_CODE_MTFTP_LAST } EFI_PXE_BASE_CODE_TFTP_OPCODE; typedef struct { EFI_IP_ADDRESS MCastIp; EFI_PXE_BASE_CODE_UDP_PORT CPort; EFI_PXE_BASE_CODE_UDP_PORT SPort; UINT16 ListenTimeout; UINT16 TransmitTimeout; } EFI_PXE_BASE_CODE_MTFTP_INFO; // // PXE Base Code Mode structure // #define EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8 #define EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8 typedef struct { BOOLEAN Started; BOOLEAN Ipv6Available; BOOLEAN Ipv6Supported; BOOLEAN UsingIpv6; BOOLEAN BisSupported; BOOLEAN BisDetected; BOOLEAN AutoArp; BOOLEAN SendGUID; BOOLEAN DhcpDiscoverValid; BOOLEAN DhcpAckReceived; BOOLEAN ProxyOfferReceived; BOOLEAN PxeDiscoverValid; BOOLEAN PxeReplyReceived; BOOLEAN PxeBisReplyReceived; BOOLEAN IcmpErrorReceived; BOOLEAN TftpErrorReceived; BOOLEAN MakeCallbacks; UINT8 TTL; UINT8 ToS; EFI_IP_ADDRESS StationIp; EFI_IP_ADDRESS SubnetMask; EFI_PXE_BASE_CODE_PACKET DhcpDiscover; EFI_PXE_BASE_CODE_PACKET DhcpAck; EFI_PXE_BASE_CODE_PACKET ProxyOffer; EFI_PXE_BASE_CODE_PACKET PxeDiscover; EFI_PXE_BASE_CODE_PACKET PxeReply; EFI_PXE_BASE_CODE_PACKET PxeBisReply; EFI_PXE_BASE_CODE_IP_FILTER IpFilter; UINT32 ArpCacheEntries; EFI_PXE_BASE_CODE_ARP_ENTRY ArpCache[EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES]; UINT32 RouteTableEntries; EFI_PXE_BASE_CODE_ROUTE_ENTRY RouteTable[EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES]; EFI_PXE_BASE_CODE_ICMP_ERROR IcmpError; EFI_PXE_BASE_CODE_TFTP_ERROR TftpError; } EFI_PXE_BASE_CODE_MODE; // // PXE Base Code Interface Function definitions // typedef EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_START) ( IN struct _EFI_PXE_BASE_CODE *This, IN BOOLEAN UseIpv6 ); typedef EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_STOP) ( IN struct _EFI_PXE_BASE_CODE *This ); typedef EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_DHCP) ( IN struct _EFI_PXE_BASE_CODE *This, IN BOOLEAN SortOffers ); typedef EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_DISCOVER) ( IN struct _EFI_PXE_BASE_CODE *This, IN UINT16 Type, IN UINT16 *Layer, IN BOOLEAN UseBis, IN OUT EFI_PXE_BASE_CODE_DISCOVER_INFO *Info OPTIONAL ); typedef EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_MTFTP) ( IN struct _EFI_PXE_BASE_CODE *This, IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation, IN OUT VOID *BufferPtr OPTIONAL, IN BOOLEAN Overwrite, IN OUT UINT64 *BufferSize, IN UINTN *BlockSize OPTIONAL, IN EFI_IP_ADDRESS *ServerIp, IN UINT8 *Filename, IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL, IN BOOLEAN DontUseBuffer ); typedef EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_UDP_WRITE) ( IN struct _EFI_PXE_BASE_CODE *This, IN UINT16 OpFlags, IN EFI_IP_ADDRESS *DestIp, IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort, IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL IN EFI_IP_ADDRESS *SrcIp, OPTIONAL IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL IN UINTN *HeaderSize, OPTIONAL IN VOID *HeaderPtr, OPTIONAL IN UINTN *BufferSize, IN VOID *BufferPtr ); typedef EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_UDP_READ) ( IN struct _EFI_PXE_BASE_CODE *This, IN UINT16 OpFlags, IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL IN UINTN *HeaderSize, OPTIONAL IN VOID *HeaderPtr, OPTIONAL IN OUT UINTN *BufferSize, IN VOID *BufferPtr ); typedef EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_SET_IP_FILTER) ( IN struct _EFI_PXE_BASE_CODE *This, IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter ); typedef EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_ARP) ( IN struct _EFI_PXE_BASE_CODE *This, - IN EFI_IP_ADDRESS *IpAddr, + IN EFI_IP_ADDRESS *IpAddr, IN EFI_MAC_ADDRESS *MacAddr OPTIONAL ); typedef EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_SET_PARAMETERS) ( IN struct _EFI_PXE_BASE_CODE *This, IN BOOLEAN *NewAutoArp, OPTIONAL IN BOOLEAN *NewSendGUID, OPTIONAL IN UINT8 *NewTTL, OPTIONAL IN UINT8 *NewToS, OPTIONAL IN BOOLEAN *NewMakeCallback OPTIONAL ); typedef EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_SET_STATION_IP) ( IN struct _EFI_PXE_BASE_CODE *This, IN EFI_IP_ADDRESS *NewStationIp, OPTIONAL IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL ); typedef EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_SET_PACKETS) ( IN struct _EFI_PXE_BASE_CODE *This, BOOLEAN *NewDhcpDiscoverValid, OPTIONAL BOOLEAN *NewDhcpAckReceived, OPTIONAL BOOLEAN *NewProxyOfferReceived, OPTIONAL BOOLEAN *NewPxeDiscoverValid, OPTIONAL BOOLEAN *NewPxeReplyReceived, OPTIONAL BOOLEAN *NewPxeBisReplyReceived,OPTIONAL IN EFI_PXE_BASE_CODE_PACKET *NewDhcpDiscover, OPTIONAL IN EFI_PXE_BASE_CODE_PACKET *NewDhcpAck, OPTIONAL IN EFI_PXE_BASE_CODE_PACKET *NewProxyOffer, OPTIONAL IN EFI_PXE_BASE_CODE_PACKET *NewPxeDiscover, OPTIONAL IN EFI_PXE_BASE_CODE_PACKET *NewPxeReply, OPTIONAL IN EFI_PXE_BASE_CODE_PACKET *NewPxeBisReply OPTIONAL ); // // PXE Base Code Protocol structure // #define EFI_PXE_BASE_CODE_INTERFACE_REVISION 0x00010000 typedef struct _EFI_PXE_BASE_CODE { UINT64 Revision; EFI_PXE_BASE_CODE_START Start; EFI_PXE_BASE_CODE_STOP Stop; EFI_PXE_BASE_CODE_DHCP Dhcp; EFI_PXE_BASE_CODE_DISCOVER Discover; EFI_PXE_BASE_CODE_MTFTP Mtftp; EFI_PXE_BASE_CODE_UDP_WRITE UdpWrite; EFI_PXE_BASE_CODE_UDP_READ UdpRead; EFI_PXE_BASE_CODE_SET_IP_FILTER SetIpFilter; EFI_PXE_BASE_CODE_ARP Arp; EFI_PXE_BASE_CODE_SET_PARAMETERS SetParameters; EFI_PXE_BASE_CODE_SET_STATION_IP SetStationIp; EFI_PXE_BASE_CODE_SET_PACKETS SetPackets; EFI_PXE_BASE_CODE_MODE *Mode; } EFI_PXE_BASE_CODE; // // Call Back Definitions // #define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL \ { 0x245dca21, 0xfb7b, 0x11d3, 0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } // // Revision Number // #define EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION 0x00010000 INTERFACE_DECL(_EFI_PXE_BASE_CODE_CALLBACK); typedef enum { EFI_PXE_BASE_CODE_FUNCTION_FIRST, EFI_PXE_BASE_CODE_FUNCTION_DHCP, EFI_PXE_BASE_CODE_FUNCTION_DISCOVER, EFI_PXE_BASE_CODE_FUNCTION_MTFTP, EFI_PXE_BASE_CODE_FUNCTION_UDP_WRITE, EFI_PXE_BASE_CODE_FUNCTION_UDP_READ, EFI_PXE_BASE_CODE_FUNCTION_ARP, EFI_PXE_BASE_CODE_FUNCTION_IGMP, EFI_PXE_BASE_CODE_PXE_FUNCTION_LAST } EFI_PXE_BASE_CODE_FUNCTION; typedef enum { EFI_PXE_BASE_CODE_CALLBACK_STATUS_FIRST, EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT, EFI_PXE_BASE_CODE_CALLBACK_STATUS_LAST } EFI_PXE_BASE_CODE_CALLBACK_STATUS; typedef -EFI_PXE_BASE_CODE_CALLBACK_STATUS +EFI_PXE_BASE_CODE_CALLBACK_STATUS (EFIAPI *EFI_PXE_CALLBACK) ( IN struct _EFI_PXE_BASE_CODE_CALLBACK *This, IN EFI_PXE_BASE_CODE_FUNCTION Function, IN BOOLEAN Received, IN UINT32 PacketLen, IN EFI_PXE_BASE_CODE_PACKET *Packet OPTIONAL ); typedef struct _EFI_PXE_BASE_CODE_CALLBACK { UINT64 Revision; EFI_PXE_CALLBACK Callback; } EFI_PXE_BASE_CODE_CALLBACK; #endif /* _EFIPXEBC_H */ Index: head/sys/boot/efi/include/efiser.h =================================================================== --- head/sys/boot/efi/include/efiser.h (revision 292622) +++ head/sys/boot/efi/include/efiser.h (revision 292623) @@ -1,139 +1,139 @@ /* $FreeBSD$ */ #ifndef _EFI_SER_H #define _EFI_SER_H /*++ Copyright (c) 1999 - 2002 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: efiser.h Abstract: EFI serial protocol Revision History --*/ // // Serial protocol // #define SERIAL_IO_PROTOCOL \ { 0xBB25CF6F, 0xF1D4, 0x11D2, 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD } INTERFACE_DECL(_SERIAL_IO_INTERFACE); typedef enum { - DefaultParity, - NoParity, + DefaultParity, + NoParity, EvenParity, OddParity, MarkParity, SpaceParity } EFI_PARITY_TYPE; typedef enum { - DefaultStopBits, + DefaultStopBits OneStopBit, // 1 stop bit OneFiveStopBits, // 1.5 stop bits TwoStopBits // 2 stop bits } EFI_STOP_BITS_TYPE; #define EFI_SERIAL_CLEAR_TO_SEND 0x0010 // RO #define EFI_SERIAL_DATA_SET_READY 0x0020 // RO #define EFI_SERIAL_RING_INDICATE 0x0040 // RO #define EFI_SERIAL_CARRIER_DETECT 0x0080 // RO #define EFI_SERIAL_REQUEST_TO_SEND 0x0002 // WO #define EFI_SERIAL_DATA_TERMINAL_READY 0x0001 // WO #define EFI_SERIAL_INPUT_BUFFER_EMPTY 0x0100 // RO #define EFI_SERIAL_OUTPUT_BUFFER_EMPTY 0x0200 // RO #define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE 0x1000 // RW #define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE 0x2000 // RW #define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE 0x4000 // RW typedef EFI_STATUS (EFIAPI *EFI_SERIAL_RESET) ( IN struct _SERIAL_IO_INTERFACE *This ); typedef EFI_STATUS (EFIAPI *EFI_SERIAL_SET_ATTRIBUTES) ( IN struct _SERIAL_IO_INTERFACE *This, IN UINT64 BaudRate, IN UINT32 ReceiveFifoDepth, IN UINT32 Timeout, IN EFI_PARITY_TYPE Parity, IN UINT8 DataBits, IN EFI_STOP_BITS_TYPE StopBits ); typedef EFI_STATUS (EFIAPI *EFI_SERIAL_SET_CONTROL_BITS) ( IN struct _SERIAL_IO_INTERFACE *This, IN UINT32 Control ); typedef EFI_STATUS (EFIAPI *EFI_SERIAL_GET_CONTROL_BITS) ( IN struct _SERIAL_IO_INTERFACE *This, OUT UINT32 *Control ); typedef EFI_STATUS (EFIAPI *EFI_SERIAL_WRITE) ( IN struct _SERIAL_IO_INTERFACE *This, IN OUT UINTN *BufferSize, IN VOID *Buffer ); typedef EFI_STATUS (EFIAPI *EFI_SERIAL_READ) ( IN struct _SERIAL_IO_INTERFACE *This, IN OUT UINTN *BufferSize, OUT VOID *Buffer ); typedef struct { UINT32 ControlMask; // current Attributes UINT32 Timeout; UINT64 BaudRate; UINT32 ReceiveFifoDepth; UINT32 DataBits; UINT32 Parity; UINT32 StopBits; } SERIAL_IO_MODE; #define SERIAL_IO_INTERFACE_REVISION 0x00010000 typedef struct _SERIAL_IO_INTERFACE { UINT32 Revision; EFI_SERIAL_RESET Reset; EFI_SERIAL_SET_ATTRIBUTES SetAttributes; EFI_SERIAL_SET_CONTROL_BITS SetControl; EFI_SERIAL_GET_CONTROL_BITS GetControl; EFI_SERIAL_WRITE Write; EFI_SERIAL_READ Read; SERIAL_IO_MODE *Mode; } SERIAL_IO_INTERFACE; #endif Index: head/sys/boot/efi/include/efiuga.h =================================================================== --- head/sys/boot/efi/include/efiuga.h (revision 292622) +++ head/sys/boot/efi/include/efiuga.h (revision 292623) @@ -1,170 +1,170 @@ /* $FreeBSD$ */ /** @file UGA Draw protocol from the EFI 1.1 specification. Abstraction of a very simple graphics device. Copyright (c) 2006 - 2008, 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. File name: UgaDraw.h **/ #ifndef __UGA_DRAW_H__ #define __UGA_DRAW_H__ #define EFI_UGA_DRAW_PROTOCOL_GUID \ { \ 0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \ } typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL; /** Return the current video mode information. @param This Protocol instance pointer. @param HorizontalResolution Current video horizontal resolution in pixels @param VerticalResolution Current video vertical resolution in pixels @param ColorDepth Current video color depth in bits per pixel @param RefreshRate Current video refresh rate in Hz. @retval EFI_SUCCESS Mode information returned. @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode () @retval EFI_INVALID_PARAMETER One of the input args was NULL. **/ typedef EFI_STATUS (EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE) ( IN EFI_UGA_DRAW_PROTOCOL *This, OUT UINT32 *HorizontalResolution, OUT UINT32 *VerticalResolution, OUT UINT32 *ColorDepth, OUT UINT32 *RefreshRate ) ; /** Return the current video mode information. @param This Protocol instance pointer. @param HorizontalResolution Current video horizontal resolution in pixels @param VerticalResolution Current video vertical resolution in pixels @param ColorDepth Current video color depth in bits per pixel @param RefreshRate Current video refresh rate in Hz. @retval EFI_SUCCESS Mode information returned. @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode () **/ typedef EFI_STATUS (EFIAPI *EFI_UGA_DRAW_PROTOCOL_SET_MODE) ( IN EFI_UGA_DRAW_PROTOCOL *This, IN UINT32 HorizontalResolution, IN UINT32 VerticalResolution, IN UINT32 ColorDepth, IN UINT32 RefreshRate ) ; typedef struct { UINT8 Blue; UINT8 Green; UINT8 Red; UINT8 Reserved; } EFI_UGA_PIXEL; typedef union { EFI_UGA_PIXEL Pixel; UINT32 Raw; } EFI_UGA_PIXEL_UNION; typedef enum { EfiUgaVideoFill, EfiUgaVideoToBltBuffer, EfiUgaBltBufferToVideo, EfiUgaVideoToVideo, EfiUgaBltMax } EFI_UGA_BLT_OPERATION; /** Type specifying a pointer to a function to perform an UGA Blt operation. The following table defines actions for BltOperations: - EfiUgaVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY) - directly to every pixel of the video display rectangle - (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). + EfiUgaVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY) + directly to every pixel of the video display rectangle + (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). Only one pixel will be used from the BltBuffer. Delta is NOT used. - EfiUgaVideoToBltBuffer - Read data from the video display rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in - the BltBuffer rectangle (DestinationX, DestinationY ) - (DestinationX + Width, DestinationY + Height). If DestinationX or - DestinationY is not zero then Delta must be set to the length in bytes + EfiUgaVideoToBltBuffer - Read data from the video display rectangle + (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in + the BltBuffer rectangle (DestinationX, DestinationY ) + (DestinationX + Width, DestinationY + Height). If DestinationX or + DestinationY is not zero then Delta must be set to the length in bytes of a row in the BltBuffer. - EfiUgaBltBufferToVideo - Write data from the BltBuffer rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the - video display rectangle (DestinationX, DestinationY) - (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is - not zero then Delta must be set to the length in bytes of a row in the + EfiUgaBltBufferToVideo - Write data from the BltBuffer rectangle + (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the + video display rectangle (DestinationX, DestinationY) + (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is + not zero then Delta must be set to the length in bytes of a row in the BltBuffer. EfiUgaVideoToVideo - Copy from the video display rectangle (SourceX, SourceY) - (SourceX + Width, SourceY + Height) .to the video display rectangle - (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). + (SourceX + Width, SourceY + Height) .to the video display rectangle + (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). The BltBuffer and Delta are not used in this mode. @param[in] This - Protocol instance pointer. - @param[in] BltBuffer - Buffer containing data to blit into video buffer. This + @param[in] BltBuffer - Buffer containing data to blit into video buffer. This buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL) @param[in] BltOperation - Operation to perform on BlitBuffer and video memory @param[in] SourceX - X coordinate of source for the BltBuffer. @param[in] SourceY - Y coordinate of source for the BltBuffer. @param[in] DestinationX - X coordinate of destination for the BltBuffer. @param[in] DestinationY - Y coordinate of destination for the BltBuffer. @param[in] Width - Width of rectangle in BltBuffer in pixels. @param[in] Height - Hight of rectangle in BltBuffer in pixels. @param[in] Delta - OPTIONAL - + @retval EFI_SUCCESS - The Blt operation completed. @retval EFI_INVALID_PARAMETER - BltOperation is not valid. @retval EFI_DEVICE_ERROR - A hardware error occured writting to the video buffer. --*/ typedef EFI_STATUS (EFIAPI *EFI_UGA_DRAW_PROTOCOL_BLT) ( IN EFI_UGA_DRAW_PROTOCOL * This, IN EFI_UGA_PIXEL * BltBuffer, OPTIONAL IN EFI_UGA_BLT_OPERATION BltOperation, IN UINTN SourceX, IN UINTN SourceY, IN UINTN DestinationX, IN UINTN DestinationY, IN UINTN Width, IN UINTN Height, IN UINTN Delta OPTIONAL ); struct _EFI_UGA_DRAW_PROTOCOL { EFI_UGA_DRAW_PROTOCOL_GET_MODE GetMode; EFI_UGA_DRAW_PROTOCOL_SET_MODE SetMode; EFI_UGA_DRAW_PROTOCOL_BLT Blt; }; extern EFI_GUID gEfiUgaDrawProtocolGuid; #endif Index: head/sys/boot/efi/include/i386/efibind.h =================================================================== --- head/sys/boot/efi/include/i386/efibind.h (revision 292622) +++ head/sys/boot/efi/include/i386/efibind.h (revision 292623) @@ -1,267 +1,267 @@ /* $FreeBSD$ */ /*++ Copyright (c) 1999 - 2003 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: efefind.h Abstract: EFI to compile bindings Revision History --*/ #pragma pack() #ifdef __FreeBSD__ #include #else // // Basic int types of various widths // #if (__STDC_VERSION__ < 199901L ) - // No ANSI C 1999/2000 stdint.h integer width declarations + // No ANSI C 1999/2000 stdint.h integer width declarations #if _MSC_EXTENSIONS - // Use Microsoft C compiler integer width declarations + // Use Microsoft C compiler integer width declarations typedef unsigned __int64 uint64_t; typedef __int64 int64_t; typedef unsigned __int32 uint32_t; typedef __int32 int32_t; typedef unsigned short uint16_t; typedef short int16_t; typedef unsigned char uint8_t; typedef char int8_t; - #else + #else #ifdef UNIX_LP64 - // Use LP64 programming model from C_FLAGS for integer width declarations + // Use LP64 programming model from C_FLAGS for integer width declarations typedef unsigned long uint64_t; typedef long int64_t; typedef unsigned int uint32_t; typedef int int32_t; typedef unsigned short uint16_t; typedef short int16_t; typedef unsigned char uint8_t; typedef char int8_t; #else - // Assume P64 programming model from C_FLAGS for integer width declarations + // Assume P64 programming model from C_FLAGS for integer width declarations typedef unsigned long long uint64_t; typedef long long int64_t; typedef unsigned int uint32_t; typedef int int32_t; typedef unsigned short uint16_t; typedef short int16_t; typedef unsigned char uint8_t; typedef char int8_t; #endif #endif #endif #endif /* __FreeBSD__ */ // // Basic EFI types of various widths // #ifndef ACPI_THREAD_ID /* ACPI's definitions are fine, use those */ #define ACPI_USE_SYSTEM_INTTYPES 1 /* Tell ACPI we've defined types */ typedef uint64_t UINT64; typedef int64_t INT64; #ifndef _BASETSD_H_ typedef uint32_t UINT32; typedef int32_t INT32; #endif typedef uint16_t UINT16; typedef int16_t INT16; typedef uint8_t UINT8; typedef int8_t INT8; #endif #undef VOID #define VOID void typedef int32_t INTN; typedef uint32_t UINTN; #ifdef EFI_NT_EMULATOR #define POST_CODE(_Data) -#else +#else #ifdef EFI_DEBUG #define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al #else #define POST_CODE(_Data) - #endif + #endif #endif #define EFIERR(a) (0x80000000 | a) #define EFI_ERROR_MASK 0x80000000 -#define EFIERR_OEM(a) (0xc0000000 | a) +#define EFIERR_OEM(a) (0xc0000000 | a) #define BAD_POINTER 0xFBFBFBFB #define MAX_ADDRESS 0xFFFFFFFF #define BREAKPOINT() __asm { int 3 } // // Pointers must be aligned to these address to function // #define MIN_ALIGNMENT_SIZE 4 #define ALIGN_VARIABLE(Value ,Adjustment) \ (UINTN)Adjustment = 0; \ if((UINTN)Value % MIN_ALIGNMENT_SIZE) \ (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ Value = (UINTN)Value + (UINTN)Adjustment // // Define macros to build data structure signatures from characters. // #define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) #define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) #define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) // // EFIAPI - prototype calling convention for EFI function pointers // BOOTSERVICE - prototype for implementation of a boot service interface // RUNTIMESERVICE - prototype for implementation of a runtime service interface // RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service -// RUNTIME_CODE - pragma macro for declaring runtime code +// RUNTIME_CODE - pragma macro for declaring runtime code // -#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options +#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options #if _MSC_EXTENSIONS - #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler + #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler #else - #define EFIAPI // Substitute expresion to force C calling convention + #define EFIAPI // Substitute expresion to force C calling convention #endif #endif #define BOOTSERVICE //#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a //#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a #define RUNTIMESERVICE #define RUNTIMEFUNCTION #define RUNTIME_CODE(a) alloc_text("rtcode", a) #define BEGIN_RUNTIME_DATA() data_seg("rtdata") #define END_RUNTIME_DATA() data_seg() #define VOLATILE volatile -#define MEMORY_FENCE() +#define MEMORY_FENCE() #ifdef EFI_NO_INTERFACE_DECL #define EFI_FORWARD_DECLARATION(x) #define EFI_INTERFACE_DECL(x) #else #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x #define EFI_INTERFACE_DECL(x) typedef struct x #endif #ifdef EFI_NT_EMULATOR // // To help ensure proper coding of integrated drivers, they are // compiled as DLLs. In NT they require a dll init entry pointer. // The macro puts a stub entry point into the DLL so it will load. // #define EFI_DRIVER_ENTRY_POINT(InitFunction) \ EFI_STATUS \ InitFunction ( \ EFI_HANDLE ImageHandle, \ EFI_SYSTEM_TABLE *SystemTable \ ); \ \ UINTN \ __stdcall \ _DllMainCRTStartup ( \ UINTN Inst, \ UINTN reason_for_call, \ VOID *rserved \ ) \ { \ return 1; \ } \ \ int \ __declspec( dllexport ) \ __cdecl \ InitializeDriver ( \ void *ImageHandle, \ void *SystemTable \ ) \ { \ return InitFunction(ImageHandle, SystemTable); \ } #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, NULL) + (_if)->LoadInternal(type, name, NULL) -#else // EFI_NT_EMULATOR +#else // EFI_NT_EMULATOR // // When build similiar to FW, then link everything together as // one big module. // #define EFI_DRIVER_ENTRY_POINT(InitFunction) #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ (_if)->LoadInternal(type, name, entry) -#endif // EFI_FW_NT +#endif // EFI_FW_NT #ifdef __FreeBSD__ #define INTERFACE_DECL(x) struct x #else // // Some compilers don't support the forward reference construct: // typedef struct XXXXX // // The following macro provide a workaround for such cases. // #ifdef NO_INTERFACE_DECL #define INTERFACE_DECL(x) #else #define INTERFACE_DECL(x) typedef struct x #endif #endif /* __FreeBSD__ */ #if _MSC_EXTENSIONS #pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP #endif Index: head/sys/boot/efi/include/i386/pe.h =================================================================== --- head/sys/boot/efi/include/i386/pe.h (revision 292622) +++ head/sys/boot/efi/include/i386/pe.h (revision 292623) @@ -1,630 +1,630 @@ /* $FreeBSD$ */ -/* +/* PE32+ header file */ #ifndef _PE_H #define _PE_H #define IMAGE_DOS_SIGNATURE 0x5A4D // MZ #define IMAGE_OS2_SIGNATURE 0x454E // NE #define IMAGE_OS2_SIGNATURE_LE 0x454C // LE -#define IMAGE_NT_SIGNATURE 0x00004550 // PE00 +#define IMAGE_NT_SIGNATURE 0x00004550 // PE00 #define IMAGE_EDOS_SIGNATURE 0x44454550 // PEED typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header UINT16 e_magic; // Magic number UINT16 e_cblp; // Bytes on last page of file UINT16 e_cp; // Pages in file UINT16 e_crlc; // Relocations UINT16 e_cparhdr; // Size of header in paragraphs UINT16 e_minalloc; // Minimum extra paragraphs needed UINT16 e_maxalloc; // Maximum extra paragraphs needed UINT16 e_ss; // Initial (relative) SS value UINT16 e_sp; // Initial SP value UINT16 e_csum; // Checksum UINT16 e_ip; // Initial IP value UINT16 e_cs; // Initial (relative) CS value UINT16 e_lfarlc; // File address of relocation table UINT16 e_ovno; // Overlay number UINT16 e_res[4]; // Reserved words UINT16 e_oemid; // OEM identifier (for e_oeminfo) UINT16 e_oeminfo; // OEM information; e_oemid specific UINT16 e_res2[10]; // Reserved words UINT32 e_lfanew; // File address of new exe header } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header UINT16 ne_magic; // Magic number UINT8 ne_ver; // Version number UINT8 ne_rev; // Revision number UINT16 ne_enttab; // Offset of Entry Table UINT16 ne_cbenttab; // Number of bytes in Entry Table UINT32 ne_crc; // Checksum of whole file UINT16 ne_flags; // Flag UINT16 UINT16 ne_autodata; // Automatic data segment number UINT16 ne_heap; // Initial heap allocation UINT16 ne_stack; // Initial stack allocation UINT32 ne_csip; // Initial CS:IP setting UINT32 ne_sssp; // Initial SS:SP setting UINT16 ne_cseg; // Count of file segments UINT16 ne_cmod; // Entries in Module Reference Table UINT16 ne_cbnrestab; // Size of non-resident name table UINT16 ne_segtab; // Offset of Segment Table UINT16 ne_rsrctab; // Offset of Resource Table UINT16 ne_restab; // Offset of resident name table UINT16 ne_modtab; // Offset of Module Reference Table UINT16 ne_imptab; // Offset of Imported Names Table UINT32 ne_nrestab; // Offset of Non-resident Names Table UINT16 ne_cmovent; // Count of movable entries UINT16 ne_align; // Segment alignment shift count UINT16 ne_cres; // Count of resource segments UINT8 ne_exetyp; // Target Operating system UINT8 ne_flagsothers; // Other .EXE flags UINT16 ne_pretthunks; // offset to return thunks UINT16 ne_psegrefbytes; // offset to segment ref. bytes UINT16 ne_swaparea; // Minimum code swap area size UINT16 ne_expver; // Expected Windows version number } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER; // // File header format. // typedef struct _IMAGE_FILE_HEADER { UINT16 Machine; UINT16 NumberOfSections; UINT32 TimeDateStamp; UINT32 PointerToSymbolTable; UINT32 NumberOfSymbols; UINT16 SizeOfOptionalHeader; UINT16 Characteristics; } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; #define IMAGE_SIZEOF_FILE_HEADER 20 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file. #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references). #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file. #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file. #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed. #define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine. #define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file #define IMAGE_FILE_SYSTEM 0x1000 // System File. #define IMAGE_FILE_DLL 0x2000 // File is a DLL. #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed. #define IMAGE_FILE_MACHINE_UNKNOWN 0 #define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386. #define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian #define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian #define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP #define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian #define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine // // Directory format. // typedef struct _IMAGE_DATA_DIRECTORY { UINT32 VirtualAddress; UINT32 Size; } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 // // Optional header format. // typedef struct _IMAGE_OPTIONAL_HEADER { // // Standard fields. // UINT16 Magic; UINT8 MajorLinkerVersion; UINT8 MinorLinkerVersion; UINT32 SizeOfCode; UINT32 SizeOfInitializedData; UINT32 SizeOfUninitializedData; UINT32 AddressOfEntryPoint; UINT32 BaseOfCode; UINT32 BaseOfData; - + // // NT additional fields. // UINT32 ImageBase; UINT32 SectionAlignment; UINT32 FileAlignment; UINT16 MajorOperatingSystemVersion; UINT16 MinorOperatingSystemVersion; UINT16 MajorImageVersion; UINT16 MinorImageVersion; UINT16 MajorSubsystemVersion; UINT16 MinorSubsystemVersion; UINT32 Reserved1; UINT32 SizeOfImage; UINT32 SizeOfHeaders; UINT32 CheckSum; UINT16 Subsystem; UINT16 DllCharacteristics; UINT32 SizeOfStackReserve; UINT32 SizeOfStackCommit; UINT32 SizeOfHeapReserve; UINT32 SizeOfHeapCommit; UINT32 LoaderFlags; UINT32 NumberOfRvaAndSizes; IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER; typedef struct _IMAGE_ROM_OPTIONAL_HEADER { UINT16 Magic; UINT8 MajorLinkerVersion; UINT8 MinorLinkerVersion; UINT32 SizeOfCode; UINT32 SizeOfInitializedData; UINT32 SizeOfUninitializedData; UINT32 AddressOfEntryPoint; UINT32 BaseOfCode; UINT32 BaseOfData; UINT32 BaseOfBss; UINT32 GprMask; UINT32 CprMask[4]; UINT32 GpValue; } IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER; #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 typedef struct _IMAGE_NT_HEADERS { UINT32 Signature; IMAGE_FILE_HEADER FileHeader; IMAGE_OPTIONAL_HEADER OptionalHeader; } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS; typedef struct _IMAGE_ROM_HEADERS { IMAGE_FILE_HEADER FileHeader; IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; } IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS; #define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \ ((UINT32)ntheader + \ FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \ ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \ )) // Subsystem Values #define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem. #define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem. #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem. #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem. #define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem. #define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix character subsystem. // Directory Entries #define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory #define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory #define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table #define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP) #define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory // // Section header format. // #define IMAGE_SIZEOF_SHORT_NAME 8 typedef struct _IMAGE_SECTION_HEADER { UINT8 Name[IMAGE_SIZEOF_SHORT_NAME]; union { UINT32 PhysicalAddress; UINT32 VirtualSize; } Misc; UINT32 VirtualAddress; UINT32 SizeOfRawData; UINT32 PointerToRawData; UINT32 PointerToRelocations; UINT32 PointerToLinenumbers; UINT16 NumberOfRelocations; UINT16 NumberOfLinenumbers; UINT32 Characteristics; } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; #define IMAGE_SIZEOF_SECTION_HEADER 40 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved. #define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code. #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data. #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data. #define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved. #define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information. #define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image. #define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat. #define IMAGE_SCN_ALIGN_1BYTES 0x00100000 // #define IMAGE_SCN_ALIGN_2BYTES 0x00200000 // #define IMAGE_SCN_ALIGN_4BYTES 0x00300000 // #define IMAGE_SCN_ALIGN_8BYTES 0x00400000 // #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified. #define IMAGE_SCN_ALIGN_32BYTES 0x00600000 // #define IMAGE_SCN_ALIGN_64BYTES 0x00700000 // #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded. #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable. #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable. #define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable. #define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable. #define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable. #define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable. // // Symbol format. // #define IMAGE_SIZEOF_SYMBOL 18 // // Section values. // // Symbols have a section number of the section in which they are // defined. Otherwise, section numbers have the following meanings: // #define IMAGE_SYM_UNDEFINED (UINT16)0 // Symbol is undefined or is common. #define IMAGE_SYM_ABSOLUTE (UINT16)-1 // Symbol is an absolute value. #define IMAGE_SYM_DEBUG (UINT16)-2 // Symbol is a special debug item. // // Type (fundamental) values. // #define IMAGE_SYM_TYPE_NULL 0 // no type. #define IMAGE_SYM_TYPE_VOID 1 // #define IMAGE_SYM_TYPE_CHAR 2 // type character. #define IMAGE_SYM_TYPE_SHORT 3 // type short integer. #define IMAGE_SYM_TYPE_INT 4 // #define IMAGE_SYM_TYPE_LONG 5 // #define IMAGE_SYM_TYPE_FLOAT 6 // #define IMAGE_SYM_TYPE_DOUBLE 7 // #define IMAGE_SYM_TYPE_STRUCT 8 // #define IMAGE_SYM_TYPE_UNION 9 // #define IMAGE_SYM_TYPE_ENUM 10 // enumeration. #define IMAGE_SYM_TYPE_MOE 11 // member of enumeration. #define IMAGE_SYM_TYPE_BYTE 12 // #define IMAGE_SYM_TYPE_WORD 13 // #define IMAGE_SYM_TYPE_UINT 14 // #define IMAGE_SYM_TYPE_DWORD 15 // // // Type (derived) values. // #define IMAGE_SYM_DTYPE_NULL 0 // no derived type. #define IMAGE_SYM_DTYPE_POINTER 1 // pointer. #define IMAGE_SYM_DTYPE_FUNCTION 2 // function. #define IMAGE_SYM_DTYPE_ARRAY 3 // array. // // Storage classes. // #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1 #define IMAGE_SYM_CLASS_NULL 0 #define IMAGE_SYM_CLASS_AUTOMATIC 1 #define IMAGE_SYM_CLASS_EXTERNAL 2 #define IMAGE_SYM_CLASS_STATIC 3 #define IMAGE_SYM_CLASS_REGISTER 4 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 5 #define IMAGE_SYM_CLASS_LABEL 6 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8 #define IMAGE_SYM_CLASS_ARGUMENT 9 #define IMAGE_SYM_CLASS_STRUCT_TAG 10 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11 #define IMAGE_SYM_CLASS_UNION_TAG 12 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 13 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14 #define IMAGE_SYM_CLASS_ENUM_TAG 15 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16 #define IMAGE_SYM_CLASS_REGISTER_PARAM 17 #define IMAGE_SYM_CLASS_BIT_FIELD 18 #define IMAGE_SYM_CLASS_BLOCK 100 #define IMAGE_SYM_CLASS_FUNCTION 101 #define IMAGE_SYM_CLASS_END_OF_STRUCT 102 #define IMAGE_SYM_CLASS_FILE 103 // new #define IMAGE_SYM_CLASS_SECTION 104 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105 // type packing constants #define N_BTMASK 017 #define N_TMASK 060 #define N_TMASK1 0300 #define N_TMASK2 0360 #define N_BTSHFT 4 #define N_TSHIFT 2 // MACROS // // Communal selection types. // #define IMAGE_COMDAT_SELECT_NODUPLICATES 1 #define IMAGE_COMDAT_SELECT_ANY 2 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 // // Relocation format. // typedef struct _IMAGE_RELOCATION { UINT32 VirtualAddress; UINT32 SymbolTableIndex; UINT16 Type; } IMAGE_RELOCATION; #define IMAGE_SIZEOF_RELOCATION 10 // // I386 relocation types. // #define IMAGE_REL_I386_ABSOLUTE 0 // Reference is absolute, no relocation is necessary #define IMAGE_REL_I386_DIR16 01 // Direct 16-bit reference to the symbols virtual address #define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit reference to the symbols virtual address #define IMAGE_REL_I386_DIR32 06 // Direct 32-bit reference to the symbols virtual address #define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit reference to the symbols virtual address, base not included #define IMAGE_REL_I386_SEG12 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address #define IMAGE_REL_I386_SECTION 012 #define IMAGE_REL_I386_SECREL 013 #define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address // // MIPS relocation types. // #define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is absolute, no relocation is necessary #define IMAGE_REL_MIPS_REFHALF 01 #define IMAGE_REL_MIPS_REFWORD 02 #define IMAGE_REL_MIPS_JMPADDR 03 #define IMAGE_REL_MIPS_REFHI 04 #define IMAGE_REL_MIPS_REFLO 05 #define IMAGE_REL_MIPS_GPREL 06 #define IMAGE_REL_MIPS_LITERAL 07 #define IMAGE_REL_MIPS_SECTION 012 #define IMAGE_REL_MIPS_SECREL 013 #define IMAGE_REL_MIPS_REFWORDNB 042 #define IMAGE_REL_MIPS_PAIR 045 // // Alpha Relocation types. // #define IMAGE_REL_ALPHA_ABSOLUTE 0x0 #define IMAGE_REL_ALPHA_REFLONG 0x1 #define IMAGE_REL_ALPHA_REFQUAD 0x2 #define IMAGE_REL_ALPHA_GPREL32 0x3 #define IMAGE_REL_ALPHA_LITERAL 0x4 #define IMAGE_REL_ALPHA_LITUSE 0x5 #define IMAGE_REL_ALPHA_GPDISP 0x6 #define IMAGE_REL_ALPHA_BRADDR 0x7 #define IMAGE_REL_ALPHA_HINT 0x8 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9 #define IMAGE_REL_ALPHA_REFHI 0xA #define IMAGE_REL_ALPHA_REFLO 0xB #define IMAGE_REL_ALPHA_PAIR 0xC #define IMAGE_REL_ALPHA_MATCH 0xD #define IMAGE_REL_ALPHA_SECTION 0xE #define IMAGE_REL_ALPHA_SECREL 0xF #define IMAGE_REL_ALPHA_REFLONGNB 0x10 // // IBM PowerPC relocation types. // #define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP #define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address #define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address #define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2 (branch absolute) #define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address #define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load doubleword) #define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted left 2 (branch relative) #define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted left 2 (br cond relative) #define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base #define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted left 2 (load doubleword) #define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base #define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an image sectionhdr) #define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number #define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction iff symbol is glue code #define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address is TOC restore instruction #define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in IMAGE_RELOCATION.Type // Flag bits in IMAGE_RELOCATION.TYPE #define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than adding it #define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict branch taken #define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict branch not taken #define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data in toc) // // Based relocation format. // typedef struct _IMAGE_BASE_RELOCATION { UINT32 VirtualAddress; UINT32 SizeOfBlock; // UINT16 TypeOffset[1]; } IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION; #define IMAGE_SIZEOF_BASE_RELOCATION 8 // // Based relocation types. // #define IMAGE_REL_BASED_ABSOLUTE 0 #define IMAGE_REL_BASED_HIGH 1 #define IMAGE_REL_BASED_LOW 2 #define IMAGE_REL_BASED_HIGHLOW 3 #define IMAGE_REL_BASED_HIGHADJ 4 #define IMAGE_REL_BASED_MIPS_JMPADDR 5 #define IMAGE_REL_BASED_DIR64 10 // // Line number format. // typedef struct _IMAGE_LINENUMBER { union { UINT32 SymbolTableIndex; // Symbol table index of function name if Linenumber is 0. UINT32 VirtualAddress; // Virtual address of line number. } Type; UINT16 Linenumber; // Line number. } IMAGE_LINENUMBER; #define IMAGE_SIZEOF_LINENUMBER 6 // // Archive format. // #define IMAGE_ARCHIVE_START_SIZE 8 #define IMAGE_ARCHIVE_START "!\n" #define IMAGE_ARCHIVE_END "`\n" #define IMAGE_ARCHIVE_PAD "\n" #define IMAGE_ARCHIVE_LINKER_MEMBER "/ " #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { UINT8 Name[16]; // File member name - `/' terminated. UINT8 Date[12]; // File member date - decimal. UINT8 UserID[6]; // File member user id - decimal. UINT8 GroupID[6]; // File member group id - decimal. UINT8 Mode[8]; // File member mode - octal. UINT8 Size[10]; // File member size - decimal. UINT8 EndHeader[2]; // String to end header. } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 // // DLL support. // // // Export Format // typedef struct _IMAGE_EXPORT_DIRECTORY { UINT32 Characteristics; UINT32 TimeDateStamp; UINT16 MajorVersion; UINT16 MinorVersion; UINT32 Name; UINT32 Base; UINT32 NumberOfFunctions; UINT32 NumberOfNames; UINT32 *AddressOfFunctions; UINT32 *AddressOfNames; UINT32 *AddressOfNameOrdinals; } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; // // Import Format // typedef struct _IMAGE_IMPORT_BY_NAME { UINT16 Hint; UINT8 Name[1]; } IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME; typedef struct _IMAGE_THUNK_DATA { union { UINT32 Function; UINT32 Ordinal; PIMAGE_IMPORT_BY_NAME AddressOfData; } u1; } IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA; #define IMAGE_ORDINAL_FLAG 0x80000000 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0) #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff) typedef struct _IMAGE_IMPORT_DESCRIPTOR { UINT32 Characteristics; UINT32 TimeDateStamp; UINT32 ForwarderChain; UINT32 Name; PIMAGE_THUNK_DATA FirstThunk; } IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR; #define IMAGE_DEBUG_TYPE_CODEVIEW 2 typedef struct { UINT32 Characteristics; UINT32 TimeDateStamp; UINT16 MajorVersion; UINT16 MinorVersion; UINT32 Type; UINT32 SizeOfData; UINT32 RVA; UINT32 FileOffset; } IMAGE_DEBUG_DIRECTORY_ENTRY; #define CODEVIEW_SIGNATURE_NB10 0x3031424E // "NB10" typedef struct { UINT32 Signature; // "NB10" UINT32 Unknown; UINT32 Unknown2; - UINT32 Unknown3; + UINT32 Unknown3; // // Filename of .PDB goes here // } EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY; #define CODEVIEW_SIGNATURE_RSDS 0x53445352 // "RSDS" typedef struct { UINT32 Signature; // "RSDS" UINT32 Unknown; UINT32 Unknown2; - UINT32 Unknown3; - UINT32 Unknown4; - UINT32 Unknown5; + UINT32 Unknown3; + UINT32 Unknown4; + UINT32 Unknown5; // // Filename of .PDB goes here // } EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY; #endif Index: head/sys/boot/efi/libefi/efinet.c =================================================================== --- head/sys/boot/efi/libefi/efinet.c (revision 292622) +++ head/sys/boot/efi/libefi/efinet.c (revision 292623) @@ -1,313 +1,313 @@ /*- * Copyright (c) 2001 Doug Rabson * Copyright (c) 2002, 2006 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include static EFI_GUID sn_guid = EFI_SIMPLE_NETWORK_PROTOCOL; static void efinet_end(struct netif *); static int efinet_get(struct iodesc *, void *, size_t, time_t); static void efinet_init(struct iodesc *, void *); static int efinet_match(struct netif *, void *); static int efinet_probe(struct netif *, void *); static int efinet_put(struct iodesc *, void *, size_t); -struct netif_driver efinetif = { +struct netif_driver efinetif = { .netif_bname = "efinet", .netif_match = efinet_match, .netif_probe = efinet_probe, .netif_init = efinet_init, .netif_get = efinet_get, .netif_put = efinet_put, .netif_end = efinet_end, .netif_ifs = NULL, .netif_nifs = 0 }; #ifdef EFINET_DEBUG static void dump_mode(EFI_SIMPLE_NETWORK_MODE *mode) { int i; printf("State = %x\n", mode->State); printf("HwAddressSize = %u\n", mode->HwAddressSize); printf("MediaHeaderSize = %u\n", mode->MediaHeaderSize); printf("MaxPacketSize = %u\n", mode->MaxPacketSize); printf("NvRamSize = %u\n", mode->NvRamSize); printf("NvRamAccessSize = %u\n", mode->NvRamAccessSize); printf("ReceiveFilterMask = %x\n", mode->ReceiveFilterMask); printf("ReceiveFilterSetting = %u\n", mode->ReceiveFilterSetting); printf("MaxMCastFilterCount = %u\n", mode->MaxMCastFilterCount); printf("MCastFilterCount = %u\n", mode->MCastFilterCount); printf("MCastFilter = {"); for (i = 0; i < mode->MCastFilterCount; i++) printf(" %s", ether_sprintf(mode->MCastFilter[i].Addr)); printf(" }\n"); printf("CurrentAddress = %s\n", ether_sprintf(mode->CurrentAddress.Addr)); printf("BroadcastAddress = %s\n", ether_sprintf(mode->BroadcastAddress.Addr)); printf("PermanentAddress = %s\n", ether_sprintf(mode->PermanentAddress.Addr)); printf("IfType = %u\n", mode->IfType); printf("MacAddressChangeable = %d\n", mode->MacAddressChangeable); printf("MultipleTxSupported = %d\n", mode->MultipleTxSupported); printf("MediaPresentSupported = %d\n", mode->MediaPresentSupported); printf("MediaPresent = %d\n", mode->MediaPresent); } #endif static int efinet_match(struct netif *nif, void *machdep_hint) { struct devdesc *dev = machdep_hint; if (dev->d_unit - 1 == nif->nif_unit) return (1); return(0); } static int efinet_probe(struct netif *nif, void *machdep_hint) { return (0); } static int efinet_put(struct iodesc *desc, void *pkt, size_t len) { struct netif *nif = desc->io_netif; EFI_SIMPLE_NETWORK *net; EFI_STATUS status; void *buf; net = nif->nif_devdata; status = net->Transmit(net, 0, len, pkt, 0, 0, 0); if (status != EFI_SUCCESS) return (-1); /* Wait for the buffer to be transmitted */ do { buf = 0; /* XXX Is this needed? */ status = net->GetStatus(net, 0, &buf); /* - * XXX EFI1.1 and the E1000 card returns a different + * XXX EFI1.1 and the E1000 card returns a different * address than we gave. Sigh. */ } while (status == EFI_SUCCESS && buf == 0); /* XXX How do we deal with status != EFI_SUCCESS now? */ return ((status == EFI_SUCCESS) ? len : -1); } static int efinet_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout) { struct netif *nif = desc->io_netif; EFI_SIMPLE_NETWORK *net; EFI_STATUS status; UINTN bufsz; time_t t; char buf[2048]; net = nif->nif_devdata; t = time(0); while ((time(0) - t) < timeout) { bufsz = sizeof(buf); status = net->Receive(net, 0, &bufsz, buf, 0, 0, 0); if (status == EFI_SUCCESS) { /* * XXX EFI1.1 and the E1000 card trash our * workspace if we do not do this silly copy. * Either they are not respecting the len * value or do not like the alignment. */ if (bufsz > len) bufsz = len; bcopy(buf, pkt, bufsz); return (bufsz); } if (status != EFI_NOT_READY) return (0); } return (0); } static void efinet_init(struct iodesc *desc, void *machdep_hint) { struct netif *nif = desc->io_netif; EFI_SIMPLE_NETWORK *net; EFI_HANDLE h; EFI_STATUS status; h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private; status = BS->HandleProtocol(h, &sn_guid, (VOID **)&nif->nif_devdata); if (status != EFI_SUCCESS) { printf("net%d: cannot start interface (status=%ld)\n", nif->nif_unit, (long)status); return; } net = nif->nif_devdata; if (net->Mode->State == EfiSimpleNetworkStopped) { status = net->Start(net); if (status != EFI_SUCCESS) { printf("net%d: cannot start interface (status=%ld)\n", nif->nif_unit, (long)status); return; } } if (net->Mode->State != EfiSimpleNetworkInitialized) { status = net->Initialize(net, 0, 0); if (status != EFI_SUCCESS) { printf("net%d: cannot init. interface (status=%ld)\n", nif->nif_unit, (long)status); return; } } if (net->Mode->ReceiveFilterSetting == 0) { UINT32 mask = EFI_SIMPLE_NETWORK_RECEIVE_UNICAST | EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST; status = net->ReceiveFilters(net, mask, 0, FALSE, 0, 0); if (status != EFI_SUCCESS) { printf("net%d: cannot set rx. filters (status=%ld)\n", nif->nif_unit, (long)status); return; } } #ifdef EFINET_DEBUG dump_mode(net->Mode); #endif bcopy(net->Mode->CurrentAddress.Addr, desc->myea, 6); desc->xid = 1; } static void efinet_end(struct netif *nif) { - EFI_SIMPLE_NETWORK *net = nif->nif_devdata; + EFI_SIMPLE_NETWORK *net = nif->nif_devdata; net->Shutdown(net); } static int efinet_dev_init(void); static void efinet_dev_print(int); struct devsw efinet_dev = { .dv_name = "net", .dv_type = DEVT_NET, .dv_init = efinet_dev_init, .dv_strategy = net_strategy, .dv_open = net_open, .dv_close = net_close, .dv_ioctl = noioctl, .dv_print = efinet_dev_print, .dv_cleanup = NULL }; static int efinet_dev_init() { struct netif_dif *dif; struct netif_stats *stats; EFI_HANDLE *handles; EFI_STATUS status; UINTN sz; int err, i, nifs; sz = 0; handles = NULL; status = BS->LocateHandle(ByProtocol, &sn_guid, 0, &sz, 0); if (status == EFI_BUFFER_TOO_SMALL) { handles = (EFI_HANDLE *)malloc(sz); status = BS->LocateHandle(ByProtocol, &sn_guid, 0, &sz, handles); if (EFI_ERROR(status)) free(handles); } if (EFI_ERROR(status)) return (efi_status_to_errno(status)); nifs = sz / sizeof(EFI_HANDLE); err = efi_register_handles(&efinet_dev, handles, NULL, nifs); free(handles); if (err != 0) return (err); efinetif.netif_nifs = nifs; efinetif.netif_ifs = calloc(nifs, sizeof(struct netif_dif)); stats = calloc(nifs, sizeof(struct netif_stats)); for (i = 0; i < nifs; i++) { dif = &efinetif.netif_ifs[i]; dif->dif_unit = i; dif->dif_nsel = 1; dif->dif_stats = &stats[i]; dif->dif_private = efi_find_handle(&efinet_dev, i); } return (0); } static void efinet_dev_print(int verbose) { char line[80]; EFI_HANDLE h; int unit; for (unit = 0, h = efi_find_handle(&efinet_dev, 0); h != NULL; h = efi_find_handle(&efinet_dev, ++unit)) { sprintf(line, " %s%d:\n", efinet_dev.dv_name, unit); pager_output(line); } } Index: head/sys/boot/efi/libefi/efipart.c =================================================================== --- head/sys/boot/efi/libefi/efipart.c (revision 292622) +++ head/sys/boot/efi/libefi/efipart.c (revision 292623) @@ -1,313 +1,313 @@ /*- * Copyright (c) 2010 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL; static EFI_GUID devpath_guid = DEVICE_PATH_PROTOCOL; static int efipart_init(void); static int efipart_strategy(void *, int, daddr_t, size_t, char *, size_t *); static int efipart_open(struct open_file *, ...); static int efipart_close(struct open_file *); static void efipart_print(int); struct devsw efipart_dev = { .dv_name = "part", .dv_type = DEVT_DISK, .dv_init = efipart_init, .dv_strategy = efipart_strategy, .dv_open = efipart_open, .dv_close = efipart_close, .dv_ioctl = noioctl, .dv_print = efipart_print, .dv_cleanup = NULL }; static int -efipart_init(void) +efipart_init(void) { EFI_BLOCK_IO *blkio; EFI_DEVICE_PATH *devpath, *devpathcpy, *tmpdevpath, *node; EFI_HANDLE *hin, *hout, *aliases, handle; EFI_STATUS status; UINTN sz; CHAR16 *path; u_int n, nin, nout; int err; size_t devpathlen; sz = 0; hin = NULL; status = BS->LocateHandle(ByProtocol, &blkio_guid, 0, &sz, 0); if (status == EFI_BUFFER_TOO_SMALL) { hin = (EFI_HANDLE *)malloc(sz * 3); status = BS->LocateHandle(ByProtocol, &blkio_guid, 0, &sz, hin); if (EFI_ERROR(status)) free(hin); } if (EFI_ERROR(status)) return (efi_status_to_errno(status)); /* Filter handles to only include FreeBSD partitions. */ nin = sz / sizeof(EFI_HANDLE); hout = hin + nin; aliases = hout + nin; nout = 0; bzero(aliases, nin * sizeof(EFI_HANDLE)); for (n = 0; n < nin; n++) { status = BS->HandleProtocol(hin[n], &devpath_guid, (void **)&devpath); if (EFI_ERROR(status)) { continue; } node = devpath; devpathlen = DevicePathNodeLength(node); while (!IsDevicePathEnd(NextDevicePathNode(node))) { node = NextDevicePathNode(node); devpathlen += DevicePathNodeLength(node); } devpathlen += DevicePathNodeLength(NextDevicePathNode(node)); status = BS->HandleProtocol(hin[n], &blkio_guid, (void**)&blkio); if (EFI_ERROR(status)) continue; if (!blkio->Media->LogicalPartition) continue; /* * If we come across a logical partition of subtype CDROM * it doesn't refer to the CD filesystem itself, but rather * to any usable El Torito boot image on it. In this case * we try to find the parent device and add that instead as * that will be the CD filesystem. */ if (DevicePathType(node) == MEDIA_DEVICE_PATH && DevicePathSubType(node) == MEDIA_CDROM_DP) { devpathcpy = malloc(devpathlen); memcpy(devpathcpy, devpath, devpathlen); node = devpathcpy; while (!IsDevicePathEnd(NextDevicePathNode(node))) node = NextDevicePathNode(node); SetDevicePathEndNode(node); tmpdevpath = devpathcpy; status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath, &handle); free(devpathcpy); if (EFI_ERROR(status)) continue; hout[nout] = handle; aliases[nout] = hin[n]; } else hout[nout] = hin[n]; nout++; } err = efi_register_handles(&efipart_dev, hout, aliases, nout); free(hin); return (err); } static void efipart_print(int verbose) { char line[80]; EFI_BLOCK_IO *blkio; EFI_HANDLE h; EFI_STATUS status; u_int unit; for (unit = 0, h = efi_find_handle(&efipart_dev, 0); h != NULL; h = efi_find_handle(&efipart_dev, ++unit)) { sprintf(line, " %s%d:", efipart_dev.dv_name, unit); pager_output(line); status = BS->HandleProtocol(h, &blkio_guid, (void **)&blkio); if (!EFI_ERROR(status)) { sprintf(line, " %llu blocks", (unsigned long long)(blkio->Media->LastBlock + 1)); pager_output(line); if (blkio->Media->RemovableMedia) pager_output(" (removable)"); } pager_output("\n"); } } -static int +static int efipart_open(struct open_file *f, ...) { va_list args; struct devdesc *dev; EFI_BLOCK_IO *blkio; EFI_HANDLE h; EFI_STATUS status; va_start(args, f); dev = va_arg(args, struct devdesc*); va_end(args); h = efi_find_handle(&efipart_dev, dev->d_unit); if (h == NULL) return (EINVAL); status = BS->HandleProtocol(h, &blkio_guid, (void **)&blkio); if (EFI_ERROR(status)) return (efi_status_to_errno(status)); if (!blkio->Media->MediaPresent) return (EAGAIN); dev->d_opendata = blkio; return (0); } -static int +static int efipart_close(struct open_file *f) { struct devdesc *dev; dev = (struct devdesc *)(f->f_devdata); if (dev->d_opendata == NULL) return (EINVAL); dev->d_opendata = NULL; return (0); } /* * efipart_readwrite() * Internal equivalent of efipart_strategy(), which operates on the * media-native block size. This function expects all I/O requests * to be within the media size and returns an error if such is not * the case. */ static int efipart_readwrite(EFI_BLOCK_IO *blkio, int rw, daddr_t blk, daddr_t nblks, char *buf) { EFI_STATUS status; if (blkio == NULL) return (ENXIO); if (blk < 0 || blk > blkio->Media->LastBlock) return (EIO); if ((blk + nblks - 1) > blkio->Media->LastBlock) return (EIO); switch (rw) { case F_READ: status = blkio->ReadBlocks(blkio, blkio->Media->MediaId, blk, nblks * blkio->Media->BlockSize, buf); break; case F_WRITE: if (blkio->Media->ReadOnly) return (EROFS); status = blkio->WriteBlocks(blkio, blkio->Media->MediaId, blk, nblks * blkio->Media->BlockSize, buf); break; default: return (ENOSYS); } if (EFI_ERROR(status)) printf("%s: rw=%d, status=%lu\n", __func__, rw, (u_long)status); return (efi_status_to_errno(status)); } -static int +static int efipart_strategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize) { struct devdesc *dev = (struct devdesc *)devdata; EFI_BLOCK_IO *blkio; off_t off; char *blkbuf; size_t blkoff, blksz; int error; if (dev == NULL || blk < 0) return (EINVAL); blkio = dev->d_opendata; if (blkio == NULL) return (ENXIO); if (size == 0 || (size % 512) != 0) return (EIO); if (rsize != NULL) *rsize = size; if (blkio->Media->BlockSize == 512) return (efipart_readwrite(blkio, rw, blk, size / 512, buf)); /* * The block size of the media is not 512B per sector. */ blkbuf = malloc(blkio->Media->BlockSize); if (blkbuf == NULL) return (ENOMEM); error = 0; off = blk * 512; blk = off / blkio->Media->BlockSize; blkoff = off % blkio->Media->BlockSize; blksz = blkio->Media->BlockSize - blkoff; while (size > 0) { error = efipart_readwrite(blkio, rw, blk, 1, blkbuf); if (error) break; if (size < blksz) blksz = size; bcopy(blkbuf + blkoff, buf, blksz); buf += blksz; size -= blksz; blk++; blkoff = 0; blksz = blkio->Media->BlockSize; } free(blkbuf); return (error); } Index: head/sys/boot/efi/libefi/time.c =================================================================== --- head/sys/boot/efi/libefi/time.c (revision 292622) +++ head/sys/boot/efi/libefi/time.c (revision 292623) @@ -1,224 +1,224 @@ /*- * Copyright (c) 1999, 2000 * Intel Corporation. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * + * * This product includes software developed by Intel Corporation and * its contributors. - * + * * 4. Neither the name of Intel Corporation or its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. - * + * */ #include __FBSDID("$FreeBSD$"); #include #include #include #include /* // Accurate only for the past couple of centuries; // that will probably do. // // (#defines From FreeBSD 3.2 lib/libc/stdtime/tzfile.h) */ #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) #define SECSPERHOUR ( 60*60 ) #define SECSPERDAY (24 * SECSPERHOUR) time_t efi_time(EFI_TIME *ETime) { /* // These arrays give the cumulative number of days up to the first of the // month number used as the index (1 -> 12) for regular and leap years. // The value at index 13 is for the whole year. */ static time_t CumulativeDays[2][14] = { {0, 0, 31, 31 + 28, 31 + 28 + 31, 31 + 28 + 31 + 30, 31 + 28 + 31 + 30 + 31, 31 + 28 + 31 + 30 + 31 + 30, 31 + 28 + 31 + 30 + 31 + 30 + 31, 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31, 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30, 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 }, {0, 0, 31, 31 + 29, 31 + 29 + 31, 31 + 29 + 31 + 30, 31 + 29 + 31 + 30 + 31, 31 + 29 + 31 + 30 + 31 + 30, 31 + 29 + 31 + 30 + 31 + 30 + 31, 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31, 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30, 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 }}; - time_t UTime; + time_t UTime; int Year; /* // Do a santity check */ if ( ETime->Year < 1998 || ETime->Year > 2099 || ETime->Month == 0 || ETime->Month > 12 || ETime->Day == 0 || ETime->Month > 31 || ETime->Hour > 23 || ETime->Minute > 59 || ETime->Second > 59 || ETime->TimeZone < -1440 || (ETime->TimeZone > 1440 && ETime->TimeZone != 2047) ) { return (0); } /* // Years */ UTime = 0; for (Year = 1970; Year != ETime->Year; ++Year) { UTime += (CumulativeDays[isleap(Year)][13] * SECSPERDAY); } /* // UTime should now be set to 00:00:00 on Jan 1 of the file's year. // - // Months + // Months */ UTime += (CumulativeDays[isleap(ETime->Year)][ETime->Month] * SECSPERDAY); /* // UTime should now be set to 00:00:00 on the first of the file's month and year // // Days -- Don't count the file's day */ UTime += (((ETime->Day > 0) ? ETime->Day-1:0) * SECSPERDAY); /* // Hours */ UTime += (ETime->Hour * SECSPERHOUR); /* // Minutes */ UTime += (ETime->Minute * 60); /* // Seconds */ UTime += ETime->Second; /* // EFI time is repored in local time. Adjust for any time zone offset to // get true UT */ if ( ETime->TimeZone != EFI_UNSPECIFIED_TIMEZONE ) { /* // TimeZone is kept in minues... */ UTime += (ETime->TimeZone * 60); } - + return UTime; } int EFI_GetTimeOfDay( OUT struct timeval *tp, OUT struct timezone *tzp ) { EFI_TIME EfiTime; EFI_TIME_CAPABILITIES Capabilities; EFI_STATUS Status; /* // Get time from EFI */ Status = RS->GetTime(&EfiTime, &Capabilities); if (EFI_ERROR(Status)) return (-1); /* // Convert to UNIX time (ie seconds since the epoch */ tp->tv_sec = efi_time( &EfiTime ); tp->tv_usec = 0; /* EfiTime.Nanosecond * 1000; */ /* // Do something with the timezone if needed */ if (tzp) { tzp->tz_minuteswest = EfiTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE ? 0 : EfiTime.TimeZone; /* // This isn't quit right since it doesn't deal with EFI_TIME_IN_DAYLIGHT */ tzp->tz_dsttime = EfiTime.Daylight & EFI_TIME_ADJUST_DAYLIGHT ? 1 : 0; } return (0); } time_t time(time_t *tloc) { struct timeval tv; EFI_GetTimeOfDay(&tv, 0); if (tloc) *tloc = tv.tv_sec; return tv.tv_sec; } time_t getsecs() { return time(0); }