diff --git a/.hgignore b/.hgignore deleted file mode 100644 index d881845544bd..000000000000 --- a/.hgignore +++ /dev/null @@ -1,28 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -syntax: glob -* diff --git a/exception_lists/closed-bins b/exception_lists/closed-bins index 044a2b8d81d8..5f9ba142f564 100644 --- a/exception_lists/closed-bins +++ b/exception_lists/closed-bins @@ -13,28 +13,49 @@ ./etc/snmp/conf ./etc/snmp/conf/mibiisa.reg ./etc/snmp/conf/snmp.conf -./kernel/drv/cpqary3 -./kernel/drv/cpqary3.conf -./kernel/drv/amd64/cpqary3 +./kernel/drv/acpi_toshiba +./kernel/drv/adpu320 +./kernel/drv/atiatom +./kernel/drv/bcm_sata +./kernel/drv/bnx ./kernel/drv/bnxe ./kernel/drv/bnxe.conf ./kernel/drv/amd64/bnxe +./kernel/drv/cpqary3 +./kernel/drv/cpqary3.conf +./kernel/drv/amd64/cpqary3 +./kernel/drv/glm +./kernel/drv/intel_nhmex ./kernel/drv/iprb ./kernel/drv/amd64/iprb +./kernel/drv/ixgb +./kernel/drv/lsimega +./kernel/drv/marvell88sx +./kernel/drv/mpt ./kernel/drv/pcn ./kernel/drv/amd64/pcn ./kernel/drv/pcser ./kernel/drv/amd64/pcser ./kernel/drv/sparcv9/pcser +./kernel/drv/sdpib +./kernel/drv/usbser_edge +./kernel/kmdb/mpt +./kernel/kmdb/nfs ./kernel/misc/klmmod ./kernel/misc/amd64/klmmod ./kernel/misc/klmops ./kernel/misc/amd64/klmops +./kernel/misc/scsi_vhci/scsi_vhci_f_asym_emc +./kernel/misc/scsi_vhci/scsi_vhci_f_asym_lsi +./kernel/misc/scsi_vhci/scsi_vhci_f_sym_emc +./kernel/strmod/sdpib ./lib/crypto ./lib/crypto/kcfd ./lib/libc_i18n.a ./lib/amd64/libc_i18n.a ./lib/sparcv9/libc_i18n.a +./platform/i86pc/kernel/cpu/cpu_ms.GenuineIntel.6.46 +./platform/i86pc/kernel/cpu/cpu_ms.GenuineIntel.6.47 ./platform/sun4v/kernel/drv/ncp.conf ./platform/sun4v/kernel/drv/n2cp.conf ./usr/has @@ -56,6 +77,9 @@ ./usr/kernel/drv/sparcv9/llc2 ./usr/kernel/drv/llc2.conf ./usr/kernel/drv/llc2 +./usr/lib/inet/i86 +./usr/lib/inet/i86/in.iked +./usr/lib/libike.so ./usr/lib/llc2 ./usr/lib/llc2/llc2_config ./usr/lib/llc2/llc2_loop3 @@ -79,6 +103,8 @@ ./usr/lib/localedef/src/iso_8859_1/charmap.src ./usr/lib/localedef/src/iso_8859_1/extension.src ./usr/lib/localedef/src/iso_8859_1/localedef.src +./usr/lib/mdb/kvm/mpt.so +./usr/lib/mdb/kvm/nfs.so ./usr/lib/nfs/lockd ./usr/lib/snmp ./usr/lib/snmp/mibiisa diff --git a/exception_lists/cstyle b/exception_lists/cstyle index 5b42abb2facc..740b1e636e76 100644 --- a/exception_lists/cstyle +++ b/exception_lists/cstyle @@ -612,6 +612,7 @@ usr/src/lib/libsmbfs/smb/derparse.h usr/src/lib/libsmbfs/smb/spnego.c usr/src/lib/libsmbfs/smb/spnegoparse.c usr/src/lib/libsmbfs/smb/spnegoparse.h +usr/src/test/libc-tests/tests/regex/testregex.c usr/src/test/os-tests/tests/sockfs/conn.c usr/src/test/os-tests/tests/sockfs/dgram.c usr/src/test/os-tests/tests/sockfs/drop_priv.c diff --git a/exception_lists/packaging b/exception_lists/packaging index 20c767320b71..0ed8ba06e0f5 100644 --- a/exception_lists/packaging +++ b/exception_lists/packaging @@ -132,7 +132,6 @@ usr/include/libsocket_priv.h usr/include/errfp.h usr/include/ikedoor.h usr/include/ipsec_util.h -usr/lib/libike.so usr/lib/amd64/libike.so i386 usr/lib/sparcv9/libike.so sparc usr/lib/libipsecutil.so @@ -420,13 +419,6 @@ usr/lib/sparcv9/libuutil.so sparc # usr/include/sys/multidata_impl.h # -# The following files are used by wanboot. -# They contain interfaces which are currently private. -# -usr/include/sys/wanboot_impl.h -usr/include/wanboot -usr/include/wanbootutil.h -# # Even though all the objects built under usr/src/stand are later glommed # together into a couple of second-stage boot loaders, we dump the static # archives and lint libraries into $(ROOT)/stand for intermediate use @@ -468,7 +460,6 @@ usr/include/aclutils.h # # USB skeleton driver stays in sync with the rest of USB but doesn't ship. # -kernel/drv/usbskel i386 kernel/drv/amd64/usbskel i386 kernel/drv/sparcv9/usbskel sparc kernel/drv/usbskel.conf @@ -815,16 +806,12 @@ usr/lib/fs/smbfs/lsacl opt/smbcl-tests # # FC related files -kernel/kmdb/fcip i386 kernel/kmdb/amd64/fcip i386 kernel/kmdb/sparcv9/fcip sparc -kernel/kmdb/fcp i386 kernel/kmdb/amd64/fcp i386 kernel/kmdb/sparcv9/fcp sparc -kernel/kmdb/fctl i386 kernel/kmdb/amd64/fctl i386 kernel/kmdb/sparcv9/fctl sparc -kernel/kmdb/qlc i386 kernel/kmdb/amd64/qlc i386 kernel/kmdb/sparcv9/qlc sparc lib/llib-la5k sparc diff --git a/usr/src/Makefile.ast b/usr/src/Makefile.ast index 4dda28afa23f..1a85c1c7e71b 100644 --- a/usr/src/Makefile.ast +++ b/usr/src/Makefile.ast @@ -26,7 +26,7 @@ # Override this top level flag so the compiler builds in its native # C99 mode. This has been enabled to support the math stuff in the # AST tools (including ksh93). -C99MODE= $(C99_ENABLE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 +CSTD= $(CSTD_GNU99) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 # silence common AST&co. warnings... # ... about |#pragma prototyped| ... diff --git a/usr/src/Makefile.lint b/usr/src/Makefile.lint index 18d2f2398abc..8e589d6626f7 100644 --- a/usr/src/Makefile.lint +++ b/usr/src/Makefile.lint @@ -82,7 +82,6 @@ COMMON_SUBDIRS = \ cmd/cmd-inet/usr.lib/slpd \ cmd/cmd-inet/usr.lib/vrrpd \ cmd/cmd-inet/usr.lib/wpad \ - cmd/cmd-inet/usr.lib/wanboot \ cmd/cmd-inet/usr.sadm \ cmd/cmd-inet/usr.sbin \ cmd/cmd-inet/usr.sbin/ilbadm \ @@ -441,8 +440,6 @@ COMMON_SUBDIRS = \ lib/libuuid \ lib/libuutil \ lib/libvrrpadm \ - lib/libwanboot \ - lib/libwanbootutil \ lib/libxnet \ lib/libzfs \ lib/libzfs_jni \ diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master index 67d57a47c869..4eef93e0a83a 100644 --- a/usr/src/Makefile.master +++ b/usr/src/Makefile.master @@ -134,11 +134,19 @@ ELFEXTRACT= $(ONBLD_TOOLS)/bin/$(MACH)/elfextract MBH_PATCH= $(ONBLD_TOOLS)/bin/$(MACH)/mbh_patch BTXLD= $(ONBLD_TOOLS)/bin/$(MACH)/btxld VTFONTCVT= $(ONBLD_TOOLS)/bin/$(MACH)/vtfontcvt +# echo(1) and true(1) are specified without absolute paths, so that the shell +# spawned by make(1) may use the built-in versions. This is minimally +# problematic, as the shell spawned by make(1) is known and under control, the +# only risk being if the shell falls back to $PATH. +# +# We specifically want an echo(1) that does interpolation of escape sequences, +# which ksh93, /bin/sh, and bash will all provide. ECHO= echo -INS= install TRUE= true +INS= $(ONBLD_TOOLS)/bin/$(MACH)/install SYMLINK= /usr/bin/ln -s LN= /usr/bin/ln +MKDIR= /usr/bin/mkdir CHMOD= /usr/bin/chmod MV= /usr/bin/mv -f RM= /usr/bin/rm -f @@ -406,11 +414,11 @@ $(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-empty-body # turn warnings into errors (C++) CCERRWARN= -xwe -# C99 mode -C99_ENABLE= -xc99=%all -C99_DISABLE= -xc99=%none -C99MODE= $(C99_DISABLE) -C99LMODE= $(C99MODE:-xc99%=-Xc99%) +# C standard. Keep Studio flags until we get rid of lint. +CSTD_GNU89= -xc99=%none +CSTD_GNU99= -xc99=%all +CSTD= $(CSTD_GNU89) +C99LMODE= $(CSTD:-xc99%=-Xc99%) # In most places, assignments to these macros should be appended with += # (CPPFLAGS.first allows values to be prepended to CPPFLAGS). @@ -460,8 +468,8 @@ DEBUGFORMAT= -xdebugformat=stabs # Flags used to build in debug mode for ctf generation. Bugs in the Devpro # compilers currently prevent us from building with cc-emitted DWARF. # -CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR) -CTF_FLAGS_i386 = -g $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR) +CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(CSTD) $(CNOGLOBAL) $(CDWARFSTR) +CTF_FLAGS_i386 = -g $(CSTD) $(CNOGLOBAL) $(CDWARFSTR) CTF_FLAGS_sparcv9 = $(CTF_FLAGS_sparc) CTF_FLAGS_amd64 = $(CTF_FLAGS_i386) @@ -543,11 +551,11 @@ $(SRCDBGBLD)CSOURCEDEBUGFLAGS = -g -xs $(SRCDBGBLD)CCSOURCEDEBUGFLAGS = -g -xs CFLAGS= $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \ - $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) \ + $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG) \ $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \ $(CUSERFLAGS) CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \ - $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) \ + $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG64) \ $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \ $(CUSERFLAGS64) # @@ -555,7 +563,7 @@ CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \ # run on the build machine (also known as the NATIVE_BUILD). # NATIVE_CFLAGS= $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \ - $(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND) \ + $(ILDOFF) $(CERRWARN) $(CSTD) $($(NATIVE_MACH)_CCUNBOUND) \ $(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) \ $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS) diff --git a/usr/src/Targetdirs b/usr/src/Targetdirs index 936bdb447555..25d0a14e025d 100644 --- a/usr/src/Targetdirs +++ b/usr/src/Targetdirs @@ -272,8 +272,6 @@ DIRS= \ /usr/lib/hal \ /usr/lib/inet \ /usr/lib/inet/ilb \ - /usr/lib/inet/$(MACH32) \ - /usr/lib/inet/wanboot \ /usr/lib/krb5 \ /usr/lib/link_audit \ /usr/lib/lwp \ diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index 427065c3be61..410c2d4b4ae2 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2017.9.11.1 +BOOT_VERSION = $(LOADER_VERSION)-2018.2.11.1 diff --git a/usr/src/boot/lib/libstand/ip.c b/usr/src/boot/lib/libstand/ip.c index c920cb71725f..789dcaab6feb 100644 --- a/usr/src/boot/lib/libstand/ip.c +++ b/usr/src/boot/lib/libstand/ip.c @@ -415,8 +415,13 @@ readip(struct iodesc *d, void **pkt, void **payload, time_t tleft, while ((getsecs() - t) < tleft) { errno = 0; ret = readipv4(d, pkt, payload, tleft, proto); + if (ret >= 0) + return (ret); + /* Bubble up the error if it wasn't successful */ if (errno != EAGAIN) - break; + return (-1); } - return (ret); + /* We've exhausted tleft; timeout */ + errno = ETIMEDOUT; + return (-1); } diff --git a/usr/src/boot/lib/libstand/net.c b/usr/src/boot/lib/libstand/net.c index 740696a5a246..ea4c75b2335e 100644 --- a/usr/src/boot/lib/libstand/net.c +++ b/usr/src/boot/lib/libstand/net.c @@ -117,7 +117,7 @@ sendrecv(struct iodesc *d, /* Try to get a packet and process it. */ cc = (*rproc)(d, pkt, payload, tleft); /* Return on data, EOF or real error. */ - if (cc != -1 || errno != 0) + if (cc != -1 || (errno != 0 && errno != ETIMEDOUT)) return (cc); /* Timed out or didn't get the packet we're waiting for */ diff --git a/usr/src/boot/lib/libstand/tftp.c b/usr/src/boot/lib/libstand/tftp.c index 36ced27a2089..39cd1466fee1 100644 --- a/usr/src/boot/lib/libstand/tftp.c +++ b/usr/src/boot/lib/libstand/tftp.c @@ -637,14 +637,20 @@ sendrecv_tftp(struct tftp_handle *h, if (cc == -1) { /* Error on transmit; wait before retrying */ while ((getsecs() - t1) < tleft); + t1 = getsecs(); continue; } + t = t1 = getsecs(); recvnext: + if ((getsecs() - t) > MAXTMO) { + errno = ETIMEDOUT; + return (-1); + } /* Try to get a packet and process it. */ cc = (*rproc)(h, pkt, payload, tleft, rtype); /* Return on data, EOF or real error. */ - if (cc != -1 || errno != 0) + if (cc != -1 || (errno != 0 && errno != ETIMEDOUT)) return (cc); if ((getsecs() - t1) < tleft) { goto recvnext; diff --git a/usr/src/boot/sys/boot/Makefile b/usr/src/boot/sys/boot/Makefile index 0493409f65f5..7f25b8f1eeb2 100644 --- a/usr/src/boot/sys/boot/Makefile +++ b/usr/src/boot/sys/boot/Makefile @@ -27,7 +27,15 @@ install := TARGET = install all clean clobber: $(SUBDIRS) -install: all $(INSTDIRS) +# +# The directories in INSTDIRS depend implicitly on SUBDIRS being built already. +# We use .WAIT instead of explicit dependencies because we only want to make +# the "install" target in INSTDIRS, not in SUBDIRS. +# +# If adding SUBDIRS which are not dependencies of INSTDIRS, "install: all" +# rules should be added to the Makefiles in those directories. +# +install: all .WAIT $(INSTDIRS) $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET) diff --git a/usr/src/boot/sys/boot/common/disk.c b/usr/src/boot/sys/boot/common/disk.c index ca068d365d9a..61a4e38b1c11 100644 --- a/usr/src/boot/sys/boot/common/disk.c +++ b/usr/src/boot/sys/boot/common/disk.c @@ -133,14 +133,16 @@ ptable_print(void *arg, const char *pname, const struct ptable_entry *part) od->sectorsize) == 0) { table = ptable_open(&dev, part->end - part->start + 1, od->sectorsize, ptblread); - if (table != NULL) { + if (table != NULL && + (ptable_gettype(table) == PTABLE_BSD || + ptable_gettype(table) == PTABLE_VTOC8)) { sprintf(line, " %s%s", pa->prefix, pname); bsd.dev = &dev; bsd.prefix = line; bsd.verbose = pa->verbose; ret = ptable_iterate(table, &bsd, ptable_print); - ptable_close(table); } + ptable_close(table); disk_close(&dev); } } diff --git a/usr/src/boot/sys/boot/common/multiboot2.c b/usr/src/boot/sys/boot/common/multiboot2.c index 876a5cd6a2cf..0e3b7bbaa325 100644 --- a/usr/src/boot/sys/boot/common/multiboot2.c +++ b/usr/src/boot/sys/boot/common/multiboot2.c @@ -791,8 +791,9 @@ multiboot2_exec(struct preloaded_file *fp) size_t size; struct bios_smap *smap; #if defined (EFI) - multiboot_tag_module_t *module; + multiboot_tag_module_t *module, *mp; EFI_MEMORY_DESCRIPTOR *map; + UINTN map_size, desc_size; struct relocator *relocator; struct chunk_head *head; struct chunk *chunk; @@ -928,7 +929,7 @@ multiboot2_exec(struct preloaded_file *fp) * - tmp != mfp->f_addr only in case of EFI. */ #if defined (EFI) - tmp = roundup2(load_addr + fp->f_size, MULTIBOOT_MOD_ALIGN); + tmp = roundup2(load_addr + fp->f_size + 1, MULTIBOOT_MOD_ALIGN); module = (multiboot_tag_module_t *)last_addr; #endif @@ -958,9 +959,12 @@ multiboot2_exec(struct preloaded_file *fp) tag->mb_type = MULTIBOOT_TAG_TYPE_MODULE; tag->mb_size = sizeof (*tag) + num; #if defined (EFI) - tag->mb_mod_start = tmp; - tag->mb_mod_end = tmp + mfp->f_size; - tmp = roundup2(tag->mb_mod_end + 1, MULTIBOOT_MOD_ALIGN); + /* + * We can assign module addresses only after BS have been + * switched off. + */ + tag->mb_mod_start = 0; + tag->mb_mod_end = mfp->f_size; #else tag->mb_mod_start = mfp->f_addr; tag->mb_mod_end = mfp->f_addr + mfp->f_size; @@ -1100,21 +1104,21 @@ multiboot2_exec(struct preloaded_file *fp) /* Leave EFI memmap last as we will also switch off the BS. */ { multiboot_tag_efi_mmap_t *tag; - UINTN size, desc_size, key; + UINTN key; EFI_STATUS status; tag = (multiboot_tag_efi_mmap_t *) mb_malloc(sizeof (*tag)); - size = 0; - status = BS->GetMemoryMap(&size, + map_size = 0; + status = BS->GetMemoryMap(&map_size, (EFI_MEMORY_DESCRIPTOR *)tag->mb_efi_mmap, &key, &desc_size, &tag->mb_descr_vers); if (status != EFI_BUFFER_TOO_SMALL) { error = EINVAL; goto error; } - status = BS->GetMemoryMap(&size, + status = BS->GetMemoryMap(&map_size, (EFI_MEMORY_DESCRIPTOR *)tag->mb_efi_mmap, &key, &desc_size, &tag->mb_descr_vers); if (EFI_ERROR(status)) { @@ -1122,7 +1126,7 @@ multiboot2_exec(struct preloaded_file *fp) goto error; } tag->mb_type = MULTIBOOT_TAG_TYPE_EFI_MMAP; - tag->mb_size = sizeof (*tag) + size; + tag->mb_size = sizeof (*tag) + map_size; tag->mb_descr_size = (uint32_t) desc_size; /* @@ -1132,7 +1136,7 @@ multiboot2_exec(struct preloaded_file *fp) * relocator data, trampoline, copy, memmove, stack. */ for (i = 0, map = (EFI_MEMORY_DESCRIPTOR *)tag->mb_efi_mmap; - i < size / desc_size; + i < map_size / desc_size; i++, map = NextMemoryDescriptor(map, desc_size)) { if (map->PhysicalStart == 0) continue; @@ -1154,7 +1158,7 @@ multiboot2_exec(struct preloaded_file *fp) } } - last_addr += size; + last_addr += map_size; last_addr = roundup2(last_addr, MULTIBOOT_TAG_ALIGN); } #endif @@ -1191,20 +1195,32 @@ multiboot2_exec(struct preloaded_file *fp) STAILQ_INSERT_TAIL(head, chunk, chunk_next); + mp = module; for (mfp = fp->f_next; mfp != NULL; mfp = mfp->f_next) { chunk = &relocator->rel_chunklist[i++]; chunk->chunk_vaddr = mfp->f_addr; - chunk->chunk_paddr = module->mb_mod_start; + + /* + * fix the mb_mod_start and mb_mod_end. + */ + mp->mb_mod_start = efi_physaddr(module, tmp, map, + map_size / desc_size, desc_size, mp->mb_mod_end); + if (mp->mb_mod_start == 0) + panic("Could not find memory for module\n"); + + mp->mb_mod_end += mp->mb_mod_start; + chunk->chunk_paddr = mp->mb_mod_start; chunk->chunk_size = mfp->f_size; STAILQ_INSERT_TAIL(head, chunk, chunk_next); - module = (multiboot_tag_module_t *) - roundup2((uintptr_t)module + module->mb_size, + mp = (multiboot_tag_module_t *) + roundup2((uintptr_t)mp + mp->mb_size, MULTIBOOT_TAG_ALIGN); } chunk = &relocator->rel_chunklist[i++]; chunk->chunk_vaddr = (EFI_VIRTUAL_ADDRESS)mbi; - chunk->chunk_paddr = tmp; + chunk->chunk_paddr = efi_physaddr(module, tmp, map, + map_size / desc_size, desc_size, mbi->mbi_total_size); chunk->chunk_size = mbi->mbi_total_size; STAILQ_INSERT_TAIL(head, chunk, chunk_next); diff --git a/usr/src/boot/sys/boot/common/part.c b/usr/src/boot/sys/boot/common/part.c index 0a91aa768edc..37eb7870ead8 100644 --- a/usr/src/boot/sys/boot/common/part.c +++ b/usr/src/boot/sys/boot/common/part.c @@ -853,6 +853,9 @@ ptable_close(struct ptable *table) { struct pentry *entry; + if (table == NULL) + return; + while (!STAILQ_EMPTY(&table->entries)) { entry = STAILQ_FIRST(&table->entries); STAILQ_REMOVE_HEAD(&table->entries, entry); diff --git a/usr/src/boot/sys/boot/efi/boot1/Makefile b/usr/src/boot/sys/boot/efi/boot1/Makefile index b027bdc845ec..49960d53c2c4 100644 --- a/usr/src/boot/sys/boot/efi/boot1/Makefile +++ b/usr/src/boot/sys/boot/efi/boot1/Makefile @@ -40,12 +40,11 @@ CPPFLAGS += -I./../../../../include CPPFLAGS += -I./../../../sys CPPFLAGS += -I./../../.. CPPFLAGS += -I../../../../lib/libstand -CPPFLAGS += -DEFI_UFS_BOOT -DUFS1_ONLY +CPPFLAGS += -DUFS1_ONLY # CPPFLAGS += -DEFI_DEBUG CPPFLAGS += -I./../../zfs/ CPPFLAGS += -I./../../../cddl/boot/zfs/ -CPPFLAGS += -DEFI_ZFS_BOOT # Always add MI sources and REGULAR efi loader bits CPPFLAGS += -I./../../common diff --git a/usr/src/boot/sys/boot/efi/boot1/boot1.c b/usr/src/boot/sys/boot/efi/boot1/boot1.c index 23d4c22b8021..98fd3b00ffc6 100644 --- a/usr/src/boot/sys/boot/efi/boot1/boot1.c +++ b/usr/src/boot/sys/boot/efi/boot1/boot1.c @@ -40,12 +40,8 @@ struct fs_ops *file_system[] = { static const boot_module_t *boot_modules[] = { -#ifdef EFI_ZFS_BOOT &zfs_module, -#endif -#ifdef EFI_UFS_BOOT &ufs_module -#endif }; #define NUM_BOOT_MODULES nitems(boot_modules) diff --git a/usr/src/boot/sys/boot/efi/boot1/boot_module.h b/usr/src/boot/sys/boot/efi/boot1/boot_module.h index 59d1a7ea4ade..30ecd30d9ca0 100644 --- a/usr/src/boot/sys/boot/efi/boot1/boot_module.h +++ b/usr/src/boot/sys/boot/efi/boot1/boot_module.h @@ -96,12 +96,8 @@ typedef struct boot_module_t } boot_module_t; /* Standard boot modules. */ -#ifdef EFI_UFS_BOOT extern const boot_module_t ufs_module; -#endif -#ifdef EFI_ZFS_BOOT extern const boot_module_t zfs_module; -#endif /* Functions available to modules. */ extern void add_device(dev_info_t **devinfop, dev_info_t *devinfo); diff --git a/usr/src/boot/sys/boot/efi/include/efi_driver_utils.h b/usr/src/boot/sys/boot/efi/include/efi_driver_utils.h new file mode 100644 index 000000000000..f030d4e61f49 --- /dev/null +++ b/usr/src/boot/sys/boot/efi/include/efi_driver_utils.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2017 Eric McCorkle + * 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. + */ + +#ifndef _EFI_DRIVER_UTILS_H_ +#define _EFI_DRIVER_UTILS_H_ + +#include +#include + +extern EFI_STATUS install_driver(EFI_DRIVER_BINDING *driver); +extern EFI_STATUS connect_controllers(EFI_GUID *filter); + +#endif diff --git a/usr/src/boot/sys/boot/efi/include/efi_drivers.h b/usr/src/boot/sys/boot/efi/include/efi_drivers.h new file mode 100644 index 000000000000..1a96d669dca3 --- /dev/null +++ b/usr/src/boot/sys/boot/efi/include/efi_drivers.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016 Eric McCorkle + * 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. + */ + +#ifndef _EFI_DRIVERS_H_ +#define _EFI_DRIVERS_H_ + +#include + +typedef struct efi_driver_t { + const char *name; + void (*init)(void); +} efi_driver_t; + +extern struct devsw efipart_dev; +extern int efipart_getdesc(struct devdesc *dev, char **out); + +/* EFI drivers. */ +extern const efi_driver_t fs_driver; + +#endif diff --git a/usr/src/boot/sys/boot/efi/include/efichar.h b/usr/src/boot/sys/boot/efi/include/efichar.h new file mode 100644 index 000000000000..97ca28bf4f9f --- /dev/null +++ b/usr/src/boot/sys/boot/efi/include/efichar.h @@ -0,0 +1,36 @@ +/* + * 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 + +#ifndef _BOOT_EFI_EFICHAR_H_ +#define _BOOT_EFI_EFICHAR_H_ + +int ucs2_to_utf8(const CHAR16 *, char **); +int utf8_to_ucs2(const char *, CHAR16 **, size_t *); +int ucs2len(const CHAR16 *); + +#endif /* _BOOT_EFI_EFICHAR_H_ */ diff --git a/usr/src/boot/sys/boot/efi/include/efilib.h b/usr/src/boot/sys/boot/efi/include/efilib.h index 4fcc0ff712ba..5f007c6d5906 100644 --- a/usr/src/boot/sys/boot/efi/include/efilib.h +++ b/usr/src/boot/sys/boot/efi/include/efilib.h @@ -60,9 +60,14 @@ typedef struct pdinfo } pdinfo_t; pdinfo_list_t *efiblk_get_pdinfo_list(struct devsw *dev); +pdinfo_t *efiblk_get_pdinfo(struct devdesc *dev); void *efi_get_table(EFI_GUID *tbl); +int efi_getdev(void **, const char *, const char **); +char *efi_fmtdev(void *); +int efi_setcurrdev(struct env_var *, int, const void *); + int efi_register_handles(struct devsw *, EFI_HANDLE *, EFI_HANDLE *, int); EFI_HANDLE efi_find_handle(struct devsw *, int); int efi_handle_lookup(EFI_HANDLE, struct devsw **, int *, uint64_t *); diff --git a/usr/src/boot/sys/boot/efi/include/efiprot.h b/usr/src/boot/sys/boot/efi/include/efiprot.h index 9e14d9c9ee29..bd051a0ee1d8 100644 --- a/usr/src/boot/sys/boot/efi/include/efiprot.h +++ b/usr/src/boot/sys/boot/efi/include/efiprot.h @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ #ifndef _EFI_PROT_H #define _EFI_PROT_H @@ -27,6 +26,8 @@ Revision History --*/ +#include + // // Device Path protocol // @@ -557,4 +558,80 @@ typedef struct _EFI_UNICODE_COLLATION_INTERFACE { CHAR8 *SupportedLanguages; } EFI_UNICODE_COLLATION_INTERFACE; +// +// Driver Binding protocol +// + +#define DRIVER_BINDING_PROTOCOL \ + { 0x18a031ab, 0xb443, 0x4d1a, {0xa5, 0xc0, 0x0c, 0x09, 0x26, 0x1e, 0x9f, 0x71} } + +INTERFACE_DECL(_EFI_DRIVER_BINDING); + +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_BINDING_SUPPORTED) ( + IN struct _EFI_DRIVER_BINDING *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_DEVICE_PATH *RemainingPath + ); + +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_BINDING_START) ( + IN struct _EFI_DRIVER_BINDING *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_DEVICE_PATH *RemainingPath + ); + +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_BINDING_STOP) ( + IN struct _EFI_DRIVER_BINDING *This, + IN EFI_HANDLE ControllerHandle, + IN UINTN NumberOfChildren, + IN EFI_HANDLE *ChildHandleBuffer + ); + +typedef struct _EFI_DRIVER_BINDING { + EFI_DRIVER_BINDING_SUPPORTED Supported; + EFI_DRIVER_BINDING_START Start; + EFI_DRIVER_BINDING_STOP Stop; + UINT32 Version; + EFI_HANDLE ImageHandle; + EFI_HANDLE DriverBindingHandle; +} EFI_DRIVER_BINDING; + +// +// Component Name Protocol 2 +// + +#define COMPONENT_NAME2_PROTOCOL \ + { 0x6a7a5cff, 0xe8d9, 0x4f70, {0xba, 0xda, 0x75, 0xab, 0x30, 0x25, 0xce, 0x14 } } + +INTERFACE_DECL(_EFI_COMPONENT_NAME2); + +typedef +EFI_STATUS +(EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME) ( + IN struct _EFI_COMPONENT_NAME2 *This, + IN CHAR8 * Language, + OUT CHAR16 **DriverName + ); + +typedef +EFI_STATUS +(EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) ( + IN struct _EFI_COMPONENT_NAME2 *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN CHAR8 *Language, + OUT CHAR16 **ControllerName +); + +typedef struct _EFI_COMPONENT_NAME2 { + EFI_COMPONENT_NAME_GET_DRIVER_NAME GetDriverName; + EFI_COMPONENT_NAME_GET_CONTROLLER_NAME GetControllerName; + CHAR8 **SupportedLanguages; +} EFI_COMPONENT_NAME2; + #endif diff --git a/usr/src/boot/sys/boot/efi/include/efizfs.h b/usr/src/boot/sys/boot/efi/include/efizfs.h new file mode 100644 index 000000000000..636951c0d6b3 --- /dev/null +++ b/usr/src/boot/sys/boot/efi/include/efizfs.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Eric McCorkle + * 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 + +#ifndef _EFIZFS_H_ +#define _EFIZFS_H_ + +typedef STAILQ_HEAD(zfsinfo_list, zfsinfo) zfsinfo_list_t; + +typedef struct zfsinfo +{ + STAILQ_ENTRY(zfsinfo) zi_link; + EFI_HANDLE zi_handle; + uint64_t zi_pool_guid; +} zfsinfo_t; + +extern uint64_t pool_guid; + +extern void efi_zfs_probe(void); +extern zfsinfo_list_t *efizfs_get_zfsinfo_list(void); +extern bool efi_zfs_is_preferred(EFI_HANDLE *h); +extern EFI_HANDLE efizfs_get_handle_by_guid(uint64_t); + +#endif diff --git a/usr/src/boot/sys/boot/efi/libefi/Makefile b/usr/src/boot/sys/boot/efi/libefi/Makefile index 5845cf85b2c6..e987cbc9d64c 100644 --- a/usr/src/boot/sys/boot/efi/libefi/Makefile +++ b/usr/src/boot/sys/boot/efi/libefi/Makefile @@ -24,8 +24,9 @@ all: lib$(LIB).a install: -SRCS= delay.c devpath.c efi_console.c efinet.c efipart.c env.c errno.c \ - handles.c libefi.c time.c wchar.c +SRCS= delay.c devicename.c devpath.c efi_console.c efi_driver_utils.c \ + efichar.c efinet.c efipart.c efizfs.c env.c errno.c handles.c \ + libefi.c time.c wchar.c #.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" #SRCS += time.c @@ -35,7 +36,7 @@ SRCS= delay.c devpath.c efi_console.c efinet.c efipart.c env.c errno.c \ OBJS= $(SRCS:%.c=%.o) -CPPFLAGS= -DTERM_EMU -D_STANDALONE +CPPFLAGS= -D_STANDALONE CFLAGS = -O2 #.if ${MACHINE_CPUARCH} == "aarch64" @@ -50,6 +51,8 @@ CFLAGS += -I$(SRC)/common/ficl -I../../ficl CFLAGS += -I../include CFLAGS += -I../include/${MACH64} CFLAGS += -I../../../../lib/libstand +CFLAGS += -I./../../zfs +CFLAGS += -I./../../../cddl/boot/zfs # Pick up the bootstrap header for some interface items CFLAGS += -I../../common @@ -57,7 +60,7 @@ CFLAGS += -I../../common # Handle FreeBSD specific %b and %D printf format specifiers # CFLAGS+= ${FORMAT_EXTENSIONS} # CFLAGS += -D__printf__=__freebsd_kprintf__ -CFLAGS+= -DTERM_EMU +CFLAGS += -DTERM_EMU include ../Makefile.inc diff --git a/usr/src/boot/sys/boot/efi/loader/devicename.c b/usr/src/boot/sys/boot/efi/libefi/devicename.c similarity index 99% rename from usr/src/boot/sys/boot/efi/loader/devicename.c rename to usr/src/boot/sys/boot/efi/libefi/devicename.c index 1e499c0b1b30..c1c38c7a61e5 100644 --- a/usr/src/boot/sys/boot/efi/loader/devicename.c +++ b/usr/src/boot/sys/boot/efi/libefi/devicename.c @@ -38,8 +38,6 @@ #include #include -#include "loader_efi.h" - static int efi_parsedev(struct devdesc **, const char *, const char **); /* diff --git a/usr/src/boot/sys/boot/efi/libefi/efi_driver_utils.c b/usr/src/boot/sys/boot/efi/libefi/efi_driver_utils.c new file mode 100644 index 000000000000..eeb8930fe38f --- /dev/null +++ b/usr/src/boot/sys/boot/efi/libefi/efi_driver_utils.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2017 Eric McCorkle + * 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 + +#include +#include + +#include "efi_driver_utils.h" + +static EFI_GUID DriverBindingProtocolGUID = DRIVER_BINDING_PROTOCOL; + +EFI_STATUS +connect_controllers(EFI_GUID *filter) +{ + EFI_STATUS status; + EFI_HANDLE *handles; + UINTN nhandles, i, hsize; + + nhandles = 0; + hsize = 0; + status = BS->LocateHandle(ByProtocol, filter, NULL, + &hsize, NULL); + + if(status != EFI_BUFFER_TOO_SMALL) { + return (status); + } + + handles = malloc(hsize); + nhandles = hsize / sizeof(EFI_HANDLE); + + status = BS->LocateHandle(ByProtocol, filter, NULL, + &hsize, handles); + + if(EFI_ERROR(status)) { + return (status); + } + + for(i = 0; i < nhandles; i++) { + BS->ConnectController(handles[i], NULL, NULL, true); + } + + free(handles); + + return (status); +} + +EFI_STATUS +install_driver(EFI_DRIVER_BINDING *driver) +{ + EFI_STATUS status; + + driver->ImageHandle = IH; + driver->DriverBindingHandle = NULL; + status = BS->InstallMultipleProtocolInterfaces( + &(driver->DriverBindingHandle), + &DriverBindingProtocolGUID, driver, + NULL); + + if (EFI_ERROR(status)) { + printf("Failed to install driver (%ld)!\n", + EFI_ERROR_CODE(status)); + } + + return (status); +} diff --git a/usr/src/boot/sys/boot/efi/libefi/efichar.c b/usr/src/boot/sys/boot/efi/libefi/efichar.c new file mode 100644 index 000000000000..3a2a773b81ce --- /dev/null +++ b/usr/src/boot/sys/boot/efi/libefi/efichar.c @@ -0,0 +1,194 @@ +/* + * 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 + +#include +#include +#include +#include + +int +ucs2len(const CHAR16 *str) +{ + int i; + + i = 0; + while (*str++) + i++; + return (i); +} + +/* + * If nm were converted to utf8, what what would strlen + * return on the resulting string? + */ +static size_t +utf8_len_of_ucs2(const CHAR16 *nm) +{ + size_t len; + CHAR16 c; + + len = 0; + while (*nm) { + c = *nm++; + if (c > 0x7ff) + len += 3; + else if (c > 0x7f) + len += 2; + else + len++; + } + + return (len); +} + +int +ucs2_to_utf8(const CHAR16 *nm, char **name) +{ + size_t len, sz; + CHAR16 c; + char *cp; + int freeit = *name == NULL; + + sz = utf8_len_of_ucs2(nm) + 1; + len = 0; + if (*name != NULL) + cp = *name; + else + cp = *name = malloc(sz); + if (*name == NULL) + return (ENOMEM); + + while (*nm) { + c = *nm++; + if (c > 0x7ff) { + if (len++ < sz) + *cp++ = (char)(0xE0 | (c >> 12)); + if (len++ < sz) + *cp++ = (char)(0x80 | ((c >> 6) & 0x3f)); + if (len++ < sz) + *cp++ = (char)(0x80 | (c & 0x3f)); + } else if (c > 0x7f) { + if (len++ < sz) + *cp++ = (char)(0xC0 | ((c >> 6) & 0x1f)); + if (len++ < sz) + *cp++ = (char)(0x80 | (c & 0x3f)); + } else { + if (len++ < sz) + *cp++ = (char)(c & 0x7f); + } + } + + if (len >= sz) { + /* Absent bugs, we'll never return EOVERFLOW */ + if (freeit) { + free(*name); + *name = NULL; + } + return (EOVERFLOW); + } + *cp++ = '\0'; + + return (0); +} + +int +utf8_to_ucs2(const char *name, CHAR16 **nmp, size_t *len) +{ + CHAR16 *nm; + size_t sz; + uint32_t ucs4; + int c, bytes; + int freeit = *nmp == NULL; + + sz = strlen(name) * 2 + 2; + if (*nmp == NULL) + *nmp = malloc(sz); + if (*nmp == NULL) + return (ENOMEM); + nm = *nmp; + *len = sz; + + ucs4 = 0; + bytes = 0; + while (sz > 1 && *name != '\0') { + c = *name++; + /* + * Conditionalize on the two major character types: + * initial and followup characters. + */ + if ((c & 0xc0) != 0x80) { + /* Initial characters. */ + if (bytes != 0) + goto ilseq; + if ((c & 0xf8) == 0xf0) { + ucs4 = c & 0x07; + bytes = 3; + } else if ((c & 0xf0) == 0xe0) { + ucs4 = c & 0x0f; + bytes = 2; + } else if ((c & 0xe0) == 0xc0) { + ucs4 = c & 0x1f; + bytes = 1; + } else { + ucs4 = c & 0x7f; + bytes = 0; + } + } else { + /* Followup characters. */ + if (bytes > 0) { + ucs4 = (ucs4 << 6) + (c & 0x3f); + bytes--; + } else if (bytes == 0) { + goto ilseq; + } + } + if (bytes == 0) { + if (ucs4 > 0xffff) + goto ilseq; + *nm++ = (CHAR16)ucs4; + sz -= 2; + } + } + if (sz < 2) { + if (freeit) { + free(nm); + *nmp = NULL; + } + return (EDOOFUS); + } + sz -= 2; + *nm = 0; + *len -= sz; + return (0); +ilseq: + if (freeit) { + free(nm); + *nmp = NULL; + } + return (EILSEQ); +} diff --git a/usr/src/boot/sys/boot/efi/libefi/efipart.c b/usr/src/boot/sys/boot/efi/libefi/efipart.c index 2640201698a2..942deab383b6 100644 --- a/usr/src/boot/sys/boot/efi/libefi/efipart.c +++ b/usr/src/boot/sys/boot/efi/libefi/efipart.c @@ -38,6 +38,7 @@ #include #include #include +#include #include static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL; @@ -105,16 +106,33 @@ static pdinfo_list_t hdinfo; static EFI_HANDLE *efipart_handles = NULL; static UINTN efipart_nhandles = 0; -static pdinfo_t * -efiblk_get_pdinfo(pdinfo_list_t *pdi, int unit) +pdinfo_list_t * +efiblk_get_pdinfo_list(struct devsw *dev) { - pdinfo_t *pd; + if (dev->dv_type == DEVT_DISK) + return (&hdinfo); + if (dev->dv_type == DEVT_CD) + return (&cdinfo); + if (dev->dv_type == DEVT_FD) + return (&fdinfo); + return (NULL); +} + +pdinfo_t * +efiblk_get_pdinfo(struct devdesc *dev) +{ + pdinfo_list_t *pdi; + pdinfo_t *pd = NULL; + + pdi = efiblk_get_pdinfo_list(dev->d_dev); + if (pdi == NULL) + return (pd); STAILQ_FOREACH(pd, pdi, pd_link) { - if (pd->pd_unit == unit) + if (pd->pd_unit == dev->d_unit) return (pd); } - return (NULL); + return (pd); } static int @@ -546,8 +564,7 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) unit = 0; /* FILEPATH_DEVICE_PATH has 0 terminated string */ - for (len = 0; node->PathName[len] != 0; len++) - ; + len = ucs2len(node->PathName); if ((pathname = malloc(len + 1)) == NULL) { printf("Failed to add disk, out of memory\n"); free(pd); @@ -777,24 +794,11 @@ efipart_printhd(int verbose) return (efipart_print_common(&efipart_hddev, &hdinfo, verbose)); } -pdinfo_list_t * -efiblk_get_pdinfo_list(struct devsw *dev) -{ - if (dev->dv_type == DEVT_DISK) - return (&hdinfo); - if (dev->dv_type == DEVT_CD) - return (&cdinfo); - if (dev->dv_type == DEVT_FD) - return (&fdinfo); - return (NULL); -} - static int efipart_open(struct open_file *f, ...) { va_list args; struct disk_devdesc *dev; - pdinfo_list_t *pdi; pdinfo_t *pd; EFI_BLOCK_IO *blkio; EFI_STATUS status; @@ -805,13 +809,9 @@ efipart_open(struct open_file *f, ...) if (dev == NULL) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) - return (EIO); + return (EINVAL); if (pd->pd_blkio == NULL) { status = BS->HandleProtocol(pd->pd_handle, &blkio_guid, @@ -851,17 +851,13 @@ static int efipart_close(struct open_file *f) { struct disk_devdesc *dev; - pdinfo_list_t *pdi; pdinfo_t *pd; dev = (struct disk_devdesc *)(f->f_devdata); if (dev == NULL) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EINVAL); @@ -880,18 +876,14 @@ static int efipart_ioctl(struct open_file *f, u_long cmd, void *data) { struct disk_devdesc *dev; - pdinfo_list_t *pdi; pdinfo_t *pd; int rc; dev = (struct disk_devdesc *)(f->f_devdata); if (dev == NULL) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EINVAL); @@ -964,17 +956,13 @@ efipart_strategy(void *devdata, int rw, daddr_t blk, size_t size, { struct bcache_devdata bcd; struct disk_devdesc *dev; - pdinfo_list_t *pdi; pdinfo_t *pd; dev = (struct disk_devdesc *)devdata; if (dev == NULL) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EINVAL); @@ -1002,7 +990,6 @@ efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize) { struct disk_devdesc *dev = (struct disk_devdesc *)devdata; - pdinfo_list_t *pdi; pdinfo_t *pd; EFI_BLOCK_IO *blkio; uint64_t off, disk_blocks, d_offset = 0; @@ -1014,11 +1001,7 @@ efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t size, if (dev == NULL || blk < 0) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EINVAL); diff --git a/usr/src/boot/sys/boot/efi/libefi/efizfs.c b/usr/src/boot/sys/boot/efi/libefi/efizfs.c new file mode 100644 index 000000000000..f60249221faf --- /dev/null +++ b/usr/src/boot/sys/boot/efi/libefi/efizfs.c @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2008-2010 Rui Paulo + * Copyright (c) 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 ``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 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 + +#include +#include + +#include + +#include +#include + +#include "efizfs.h" + +static zfsinfo_list_t zfsinfo; + +uint64_t pool_guid; + +zfsinfo_list_t * +efizfs_get_zfsinfo_list(void) +{ + return (&zfsinfo); +} + +EFI_HANDLE +efizfs_get_handle_by_guid(uint64_t guid) +{ + zfsinfo_t *zi; + + STAILQ_FOREACH(zi, &zfsinfo, zi_link) { + if (zi->zi_pool_guid == guid) { + return (zi->zi_handle); + } + } + return (NULL); +} + +static void +insert_zfs(EFI_HANDLE handle, uint64_t guid) +{ + zfsinfo_t *zi; + + zi = malloc(sizeof(zfsinfo_t)); + zi->zi_handle = handle; + zi->zi_pool_guid = guid; + STAILQ_INSERT_TAIL(&zfsinfo, zi, zi_link); +} + +void +efi_zfs_probe(void) +{ + pdinfo_list_t *hdi; + pdinfo_t *hd, *pd = NULL; + char devname[SPECNAMELEN + 1]; + uint64_t guid; + + hdi = efiblk_get_pdinfo_list(&efipart_hddev); + STAILQ_INIT(&zfsinfo); + + /* + * Find the handle for the boot device. The boot1 did find the + * device with loader binary, now we need to search for the + * same device and if it is part of the zfs pool, we record the + * pool GUID for currdev setup. + */ + STAILQ_FOREACH(hd, hdi, pd_link) { + STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { + + snprintf(devname, sizeof(devname), "%s%dp%d:", + efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit); + + if (zfs_probe_dev(devname, &guid) == 0) { + insert_zfs(pd->pd_handle, guid); + + if (efi_zfs_is_preferred(pd->pd_handle)) + pool_guid = guid; + } + + } + } +} + +uint64_t +ldi_get_size(void *priv) +{ + int fd = (uintptr_t) priv; + uint64_t size; + + ioctl(fd, DIOCGMEDIASIZE, &size); + return (size); +} diff --git a/usr/src/boot/sys/boot/efi/loader/Makefile b/usr/src/boot/sys/boot/efi/loader/Makefile index cea026b91c41..0ae2ebbe3b88 100644 --- a/usr/src/boot/sys/boot/efi/loader/Makefile +++ b/usr/src/boot/sys/boot/efi/loader/Makefile @@ -26,9 +26,9 @@ PROG= loader.sym MACHINE= $(MACH64) # architecture-specific loader code -SRCS= autoload.c bootinfo.c conf.c copy.c devicename.c efi_main.c main.c \ +SRCS= autoload.c bootinfo.c conf.c copy.c efi_main.c main.c \ self_reloc.c smbios.c acpi.c vers.c memmap.c multiboot2.c -OBJS= autoload.o bootinfo.o conf.o copy.o devicename.o efi_main.o main.o \ +OBJS= autoload.o bootinfo.o conf.o copy.o efi_main.o main.o \ self_reloc.o smbios.o acpi.o vers.o memmap.o multiboot2.o ASFLAGS=-m64 -fPIC @@ -49,7 +49,6 @@ CPPFLAGS += -I./../../.. CPPFLAGS += -I./../../i386/libi386 CPPFLAGS += -I./../../zfs CPPFLAGS += -I./../../../cddl/boot/zfs -CPPFLAGS += -DEFI_ZFS_BOOT CPPFLAGS += -DNO_PCI -DEFI -DTERM_EMU # Export serial numbers, UUID, and asset tag from loader. diff --git a/usr/src/boot/sys/boot/efi/loader/conf.c b/usr/src/boot/sys/boot/efi/loader/conf.c index 6b24517c982f..5a7bfede2607 100644 --- a/usr/src/boot/sys/boot/efi/loader/conf.c +++ b/usr/src/boot/sys/boot/efi/loader/conf.c @@ -25,32 +25,25 @@ */ #include -__FBSDID("$FreeBSD$"); #include #include #include #include -#ifdef EFI_ZFS_BOOT #include -#endif struct devsw *devsw[] = { &efipart_fddev, &efipart_cddev, &efipart_hddev, &efinet_dev, -#ifdef EFI_ZFS_BOOT &zfs_dev, -#endif NULL }; struct fs_ops *file_system[] = { &gzipfs_fsops, -#ifdef EFI_ZFS_BOOT &zfs_fsops, -#endif &dosfs_fsops, &ufs_fsops, &cd9660_fsops, diff --git a/usr/src/boot/sys/boot/efi/loader/copy.c b/usr/src/boot/sys/boot/efi/loader/copy.c index a4f44bc07283..9658a659d42f 100644 --- a/usr/src/boot/sys/boot/efi/loader/copy.c +++ b/usr/src/boot/sys/boot/efi/loader/copy.c @@ -1,4 +1,4 @@ -/*- +/* * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * @@ -40,6 +40,110 @@ #include "loader_efi.h" +/* + * Verify the address is not in use by existing modules. + */ +static vm_offset_t +addr_verify(multiboot_tag_module_t *module, vm_offset_t addr, size_t size) +{ + vm_offset_t start, end; + + for (;module->mb_type == MULTIBOOT_TAG_TYPE_MODULE; + module = (multiboot_tag_module_t *) + roundup((uintptr_t)module + module->mb_size, MULTIBOOT_TAG_ALIGN)) { + + start = module->mb_mod_start; + end = module->mb_mod_end; + + /* Does this module have address assigned? */ + if (start == 0) + continue; + + if ((start <= addr) && (end >= addr)) { + return (0); + } + if ((start >= addr) && (start <= addr + size)) { + return (0); + } + } + return (addr); +} + +/* + * Find memory map entry above 1MB, able to contain size bytes from addr. + */ +static vm_offset_t +memmap_find(EFI_MEMORY_DESCRIPTOR *map, size_t count, UINTN dsize, + vm_offset_t addr, size_t size) +{ + int i; + + for (i = 0; i < count; i++, map = NextMemoryDescriptor(map, dsize)) { + + if (map->Type != EfiConventionalMemory) + continue; + + /* We do not want address below 1MB. */ + if (map->PhysicalStart < 0x100000) + continue; + + /* Do we fit into current entry? */ + if ((map->PhysicalStart <= addr) && + (map->PhysicalStart + + (map->NumberOfPages << EFI_PAGE_SHIFT) >= addr + size)) { + return (addr); + } + + /* Do we fit into new entry? */ + if ((map->PhysicalStart > addr) && + (map->NumberOfPages >= EFI_SIZE_TO_PAGES(size))) { + return (map->PhysicalStart); + } + } + return (0); +} + +/* + * Find usable address for loading. The address for the kernel is fixed, as + * it is determined by kernel linker map (dboot PT_LOAD address). + * For modules, we need to consult memory map, the module address has to be + * aligned to page boundary and we have to fit into map entry. + */ +vm_offset_t +efi_physaddr(multiboot_tag_module_t *module, vm_offset_t addr, + EFI_MEMORY_DESCRIPTOR *map, size_t count, UINTN dsize, size_t size) +{ + multiboot_tag_module_t *mp; + vm_offset_t off; + + if (addr == 0) + return (addr); + + mp = module; + do { + off = addr; + /* Test proposed address */ + off = memmap_find(map, count, dsize, off, size); + if (off != 0) + off = addr_verify(module, off, size); + if (off != 0) + break; + + /* The module list is exhausted */ + if (mp->mb_type != MULTIBOOT_TAG_TYPE_MODULE) + break; + + if (mp->mb_mod_start != 0) { + addr = roundup2(mp->mb_mod_end + 1, + MULTIBOOT_MOD_ALIGN); + } + mp = (multiboot_tag_module_t *) + roundup((uintptr_t)mp + mp->mb_size, MULTIBOOT_TAG_ALIGN); + } while (off == 0); + + return (off); +} + /* * Allocate pages for data to be loaded. As we can not expect AllocateAddress * to succeed, we allocate using AllocateMaxAddress from 4GB limit. diff --git a/usr/src/boot/sys/boot/efi/loader/loader_efi.h b/usr/src/boot/sys/boot/efi/loader/loader_efi.h index 6378a662d3de..7339515b6b53 100644 --- a/usr/src/boot/sys/boot/efi/loader/loader_efi.h +++ b/usr/src/boot/sys/boot/efi/loader/loader_efi.h @@ -55,16 +55,14 @@ struct relocator { int efi_autoload(void); -int efi_getdev(void **, const char *, const char **); -char *efi_fmtdev(void *); -int efi_setcurrdev(struct env_var *, int, const void *); - ssize_t efi_copyin(const void *, vm_offset_t, const size_t); ssize_t efi_copyout(const vm_offset_t, void *, const size_t); ssize_t efi_readin(const int, vm_offset_t, const size_t); uint64_t efi_loadaddr(u_int, void *, uint64_t); void efi_free_loadaddr(uint64_t, uint64_t); void * efi_translate(vm_offset_t); +vm_offset_t efi_physaddr(multiboot_tag_module_t *, vm_offset_t, + EFI_MEMORY_DESCRIPTOR *, size_t, UINTN, size_t); multiboot2_info_header_t *efi_copy_finish(struct relocator *); void multiboot_tramp(uint32_t, struct relocator *, uint64_t); diff --git a/usr/src/boot/sys/boot/efi/loader/main.c b/usr/src/boot/sys/boot/efi/loader/main.c index c6901027946e..3570c4fd07bf 100644 --- a/usr/src/boot/sys/boot/efi/loader/main.c +++ b/usr/src/boot/sys/boot/efi/loader/main.c @@ -1,4 +1,4 @@ -/*- +/* * Copyright (c) 2008-2010 Rui Paulo * Copyright (c) 2006 Marcel Moolenaar * All rights reserved. @@ -46,9 +46,8 @@ #include #include -#ifdef EFI_ZFS_BOOT #include -#endif +#include #include "loader_efi.h" @@ -64,10 +63,14 @@ EFI_GUID inputid = SIMPLE_TEXT_INPUT_PROTOCOL; extern void acpi_detect(void); extern void efi_getsmap(void); -#ifdef EFI_ZFS_BOOT -static void efi_zfs_probe(void); -static uint64_t pool_guid; -#endif + +static EFI_LOADED_IMAGE *img; + +bool +efi_zfs_is_preferred(EFI_HANDLE *h) +{ + return (h == img->DeviceHandle); +} static int has_keyboard(void) @@ -77,7 +80,7 @@ has_keyboard(void) EFI_HANDLE *hin, *hin_end, *walker; UINTN sz; int retval = 0; - + /* * Find all the handles that support the SIMPLE_TEXT_INPUT_PROTOCOL and * do the typical dance to get the right sized buffer. @@ -134,7 +137,7 @@ has_keyboard(void) } else if (DevicePathType(path) == MESSAGING_DEVICE_PATH && DevicePathSubType(path) == MSG_USB_CLASS_DP) { USB_CLASS_DEVICE_PATH *usb; - + usb = (USB_CLASS_DEVICE_PATH *)(void *)path; if (usb->DeviceClass == 3 && /* HID */ usb->DeviceSubClass == 1 && /* Boot devices */ @@ -294,7 +297,6 @@ EFI_STATUS main(int argc, CHAR16 *argv[]) { char var[128]; - EFI_LOADED_IMAGE *img; EFI_GUID *guid; int i, j, vargood, howto; void *ptr; @@ -308,10 +310,11 @@ main(int argc, CHAR16 *argv[]) archsw.arch_readin = efi_readin; archsw.arch_loadaddr = efi_loadaddr; archsw.arch_free_loadaddr = efi_free_loadaddr; -#ifdef EFI_ZFS_BOOT /* Note this needs to be set before ZFS init. */ archsw.arch_zfs_probe = efi_zfs_probe; -#endif + + /* Get our loaded image protocol interface structure. */ + BS->HandleProtocol(IH, &imgid, (VOID**)&img); /* Init the time source */ efi_time_init(); @@ -438,9 +441,6 @@ main(int argc, CHAR16 *argv[]) if (devsw[i]->dv_init != NULL) (devsw[i]->dv_init)(); - /* Get our loaded image protocol interface structure. */ - BS->HandleProtocol(IH, &imgid, (VOID**)&img); - printf("Command line arguments:"); for (i = 0; i < argc; i++) { printf(" %S", argv[i]); @@ -884,9 +884,41 @@ command_chain(int argc, char *argv[]) *(--argv) = 0; } - if (efi_getdev((void **)&dev, name, (const char **)&path) == 0) - loaded_image->DeviceHandle = - efi_find_handle(dev->d_dev, dev->d_unit); + if (efi_getdev((void **)&dev, name, (const char **)&path) == 0) { + struct zfs_devdesc *z_dev; + struct disk_devdesc *d_dev; + pdinfo_t *hd, *pd; + + switch (dev->d_type) { + case DEVT_ZFS: + z_dev = (struct zfs_devdesc *)dev; + loaded_image->DeviceHandle = + efizfs_get_handle_by_guid(z_dev->pool_guid); + break; + case DEVT_NET: + loaded_image->DeviceHandle = + efi_find_handle(dev->d_dev, dev->d_unit); + break; + default: + hd = efiblk_get_pdinfo(dev); + if (STAILQ_EMPTY(&hd->pd_part)) { + loaded_image->DeviceHandle = hd->pd_handle; + break; + } + d_dev = (struct disk_devdesc *)dev; + STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { + /* + * d_partition should be 255 + */ + if (pd->pd_unit == d_dev->d_slice) { + loaded_image->DeviceHandle = + pd->pd_handle; + break; + } + } + break; + } + } dev_cleanup(); status = BS->StartImage(loaderhandle, NULL, NULL); @@ -902,46 +934,3 @@ command_chain(int argc, char *argv[]) } COMMAND_SET(chain, "chain", "chain load file", command_chain); - -#ifdef EFI_ZFS_BOOT -static void -efi_zfs_probe(void) -{ - pdinfo_list_t *hdi; - pdinfo_t *hd, *pd = NULL; - EFI_GUID imgid = LOADED_IMAGE_PROTOCOL; - EFI_LOADED_IMAGE *img; - char devname[SPECNAMELEN + 1]; - - BS->HandleProtocol(IH, &imgid, (VOID**)&img); - hdi = efiblk_get_pdinfo_list(&efipart_hddev); - - /* - * Find the handle for the boot device. The boot1 did find the - * device with loader binary, now we need to search for the - * same device and if it is part of the zfs pool, we record the - * pool GUID for currdev setup. - */ - STAILQ_FOREACH(hd, hdi, pd_link) { - STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { - - snprintf(devname, sizeof(devname), "%s%dp%d:", - efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit); - if (pd->pd_handle == img->DeviceHandle) - (void) zfs_probe_dev(devname, &pool_guid); - else - (void) zfs_probe_dev(devname, NULL); - } - } -} - -uint64_t -ldi_get_size(void *priv) -{ - int fd = (uintptr_t) priv; - uint64_t size; - - ioctl(fd, DIOCGMEDIASIZE, &size); - return (size); -} -#endif diff --git a/usr/src/boot/sys/boot/forth/support.4th b/usr/src/boot/sys/boot/forth/support.4th index 8b30502724b0..b95068f74599 100644 --- a/usr/src/boot/sys/boot/forth/support.4th +++ b/usr/src/boot/sys/boot/forth/support.4th @@ -1553,17 +1553,6 @@ also builtins \ Parse filename from a semicolon-separated list -\ replacement, not working yet -: newparse-; { addr len | a1 -- a' len-x addr x } - addr len [char] ; strchr dup if ( a1 len1 ) - swap to a1 ( store address ) - 1 - a1 @ 1 + swap ( remove match ) - addr a1 addr - - else - 0 0 addr len - then -; - : parse-; ( addr len -- addr' len-x addr x ) over 0 2swap ( addr 0 addr len ) begin @@ -1594,11 +1583,19 @@ also builtins dup 2 = if ." Flags : " >r 2over type r> cr then then \ if it's xen, the xen kernel is loaded, unix needs to be loaded as module - s" xen_kernel" getenv -1 = if - 1 load \ normal kernel - else - drop - >r s" kernel" s" -t " r> 2 + 1 load + s" xen_kernel" getenv -1 <> if + drop \ drop address from getenv + >r \ argument count to R + s" kernel" s" -t " \ push 2 strings into the stack + r> 2 + \ increment argument count + then + + 1 ['] load catch dup if + ( addr0 len0 addr1 len1 ... args 1 error ) + >r \ error code to R + drop \ drop 1 + 0 do 2drop loop \ drop addr len pairs + r> \ set flag for while then while dup 0= diff --git a/usr/src/boot/sys/boot/i386/Makefile b/usr/src/boot/sys/boot/i386/Makefile index 305a816aa05d..46db89b56ea6 100644 --- a/usr/src/boot/sys/boot/i386/Makefile +++ b/usr/src/boot/sys/boot/i386/Makefile @@ -29,9 +29,11 @@ clobber:= TARGET= clobber .KEEP_STATE: +pxeldr: loader + all clean clobber: $(SUBDIRS) -install: all $(INSTDIRS) +install: all .WAIT $(INSTDIRS) FRC: diff --git a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c index bc1c4da24a16..537fc898e73e 100644 --- a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c +++ b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c @@ -613,11 +613,16 @@ probe_partition(void *arg, const char *partname, table = ptable_open(&pa, part->end - part->start + 1, ppa->secsz, parttblread); if (table != NULL) { - ret = ptable_iterate(table, &pa, probe_partition); + if (ptable_gettype(table) == PTABLE_VTOC8) { + ret = ptable_iterate(table, &pa, + probe_partition); + ptable_close(table); + close(pa.fd); + return (ret); + } ptable_close(table); } close(pa.fd); - return (ret); } if (ppa->offset + part->start == start_sector) { diff --git a/usr/src/boot/sys/boot/zfs/zfs.c b/usr/src/boot/sys/boot/zfs/zfs.c index 6843feae5830..033e0d98d666 100644 --- a/usr/src/boot/sys/boot/zfs/zfs.c +++ b/usr/src/boot/sys/boot/zfs/zfs.c @@ -497,7 +497,7 @@ zfs_probe_partition(void *arg, const char *partname, case PART_VTOC_SWAP: return (ret); default: - break;; + break; } ppa = (struct zfs_probe_args *)arg; strncpy(devname, ppa->devname, strlen(ppa->devname) - 1); @@ -516,7 +516,8 @@ zfs_probe_partition(void *arg, const char *partname, table = ptable_open(&pa, part->end - part->start + 1, ppa->secsz, zfs_diskread); if (table != NULL) { - ptable_iterate(table, &pa, zfs_probe_partition); + if (ptable_gettype(table) == PTABLE_VTOC8) + ptable_iterate(table, &pa, zfs_probe_partition); ptable_close(table); } } diff --git a/usr/src/boot/sys/i386/include/cpufunc.h b/usr/src/boot/sys/i386/include/cpufunc.h index f43319476d3f..501d229035cd 100644 --- a/usr/src/boot/sys/i386/include/cpufunc.h +++ b/usr/src/boot/sys/i386/include/cpufunc.h @@ -109,9 +109,12 @@ disable_intr(void) static __inline void do_cpuid(u_int ax, u_int *p) { - __asm __volatile("cpuid" - : "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (ax)); + __asm __volatile("pushl %%ebx \n\t" + "cpuid \n\t" + "movl %%ebx, %1 \n\t" + "popl %%ebx \n\t" + : "=a" (p[0]), "=m" (p[1]), "=c" (p[2]), "=d" (p[3]) + : "0" (ax)); } static __inline void diff --git a/usr/src/cmd/Makefile.cmd b/usr/src/cmd/Makefile.cmd index e00665a839a6..14102c60081f 100644 --- a/usr/src/cmd/Makefile.cmd +++ b/usr/src/cmd/Makefile.cmd @@ -96,10 +96,6 @@ ROOTCMDDIR64= $(ROOTCMDDIR)/$(MACH64) ROOTLIB64= $(ROOTLIB)/$(MACH64) ROOTUSRSBIN32= $(ROOTUSRSBIN)/$(MACH32) ROOTUSRSBIN64= $(ROOTUSRSBIN)/$(MACH64) -ROOTMAN= $(ROOT)/usr/share/man -ROOTMAN1= $(ROOTMAN)/man1 -ROOTMAN1M= $(ROOTMAN)/man1m -ROOTMAN3= $(ROOTMAN)/man3 ROOTVARSMB= $(ROOT)/var/smb @@ -164,12 +160,6 @@ ROOTPROG32= $(PROG:%=$(ROOTBIN32)/%) ROOTCMD64= $(PROG:%=$(ROOTCMDDIR64)/%) ROOTUSRSBINPROG32= $(PROG:%=$(ROOTUSRSBIN32)/%) ROOTUSRSBINPROG64= $(PROG:%=$(ROOTUSRSBIN64)/%) -ROOTMAN1FILES= $(MAN1FILES:%=$(ROOTMAN1)/%) -$(ROOTMAN1FILES) := FILEMODE= 444 -ROOTMAN1MFILES= $(MAN1MFILES:%=$(ROOTMAN1M)/%) -$(ROOTMAN1MFILES) := FILEMODE= 444 -ROOTMAN3FILES= $(MAN3FILES:%=$(ROOTMAN3)/%) -$(ROOTMAN3FILES) := FILEMODE= 444 # Symlink rules for /usr/ccs/bin commands. Note, those commands under # the rule of the linker area, are controlled by a different set of @@ -475,15 +465,6 @@ $(ROOTCCSBINLINKDIR)/%: % $(ROOTCCSBINLINKDIR64)/%: % $(INS.ccsbinlink64) -$(ROOTMAN1)/%: %.sunman - $(INS.rename) - -$(ROOTMAN1M)/%: %.sunman - $(INS.rename) - -$(ROOTMAN3)/%: %.sunman - $(INS.rename) - $(ROOTVARSMB)/%: % $(INS.file) diff --git a/usr/src/cmd/audio/audiorecord/audiorecord.c b/usr/src/cmd/audio/audiorecord/audiorecord.c index d8b681d7771c..1879f238fadb 100644 --- a/usr/src/cmd/audio/audiorecord/audiorecord.c +++ b/usr/src/cmd/audio/audiorecord/audiorecord.c @@ -577,7 +577,7 @@ main(int argc, char **argv) ((double)File_hdr.sample_rate / 1000.)); break; } /* if not -f, fall through */ - + /* FALLTHROUGH */ default: /* encoding mismatch */ (void) audio_enc_to_str(&Dev_hdr, msg); Error(stderr, diff --git a/usr/src/cmd/audio/include/Audio.h b/usr/src/cmd/audio/include/Audio.h index 2ee8c8a6a8bf..57f43ed658d2 100644 --- a/usr/src/cmd/audio/include/Audio.h +++ b/usr/src/cmd/audio/include/Audio.h @@ -27,8 +27,6 @@ #ifndef _MULTIMEDIA_AUDIO_H #define _MULTIMEDIA_AUDIO_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -40,7 +38,7 @@ extern "C" { // Error-handling function declaration class Audio; typedef Boolean (*AudioErrfunc)(const Audio*, AudioError, AudioSeverity, - char *); + const char *); // Data transfer subcodes. @@ -86,7 +84,7 @@ class Audio { virtual AudioError RaiseError( AudioError code, // error code AudioSeverity sev = Error, // error severity - char *msg = '\0') const; // error message + const char *msg = "unknown error") const; // error message // Raise error msg virtual void PrintMsg( diff --git a/usr/src/cmd/audio/include/AudioDebug.h b/usr/src/cmd/audio/include/AudioDebug.h index 84a6432ca46f..234c26c2fb7a 100644 --- a/usr/src/cmd/audio/include/AudioDebug.h +++ b/usr/src/cmd/audio/include/AudioDebug.h @@ -27,8 +27,6 @@ #ifndef _MULTIMEDIA_AUDIODEBUG_H #define _MULTIMEDIA_AUDIODEBUG_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include @@ -37,7 +35,7 @@ extern "C" { #endif // Declare default message printing routine -Boolean AudioStderrMsg(const Audio *, AudioError, AudioSeverity, char *); +Boolean AudioStderrMsg(const Audio *, AudioError, AudioSeverity, const char *); #ifdef DEBUG diff --git a/usr/src/cmd/audio/utilities/Audio.cc b/usr/src/cmd/audio/utilities/Audio.cc index 938bab7d361c..1e409e27146e 100644 --- a/usr/src/cmd/audio/utilities/Audio.cc +++ b/usr/src/cmd/audio/utilities/Audio.cc @@ -24,8 +24,6 @@ * All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -83,7 +81,7 @@ AudioError Audio:: RaiseError( AudioError code, // error code AudioSeverity sev, // error severity - char *msg) const // additional message + const char *msg) const // additional message { if (code == AUDIO_SUCCESS) return (code); diff --git a/usr/src/cmd/audio/utilities/AudioDebug.cc b/usr/src/cmd/audio/utilities/AudioDebug.cc index 8e147044364b..6ebca9349b19 100644 --- a/usr/src/cmd/audio/utilities/AudioDebug.cc +++ b/usr/src/cmd/audio/utilities/AudioDebug.cc @@ -24,8 +24,6 @@ * All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - // XXX - all this either goes away or gets repackaged #include #include @@ -58,7 +56,7 @@ AudioStderrMsg( const Audio* cp, // object pointer AudioError code, // error code AudioSeverity sev, // error severity - char *str) // additional message string + const char *str) // additional message string { int id; char *name; diff --git a/usr/src/cmd/boot/bootadm/Makefile b/usr/src/cmd/boot/bootadm/Makefile index ad060b375cee..b25c45ce043e 100644 --- a/usr/src/cmd/boot/bootadm/Makefile +++ b/usr/src/cmd/boot/bootadm/Makefile @@ -51,7 +51,7 @@ CFLAGS += $(XSTRCONST) CPPFLAGS += -D_FILE_OFFSET_BITS=64 CPPFLAGS += -I$(SRC)/uts/common -I$(SRC)/common -I$(SRC)/common/ficl -C99MODE= $(C99_ENABLE) +CSTD= $(CSTD_GNU99) LINTFLAGS += -erroff=E_INCONS_ARG_DECL2 LINTFLAGS += -erroff=E_INCONS_VAL_TYPE_DECL2 diff --git a/usr/src/cmd/boot/bootadm/bootadm_loader.c b/usr/src/cmd/boot/bootadm/bootadm_loader.c index 29db09800693..56b509b9ed11 100644 --- a/usr/src/cmd/boot/bootadm/bootadm_loader.c +++ b/usr/src/cmd/boot/bootadm/bootadm_loader.c @@ -1151,7 +1151,7 @@ update_temp(struct menu_lst *menu, char *dummy, char *opt) fp = fopen(path, "w"); if (fp == NULL) return (BAM_ERROR); - (void) fprintf(fp, "bootfile=\"%s\"\n", opt); + (void) fprintf(fp, "bootfile=\"%s;unix\"\n", opt); (void) fclose(fp); return (BAM_SUCCESS); } @@ -1159,7 +1159,7 @@ update_temp(struct menu_lst *menu, char *dummy, char *opt) fp = fopen(path, "w"); if (fp == NULL) return (BAM_ERROR); - (void) fprintf(fp, "bootfile=\"%s\"\n", opt); + (void) fprintf(fp, "bootfile=\"%s;unix\"\n", opt); if (env != NULL) { env = getenv("boot-args"); diff --git a/usr/src/cmd/boot/installboot/Makefile.com b/usr/src/cmd/boot/installboot/Makefile.com index 566e48c42aa5..1cd8454078d1 100644 --- a/usr/src/cmd/boot/installboot/Makefile.com +++ b/usr/src/cmd/boot/installboot/Makefile.com @@ -37,7 +37,7 @@ CPPFLAGS += -I$(SRC)/uts/common LDLIBS += -lmd5 -C99MODE= $(C99_ENABLE) +CSTD= $(CSTD_GNU99) LINTFLAGS += -erroff=E_BAD_PTR_CAST_ALIGN diff --git a/usr/src/cmd/boot/installgrub/Makefile b/usr/src/cmd/boot/installgrub/Makefile index 56dfeac5364a..3269e7d7ef72 100644 --- a/usr/src/cmd/boot/installgrub/Makefile +++ b/usr/src/cmd/boot/installgrub/Makefile @@ -55,7 +55,7 @@ LINTFLAGS += \ -xerroff=E_NAME_DEF_NOT_USED2 -C99MODE= $(C99_ENABLE) +CSTD= $(CSTD_GNU99) .KEEP_STATE: diff --git a/usr/src/cmd/cmd-inet/etc/Makefile b/usr/src/cmd/cmd-inet/etc/Makefile index 2336c5af1d5f..c9d3824663af 100644 --- a/usr/src/cmd/cmd-inet/etc/Makefile +++ b/usr/src/cmd/cmd-inet/etc/Makefile @@ -25,7 +25,7 @@ SYMPROG= hosts inetd.conf networks protocols services netmasks # New /etc/inet files shouldn't have /etc entries. EDITPROG= ipaddrsel.conf ipsecalgs PROG= datemsk.ndpd ipsecinit.sample ipqosconf.1.sample ipqosconf.2.sample \ - ipqosconf.3.sample wanboot.conf.sample + ipqosconf.3.sample ETCPROG= $(SYMPROG) $(EDITPROG) $(PROG) SUBDIRS= default dhcp init.d ike nca ppp secret sock2path.d diff --git a/usr/src/cmd/cmd-inet/etc/wanboot.conf.sample b/usr/src/cmd/cmd-inet/etc/wanboot.conf.sample deleted file mode 100644 index 8fc0ee5d4716..000000000000 --- a/usr/src/cmd/cmd-inet/etc/wanboot.conf.sample +++ /dev/null @@ -1,104 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# ident "%Z%%M% %I% %E% SMI" - -#################################################################### -# wanboot.conf(4): boot configuration file. -# -# Please consult wanboot.conf(4) for further information. Note that -# this interface is "Evolving" as defined by attributes(5). -# -# Anything after a '#' is comment. Values may be quoted (e.g. "val"). -# -# means there is no value, i.e. null. The absence of any -# parameter implies that it takes a default value ( unless -# otherwise specified). -# -# is of the form http://... or https://... -#################################################################### - -# The path of the bootstrap file (within htdocs) which is served up -# by wanboot-cgi(bootfile). -# -boot_file=/bootfiles/wanboot # - -# These are used by wanboot-cgi(bootfile|bootfs|rootfs) to determine -# whether boot_file or the bootfs is to be sent encrypted/signed, or -# root_file is to be sent signed; the client must be setup with the -# corresponding encryption/signature key(s) (which cannot be auto- -# matically verified). -# -# If an encryption_type is specified then a signature_type must also -# be specified. -# -encryption_type=3des # 3des | aes | -signature_type=sha1 # sha1 | - -# This is used by wanboot-cgi(bootfs) and wanboot to determine whether -# server authentication should be requested during SSL connection -# setup. -# -server_authentication=yes # yes | no - -# This is used by wanboot-cgi(bootfs) and wanboot to determine whether -# client authentication should be requested during SSL connection -# setup. If client_authentication is "yes", then server_authentication -# must also be "yes". -# -client_authentication=yes # yes | no - -# wanboot-cgi(bootfs) will construct a hosts file which resolves any -# hostnames specified in any of the URLs in the wanboot.conf file, -# plus those found in certificates, etc. The following parameter -# may be used to add additional mappings to the hosts file. -# -resolve_hosts= # [,*] | - -# This is used to specify the URL of wanboot-cgi on the server on which -# the root_file exists, and used by wanboot to obtain the root server's -# URL; wanboot substitutes root_file for the pathname part of the URL. -# If the schema is http://... then the root_file will be signed if there -# is a non-empty signature_type. If server_authentication is "yes", the -# schema must be https://...; otherwise it must be http://... -# -root_server=https://host:port/cgi-bin/wanboot-cgi # | - -# This is used by wanboot-cgi(rootfs) to locate the path of the -# rootfs image (within htdocs) on the root_server. -# -root_file=/rootimages/miniroot # | - -# This is used by wanboot to determine the URL of the bootserver -# (and whether bootlog traffic should be sent using http or https), -# or whether it should simply be sent to the console. -# -boot_logger= # | - -# This is used by the system startup scripts. If set, it should -# point to a file that contains name value pairs to be used at -# start up time. For example, this file may be used to provide -# install the values for sysidcfg and jumpscfg. -# -system_conf=system.conf diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/README.v6 b/usr/src/cmd/cmd-inet/sbin/dhcpagent/README.v6 index a52fe3e6b94a..77adf3655b9d 100644 --- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/README.v6 +++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/README.v6 @@ -20,8 +20,6 @@ CDDL HEADER END Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. -ident "%Z%%M% %I% %E% SMI" - ** PLEASE NOTE: ** @@ -135,7 +133,7 @@ Background dhcp_pkt_t is a wrapper for packets to be sent. The basic PKT structure is used in dhcpagent, inetboot, in.dhcpd, - libdhcpagent, libwanboot, libdhcputil, and others. PKT_LIST is used + libdhcpagent, libdhcputil, and others. PKT_LIST is used in a similar set of places, including the kernel NFS modules. dhcp_pkt_t is (as the header file implies) limited to dhcpagent. diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/adopt.c b/usr/src/cmd/cmd-inet/sbin/dhcpagent/adopt.c index d81cb9264f8a..4fbaf6ac727e 100644 --- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/adopt.c +++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/adopt.c @@ -264,8 +264,7 @@ get_dhcp_kcache(dhcp_kcache_t **kernel_cachep, size_t *kcache_size) * output: boolean_t: Returns B_TRUE if successful (no problems), * otherwise B_FALSE. * note: The memory allocated by this function must be freed by - * the caller. This code is derived from - * usr/src/lib/libwanboot/common/bootinfo_aux.c. + * the caller. */ static boolean_t diff --git a/usr/src/cmd/cmd-inet/usr.bin/dns-sd/Makefile b/usr/src/cmd/cmd-inet/usr.bin/dns-sd/Makefile index 293a4f5976b7..24028e7f42c8 100644 --- a/usr/src/cmd/cmd-inet/usr.bin/dns-sd/Makefile +++ b/usr/src/cmd/cmd-inet/usr.bin/dns-sd/Makefile @@ -23,7 +23,7 @@ include ../../Makefile.cmd-inet OBJS= ClientCommon.o dns-sd.o SRCS= ClientCommon.c dns-sd.c -CFLAGS += $(C99_ENABLE) +CFLAGS += $(CSTD_GNU99) CPPFLAGS += -DMDNS_VERSIONSTR_NODTS LDLIBS += -lsocket -ldns_sd diff --git a/usr/src/cmd/cmd-inet/usr.lib/Makefile b/usr/src/cmd/cmd-inet/usr.lib/Makefile index 718d4ed15aec..9f3c16413e00 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/Makefile +++ b/usr/src/cmd/cmd-inet/usr.lib/Makefile @@ -27,15 +27,14 @@ SUBDIRS= bridged ilbd in.chargend in.daytimed \ in.discardd in.echod in.mpathd in.ndpd \ in.ripngd in.timed inetd mdnsd ncaconfd pppoe \ - slpd vrrpd wanboot wpad + slpd vrrpd wpad -MSGSUBDIRS= ilbd inetd ncaconfd vrrpd wanboot +MSGSUBDIRS= ilbd inetd ncaconfd vrrpd include ../../Makefile.cmd include ./Makefile.lib -POFILES= inetd/inetd.po ncaconfd/ncaconfd.po vrrpd/vrrpd.po \ - wanboot/wanboot.po +POFILES= inetd/inetd.po ncaconfd/ncaconfd.po vrrpd/vrrpd.po POFILE= usr.lib.po all:= TARGET= all diff --git a/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile index d00653d4ebae..2648c7cf05e2 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile +++ b/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile @@ -53,7 +53,7 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-label -C99MODE = $(C99_ENABLE) +CSTD = $(CSTD_GNU99) # I18n POFILE = $(ILBD).po diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/Makefile index 7f08f59b9072..f28c630ac361 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/Makefile +++ b/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/Makefile @@ -36,7 +36,7 @@ ROOTCMDDIR = $(ROOT)/lib/inet POFILE = $(PROG).po POFILES = $(SRCS:%.c=%.po) -C99MODE = $(C99_ENABLE) +CSTD = $(CSTD_GNU99) # # We need access to the ancillary data features which are only available diff --git a/usr/src/cmd/cmd-inet/usr.lib/mdnsd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/mdnsd/Makefile index 128bb637b41e..e110c4ef488a 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/mdnsd/Makefile +++ b/usr/src/cmd/cmd-inet/usr.lib/mdnsd/Makefile @@ -68,7 +68,7 @@ $(PROG): $(OBJS) include ../Makefile.lib -C99MODE = $(C99_ENABLE) +CSTD = $(CSTD_GNU99) CPPFLAGS += -D_REENTRANT $(MDNSFLAGS) -I$(CMN_DIR) LDLIBS += -lsocket -lnsl diff --git a/usr/src/cmd/cmd-inet/usr.lib/vrrpd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/vrrpd/Makefile index 12a621d55fe8..0039ea5f6a8d 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/vrrpd/Makefile +++ b/usr/src/cmd/cmd-inet/usr.lib/vrrpd/Makefile @@ -37,7 +37,7 @@ $(ROOTETC)/inet/$(CFGFILES):= FILEMODE= 644 $(ROOTETC)/inet/$(CFGFILES):= OWNER= root $(ROOTETC)/inet/$(CFGFILES):= GROUP= sys -C99MODE= $(C99_ENABLE) +CSTD= $(CSTD_GNU99) # # We need access to the ancillary data features which are only available diff --git a/usr/src/cmd/cmd-inet/usr.lib/wanboot/Makefile b/usr/src/cmd/cmd-inet/usr.lib/wanboot/Makefile deleted file mode 100644 index 2d7d04478fee..000000000000 --- a/usr/src/cmd/cmd-inet/usr.lib/wanboot/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include $(SRC)/cmd/Makefile.cmd - -SUBDIR_SCR= bootlog-cgi -SUBDIR_PGMS= wanboot-cgi\ - keygen \ - keymgmt \ - hmac \ - encr \ - ickey \ - p12split \ - netbootinfo - -SUBDIRS= $(SUBDIR_SCR) $(SUBDIR_PGMS) - -MSGFILES= encr/encr.c hmac/hmac.c ickey/ickey.c keygen/keygen.c \ - keymgmt/keymgmt.c p12split/p12split.c netbootinfo/netbootinfo.c - -POFILE= wanboot.po -XGETFLAGS += -a -x wanboot.xcl - -all:= TARGET= all -install:= TARGET= install -clean:= TARGET= clean -clobber:= TARGET= clobber -lint:= TARGET= lint -_msg:= TARGET= _msg - -.KEEP_STATE: -.PARALLEL: $(SUBDIRS) - -all install: $(SUBDIRS) - -lint: $(SUBDIR_PGMS) - -clean: $(SUBDIR_PGMS) - -clobber: $(SUBDIR_PGMS) local_clobber - -local_clobber: - $(RM) $(CLOBBERFILES) - -$(POFILE): pofile_MSGFILES - -_msg: $(MSGDOMAINPOFILE) - -$(SUBDIRS): FRC - @cd $@; pwd; $(MAKE) $(TARGET) - -FRC: - -include $(SRC)/Makefile.msg.targ diff --git a/usr/src/cmd/cmd-inet/usr.lib/wanboot/Makefile.com b/usr/src/cmd/cmd-inet/usr.lib/wanboot/Makefile.com deleted file mode 100644 index aa9d03f1624b..000000000000 --- a/usr/src/cmd/cmd-inet/usr.lib/wanboot/Makefile.com +++ /dev/null @@ -1,34 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -include $(SRC)/cmd/Makefile.cmd -ROOTCMDDIR = $(ROOT)/usr/lib/inet/wanboot - -CMNCRYPTDIR = ../../../../../common/net/wanboot/crypt - -CERRWARN += -_gcc=-Wno-uninitialized - -.KEEP_STATE: diff --git a/usr/src/cmd/cmd-inet/usr.lib/wanboot/bootlog-cgi/Makefile b/usr/src/cmd/cmd-inet/usr.lib/wanboot/bootlog-cgi/Makefile deleted file mode 100644 index b84272bc899e..000000000000 --- a/usr/src/cmd/cmd-inet/usr.lib/wanboot/bootlog-cgi/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include ../Makefile.com - -PROG= bootlog-cgi - -all: $(PROG) - -install: all $(ROOTCMD) - -include ../../../../Makefile.targ diff --git a/usr/src/cmd/cmd-inet/usr.lib/wanboot/bootlog-cgi/bootlog-cgi b/usr/src/cmd/cmd-inet/usr.lib/wanboot/bootlog-cgi/bootlog-cgi deleted file mode 100644 index 0e4317de5538..000000000000 --- a/usr/src/cmd/cmd-inet/usr.lib/wanboot/bootlog-cgi/bootlog-cgi +++ /dev/null @@ -1,59 +0,0 @@ -#! /usr/bin/sh -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -# cgi script to handle bootlog messages -# formats the message: -# replaces