svn commit: r293724 - in head/sys/boot: arm64/libarm64 common efi/boot1 efi/fdt efi/include efi/include/arm64 efi/libefi efi/loader efi/loader/arch/amd64 efi/loader/arch/arm efi/loader/arch/arm64 i...

Steven Hartland smh at FreeBSD.org
Tue Jan 12 02:17:45 UTC 2016


Author: smh
Date: Tue Jan 12 02:17:39 2016
New Revision: 293724
URL: https://svnweb.freebsd.org/changeset/base/293724

Log:
  Enable warnings in EFI boot code
  
  Set WARNS if not set for EFI boot code and fix the issues highlighted by
  setting it.
  
  Most components are set to WARNS level 6 with few being left at lower
  levels due to the amount of changes needed to fix at higher levels.
  
  Error types fixed:
  * Missing / invalid casts
  * Missing inner structs
  * Unused vars
  * Missing static for internal only funcs
  * Missing prototypes
  * Alignment changes
  * Use of uninitialised vars
  * Unknown pragma (intrinsic)
  * Missing types etc due to missing includes
  * printf formatting types
  
  Reviewed by:	emaste (in part)
  MFC after:	2 weeks
  X-MFC-With:	r293268
  Sponsored by:	Multiplay
  Differential Revision:	https://reviews.freebsd.org/D4839

Modified:
  head/sys/boot/arm64/libarm64/cache.c
  head/sys/boot/common/load_elf.c
  head/sys/boot/common/load_elf_obj.c
  head/sys/boot/common/misc.c
  head/sys/boot/common/module.c
  head/sys/boot/common/part.c
  head/sys/boot/common/self_reloc.c
  head/sys/boot/common/ufsread.c
  head/sys/boot/efi/boot1/Makefile
  head/sys/boot/efi/boot1/boot1.c
  head/sys/boot/efi/fdt/Makefile
  head/sys/boot/efi/fdt/efi_fdt.c
  head/sys/boot/efi/include/arm64/efibind.h
  head/sys/boot/efi/include/efi_nii.h
  head/sys/boot/efi/include/efiapi.h
  head/sys/boot/efi/include/eficon.h
  head/sys/boot/efi/include/eficonsctl.h
  head/sys/boot/efi/include/efidevp.h
  head/sys/boot/efi/include/efierr.h
  head/sys/boot/efi/include/efifpswa.h
  head/sys/boot/efi/include/efigop.h
  head/sys/boot/efi/include/efilib.h
  head/sys/boot/efi/include/efinet.h
  head/sys/boot/efi/include/efipciio.h
  head/sys/boot/efi/include/efiprot.h
  head/sys/boot/efi/include/efipxebc.h
  head/sys/boot/efi/include/efiser.h
  head/sys/boot/efi/include/efiuga.h
  head/sys/boot/efi/libefi/Makefile
  head/sys/boot/efi/libefi/efi_console.c
  head/sys/boot/efi/libefi/efipart.c
  head/sys/boot/efi/libefi/libefi.c
  head/sys/boot/efi/loader/Makefile
  head/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c
  head/sys/boot/efi/loader/arch/amd64/framebuffer.c
  head/sys/boot/efi/loader/arch/arm/exec.c
  head/sys/boot/efi/loader/arch/arm64/exec.c
  head/sys/boot/efi/loader/autoload.c
  head/sys/boot/efi/loader/bootinfo.c
  head/sys/boot/efi/loader/copy.c
  head/sys/boot/efi/loader/devicename.c
  head/sys/boot/efi/loader/loader_efi.h
  head/sys/boot/efi/loader/main.c
  head/sys/boot/i386/libi386/smbios.c

Modified: head/sys/boot/arm64/libarm64/cache.c
==============================================================================
--- head/sys/boot/arm64/libarm64/cache.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/arm64/libarm64/cache.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -67,7 +67,7 @@ cpu_flush_dcache(const void *ptr, size_t
 	cl_size = get_dcache_line_size();
 
 	/* Calculate end address to clean */
-	end = (vm_offset_t)(ptr + len);
+	end = (vm_offset_t)ptr + (vm_offset_t)len;
 	/* Align start address to cache line */
 	addr = (vm_offset_t)ptr;
 	addr = rounddown2(addr, cl_size);

Modified: head/sys/boot/common/load_elf.c
==============================================================================
--- head/sys/boot/common/load_elf.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/common/load_elf.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -886,7 +886,7 @@ __elfN(parse_modmetadata)(struct preload
 	error = __elfN(reloc_ptr)(fp, ef, v, &md, sizeof(md));
 	if (error == EOPNOTSUPP) {
 	    md.md_cval += ef->off;
-	    md.md_data += ef->off;
+	    md.md_data = (void *)((uintptr_t)md.md_data + ef->off);
 	} else if (error != 0)
 	    return (error);
 #endif

Modified: head/sys/boot/common/load_elf_obj.c
==============================================================================
--- head/sys/boot/common/load_elf_obj.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/common/load_elf_obj.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -520,10 +520,8 @@ __elfN(obj_symaddr)(struct elf_file *ef,
 {
 	Elf_Sym sym;
 	Elf_Addr base;
-	int symcnt;
 
-	symcnt = ef->e_shdr[ef->symtabindex].sh_size / sizeof(Elf_Sym);
-	if (symidx >= symcnt)
+	if (symidx >= ef->e_shdr[ef->symtabindex].sh_size / sizeof(Elf_Sym))
 		return (0);
 	COPYOUT(ef->e_shdr[ef->symtabindex].sh_addr + symidx * sizeof(Elf_Sym),
 	    &sym, sizeof(sym));

Modified: head/sys/boot/common/misc.c
==============================================================================
--- head/sys/boot/common/misc.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/common/misc.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -118,7 +118,6 @@ kern_bzero(vm_offset_t dest, size_t len)
 int
 kern_pread(int fd, vm_offset_t dest, size_t len, off_t off)
 {
-	ssize_t nread;
 
 	if (lseek(fd, off, SEEK_SET) == -1) {
 #ifdef DEBUG
@@ -126,8 +125,7 @@ kern_pread(int fd, vm_offset_t dest, siz
 #endif
 		return (-1);
 	}
-	nread = archsw.arch_readin(fd, dest, len);
-	if (nread != len) {
+	if ((size_t)archsw.arch_readin(fd, dest, len) != len) {
 #ifdef DEBUG
 		printf("\nreadin failed\n");
 #endif
@@ -144,7 +142,6 @@ void *
 alloc_pread(int fd, off_t off, size_t len)
 {
 	void *buf;
-	ssize_t nread;
 
 	buf = malloc(len);
 	if (buf == NULL) {
@@ -160,8 +157,7 @@ alloc_pread(int fd, off_t off, size_t le
 		free(buf);
 		return (NULL);
 	}
-	nread = read(fd, buf, len);
-	if (nread != len) {
+	if ((size_t)read(fd, buf, len) != len) {
 #ifdef DEBUG
 		printf("\nread failed\n");
 #endif

Modified: head/sys/boot/common/module.c
==============================================================================
--- head/sys/boot/common/module.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/common/module.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -983,7 +983,7 @@ moduledir_rebuild(void)
 {
     struct	moduledir *mdp, *mtmp;
     const char	*path, *cp, *ep;
-    int		cplen;
+    size_t	cplen;
 
     path = getenv("module_path");
     if (path == NULL)

Modified: head/sys/boot/common/part.c
==============================================================================
--- head/sys/boot/common/part.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/common/part.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -102,7 +102,7 @@ static struct parttypes {
 const char *
 parttype2str(enum partition_type type)
 {
-	int i;
+	size_t i;
 
 	for (i = 0; i < sizeof(ptypes) / sizeof(ptypes[0]); i++)
 		if (ptypes[i].type == type)
@@ -203,7 +203,7 @@ gpt_checktbl(const struct gpt_hdr *hdr, 
     uint64_t lba_last)
 {
 	struct gpt_ent *ent;
-	int i, cnt;
+	uint32_t i, cnt;
 
 	cnt = size / hdr->hdr_entsz;
 	if (hdr->hdr_entries <= cnt) {
@@ -234,8 +234,8 @@ ptable_gptread(struct ptable *table, voi
 	struct gpt_ent *ent;
 	u_char *buf, *tbl;
 	uint64_t offset;
-	int pri, sec, i;
-	size_t size;
+	int pri, sec;
+	size_t size, i;
 
 	buf = malloc(table->sectorsize);
 	if (buf == NULL)
@@ -358,7 +358,7 @@ mbr_parttype(uint8_t type)
 	return (PART_UNKNOWN);
 }
 
-struct ptable*
+static struct ptable*
 ptable_ebrread(struct ptable *table, void *dev, diskread_t dread)
 {
 	struct dos_partition *dp;
@@ -436,7 +436,7 @@ bsd_parttype(uint8_t type)
 	return (PART_UNKNOWN);
 }
 
-struct ptable*
+static struct ptable*
 ptable_bsdread(struct ptable *table, void *dev, diskread_t dread)
 {
 	struct disklabel *dl;

Modified: head/sys/boot/common/self_reloc.c
==============================================================================
--- head/sys/boot/common/self_reloc.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/common/self_reloc.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$");
 #define	RELOC_TYPE_RELATIVE	R_386_RELATIVE
 #endif
 
+void self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic);
+
 /*
  * A simple elf relocator.
  */
@@ -118,6 +120,6 @@ self_reloc(Elf_Addr baseaddr, ElfW_Dyn *
 			/* XXX: do we need other relocations ? */
 			break;
 		}
-		rel = (ElfW_Rel *) ((caddr_t) rel + relent);
+		rel = (ElfW_Rel *)(void *)((caddr_t) rel + relent);
 	}
 }

Modified: head/sys/boot/common/ufsread.c
==============================================================================
--- head/sys/boot/common/ufsread.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/common/ufsread.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -207,7 +207,7 @@ fsread(ufs_ino_t inode, void *buf, size_
 #endif
 			    ) &&
 			    fs.fs_bsize <= MAXBSIZE &&
-			    fs.fs_bsize >= sizeof(struct fs))
+			    fs.fs_bsize >= (int32_t)sizeof(struct fs))
 				break;
 		}
 		if (sblock_try[n] == -1) {
@@ -231,10 +231,10 @@ fsread(ufs_ino_t inode, void *buf, size_
 		    sizeof(struct ufs2_dinode));
 #else
 		if (fs.fs_magic == FS_UFS1_MAGIC)
-			memcpy(&dp1, (struct ufs1_dinode *)blkbuf + n,
+			memcpy(&dp1, (struct ufs1_dinode *)(void *)blkbuf + n,
 			    sizeof(struct ufs1_dinode));
 		else
-			memcpy(&dp2, (struct ufs2_dinode *)blkbuf + n,
+			memcpy(&dp2, (struct ufs2_dinode *)(void *)blkbuf + n,
 			    sizeof(struct ufs2_dinode));
 #endif
 		inomap = inode;
@@ -283,7 +283,7 @@ fsread(ufs_ino_t inode, void *buf, size_
 			return -1;
 		vbaddr = fsbtodb(&fs, addr2) + (off >> VBLKSHIFT) * DBPERVBLK;
 		vboff = off & VBLKMASK;
-		n = sblksize(&fs, size, lbn) - (off & ~VBLKMASK);
+		n = sblksize(&fs, (off_t)size, lbn) - (off & ~VBLKMASK);
 		if (n > VBLKSIZE)
 			n = VBLKSIZE;
 		if (blkmap != vbaddr) {

Modified: head/sys/boot/efi/boot1/Makefile
==============================================================================
--- head/sys/boot/efi/boot1/Makefile	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/boot1/Makefile	Tue Jan 12 02:17:39 2016	(r293724)
@@ -11,6 +11,7 @@ MK_SSP=		no
 
 PROG=		boot1.sym
 INTERNALPROG=
+WARNS?=		6
 
 # architecture-specific loader code
 SRCS=	boot1.c self_reloc.c start.S

Modified: head/sys/boot/efi/boot1/boot1.c
==============================================================================
--- head/sys/boot/efi/boot1/boot1.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/boot1/boot1.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 
 void panic(const char *fmt, ...) __dead2;
 void putchar(int c);
+EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab);
 
 static int domount(EFI_DEVICE_PATH *device, EFI_BLOCK_IO *blkio, int quiet);
 static void load(const char *fname);
@@ -62,7 +63,7 @@ EFI_STATUS efi_main(EFI_HANDLE Ximage, E
 	EFI_BOOT_SERVICES *BS;
 	EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl = NULL;
 	SIMPLE_TEXT_OUTPUT_INTERFACE *conout = NULL;
-	char *path = _PATH_LOADER;
+	const char *path = _PATH_LOADER;
 
 	systab = Xsystab;
 	image = Ximage;
@@ -157,7 +158,6 @@ fsstat(ufs_ino_t inode)
 {
 #ifndef UFS2_ONLY
 	static struct ufs1_dinode dp1;
-	ufs1_daddr_t addr1;
 #endif
 #ifndef UFS1_ONLY
 	static struct ufs2_dinode dp2;
@@ -166,11 +166,8 @@ fsstat(ufs_ino_t inode)
 	static ufs_ino_t inomap;
 	char *blkbuf;
 	void *indbuf;
-	size_t n, nb, size, off, vboff;
-	ufs_lbn_t lbn;
-	ufs2_daddr_t addr2, vbaddr;
+	size_t n, size;
 	static ufs2_daddr_t blkmap, indmap;
-	u_int u;
 
 	blkbuf = dmadat->blkbuf;
 	indbuf = dmadat->indbuf;
@@ -194,7 +191,7 @@ fsstat(ufs_ino_t inode)
 #endif
 			    ) &&
 			    fs.fs_bsize <= MAXBSIZE &&
-			    fs.fs_bsize >= sizeof(struct fs))
+			    fs.fs_bsize >= (int32_t)sizeof(struct fs))
 				break;
 		}
 		if (sblock_try[n] == -1) {
@@ -218,10 +215,10 @@ fsstat(ufs_ino_t inode)
 		    sizeof(struct ufs2_dinode));
 #else
 		if (fs.fs_magic == FS_UFS1_MAGIC)
-			memcpy(&dp1, (struct ufs1_dinode *)blkbuf + n,
+			memcpy(&dp1, (struct ufs1_dinode *)(void *)blkbuf + n,
 			    sizeof(struct ufs1_dinode));
 		else
-			memcpy(&dp2, (struct ufs2_dinode *)blkbuf + n,
+			memcpy(&dp2, (struct ufs2_dinode *)(void *)blkbuf + n,
 			    sizeof(struct ufs2_dinode));
 #endif
 		inomap = inode;

Modified: head/sys/boot/efi/fdt/Makefile
==============================================================================
--- head/sys/boot/efi/fdt/Makefile	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/fdt/Makefile	Tue Jan 12 02:17:39 2016	(r293724)
@@ -6,6 +6,7 @@
 
 LIB=		efi_fdt
 INTERNALLIB=
+WARNS?=		6
 
 SRCS=		efi_fdt.c
 

Modified: head/sys/boot/efi/fdt/efi_fdt.c
==============================================================================
--- head/sys/boot/efi/fdt/efi_fdt.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/fdt/efi_fdt.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -44,7 +44,6 @@ int
 fdt_platform_load_dtb(void)
 {
 	struct fdt_header *hdr;
-	int err;
 
 	hdr = efi_get_table(&fdtdtb);
 	if (hdr != NULL) {
@@ -54,7 +53,7 @@ fdt_platform_load_dtb(void)
 		}
 	}
 
-	return (err);
+	return (1);
 }
 
 void

Modified: head/sys/boot/efi/include/arm64/efibind.h
==============================================================================
--- head/sys/boot/efi/include/arm64/efibind.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/arm64/efibind.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -127,7 +127,6 @@ typedef uint64_t   UINTN;
 #define BAD_POINTER         0xFBFBFBFBFBFBFBFB
 #define MAX_ADDRESS         0xFFFFFFFFFFFFFFFF
 
-#pragma intrinsic (__break)  
 #define BREAKPOINT()  __break(0)
 
 //
@@ -180,7 +179,6 @@ typedef uint64_t   UINTN;
 // BugBug: Need to find out if this is portable accross compliers.
 //
 void __mfa (void);                       
-#pragma intrinsic (__mfa)  
 #define MEMORY_FENCE()    __mfa()
 
 #ifdef EFI_NO_INTERFACE_DECL

Modified: head/sys/boot/efi/include/efi_nii.h
==============================================================================
--- head/sys/boot/efi/include/efi_nii.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efi_nii.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -26,9 +26,9 @@ Revision history:
 --*/
 
 #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL \
-    { 0xE18541CD, 0xF755, 0x4f73, 0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29 }
+    { 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 }
+    { 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

Modified: head/sys/boot/efi/include/efiapi.h
==============================================================================
--- head/sys/boot/efi/include/efiapi.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efiapi.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -214,8 +214,8 @@ VOID
 // EFI platform varibles
 //
 
-#define EFI_GLOBAL_VARIABLE     \
-    { 0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }
+#define EFI_GLOBAL_VARIABLE \
+    { 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} }
 
 // Variable attributes
 #define EFI_VARIABLE_NON_VOLATILE           0x00000001
@@ -363,8 +363,8 @@ EFI_STATUS
 
 
 // Image handle
-#define LOADED_IMAGE_PROTOCOL      \
-    { 0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }
+#define LOADED_IMAGE_PROTOCOL \
+    { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
 
 #define EFI_LOADED_IMAGE_INFORMATION_REVISION      0x1000
 typedef struct {
@@ -827,35 +827,35 @@ typedef struct {
 // EFI Configuration Table and GUID definitions
 //
 
-#define MPS_TABLE_GUID    \
-  { 0xeb9d2d2f, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
+#define MPS_TABLE_GUID \
+    { 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
 
-#define ACPI_TABLE_GUID    \
-  { 0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
+#define ACPI_TABLE_GUID \
+    { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
 
-#define ACPI_20_TABLE_GUID  \
-  { 0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }
+#define ACPI_20_TABLE_GUID \
+    { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
 
-#define SMBIOS_TABLE_GUID    \
-  { 0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
+#define SMBIOS_TABLE_GUID \
+    { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
 
-#define SAL_SYSTEM_TABLE_GUID    \
-  { 0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
+#define SAL_SYSTEM_TABLE_GUID  \
+    { 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
 
-#define FDT_TABLE_GUID    \
-  { 0xb1b621d5, 0xf19c, 0x41a5, 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 }
+#define FDT_TABLE_GUID \
+    { 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} }
 
-#define DXE_SERVICES_TABLE_GUID	\
-  { 0x5ad34ba, 0x6f02, 0x4214, 0x95, 0x2e, 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9 }
+#define DXE_SERVICES_TABLE_GUID \
+    { 0x5ad34ba, 0x6f02, 0x4214, {0x95, 0x2e, 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9} }
 
-#define	HOB_LIST_TABLE_GUID	\
-  { 0x7739f24c, 0x93d7, 0x11d4, 0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
+#define HOB_LIST_TABLE_GUID \
+    { 0x7739f24c, 0x93d7, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
 
 #define MEMORY_TYPE_INFORMATION_TABLE_GUID \
-  { 0x4c19049f, 0x4137, 0x4dd3, 0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa }
+    { 0x4c19049f, 0x4137, 0x4dd3, {0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa} }
 
 #define DEBUG_IMAGE_INFO_TABLE_GUID \
-  { 0x49152e77, 0x1ada, 0x4764, 0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b }
+    { 0x49152e77, 0x1ada, 0x4764, {0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b} }
 
 typedef struct _EFI_CONFIGURATION_TABLE {
   EFI_GUID                VendorGuid;

Modified: head/sys/boot/efi/include/eficon.h
==============================================================================
--- head/sys/boot/efi/include/eficon.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/eficon.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -32,7 +32,7 @@ Revision History
 //
 
 #define SIMPLE_TEXT_OUTPUT_PROTOCOL \
-    { 0x387477c2, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
+    { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
 
 INTERFACE_DECL(_SIMPLE_TEXT_OUTPUT_INTERFACE);
 
@@ -239,8 +239,8 @@ typedef struct _SIMPLE_TEXT_OUTPUT_INTER
 // Text input protocol
 //
 
-#define SIMPLE_TEXT_INPUT_PROTOCOL  \
-    { 0x387477c1, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
+#define SIMPLE_TEXT_INPUT_PROTOCOL \
+    { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
 
 INTERFACE_DECL(_SIMPLE_INPUT_INTERFACE);
 

Modified: head/sys/boot/efi/include/eficonsctl.h
==============================================================================
--- head/sys/boot/efi/include/eficonsctl.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/eficonsctl.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -35,7 +35,7 @@
 #define _EFI_CONS_CTL_H
 
 #define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \
-  { 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} }
+    { 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} }
 
 typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL   EFI_CONSOLE_CONTROL_PROTOCOL;
 

Modified: head/sys/boot/efi/include/efidevp.h
==============================================================================
--- head/sys/boot/efi/include/efidevp.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efidevp.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -110,7 +110,7 @@ typedef struct _VENDOR_DEVICE_PATH {
 } VENDOR_DEVICE_PATH;
 
 #define UNKNOWN_DEVICE_GUID \
-    { 0xcf31fac5, 0xc24e, 0x11d2,  0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b  }
+    { 0xcf31fac5, 0xc24e, 0x11d2, {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} }
 
 typedef struct _UKNOWN_DEVICE_VENDOR_DP {
     VENDOR_DEVICE_PATH      DevicePath;
@@ -274,16 +274,16 @@ typedef struct _UART_DEVICE_PATH {
 /* Use VENDOR_DEVICE_PATH struct */
 
 #define DEVICE_PATH_MESSAGING_PC_ANSI \
-    { 0xe0c14753, 0xf9be, 0x11d2,  0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d  }
+    { 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  }
+    { 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  }
+    { 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

Modified: head/sys/boot/efi/include/efierr.h
==============================================================================
--- head/sys/boot/efi/include/efierr.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efierr.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -31,7 +31,7 @@ Revision History
 
 #define EFIWARN(a)                            (a)
 #define EFI_ERROR(a)             (((INTN) a) < 0)
-#define EFI_ERROR_CODE(a)   (a & ~EFI_ERROR_MASK)
+#define EFI_ERROR_CODE(a)   (unsigned long)(a & ~EFI_ERROR_MASK)
 
 
 #define EFI_SUCCESS                             0

Modified: head/sys/boot/efi/include/efifpswa.h
==============================================================================
--- head/sys/boot/efi/include/efifpswa.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efifpswa.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -7,7 +7,7 @@
  */
 
 #define EFI_INTEL_FPSWA \
-    { 0xc41b6531, 0x97b9, 0x11d3, 0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
+    { 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
 
 INTERFACE_DECL(_FPSWA_INTERFACE);
 

Modified: head/sys/boot/efi/include/efigop.h
==============================================================================
--- head/sys/boot/efi/include/efigop.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efigop.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -27,9 +27,8 @@ Revision History
 #ifndef _EFIGOP_H
 #define _EFIGOP_H
 
-#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID				\
-    { 0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80,	\
-      0x51, 0x6a }
+#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
+    { 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a} }
 
 INTERFACE_DECL(_EFI_GRAPHICS_OUTPUT);
 

Modified: head/sys/boot/efi/include/efilib.h
==============================================================================
--- head/sys/boot/efi/include/efilib.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efilib.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -50,3 +50,4 @@ time_t efi_time(EFI_TIME *);
 
 EFI_STATUS main(int argc, CHAR16 *argv[]);
 void exit(EFI_STATUS status);
+void delay(int usecs);

Modified: head/sys/boot/efi/include/efinet.h
==============================================================================
--- head/sys/boot/efi/include/efinet.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efinet.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -29,7 +29,7 @@ Revision History
 //
 
 #define EFI_SIMPLE_NETWORK_PROTOCOL \
-    { 0xA19832B9, 0xAC25, 0x11D3, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }
+    { 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
 
 
 INTERFACE_DECL(_EFI_SIMPLE_NETWORK);

Modified: head/sys/boot/efi/include/efipciio.h
==============================================================================
--- head/sys/boot/efi/include/efipciio.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efipciio.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -21,9 +21,7 @@
 /// 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 } \
-  }
+    { 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a} }
 
 typedef struct _EFI_PCI_IO_PROTOCOL  EFI_PCI_IO_PROTOCOL;
 

Modified: head/sys/boot/efi/include/efiprot.h
==============================================================================
--- head/sys/boot/efi/include/efiprot.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efiprot.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -31,8 +31,8 @@ Revision History
 // Device Path protocol
 //
 
-#define DEVICE_PATH_PROTOCOL    \
-    { 0x9576e91, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
+#define DEVICE_PATH_PROTOCOL \
+    { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
 
 
 //
@@ -40,7 +40,7 @@ Revision History
 //
 
 #define BLOCK_IO_PROTOCOL \
-    { 0x964e5b21, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
+    { 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
 #define EFI_BLOCK_IO_INTERFACE_REVISION   0x00010000
 
 INTERFACE_DECL(_EFI_BLOCK_IO);
@@ -116,7 +116,7 @@ typedef struct _EFI_BLOCK_IO {
 //
 
 #define DISK_IO_PROTOCOL \
-    { 0xce345171, 0xba0b, 0x11d2,  0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
+    { 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
 #define EFI_DISK_IO_INTERFACE_REVISION   0x00010000
 
 INTERFACE_DECL(_EFI_DISK_IO);
@@ -155,7 +155,7 @@ typedef struct _EFI_DISK_IO {
 //
 
 #define SIMPLE_FILE_SYSTEM_PROTOCOL \
-    { 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
+    { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
 
 INTERFACE_DECL(_EFI_FILE_IO_INTERFACE);
 INTERFACE_DECL(_EFI_FILE_HANDLE);
@@ -290,8 +290,8 @@ typedef struct _EFI_FILE_HANDLE {
 // File information types
 //
 
-#define EFI_FILE_INFO_ID   \
-    { 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
+#define EFI_FILE_INFO_ID \
+    { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
 
 typedef struct {
     UINT64                  Size;
@@ -314,8 +314,8 @@ typedef struct {
 
 #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 }
+#define EFI_FILE_SYSTEM_INFO_ID \
+    { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
 
 typedef struct {
     UINT64                  Size;
@@ -336,8 +336,8 @@ typedef struct {
 
 #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 }
+#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \
+    { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
 
 typedef struct {
     CHAR16                  VolumeLabel[1];
@@ -351,7 +351,7 @@ typedef struct {
 
 
 #define LOAD_FILE_PROTOCOL \
-    { 0x56EC3091, 0x954C, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }
+    { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
 
 INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE);
 
@@ -375,7 +375,7 @@ typedef struct _EFI_LOAD_FILE_INTERFACE 
 //
 
 #define DEVICE_IO_PROTOCOL \
-    { 0xaf6ac311, 0x84c3, 0x11d2, 0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
+    { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
 
 INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE);
 
@@ -485,7 +485,7 @@ typedef struct _EFI_DEVICE_IO_INTERFACE 
 //
 
 #define UNICODE_COLLATION_PROTOCOL \
-    { 0x1d85cd7f, 0xf43d, 0x11d2, 0x9a, 0xc,  0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
+    { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
 
 #define UNICODE_BYTE_ORDER_MARK       (CHAR16)(0xfeff)
 

Modified: head/sys/boot/efi/include/efipxebc.h
==============================================================================
--- head/sys/boot/efi/include/efipxebc.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efipxebc.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -32,7 +32,7 @@ Revision History
 //
 
 #define EFI_PXE_BASE_CODE_PROTOCOL \
-    { 0x03c4e603, 0xac28, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
+    { 0x03c4e603, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
 
 INTERFACE_DECL(_EFI_PXE_BASE_CODE);
 
@@ -425,7 +425,7 @@ typedef struct _EFI_PXE_BASE_CODE {
 //
 
 #define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL \
-    { 0x245dca21, 0xfb7b, 0x11d3, 0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
+    { 0x245dca21, 0xfb7b, 0x11d3, {0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
 
 //
 // Revision Number

Modified: head/sys/boot/efi/include/efiser.h
==============================================================================
--- head/sys/boot/efi/include/efiser.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efiser.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -30,7 +30,7 @@ Revision History
 //
 
 #define SERIAL_IO_PROTOCOL \
-    { 0xBB25CF6F, 0xF1D4, 0x11D2, 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD }
+    { 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD} }
 
 INTERFACE_DECL(_SERIAL_IO_INTERFACE);
 

Modified: head/sys/boot/efi/include/efiuga.h
==============================================================================
--- head/sys/boot/efi/include/efiuga.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/include/efiuga.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -22,9 +22,7 @@
 #define __UGA_DRAW_H__
 
 #define EFI_UGA_DRAW_PROTOCOL_GUID \
-  { \
-    0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \
-  }
+    { 0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39} }
 
 typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL;
 

Modified: head/sys/boot/efi/libefi/Makefile
==============================================================================
--- head/sys/boot/efi/libefi/Makefile	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/libefi/Makefile	Tue Jan 12 02:17:39 2016	(r293724)
@@ -2,6 +2,7 @@
 
 LIB=	efi
 INTERNALLIB=
+WARNS?=	2
 
 SRCS=	delay.c efi_console.c efinet.c efipart.c errno.c handles.c \
 	libefi.c time.c

Modified: head/sys/boot/efi/libefi/efi_console.c
==============================================================================
--- head/sys/boot/efi/libefi/efi_console.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/libefi/efi_console.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -47,6 +47,8 @@ static int esc;
 void get_pos(int *x, int *y);
 void curs_move(int *_x, int *_y, int x, int y);
 static void CL(int);
+void HO(void);
+void end_term(void);
 #endif
 
 static void efi_cons_probe(struct console *);

Modified: head/sys/boot/efi/libefi/efipart.c
==============================================================================
--- head/sys/boot/efi/libefi/efipart.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/libefi/efipart.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -67,7 +67,6 @@ efipart_init(void) 
 	EFI_HANDLE *hin, *hout, *aliases, handle;
 	EFI_STATUS status;
 	UINTN sz;
-	CHAR16 *path;
 	u_int n, nin, nout;
 	int err;
 	size_t devpathlen;

Modified: head/sys/boot/efi/libefi/libefi.c
==============================================================================
--- head/sys/boot/efi/libefi/libefi.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/libefi/libefi.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -179,7 +179,7 @@ efi_main(EFI_HANDLE image_handle, EFI_SY
 	argv = malloc((argc + 1) * sizeof(CHAR16*));
 	argc = 0;
 	if (addprog)
-		argv[argc++] = L"loader.efi";
+		argv[argc++] = (CHAR16 *)"loader.efi";
 	argp = args;
 	while (argp != NULL && *argp != 0) {
 		argp = arg_skipsep(argp);

Modified: head/sys/boot/efi/loader/Makefile
==============================================================================
--- head/sys/boot/efi/loader/Makefile	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/loader/Makefile	Tue Jan 12 02:17:39 2016	(r293724)
@@ -11,6 +11,7 @@ MK_SSP=		no
 
 PROG=		loader.sym
 INTERNALPROG=
+WARNS?=		3
 
 # architecture-specific loader code
 SRCS=	autoload.c \

Modified: head/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c
==============================================================================
--- head/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -100,7 +100,6 @@ elf64_exec(struct preloaded_file *fp)
 	ACPI_TABLE_RSDP		*rsdp;
 	char			buf[24];
 	int			revision;
-	EFI_STATUS		status;
 
 	rsdp = efi_get_table(&acpi20_guid);
 	if (rsdp == NULL) {

Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c
==============================================================================
--- head/sys/boot/efi/loader/arch/amd64/framebuffer.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/loader/arch/amd64/framebuffer.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$");
 #include <efipciio.h>
 #include <machine/metadata.h>
 
+#include "framebuffer.h"
+
 static EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
 static EFI_GUID pciio_guid = EFI_PCI_IO_PROTOCOL_GUID;
 static EFI_GUID uga_guid = EFI_UGA_DRAW_PROTOCOL_GUID;
@@ -270,7 +272,7 @@ efifb_from_uga(struct efi_fb *efifb, EFI
 	char *ev, *p;
 	EFI_STATUS status;
 	ssize_t offset;
-	uint64_t fbaddr, fbsize;
+	uint64_t fbaddr;
 	uint32_t horiz, vert, stride;
 	uint32_t np, depth, refresh;
 

Modified: head/sys/boot/efi/loader/arch/arm/exec.c
==============================================================================
--- head/sys/boot/efi/loader/arch/arm/exec.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/loader/arch/arm/exec.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -44,8 +44,9 @@ __FBSDID("$FreeBSD$");
 #include "loader_efi.h"
 
 extern vm_offset_t md_load(char *, vm_offset_t *);
+extern int bi_load(char *, vm_offset_t *, vm_offset_t *);
 
-int
+static int
 __elfN(arm_load)(char *filename, u_int64_t dest,
     struct preloaded_file **result)
 {
@@ -58,7 +59,7 @@ __elfN(arm_load)(char *filename, u_int64
 	return (0);
 }
 
-int
+static int
 __elfN(arm_exec)(struct preloaded_file *fp)
 {
 	struct file_metadata *fmp;
@@ -66,7 +67,6 @@ __elfN(arm_exec)(struct preloaded_file *
 	Elf_Ehdr *e;
 	int error;
 	void (*entry)(void *);
-	EFI_STATUS status;
 
 	if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL)
 		return (EFTYPE);

Modified: head/sys/boot/efi/loader/arch/arm64/exec.c
==============================================================================
--- head/sys/boot/efi/loader/arch/arm64/exec.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/loader/arch/arm64/exec.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include "platform/acfreebsd.h"
 #include "acconfig.h"
 #define ACPI_SYSTEM_XFACE
+#define ACPI_USE_SYSTEM_INTTYPES
 #include "actypes.h"
 #include "actbl.h"
 
@@ -74,8 +75,6 @@ elf64_exec(struct preloaded_file *fp)
 	size_t clean_size;
 	struct file_metadata *md;
 	ACPI_TABLE_RSDP *rsdp;
-	EFI_STATUS status;
-	EFI_PHYSICAL_ADDRESS addr;
 	Elf_Ehdr *ehdr;
 	char buf[24];
 	int err, revision;
@@ -119,8 +118,8 @@ elf64_exec(struct preloaded_file *fp)
 		return (err);
 
 	/* Clean D-cache under kernel area and invalidate whole I-cache */
-	clean_addr = efi_translate(fp->f_addr);
-	clean_size = efi_translate(kernendp) - clean_addr;
+	clean_addr = (vm_offset_t)efi_translate(fp->f_addr);
+	clean_size = (vm_offset_t)efi_translate(kernendp) - clean_addr;
 
 	cpu_flush_dcache((void *)clean_addr, clean_size);
 	cpu_inval_icache(NULL, 0);

Modified: head/sys/boot/efi/loader/autoload.c
==============================================================================
--- head/sys/boot/efi/loader/autoload.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/loader/autoload.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "loader_efi.h"
+
 int
 efi_autoload(void)
 {

Modified: head/sys/boot/efi/loader/bootinfo.c
==============================================================================
--- head/sys/boot/efi/loader/bootinfo.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/loader/bootinfo.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$");
 #include <fdt_platform.h>
 #endif
 
+int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp);
+
 extern EFI_SYSTEM_TABLE	*ST;
 
 static const char howto_switches[] = "aCdrgDmphsv";
@@ -122,7 +124,7 @@ bi_copyenv(vm_offset_t start)
 	/* Traverse the environment. */
 	for (ep = environ; ep != NULL; ep = ep->ev_next) {
 		len = strlen(ep->ev_name);
-		if (archsw.arch_copyin(ep->ev_name, addr, len) != len)
+		if ((size_t)archsw.arch_copyin(ep->ev_name, addr, len) != len)
 			break;
 		addr += len;
 		if (archsw.arch_copyin("=", addr, 1) != 1)
@@ -130,7 +132,7 @@ bi_copyenv(vm_offset_t start)
 		addr++;
 		if (ep->ev_value != NULL) {
 			len = strlen(ep->ev_value);
-			if (archsw.arch_copyin(ep->ev_value, addr, len) != len)
+			if ((size_t)archsw.arch_copyin(ep->ev_value, addr, len) != len)
 				break;
 			addr += len;
 		}
@@ -351,7 +353,7 @@ bi_load(char *args, vm_offset_t *modulep
 #endif
 #if defined(__arm__)
 	vm_offset_t vaddr;
-	int i;
+	size_t i;
 	/*
 	 * These metadata addreses must be converted for kernel after
 	 * relocation.

Modified: head/sys/boot/efi/loader/copy.c
==============================================================================
--- head/sys/boot/efi/loader/copy.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/loader/copy.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
 #include <efi.h>
 #include <efilib.h>
 
+#include "loader_efi.h"
+
 #ifndef EFI_STAGING_SIZE
 #define	EFI_STAGING_SIZE	48
 #endif

Modified: head/sys/boot/efi/loader/devicename.c
==============================================================================
--- head/sys/boot/efi/loader/devicename.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/loader/devicename.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -31,11 +31,13 @@ __FBSDID("$FreeBSD$");
 #include <stand.h>
 #include <string.h>
 #include <sys/disklabel.h>
-#include "bootstrap.h"
+#include <bootstrap.h>
 
 #include <efi.h>
 #include <efilib.h>
 
+#include "loader_efi.h"
+
 static int efi_parsedev(struct devdesc **, const char *, const char **);
 
 /*

Modified: head/sys/boot/efi/loader/loader_efi.h
==============================================================================
--- head/sys/boot/efi/loader/loader_efi.h	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/loader/loader_efi.h	Tue Jan 12 02:17:39 2016	(r293724)
@@ -31,6 +31,8 @@
 #ifndef	_LOADER_EFI_COPY_H_
 #define	_LOADER_EFI_COPY_H_
 
+#include <stand.h>
+
 int	efi_autoload(void);
 
 int	efi_getdev(void **vdev, const char *devspec, const char **path);

Modified: head/sys/boot/efi/loader/main.c
==============================================================================
--- head/sys/boot/efi/loader/main.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/efi/loader/main.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -68,6 +68,7 @@ main(int argc, CHAR16 *argv[])
 	EFI_LOADED_IMAGE *img;
 	EFI_GUID *guid;
 	int i, j, vargood;
+	UINTN k;
 
 	/*
 	 * XXX Chicken-and-egg problem; we want to have console output
@@ -155,10 +156,10 @@ main(int argc, CHAR16 *argv[])
 	archsw.arch_copyout = efi_copyout;
 	archsw.arch_readin = efi_readin;
 
-	for (i = 0; i < ST->NumberOfTableEntries; i++) {
-		guid = &ST->ConfigurationTable[i].VendorGuid;
+	for (k = 0; k < ST->NumberOfTableEntries; k++) {
+		guid = &ST->ConfigurationTable[k].VendorGuid;
 		if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) {
-			smbios_detect(ST->ConfigurationTable[i].VendorTable);
+			smbios_detect(ST->ConfigurationTable[k].VendorTable);
 			break;
 		}
 	}
@@ -242,8 +243,9 @@ command_memmap(int argc, char *argv[])
 
 	for (i = 0, p = map; i < ndesc;
 	     i++, p = NextMemoryDescriptor(p, dsz)) {
-		printf("%23s %012lx %012lx %08lx ", types[p->Type],
-		   p->PhysicalStart, p->VirtualStart, p->NumberOfPages);
+		printf("%23s %012jx %012jx %08jx ", types[p->Type],
+		   (uintmax_t)p->PhysicalStart, (uintmax_t)p->VirtualStart,
+		   (uintmax_t)p->NumberOfPages);
 		if (p->Attribute & EFI_MEMORY_UC)
 			printf("UC ");
 		if (p->Attribute & EFI_MEMORY_WC)
@@ -284,9 +286,10 @@ guid_to_string(EFI_GUID *guid)
 static int
 command_configuration(int argc, char *argv[])
 {
-	int i;
+	UINTN i;
 
-	printf("NumberOfTableEntries=%ld\n", ST->NumberOfTableEntries);
+	printf("NumberOfTableEntries=%lu\n",
+		(unsigned long)ST->NumberOfTableEntries);
 	for (i = 0; i < ST->NumberOfTableEntries; i++) {
 		EFI_GUID *guid;
 
@@ -382,9 +385,8 @@ command_nvram(int argc, char *argv[])
 	CHAR16 *data;
 	EFI_STATUS status;
 	EFI_GUID varguid = { 0,0,0,{0,0,0,0,0,0,0,0} };
-	UINTN varsz, datasz;
+	UINTN varsz, datasz, i;
 	SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
-	int i;
 
 	conout = ST->ConOut;
 

Modified: head/sys/boot/i386/libi386/smbios.c
==============================================================================
--- head/sys/boot/i386/libi386/smbios.c	Tue Jan 12 02:12:40 2016	(r293723)
+++ head/sys/boot/i386/libi386/smbios.c	Tue Jan 12 02:17:39 2016	(r293724)
@@ -332,7 +332,7 @@ static caddr_t
 smbios_find_struct(int type)
 {
 	caddr_t		dmi;
-	int		i;
+	size_t		i;
 
 	if (smbios.addr == NULL)
 		return (NULL);
@@ -402,7 +402,7 @@ smbios_detect(const caddr_t addr)
 {
 	char		buf[16];
 	caddr_t		dmi;
-	int		i;
+	size_t		i;
 
 	smbios_probe(addr);
 	if (smbios.addr == NULL)


More information about the svn-src-head mailing list