svn commit: r368093 - head/usr.sbin/bhyve

2020-11-27 Thread Rebecca Cran
Author: bcran
Date: Fri Nov 27 08:00:32 2020
New Revision: 368093
URL: https://svnweb.freebsd.org/changeset/base/368093

Log:
  Fix bhyve SMBIOS type 19 handling to avoid misreporting total RAM amount
  
  This fixes the amount of memory displayed in the EDK2 UiApp to be the same
  as passed on the bhyve command line. Otherwise, 8GB is displayed as 4GB,
  32GB as 28GB etc.
  
  Reviewed by:  jhb, kib, rgrimes
  Differential Revision:https://reviews.freebsd.org/D27348

Modified:
  head/usr.sbin/bhyve/smbiostbl.c

Modified: head/usr.sbin/bhyve/smbiostbl.c
==
--- head/usr.sbin/bhyve/smbiostbl.c Fri Nov 27 07:53:15 2020
(r368092)
+++ head/usr.sbin/bhyve/smbiostbl.c Fri Nov 27 08:00:32 2020
(r368093)
@@ -758,7 +758,7 @@ smbios_type19_initializer(struct smbios_structure *tem
type19 = (struct smbios_table_type19 *)curaddr;
type19->arrayhand = type16_handle;
type19->xsaddr = 4*GB;
-   type19->xeaddr = guest_himem;
+   type19->xeaddr = type19->xsaddr + guest_himem;
}
 
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r368092 - head/usr.sbin/bhyve

2020-11-26 Thread Rebecca Cran
Author: bcran
Date: Fri Nov 27 07:53:15 2020
New Revision: 368092
URL: https://svnweb.freebsd.org/changeset/base/368092

Log:
  bhyve: fix smbiostbl.c style issues and add comment about date format
  
  Fix a couple of style issues introduced in my previous commit.
  Add a comment explaining that the SMBIOS specification defines the date
  format to be mm/dd/, which is why we don't use ISO 8601.

Modified:
  head/usr.sbin/bhyve/smbiostbl.c

Modified: head/usr.sbin/bhyve/smbiostbl.c
==
--- head/usr.sbin/bhyve/smbiostbl.c Fri Nov 27 05:13:52 2020
(r368091)
+++ head/usr.sbin/bhyve/smbiostbl.c Fri Nov 27 07:53:15 2020
(r368092)
@@ -51,8 +51,9 @@ __FBSDID("$FreeBSD$");
 
 #define SMBIOS_BASE0xF1000
 
-#define FIRMWARE_VERSION   "13.0"
-#define FIRMWARE_RELEASE_DATE  "11/10/2020"
+#defineFIRMWARE_VERSION"13.0"
+/* The SMBIOS specification defines the date format to be mm/dd/ */
+#defineFIRMWARE_RELEASE_DATE   "11/10/2020"
 
 /* BHYVE_ACPI_BASE - SMBIOS_BASE) */
 #defineSMBIOS_MAX_LENGTH   (0xF2400 - 0xF1000)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r367651 - head/usr.sbin/bhyve

2020-11-13 Thread Rebecca Cran

On 11/13/20 5:47 PM, Ravi Pokala wrote:

+#define FIRMWARE_RELEASE_DATE  "11/10/2020"

Might I suggest "2020-11-10", as sorting, logic, ${DEITY}, and ISO-8601 demand? 
;-)


I wish! I'll add a comment clarifying that the specification mandates 
mm/dd/yyyy.



--

Rebecca Cran


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r367651 - head/usr.sbin/bhyve

2020-11-13 Thread Rebecca Cran

On 11/13/20 1:03 PM, Shawn Webb wrote:



Style nit: shouldn't there be a tab between #define and the macro?


Thanks, I'll try and remember that in future.


--
Rebecca Cran


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367651 - head/usr.sbin/bhyve

2020-11-13 Thread Rebecca Cran
Author: bcran
Date: Fri Nov 13 19:47:16 2020
New Revision: 367651
URL: https://svnweb.freebsd.org/changeset/base/367651

Log:
  bhyve: update smbiostbl.c to bump the version and release date
  
  Since lots of work has been done on bhyve since 2014, increase the version
  to 13.0 to match 13-CURRENT, and update the release date.
  
  Reviewed by:  grehan
  Differential Revision:https://reviews.freebsd.org/D27147

Modified:
  head/usr.sbin/bhyve/smbiostbl.c

Modified: head/usr.sbin/bhyve/smbiostbl.c
==
--- head/usr.sbin/bhyve/smbiostbl.c Fri Nov 13 19:22:53 2020
(r367650)
+++ head/usr.sbin/bhyve/smbiostbl.c Fri Nov 13 19:47:16 2020
(r367651)
@@ -51,6 +51,9 @@ __FBSDID("$FreeBSD$");
 
 #define SMBIOS_BASE0xF1000
 
+#define FIRMWARE_VERSION   "13.0"
+#define FIRMWARE_RELEASE_DATE  "11/10/2020"
+
 /* BHYVE_ACPI_BASE - SMBIOS_BASE) */
 #defineSMBIOS_MAX_LENGTH   (0xF2400 - 0xF1000)
 
@@ -323,9 +326,9 @@ struct smbios_table_type0 smbios_type0_template = {
 };
 
 const char *smbios_type0_strings[] = {
-   "BHYVE",/* vendor string */
-   "1.00", /* bios version string */
-   "03/14/2014",   /* bios release date string */
+   "BHYVE",/* vendor string */
+   FIRMWARE_VERSION,   /* bios version string */
+   FIRMWARE_RELEASE_DATE,  /* bios release date string */
NULL
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359478 - head/usr.sbin/bhyve

2020-03-30 Thread Rebecca Cran
Author: bcran
Date: Tue Mar 31 02:36:39 2020
New Revision: 359478
URL: https://svnweb.freebsd.org/changeset/base/359478

Log:
  Bhyve: fix SMBIOS Type 17 table generation
  
  According to the SMBIOS specification (revision 2.7 or newer), the
  extended module size field should only be used for sizes that can't
  fit in the older size field.
  
  Reviewed by:  rgrimes, grehan, jhb
  Differential Revision:https://reviews.freebsd.org/D24107

Modified:
  head/usr.sbin/bhyve/smbiostbl.c

Modified: head/usr.sbin/bhyve/smbiostbl.c
==
--- head/usr.sbin/bhyve/smbiostbl.c Tue Mar 31 02:25:53 2020
(r359477)
+++ head/usr.sbin/bhyve/smbiostbl.c Tue Mar 31 02:36:39 2020
(r359478)
@@ -255,7 +255,7 @@ struct smbios_table_type17 {
uint16_terrhand;/* handle of mem error data */
uint16_ttwidth; /* total width in bits */
uint16_tdwidth; /* data width in bits */
-   uint16_tsize;   /* size in bytes */
+   uint16_tsize;   /* size in kb or mb */
uint8_t form;   /* form factor */
uint8_t set;/* set */
uint8_t dloc;   /* device locator string */
@@ -268,7 +268,7 @@ struct smbios_table_type17 {
uint8_t asset;  /* asset tag string */
uint8_t part;   /* part number string */
uint8_t attributes; /* attributes */
-   uint32_txsize;  /* extended size in mbs */
+   uint32_txsize;  /* extended size in mb */
uint16_tcurspeed;   /* current speed in mhz */
uint16_tminvoltage; /* minimum voltage */
uint16_tmaxvoltage; /* maximum voltage */
@@ -444,7 +444,7 @@ struct smbios_table_type17 smbios_type17_template = {
-1, /* handle of memory error data */
64, /* total width in bits including ecc */
64, /* data width in bits */
-   0x7fff, /* size in bytes (0x7fff=use extended)*/
+   0,  /* size in kb or mb (0x7fff=use extended)*/
SMBIOS_MDFF_UNKNOWN,
0,  /* set (0x00=none, 0xff=unknown) */
1,  /* device locator string */
@@ -695,20 +695,39 @@ smbios_type17_initializer(struct smbios_structure *tem
 uint16_t *n, uint16_t *size)
 {
struct smbios_table_type17 *type17;
+   uint64_t memsize, size_KB, size_MB;
 
smbios_generic_initializer(template_entry, template_strings,
curaddr, endaddr, n, size);
type17 = (struct smbios_table_type17 *)curaddr;
type17->arrayhand = type16_handle;
-   type17->xsize = guest_lomem;
 
-   if (guest_himem > 0) {
-   curaddr = *endaddr;
-   smbios_generic_initializer(template_entry, template_strings,
-   curaddr, endaddr, n, size);
-   type17 = (struct smbios_table_type17 *)curaddr;
-   type17->arrayhand = type16_handle;
-   type17->xsize = guest_himem;
+   memsize = guest_lomem + guest_himem;
+   size_KB = memsize / 1024;
+   size_MB = memsize / MB;
+
+   /* A single Type 17 entry can't represent more than ~2PB RAM */
+   if (size_MB > 0x7FFF) {
+   printf("Warning: guest memory too big for SMBIOS Type 17 table: 
"
+   "%luMB greater than max supported 2147483647MB\n", 
size_MB);
+
+   size_MB = 0x7FFF;
+   }
+
+   /* See SMBIOS 2.7.0 section 7.18 - Memory Device (Type 17) */
+   if (size_KB <= 0x7FFF) {
+   /* Can represent up to 32767KB with the top bit set */
+   type17->size = size_KB | (1 << 15);
+   } else if (size_MB < 0x7FFF) {
+   /* Can represent up to 32766MB with the top bit unset */
+   type17->size = size_MB & 0x7FFF;
+   } else {
+   type17->size = 0x7FFF;
+   /*
+* Can represent up to 2147483647MB (~2PB)
+* The top bit is reserved
+*/
+   type17->xsize = size_MB & 0x7FFF;
}
 
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359065 - head/usr.sbin/bhyve

2020-03-17 Thread Rebecca Cran
Author: bcran
Date: Wed Mar 18 03:17:15 2020
New Revision: 359065
URL: https://svnweb.freebsd.org/changeset/base/359065

Log:
  Bhyve: log message when rfb client connects
  
  Reviewed by:  jhb
  Differential Revision:https://reviews.freebsd.org/D24098

Modified:
  head/usr.sbin/bhyve/rfb.c

Modified: head/usr.sbin/bhyve/rfb.c
==
--- head/usr.sbin/bhyve/rfb.c   Wed Mar 18 03:15:57 2020(r359064)
+++ head/usr.sbin/bhyve/rfb.c   Wed Mar 18 03:17:15 2020(r359065)
@@ -1049,6 +1049,7 @@ rfb_init(char *hostname, int port, int wait, char *pas
pthread_mutex_lock(>mtx);
pthread_cond_wait(>cond, >mtx);
pthread_mutex_unlock(>mtx);
+   DPRINTF(("rfb client connected"));
}
 
freeaddrinfo(ai);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359064 - head/usr.sbin/bhyve

2020-03-17 Thread Rebecca Cran
Author: bcran
Date: Wed Mar 18 03:15:57 2020
New Revision: 359064
URL: https://svnweb.freebsd.org/changeset/base/359064

Log:
  Bhyve: DPRINTF already includes newline, so don't add another
  
  Reviewed by:  jhb, vmaffione, emaste
  Differential Revision:https://reviews.freebsd.org/D24099

Modified:
  head/usr.sbin/bhyve/pci_fbuf.c

Modified: head/usr.sbin/bhyve/pci_fbuf.c
==
--- head/usr.sbin/bhyve/pci_fbuf.c  Wed Mar 18 03:14:17 2020
(r359063)
+++ head/usr.sbin/bhyve/pci_fbuf.c  Wed Mar 18 03:15:57 2020
(r359064)
@@ -135,7 +135,7 @@ pci_fbuf_write(struct vmctx *ctx, int vcpu, struct pci
sc = pi->pi_arg;
 
DPRINTF(DEBUG_VERBOSE,
-   ("fbuf wr: offset 0x%lx, size: %d, value: 0x%lx\n",
+   ("fbuf wr: offset 0x%lx, size: %d, value: 0x%lx",
offset, size, value));
 
if (offset + size > DMEMSZ) {
@@ -217,7 +217,7 @@ pci_fbuf_read(struct vmctx *ctx, int vcpu, struct pci_
}
 
DPRINTF(DEBUG_VERBOSE,
-   ("fbuf rd: offset 0x%lx, size: %d, value: 0x%lx\n",
+   ("fbuf rd: offset 0x%lx, size: %d, value: 0x%lx",
 offset, size, value));
 
return (value);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359063 - head/sys/dev/ath/ath_hal

2020-03-17 Thread Rebecca Cran
Author: bcran
Date: Wed Mar 18 03:14:17 2020
New Revision: 359063
URL: https://svnweb.freebsd.org/changeset/base/359063

Log:
  ath_hal: fix typo in ath_hal_printf

Modified:
  head/sys/dev/ath/ath_hal/ah_regdomain.c

Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c
==
--- head/sys/dev/ath/ath_hal/ah_regdomain.c Wed Mar 18 02:58:18 2020
(r359062)
+++ head/sys/dev/ath/ath_hal/ah_regdomain.c Wed Mar 18 03:14:17 2020
(r359063)
@@ -695,7 +695,7 @@ getchannels(struct ath_hal *ah,
else if (cm->flags & IEEE80211_CHAN_2GHZ)
rd = rd2GHz;
else {
-   ath_hal_printf(ah, "%s: Unkonwn HAL flags 0x%x\n",
+   ath_hal_printf(ah, "%s: Unknown HAL flags 0x%x\n",
__func__, cm->flags);
return HAL_EINVAL;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358183 - head/usr.bin/dtc

2020-02-20 Thread Rebecca Cran
Author: bcran
Date: Thu Feb 20 21:29:59 2020
New Revision: 358183
URL: https://svnweb.freebsd.org/changeset/base/358183

Log:
  dtc: remove unknown option printf, since getopt will print it
  
  Since we don't set opterr to 0, getopt prints a message when it
  encounters an unknown/invalid option. We therefore don't need to
  print our own message in the default handler.
  
  Reviewed by:  kevans, theraven
  Differential Revision:https://reviews.freebsd.org/D23662

Modified:
  head/usr.bin/dtc/dtc.cc

Modified: head/usr.bin/dtc/dtc.cc
==
--- head/usr.bin/dtc/dtc.cc Thu Feb 20 21:25:12 2020(r358182)
+++ head/usr.bin/dtc/dtc.cc Thu Feb 20 21:29:59 2020(r358183)
@@ -304,7 +304,10 @@ main(int argc, char **argv)
}
break;
default:
-   fprintf(stderr, "Unknown option %c\n", ch);
+   /* 
+* Since opterr is non-zero, getopt will have
+* already printed an error message.
+*/
return EXIT_FAILURE;
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356740 - in head/usr.sbin/bsdinstall: . partedit scripts

2020-01-14 Thread Rebecca Cran
Author: bcran
Date: Wed Jan 15 00:45:05 2020
New Revision: 356740
URL: https://svnweb.freebsd.org/changeset/base/356740

Log:
  bsdinstall: Use TMPDIR if set
  
  Submitted by: Ryan Moeller 
  Reviewed by:  bcran, Nick Wolff 
  Differential Revision:https://reviews.freebsd.org/D22979/

Modified:
  head/usr.sbin/bsdinstall/bsdinstall
  head/usr.sbin/bsdinstall/bsdinstall.8
  head/usr.sbin/bsdinstall/partedit/gpart_ops.c
  head/usr.sbin/bsdinstall/partedit/partedit.c
  head/usr.sbin/bsdinstall/partedit/partedit.h
  head/usr.sbin/bsdinstall/scripts/bootconfig
  head/usr.sbin/bsdinstall/scripts/mount
  head/usr.sbin/bsdinstall/scripts/script
  head/usr.sbin/bsdinstall/scripts/umount
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/bsdinstall
==
--- head/usr.sbin/bsdinstall/bsdinstall Tue Jan 14 22:27:46 2020
(r356739)
+++ head/usr.sbin/bsdinstall/bsdinstall Wed Jan 15 00:45:05 2020
(r356740)
@@ -40,13 +40,15 @@ BSDCFG_SHARE="/usr/share/bsdconfig"
 
  GLOBALS
 
-: ${BSDINSTALL_TMPETC="/tmp/bsdinstall_etc"}; export BSDINSTALL_TMPETC
-: ${BSDINSTALL_TMPBOOT="/tmp/bsdinstall_boot"}; export BSDINSTALL_TMPBOOT
+: ${TMPDIR:="/tmp"}; export TMPDIR
+
+: ${BSDINSTALL_TMPETC="${TMPDIR}/bsdinstall_etc"}; export BSDINSTALL_TMPETC
+: ${BSDINSTALL_TMPBOOT="${TMPDIR}/bsdinstall_boot"}; export BSDINSTALL_TMPBOOT
 : ${PATH_FSTAB="$BSDINSTALL_TMPETC/fstab"}; export PATH_FSTAB
 : ${BSDINSTALL_DISTDIR="/usr/freebsd-dist"}; export BSDINSTALL_DISTDIR
 : ${BSDINSTALL_CHROOT="/mnt"}; export BSDINSTALL_CHROOT
 
-export debugFile="${debugFile-${BSDINSTALL_LOG-/tmp/bsdinstall_log}}"
+export debugFile="${debugFile-${BSDINSTALL_LOG-${TMPDIR}/bsdinstall_log}}"
 
  MAIN
 

Modified: head/usr.sbin/bsdinstall/bsdinstall.8
==
--- head/usr.sbin/bsdinstall/bsdinstall.8   Tue Jan 14 22:27:46 2020
(r356739)
+++ head/usr.sbin/bsdinstall/bsdinstall.8   Wed Jan 15 00:45:05 2020
(r356740)
@@ -259,6 +259,10 @@ for most installation scenarios.
 Others are set by various interactive user prompts, and can be usefully
 overridden when making scripted or customized installers.
 .Bl -tag -width ".Ev BSDINSTALL_DISTSITE"
+.It Ev TMPDIR
+The directory to use for temporary files.
+Default:
+.Dq Pa /tmp
 .It Ev DISTRIBUTIONS
 The set of distributions to install, e.g., "base.txz kernel.txz ports.txz".
 Default: unset
@@ -291,7 +295,7 @@ Default:
 .It Ev BSDINSTALL_LOG
 Path to a log file for the installation.
 Default:
-.Dq Pa /tmp/bsdinstall_log
+.Dq Pa $TMPDIR/bsdinstall_log
 .It Ev BSDINSTALL_TMPETC
 Directory where files destined for the new system's
 .Pa /etc
@@ -300,7 +304,7 @@ will be stored until the
 target is executed.
 If this directory does not already exist, it will be created.
 Default:
-.Dq Pa /tmp/bsdinstall_etc
+.Dq Pa $TMPDIR/bsdinstall_etc
 .It Ev BSDINSTALL_TMPBOOT
 Directory where files destined for the new system's
 .Pa /boot
@@ -309,7 +313,7 @@ will be stored until the
 target is executed.
 If this directory does not already exist, it will be created.
 Default:
-.Dq Pa /tmp/bsdinstall_boot
+.Dq Pa $TMPDIR/bsdinstall_boot
 .It Ev ZFSBOOT_POOL_NAME
 Name for the pool containing the base system.
 Default:

Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c
==
--- head/usr.sbin/bsdinstall/partedit/gpart_ops.c   Tue Jan 14 22:27:46 
2020(r356739)
+++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c   Wed Jan 15 00:45:05 
2020(r356740)
@@ -711,10 +711,11 @@ set_default_part_metadata(const char *name, const char
if (strcmp(type, bootpart_type(scheme, _bootmount)) == 0) {
if (default_bootmount == NULL) {
 
-   int fd = open("/tmp/bsdinstall-esps", O_CREAT | 
O_WRONLY | O_APPEND,
- 0600);
+   int fd = openat(tmpdfd, "bsdinstall-esps",
+   O_CREAT | O_WRONLY | O_APPEND, 0600);
if (fd > 0) {
write(fd, md->name, strlen(md->name));
+   write(fd, "\n", 1);
close(fd);
}
 

Modified: head/usr.sbin/bsdinstall/partedit/partedit.c
==
--- head/usr.sbin/bsdinstall/partedit/partedit.cTue Jan 14 22:27:46 
2020(r356739)
+++ head/usr.sbin/bsdinstall/partedit/partedit.cWed Jan 15 00:45:05 
2020(r356740)
@@ -32,17 +32,20 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 

svn commit: r352788 - stable/12/stand/efi/loader

2019-09-26 Thread Rebecca Cran
Author: bcran
Date: Fri Sep 27 05:12:28 2019
New Revision: 352788
URL: https://svnweb.freebsd.org/changeset/base/352788

Log:
  MFC r344839:
  
  Add retry loop around GetMemoryMap call to fix fragmentation bug
  
  The call to BS->AllocatePages can cause the memory map to become framented,
  causing BS->GetMemoryMap to return EFI_BUFFER_TOO_SMALL more than once. For
  example this can happen on the MinnowBoard Turbot, causing the boot to stop
  with an error. Avoid this by calling GetMemoryMap in a loop.

Modified:
  stable/12/stand/efi/loader/bootinfo.c
  stable/12/stand/efi/loader/copy.c

Modified: stable/12/stand/efi/loader/bootinfo.c
==
--- stable/12/stand/efi/loader/bootinfo.c   Fri Sep 27 02:09:20 2019
(r352787)
+++ stable/12/stand/efi/loader/bootinfo.c   Fri Sep 27 05:12:28 2019
(r352788)
@@ -287,12 +287,12 @@ static int
 bi_load_efi_data(struct preloaded_file *kfp)
 {
EFI_MEMORY_DESCRIPTOR *mm;
-   EFI_PHYSICAL_ADDRESS addr;
+   EFI_PHYSICAL_ADDRESS addr = 0;
EFI_STATUS status;
const char *efi_novmap;
size_t efisz;
UINTN efi_mapkey;
-   UINTN mmsz, pages, retry, sz;
+   UINTN dsz, pages, retry, sz;
UINT32 mmver;
struct efi_map_header *efihdr;
bool do_vmap;
@@ -323,76 +323,94 @@ bi_load_efi_data(struct preloaded_file *kfp)
efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf;
 
/*
-* Assgin size of EFI_MEMORY_DESCRIPTOR to keep compatible with
+* Assign size of EFI_MEMORY_DESCRIPTOR to keep compatible with
 * u-boot which doesn't fill this value when buffer for memory
 * descriptors is too small (eg. 0 to obtain memory map size)
 */
-   mmsz = sizeof(EFI_MEMORY_DESCRIPTOR);
+   dsz = sizeof(EFI_MEMORY_DESCRIPTOR);
 
/*
-* It is possible that the first call to ExitBootServices may change
-* the map key. Fetch a new map key and retry ExitBootServices in that
-* case.
+* Allocate enough pages to hold the bootinfo block and the
+* memory map EFI will return to us. The memory map has an
+* unknown size, so we have to determine that first. Note that
+* the AllocatePages call can itself modify the memory map, so
+* we have to take that into account as well. The changes to
+* the memory map are caused by splitting a range of free
+* memory into two, so that one is marked as being loader
+* data.
 */
+
+   sz = 0;
+
+   /*
+* Matthew Garrett has observed at least one system changing the
+* memory map when calling ExitBootServices, causing it to return an
+* error, probably because callbacks are allocating memory.
+* So we need to retry calling it at least once.
+*/
for (retry = 2; retry > 0; retry--) {
-   /*
-* Allocate enough pages to hold the bootinfo block and the
-* memory map EFI will return to us. The memory map has an
-* unknown size, so we have to determine that first. Note that
-* the AllocatePages call can itself modify the memory map, so
-* we have to take that into account as well. The changes to
-* the memory map are caused by splitting a range of free
-* memory into two (AFAICT), so that one is marked as being
-* loader data.
-*/
-   sz = 0;
-   BS->GetMemoryMap(, NULL, _mapkey, , );
-   sz += mmsz;
-   sz = (sz + 0xf) & ~0xf;
-   pages = EFI_SIZE_TO_PAGES(sz + efisz);
-   status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData,
-pages, );
-   if (EFI_ERROR(status)) {
-   printf("%s: AllocatePages error %lu\n", __func__,
-   EFI_ERROR_CODE(status));
-   return (ENOMEM);
-   }
+   for (;;) {
+   status = BS->GetMemoryMap(, mm, _mapkey, , 
);
+   if (!EFI_ERROR(status))
+   break;
 
-   /*
-* Read the memory map and stash it after bootinfo. Align the
-* memory map on a 16-byte boundary (the bootinfo block is page
-* aligned).
-*/
-   efihdr = (struct efi_map_header *)(uintptr_t)addr;
-   mm = (void *)((uint8_t *)efihdr + efisz);
-   sz = (EFI_PAGE_SIZE * pages) - efisz;
+   if (status != EFI_BUFFER_TOO_SMALL) {
+   printf("%s: GetMemoryMap error %lu\n", __func__,
+  EFI_ERROR_CODE(status));
+   return (EINVAL);
+   }
 
-   status = 

Re: svn commit: r352112 - in head: share/man/man4 sys/net

2019-09-09 Thread Rebecca Cran
On 2019-09-09 16:54, Conrad Meyer wrote:
> Author: cem
>   head/share/man/man4/ddb.4
>   head/sys/net/rtsock.c

I'm seeing the following errors when building:


--- rtsock.o ---
pointer-sign -Wno-error-shift-negative-value
-Wno-address-of-packed-member -Wno-format-zero-length  -mno-aes
-mno-avx  -std=iso9899:1999 -Werror  /usr/src/sys/net/rtsock.c
/usr/src/sys/net/rtsock.c:2108:13: error: format string is not a string
literal (potentially insecure) [-Werror,-Wformat-security]
    db_printf(rt_flag_name(idx));
  ^
/usr/src/sys/net/rtsock.c:2108:13: note: treat the string as an argument
to avoid this
    db_printf(rt_flag_name(idx));
  ^
  "%s",
/usr/src/sys/net/rtsock.c:2370:13: error: variable 'dstp' is used
uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
    } else if (af == AF_INET6) {
   ^~
/usr/src/sys/net/rtsock.c:2385:16: note: uninitialized use occurs here
    rt = rtalloc1(dstp, 0, RTF_RNH_LOCKED);
      ^~~~

-- 

Rebecca Cran



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r351831 - in head: . stand/efi/boot1 stand/efi/gptboot tools/build/mk

2019-09-08 Thread Rebecca Cran
On 2019-09-06 04:02, Andrew Turner wrote:
> I use them in a Jenkins instance to test arm64. I specifically don’t give the 
> Jenkins user any root access so am unable to use mdconfig to create the ESP 
> image. I would use makefs however support for generating fat images hasn’t 
> made it into a release yet, and it doesn’t build on 12 as many needed structs 
> are protected by _KERNEL.
> 
> I don’t care about the image being installed, but would like to be able to 
> generate it when needed on the latest 12 release without needing root access.

Sorry for the delay in replying. I'd prefer not to partially revert the
commit, but I'm not sure what the solution would be. Perhaps we could
accelerate the MFC of msdos makefs support to 12-STABLE?

-- 
Rebecca Cran



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r351831 - in head: . stand/efi/boot1 stand/efi/gptboot tools/build/mk

2019-09-05 Thread Rebecca Cran


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 2019-09-05 17:48, Rebecca Cran wrote:
>
> Or, if you prefer not to rely on EFI boot variables (for example, Linux
> GRUB EFI updates seem to reset them, deleting the FreeBSD entries), you
> can also copy loader.efi into /mnt/EFI/BOOT/BOOTx64.efi (replace
> BOOTx64.efi with BOOTarm.efi for ARM, and BOOTaa64.efi for AARCH64).
>
> EFI\BOOT\BOOTx64.efi is the default place where UEFI system firmware
> looks to run a bootloader from, given no EFI boot variables. I think
> it's only supposed to be for removable media, but I've not come across
> any that differentiate between fixed and removable.
>
Oh! Another thing: if you've been using the efifat file, be aware that
the ESP will only be an 800KB filesystem. The actual partition should be
a lot larger though, so you might want to back up any files you have on
it and run reformat it using newfs_msdos to a larger size.


- -- 

Rebecca Cran

-BEGIN PGP SIGNATURE-

iQIzBAEBCAAdFiEEH7l9m2RN073jRiviDQIrUxG+ECAFAl1xn7IACgkQDQIrUxG+
ECB+yA//Us8+b7vHUCt9pxAnYxsFoj8kbzphxNy76sAhyig8UZBG5P4/Qflt7mz+
nq1AztIzVChZHluBNl30j/euwVdEUChR7MAZ1PGvaM6ckcfxmVbgvKKVX4zyAy3h
feIr+8E2tvn5fBwtXkskMXPCMKVobPgqyCqDudQJ33C6o8f5DdrIKF7mSPikq77s
Vism537YX4zj2ip96KpG49fRcp9v+q3wzwLJxRgKhcafbdBU60jhujfSrRg8CUT/
SvuaG0IqdtZSNXP3Du+EM4NSX5EW87fZ4FcsQauvAl7+fH0ekmXNl9H+JdSHi6iT
J6XSPlTKnPzK6V4ER9Virs7BcWUWSG+9lNZmvSSfUd3RqSRFb5j4K8W8g4kgKsBh
4skMbwcHIMJkmPe/uPjLRU33ix/TFNv9cepOB6sQ9hlzIZG9NrjYOqzPEgbzDgtN
y4xrrx52g6vNO9Nsv+LW6hiZVg129zp3kYSAU0kJWKsJ7XBFRSHTLFiA9NUiYWsE
oSO15Q1E0wzj20ols0GI5bRqVmiloc+AV6pcCNmh3IwfGms6i1jIUTZ78EHusq0b
LXd8P4fHDgZRw/1Dljz600C7FNULg8vGjFem3mMS0v+B9O6kNE9SR/N4xYrhfh9j
9+kBOuvc8ROkc4OmS9UvFcqZCJnqkzsMaDS3JZO+4HbezJqzhV0=
=vHi0
-END PGP SIGNATURE-

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r351831 - in head: . stand/efi/boot1 stand/efi/gptboot tools/build/mk

2019-09-05 Thread Rebecca Cran
On 2019-09-05 02:41, Niclas Zeising wrote:

> mount -t msdosfs /dev/ada0p1 /mnt # (if that's the ESP, check with gpart
> list)
> cp /boot/loader.efi /mnt/EFI/FreeBSD/loader.efi
> umount /mnt
> 
> This works if proper EFI boot variables have been set up.  This can be
> done with, it's only needed the first time, or if they are somehow
> overwritten.
> 
> efibootmgr --create --activate --label FreeBSD --loader
> /dev/ada0p1:/EFI/FreeBSD/loader.efi
> 
> Once again, check that /dev/ada0p1 is the ESP.
> You can check your efi boot variables with efibootmgr -v

Or, if you prefer not to rely on EFI boot variables (for example, Linux
GRUB EFI updates seem to reset them, deleting the FreeBSD entries), you
can also copy loader.efi into /mnt/EFI/BOOT/BOOTx64.efi (replace
BOOTx64.efi with BOOTarm.efi for ARM, and BOOTaa64.efi for AARCH64).

EFI\BOOT\BOOTx64.efi is the default place where UEFI system firmware
looks to run a bootloader from, given no EFI boot variables. I think
it's only supposed to be for removable media, but I've not come across
any that differentiate between fixed and removable.

-- 
Rebecca Cran



signature.asc
Description: OpenPGP digital signature


svn commit: r351831 - in head: . stand/efi/boot1 stand/efi/gptboot tools/build/mk

2019-09-04 Thread Rebecca Cran
Author: bcran
Date: Wed Sep  4 20:55:48 2019
New Revision: 351831
URL: https://svnweb.freebsd.org/changeset/base/351831

Log:
  The efifat files are no longer used: remove the code to build them
  
  Reviewed by:  imp, tsoome, emaste
  Differential Revision:https://reviews.freebsd.org/D20562

Deleted:
  head/stand/efi/boot1/Makefile.fat
  head/stand/efi/boot1/fat-amd64.tmpl.xz
  head/stand/efi/boot1/fat-arm.tmpl.xz
  head/stand/efi/boot1/fat-arm64.tmpl.xz
  head/stand/efi/boot1/fat-i386.tmpl.xz
  head/stand/efi/boot1/generate-fat.sh
Modified:
  head/ObsoleteFiles.inc
  head/stand/efi/boot1/Makefile
  head/stand/efi/gptboot/Makefile
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Sep  4 20:28:16 2019(r351830)
+++ head/ObsoleteFiles.inc  Wed Sep  4 20:55:48 2019(r351831)
@@ -37,7 +37,9 @@
 #   -V OLD_FILES -V OLD_LIBS -V OLD_DIRS check-old | \
 #   xargs -n1 | sort | uniq -d;
 # done
- 
+
+# 20190904: Remove boot1.efifat
+OLD_FILES+=boot/boot1.efifat
 # 20190903: pc-sysinstall(8) removed
 OLD_FILES+=usr/share/examples/pc-sysinstall/README
 OLD_FILES+=usr/share/examples/pc-sysinstall/pc-autoinstall.conf

Modified: head/stand/efi/boot1/Makefile
==
--- head/stand/efi/boot1/Makefile   Wed Sep  4 20:28:16 2019
(r351830)
+++ head/stand/efi/boot1/Makefile   Wed Sep  4 20:55:48 2019
(r351831)
@@ -62,9 +62,6 @@ CFLAGS+=  -I${LDRSRC}
 
 FILES= ${BOOT1}.efi
 FILESMODE_${BOOT1}.efi=${BINMODE}
-.ifndef(NOFAT)
-FILES+= ${BOOT1}.efifat
-.endif
 
 LDSCRIPT=  ${EFISRC}/loader/arch/${MACHINE}/ldscript.${MACHINE}
 LDFLAGS+=  -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared
@@ -99,25 +96,5 @@ ${BOOT1}.efi: ${PROG}
-j .dynamic -j .dynsym -j .rel.dyn \
-j .rela.dyn -j .reloc -j .eh_frame \
--output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
-
-.ifndef(NOFAT)
-# The following inserts our objects into a template FAT file system
-# created by generate-fat.sh
-
-.include "Makefile.fat"
-
-${BOOT1}.efifat: ${BOOT1}.efi
-   @set -- `ls -l ${.ALLSRC}`; \
-   x=$$(($$5-${BOOT1_MAXSIZE})); \
-   if [ $$x -ge 0 ]; then \
-   echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\
-   exit 1; \
-   fi
-   echo ${.OBJDIR}
-   xz -d -c ${BOOTSRC}/efi/boot1/fat-${MACHINE}.tmpl.xz > ${.TARGET}
-   ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
-
-CLEANFILES+= ${BOOT1}.efi ${BOOT1}.efifat
-.endif
 
 .include 

Modified: head/stand/efi/gptboot/Makefile
==
--- head/stand/efi/gptboot/Makefile Wed Sep  4 20:28:16 2019
(r351830)
+++ head/stand/efi/gptboot/Makefile Wed Sep  4 20:55:48 2019
(r351831)
@@ -4,7 +4,6 @@
 # we don't want the gptboot.efifat thing created.
 MK_LOADER_ZFS=no
 EFI_DEBUG=yes
-NOFAT=yes
 
 BOOT1?=gptboot
 .PATH: ${SRCTOP}/stand/efi/boot1 ${SRCTOP}/stand/libsa

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Sep  4 20:28:16 
2019(r351830)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Sep  4 20:55:48 
2019(r351831)
@@ -618,7 +618,6 @@ OLD_FILES+=boot/boot0
 OLD_FILES+=boot/boot0sio
 OLD_FILES+=boot/boot1
 OLD_FILES+=boot/boot1.efi
-OLD_FILES+=boot/boot1.efifat
 OLD_FILES+=boot/boot2
 OLD_FILES+=boot/brand.4th
 OLD_FILES+=boot/cdboot
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r346039 - head/sys/conf

2019-09-03 Thread Rebecca Cran

On 2019-04-08 12:25, Warner Losh wrote:

Author: imp
Date: Mon Apr  8 18:25:14 2019
New Revision: 346039
URL: https://svnweb.freebsd.org/changeset/base/346039

Log:
   Style only change: Prefer $() to ``
   
   $() is more modern and also nests. Convert the mix of styles to using

   only the former (although the latter was more common). It's the more
   dominant style in other shell scripts these days as well.
   
   Differential Revision:  https://reviews.freebsd.org/D19840


Modified:
   head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh



I thought I saw an email a few weeks ago that suggested that the list of 
people who reviewed the patch should be copied into a "Reviewed by:" 
line, to avoid only having that information in Phabricator.


Am I remembering correctly, or is just mentioning the Phab review 
considered sufficient?



--
Rebecca Cran



___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349494 - head/sys/dev/uart

2019-06-27 Thread Rebecca Cran
Author: bcran
Date: Fri Jun 28 01:19:08 2019
New Revision: 349494
URL: https://svnweb.freebsd.org/changeset/base/349494

Log:
  Add ACPI entries for Synopsys Designware UARTs used on ARM platforms
  
  This fixes (userspace) console on the Marvell MACCHIATObin in ACPI mode with
  latest TianoCore EDK2 firmware.
  
  Submitted by: Greg V 
  Reviewed by:  mw, bcran
  Differential Revision:https://reviews.freebsd.org/D20765

Modified:
  head/sys/dev/uart/uart_dev_ns8250.c

Modified: head/sys/dev/uart/uart_dev_ns8250.c
==
--- head/sys/dev/uart/uart_dev_ns8250.c Fri Jun 28 01:17:33 2019
(r349493)
+++ head/sys/dev/uart/uart_dev_ns8250.c Fri Jun 28 01:19:08 2019
(r349494)
@@ -415,6 +415,9 @@ struct uart_class uart_ns8250_class = {
 static struct acpi_uart_compat_data acpi_compat_data[] = {
{"AMD0020", _ns8250_class, 0, 2, 0, 4800, 
UART_F_BUSY_DETECT, "AMD / Synopsys Designware UART"},
{"AMDI0020", _ns8250_class, 0, 2, 0, 4800, UART_F_BUSY_DETECT, 
"AMD / Synopsys Designware UART"},
+   {"MRVL0001", _ns8250_class, 0, 2, 0, 2, 
UART_F_BUSY_DETECT, "Marvell / Synopsys Designware UART"},
+   {"SCX0006",  _ns8250_class, 0, 2, 0, 6250, UART_F_BUSY_DETECT, 
"SynQuacer / Synopsys Designware UART"},
+   {"HISI0031", _ns8250_class, 0, 2, 0, 2, 
UART_F_BUSY_DETECT, "HiSilicon / Synopsys Designware UART"},
{"PNP0500", _ns8250_class, 0, 0, 0, 0, 0, "Standard PC COM port"},
{"PNP0501", _ns8250_class, 0, 0, 0, 0, 0, "16550A-compatible COM 
port"},
{"PNP0502", _ns8250_class, 0, 0, 0, 0, 0, "Multiport serial device 
(non-intelligent 16550)"},
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349493 - head/sys/arm/arm

2019-06-27 Thread Rebecca Cran
Author: bcran
Date: Fri Jun 28 01:17:33 2019
New Revision: 349493
URL: https://svnweb.freebsd.org/changeset/base/349493

Log:
  Add missing ACPI GICv2 MSI/MSI-X attachment
  
  This lets PCIe MSI-X device interrupts work on the MACCHIATObin
  (Marvell Armada 8k), which allows e.g. the Intel igb NIC to fully work.
  
  Submitted by: Greg V 
  Reviewed by:  mw, bcran
  Differential Revision:https://reviews.freebsd.org/D20775

Modified:
  head/sys/arm/arm/gic_acpi.c

Modified: head/sys/arm/arm/gic_acpi.c
==
--- head/sys/arm/arm/gic_acpi.c Fri Jun 28 01:07:19 2019(r349492)
+++ head/sys/arm/arm/gic_acpi.c Fri Jun 28 01:17:33 2019(r349493)
@@ -331,9 +331,21 @@ arm_gicv2m_acpi_probe(device_t dev)
return (BUS_PROBE_DEFAULT);
 }
 
+static int
+arm_gicv2m_acpi_attach(device_t dev)
+{
+   struct arm_gicv2m_softc *sc;
+
+   sc = device_get_softc(dev);
+   sc->sc_xref = ACPI_MSI_XREF;
+
+   return (arm_gicv2m_attach(dev));
+}
+
 static device_method_t arm_gicv2m_acpi_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, arm_gicv2m_acpi_probe),
+   DEVMETHOD(device_attach,arm_gicv2m_acpi_attach),
 
/* End */
DEVMETHOD_END
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349471 - head/stand/efi/loader

2019-06-27 Thread Rebecca Cran
Author: bcran
Date: Thu Jun 27 22:06:41 2019
New Revision: 349471
URL: https://svnweb.freebsd.org/changeset/base/349471

Log:
  Increase EFI_STAGING_SIZE to 100MB on x64
  
  To avoid failures when the large 18MB nvidia.ko module is being loaded,
  increase EFI_STAGING_SIZE from 64MB to 100MB on x64 systems.
  Leave the other platforms at 64MB.

Modified:
  head/stand/efi/loader/copy.c

Modified: head/stand/efi/loader/copy.c
==
--- head/stand/efi/loader/copy.cThu Jun 27 21:45:40 2019
(r349470)
+++ head/stand/efi/loader/copy.cThu Jun 27 22:06:41 2019
(r349471)
@@ -176,7 +176,11 @@ out:
 #endif /* __i386__ || __amd64__ */
 
 #ifndef EFI_STAGING_SIZE
+#if defined(__amd64__)
+#defineEFI_STAGING_SIZE100
+#else
 #defineEFI_STAGING_SIZE64
+#endif
 #endif
 
 EFI_PHYSICAL_ADDRESS   staging, staging_end;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349404 - in head/stand/efi: libefi loader

2019-06-25 Thread Rebecca Cran
Author: bcran
Date: Wed Jun 26 03:06:57 2019
New Revision: 349404
URL: https://svnweb.freebsd.org/changeset/base/349404

Log:
  Re-enable loader efi http boot and fix dv_open bug if dv_init failed
  
  The code in efihttp.c was assuming that dv_open wouldn't be called if
  dv_init failed. But the dv_init return value is currently ignored.
  
  Add a new variable, `efihttp_init_done` and only proceed in dv_open if
  it's true. This fixes the loader on systems without efi http support.

Modified:
  head/stand/efi/libefi/efihttp.c
  head/stand/efi/loader/conf.c

Modified: head/stand/efi/libefi/efihttp.c
==
--- head/stand/efi/libefi/efihttp.c Wed Jun 26 02:09:22 2019
(r349403)
+++ head/stand/efi/libefi/efihttp.c Wed Jun 26 03:06:57 2019
(r349404)
@@ -52,6 +52,8 @@ static EFI_GUID http_guid = EFI_HTTP_PROTOCOL_GUID;
 static EFI_GUID httpsb_guid = EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID;
 static EFI_GUID ip4config2_guid = EFI_IP4_CONFIG2_PROTOCOL_GUID;
 
+static bool efihttp_init_done = false;
+
 static int efihttp_dev_init(void);
 static int efihttp_dev_strategy(void *devdata, int rw, daddr_t blk, size_t 
size,
 char *buf, size_t *rsize);
@@ -208,6 +210,9 @@ efihttp_dev_init(void)
return (efi_status_to_errno(status));
 
err = efi_register_handles(_dev, , NULL, 1);
+   if (!err)
+   efihttp_init_done = true;
+
return (err);
 }
 
@@ -236,6 +241,9 @@ efihttp_dev_open(struct open_file *f, ...)
EFI_STATUS status;
int err, len;
 
+   if (!efihttp_init_done)
+   return (ENXIO);
+
imgpath = efi_lookup_image_devpath(IH);
if (imgpath == NULL)
return (ENXIO);
@@ -555,6 +563,8 @@ efihttp_fs_open(const char *path, struct open_file *f)
char *path_slash;
int err;
 
+   if (!efihttp_init_done)
+   return (ENXIO);
/*
 * If any path fails to open, try with a trailing slash in
 * case it's a directory.

Modified: head/stand/efi/loader/conf.c
==
--- head/stand/efi/loader/conf.cWed Jun 26 02:09:22 2019
(r349403)
+++ head/stand/efi/loader/conf.cWed Jun 26 03:06:57 2019
(r349404)
@@ -39,6 +39,7 @@ struct devsw *devsw[] = {
_fddev,
_cddev,
_hddev,
+   _dev, /* ordering with efinet_dev matters */
_dev,
_dev,
 #ifdef EFI_ZFS_BOOT
@@ -54,6 +55,7 @@ struct fs_ops *file_system[] = {
_fsops,
_fsops,
_fsops,
+   _fsops,
_fsops,
_fsops,
_fsops,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa

2019-06-25 Thread Rebecca Cran
On 2019-06-25 11:23, Dave Cottlehuber wrote:

> This fails to identify the partition with a bootable zpool on both a laptop 
> (details
> in the PR)  and also a server (2 zpools), and instead tries to boot from the 
> EFI
> partition where the boot1.efi loader is located (i.e. disk0p1 and not 
> disk0p2).
> 
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238800

This doesn't sound related to the EFI HTTP changes, but may be related
to some recent changes Warner's made?

Other people have reported problems booting after my changeset though,
so I've disconnected the HTTP boot code in r349395.

-- 
Rebecca Cran



signature.asc
Description: OpenPGP digital signature


svn commit: r349395 - head/stand/efi/loader

2019-06-25 Thread Rebecca Cran
Author: bcran
Date: Tue Jun 25 21:26:57 2019
New Revision: 349395
URL: https://svnweb.freebsd.org/changeset/base/349395

Log:
  Disconnect EFI HTTP support
  
  The EFI HTTP code has been causing boot failures for people, so disable it
  while a fix is being worked on.

Modified:
  head/stand/efi/loader/conf.c

Modified: head/stand/efi/loader/conf.c
==
--- head/stand/efi/loader/conf.cTue Jun 25 21:21:34 2019
(r349394)
+++ head/stand/efi/loader/conf.cTue Jun 25 21:26:57 2019
(r349395)
@@ -39,7 +39,6 @@ struct devsw *devsw[] = {
_fddev,
_cddev,
_hddev,
-   _dev, /* ordering with efinet_dev matters */
_dev,
_dev,
 #ifdef EFI_ZFS_BOOT
@@ -55,7 +54,6 @@ struct fs_ops *file_system[] = {
_fsops,
_fsops,
_fsops,
-   _fsops,
_fsops,
_fsops,
_fsops,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa

2019-06-25 Thread Rebecca Cran
On 2019-06-25 07:03, Ed Maste wrote:

> My QEMU smoke test script (tools/boot/ci-qemu-test.sh) fails after
> this change, with an exception in the loader:
I can replicate this failure, and am working to debug it.

-- 
Rebecca Cran



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa

2019-06-24 Thread Rebecca Cran
On 2019-06-24 18:45, Rodney W. Grimes wrote:

> It sys accompanies, that means not a pointer to
> Hum oh my, what has happend to the disclaimer?

Huh. It turns out the _latest_ version of that file just contains:

/** @file
  This file defines the EFI HTTP Protocol interface. It is split into
  the following two main sections:
  HTTP Service Binding Protocol (HTTPSB)
  HTTP Protocol (HTTP)

  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
  (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
  SPDX-License-Identifier: BSD-2-Clause-Patent

  @par Revision Reference:
  This Protocol is introduced in UEFI Specification 2.5

**/


I think I should update the copy in the tree with this version, which
makes more sense. Do you agree?

-- 
Rebecca Cran



signature.asc
Description: OpenPGP digital signature


svn commit: r349349 - in head/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa

2019-06-24 Thread Rebecca Cran
Author: bcran
Date: Mon Jun 24 23:18:42 2019
New Revision: 349349
URL: https://svnweb.freebsd.org/changeset/base/349349

Log:
  loader: add HTTP support using UEFI
  
  Add support for an HTTP "network filesystem" using the UEFI's HTTP
  stack.
  
  This also supports HTTPS, but TianoCore EDK2 implementations currently
  crash while fetching loader files.
  Only IPv4 is supported at the moment. IPv6 support is planned for a
  follow-up changeset.
  
  Note that we include some headers from the TianoCore EDK II project in
  stand/efi/include/Protocol verbatim, including links to the license instead
  of including the full text because that's their preferred way of
  communicating it, despite not being normal FreeBSD project practice.
  
  Submitted by: scottph
  Reviewed by:  imp, bcran
  Differential Revision:https://reviews.freebsd.org/D20643

Added:
  head/stand/efi/include/Protocol/Http.h   (contents, props changed)
  head/stand/efi/include/Protocol/Ip4Config2.h   (contents, props changed)
  head/stand/efi/include/Protocol/ServiceBinding.h   (contents, props changed)
  head/stand/efi/libefi/efihttp.c   (contents, props changed)
Modified:
  head/stand/efi/include/efidevp.h
  head/stand/efi/include/efilib.h
  head/stand/efi/libefi/Makefile
  head/stand/efi/loader/conf.c
  head/stand/libsa/stand.h

Added: head/stand/efi/include/Protocol/Http.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/stand/efi/include/Protocol/Http.h  Mon Jun 24 23:18:42 2019
(r349349)
@@ -0,0 +1,523 @@
+/* $FreeBSD$ */
+/** @file
+  This file defines the EFI HTTP Protocol interface. It is split into
+  the following two main sections:
+  HTTP Service Binding Protocol (HTTPSB)
+  HTTP Protocol (HTTP)
+
+  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
+  (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution. The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This Protocol is introduced in UEFI Specification 2.5
+
+**/
+
+#ifndef __EFI_HTTP_PROTOCOL_H__
+#define __EFI_HTTP_PROTOCOL_H__
+
+#define EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID \
+  { \
+0xbdc8e6af, 0xd9bc, 0x4379, {0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 
0x1c } \
+  }
+
+#define EFI_HTTP_PROTOCOL_GUID \
+  { \
+0x7a59b29b, 0x910b, 0x4171, {0x82, 0x42, 0xa8, 0x5a, 0x0d, 0xf2, 0x5b, 
0x5b } \
+  }
+
+typedef struct _EFI_HTTP_PROTOCOL EFI_HTTP_PROTOCOL;
+
+///
+/// EFI_HTTP_VERSION
+///
+typedef enum {
+  HttpVersion10,
+  HttpVersion11,
+  HttpVersionUnsupported
+} EFI_HTTP_VERSION;
+
+///
+/// EFI_HTTP_METHOD
+///
+typedef enum {
+  HttpMethodGet,
+  HttpMethodPost,
+  HttpMethodPatch,
+  HttpMethodOptions,
+  HttpMethodConnect,
+  HttpMethodHead,
+  HttpMethodPut,
+  HttpMethodDelete,
+  HttpMethodTrace,
+  HttpMethodMax
+} EFI_HTTP_METHOD;
+
+///
+/// EFI_HTTP_STATUS_CODE
+///
+typedef enum {
+  HTTP_STATUS_UNSUPPORTED_STATUS = 0,
+  HTTP_STATUS_100_CONTINUE,
+  HTTP_STATUS_101_SWITCHING_PROTOCOLS,
+  HTTP_STATUS_200_OK,
+  HTTP_STATUS_201_CREATED,
+  HTTP_STATUS_202_ACCEPTED,
+  HTTP_STATUS_203_NON_AUTHORITATIVE_INFORMATION,
+  HTTP_STATUS_204_NO_CONTENT,
+  HTTP_STATUS_205_RESET_CONTENT,
+  HTTP_STATUS_206_PARTIAL_CONTENT,
+  HTTP_STATUS_300_MULTIPLE_CHOICES,
+  HTTP_STATUS_301_MOVED_PERMANENTLY,
+  HTTP_STATUS_302_FOUND,
+  HTTP_STATUS_303_SEE_OTHER,
+  HTTP_STATUS_304_NOT_MODIFIED,
+  HTTP_STATUS_305_USE_PROXY,
+  HTTP_STATUS_307_TEMPORARY_REDIRECT,
+  HTTP_STATUS_400_BAD_REQUEST,
+  HTTP_STATUS_401_UNAUTHORIZED,
+  HTTP_STATUS_402_PAYMENT_REQUIRED,
+  HTTP_STATUS_403_FORBIDDEN,
+  HTTP_STATUS_404_NOT_FOUND,
+  HTTP_STATUS_405_METHOD_NOT_ALLOWED,
+  HTTP_STATUS_406_NOT_ACCEPTABLE,
+  HTTP_STATUS_407_PROXY_AUTHENTICATION_REQUIRED,
+  HTTP_STATUS_408_REQUEST_TIME_OUT,
+  HTTP_STATUS_409_CONFLICT,
+  HTTP_STATUS_410_GONE,
+  HTTP_STATUS_411_LENGTH_REQUIRED,
+  HTTP_STATUS_412_PRECONDITION_FAILED,
+  HTTP_STATUS_413_REQUEST_ENTITY_TOO_LARGE,
+  HTTP_STATUS_414_REQUEST_URI_TOO_LARGE,
+  HTTP_STATUS_415_UNSUPPORTED_MEDIA_TYPE,
+  HTTP_STATUS_416_REQUESTED_RANGE_NOT_SATISFIED,
+  HTTP_STATUS_417_EXPECTATION_FAILED,
+  HTTP_STATUS_500_INTERNAL_SERVER_ERROR,
+  HTTP_STATUS_501_NOT_IMPLEMENTED,
+  HTTP_STATUS_502_BAD_GATEWAY,
+  HTTP_STATUS_503_SERVICE_UNAVAILABLE,
+  HTTP_STATUS_504_GATEWAY_TIME_OUT,
+  HTTP_STATUS_505_HTTP_VERSION_NOT_SUPPORTED,
+  HTTP_STATUS_308_PERMANENT_REDIRECT
+} EFI_HTTP_STATUS_CODE;
+
+///
+/// EFI_HTTPv4_ACCESS_POINT
+///
+typedef struct {
+  ///
+  /// Set to TRUE to instruct the EFI 

svn commit: r349201 - head/stand/efi/libefi

2019-06-19 Thread Rebecca Cran
Author: bcran
Date: Wed Jun 19 18:47:44 2019
New Revision: 349201
URL: https://svnweb.freebsd.org/changeset/base/349201

Log:
  efinet: Defer exclusively opening the network handles
  
  Don't commit to exclusive access to the network device handle by
  efinet until the loader has decided to load something through the
  network. This allows for the possibility of other users of the
  network device.
  
  Submitted by: scottph
  Reviewed by:  tsoome, emaste
  Tested by:tsoome, bcran
  Differential Revision:https://reviews.freebsd.org/D20642

Modified:
  head/stand/efi/libefi/efinet.c

Modified: head/stand/efi/libefi/efinet.c
==
--- head/stand/efi/libefi/efinet.c  Wed Jun 19 16:44:07 2019
(r349200)
+++ head/stand/efi/libefi/efinet.c  Wed Jun 19 18:47:44 2019
(r349201)
@@ -108,7 +108,25 @@ efinet_match(struct netif *nif, void *machdep_hint)
 static int
 efinet_probe(struct netif *nif, void *machdep_hint)
 {
+   EFI_SIMPLE_NETWORK *net;
+   EFI_HANDLE h;
+   EFI_STATUS status;
 
+   h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private;
+   /*
+* Open the network device in exclusive mode. Without this
+* we will be racing with the UEFI network stack. It will
+* pull packets off the network leading to lost packets.
+*/
+   status = BS->OpenProtocol(h, _guid, (void **),
+   IH, NULL, EFI_OPEN_PROTOCOL_EXCLUSIVE);
+   if (status != EFI_SUCCESS) {
+   printf("Unable to open network interface %d for "
+   "exclusive access: %lu\n", nif->nif_unit,
+   EFI_ERROR_CODE(status));
+   return (efi_status_to_errno(status));
+   }
+
return (0);
 }
 
@@ -269,7 +287,6 @@ efinet_dev_init()
struct netif_dif *dif;
struct netif_stats *stats;
EFI_DEVICE_PATH *devpath, *node;
-   EFI_SIMPLE_NETWORK *net;
EFI_HANDLE *handles, *handles2;
EFI_STATUS status;
UINTN sz;
@@ -304,19 +321,6 @@ efinet_dev_init()
if (DevicePathType(node) != MESSAGING_DEVICE_PATH ||
DevicePathSubType(node) != MSG_MAC_ADDR_DP)
continue;
-
-   /*
-* Open the network device in exclusive mode. Without this
-* we will be racing with the UEFI network stack. It will
-* pull packets off the network leading to lost packets.
-*/
-   status = BS->OpenProtocol(handles[i], _guid, (void **),
-   IH, NULL, EFI_OPEN_PROTOCOL_EXCLUSIVE);
-   if (status != EFI_SUCCESS) {
-   printf("Unable to open network interface %d for "
-   "exclusive access: %lu\n", i,
-   EFI_ERROR_CODE(status));
-   }
 
handles2[nifs] = handles[i];
nifs++;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r348499 - head/stand/common

2019-06-01 Thread Rebecca Cran
Author: bcran
Date: Sat Jun  1 19:47:15 2019
New Revision: 348499
URL: https://svnweb.freebsd.org/changeset/base/348499

Log:
  Fix comment parsing in interp_simple.c
  
  loader.rc has comment lines without a trailing space, which get
  interpreted as commands. Avoid this by only matching against the
  backslash character.
  
  Reviewed by:  imp, tsoome
  Differential Revision:https://reviews.freebsd.org/D20491

Modified:
  head/stand/common/interp_simple.c

Modified: head/stand/common/interp_simple.c
==
--- head/stand/common/interp_simple.c   Sat Jun  1 18:26:07 2019
(r348498)
+++ head/stand/common/interp_simple.c   Sat Jun  1 19:47:15 2019
(r348499)
@@ -114,7 +114,7 @@ interp_include(const char *filename)
line++;
flags = 0;
/* Discard comments */
-   if (strncmp(input+strspn(input, " "), "\\ ", 2) == 0)
+   if (strncmp(input+strspn(input, " "), "\\", 1) == 0)
continue;
cp = input;
/* Echo? */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346748 - head/tools/boot

2019-04-26 Thread Rebecca Cran
Author: bcran
Date: Fri Apr 26 14:44:46 2019
New Revision: 346748
URL: https://svnweb.freebsd.org/changeset/base/346748

Log:
  Fix tools/boot/ci-qemu-test.sh and make some improvements
  
  Update ci-qemu-test.sh
  
  o Update the path to the OVMF file, which is now in 
/usr/local/share/uefi-edk2-qemu.
  o Use the more modern q35, pc-q35-3.0 (Q35 + ICH9, 2009) QEMU machine
instead of the default, obsolete pc, pc-i440fx-3.0 (i440FX + PIIX, 1996).
For example this adds ACPI support.
  o Specify the system firmware using the newer pflash drive syntax instead
of bios.
  o Remove extra, unneeded devices by passing -nodefaults.
  o Change text to talk about 'firmware' instead of 'bios', since UEFI
isn't a BIOS.
  
  Reviewed by:  imp, emaste
  Differential Revision:https://reviews.freebsd.org/D20074

Modified:
  head/tools/boot/ci-qemu-test.sh

Modified: head/tools/boot/ci-qemu-test.sh
==
--- head/tools/boot/ci-qemu-test.sh Fri Apr 26 14:44:20 2019
(r346747)
+++ head/tools/boot/ci-qemu-test.sh Fri Apr 26 14:44:46 2019
(r346748)
@@ -81,10 +81,10 @@ if [ -z "${SRCTOP}" ]; then
die "Cannot locate top of source tree"
 fi
 
-# Locate the uefi bios file used by qemu.
-: ${OVMF:=/usr/local/share/UEFI-firmware/QEMU_UEFI_CODE_x86_64.fd}
+# Locate the uefi firmware file used by qemu.
+: ${OVMF:=/usr/local/share/uefi-edk2-qemu/QEMU_UEFI_CODE-x86_64.fd}
 if [ ! -r "${OVMF}" ]; then
-   die "Cannot read UEFI bios file ${OVMF}"
+   die "Cannot read UEFI firmware file ${OVMF}"
 fi
 
 # Create a temp dir to hold the boot image.
@@ -97,7 +97,8 @@ trap tempdir_cleanup EXIT SIGINT SIGHUP SIGTERM SIGQUI
 # And, boot in QEMU.
 : ${BOOTLOG:=${TMPDIR:-/tmp}/ci-qemu-test-boot.log}
 timeout 300 \
-qemu-system-x86_64 -m 256M -bios ${OVMF} \
+qemu-system-x86_64 -M q35 -m 256M -nodefaults \
+   -drive if=pflash,format=raw,readonly,file=${OVMF} \
 -serial stdio -vga none -nographic -monitor none \
 -snapshot -hda fat:${ROOTDIR} 2>&1 | tee ${BOOTLOG}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346657 - head/sys/dev/uart

2019-04-24 Thread Rebecca Cran
Author: bcran
Date: Thu Apr 25 02:16:48 2019
New Revision: 346657
URL: https://svnweb.freebsd.org/changeset/base/346657

Log:
  ACPI SPCR: handle BaudRate=0
  
  From 
https://github.com/tianocore/edk2-platforms/commit/7d8dc6544c93a5f5a03c83316489ba8700946e9f
  
  "The mcbin (and likely others) have a nonstandard uart clock. This means
  that the earlycon programming will incorrectly set the baud rate if it is
  specified. The way around this is to tell the kernel to continue using the
  preprogrammed baud rate. This is done by setting the baud to 0."
  
  Our drivers (uart_dev_ns8250) do respect zero, but SPCR would error. Let's
  not error.
  
  Submitted by: Greg V 
  Reviewed by:  mw, imp, bcran
  Differential Revision:https://reviews.freebsd.org/D19914

Modified:
  head/sys/dev/uart/uart_cpu_arm64.c

Modified: head/sys/dev/uart/uart_cpu_arm64.c
==
--- head/sys/dev/uart/uart_cpu_arm64.c  Thu Apr 25 00:58:11 2019
(r346656)
+++ head/sys/dev/uart/uart_cpu_arm64.c  Thu Apr 25 02:16:48 2019
(r346657)
@@ -128,6 +128,13 @@ uart_cpu_acpi_probe(struct uart_class **classp, bus_sp
goto out;
 
switch(spcr->BaudRate) {
+   case 0:
+   /*
+* A BaudRate of 0 is a special value which means not to
+* change the rate that's already programmed.
+*/
+   *baud = 0;
+   break;
case 3:
*baud = 9600;
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346646 - head/tools/boot

2019-04-24 Thread Rebecca Cran
Author: bcran
Date: Wed Apr 24 22:35:29 2019
New Revision: 346646
URL: https://svnweb.freebsd.org/changeset/base/346646

Log:
  Fix install-boot.sh and rootgen.sh UEFI bugs
  
  tools/boot/install-boot.sh was assuming that if a device was passed in,
  it should operate on the current system and run efibootmgr etc. to
  update the boot manager. However, rootgen.sh passes a md(4) device and
  not a fixed disk.
  
  Add a -u option to install-boot.sh to tell it to update the system
  in-place and run efibootmgr etc.
  
  Also, source install-boot.sh in rootgen.sh to allow it to find and
  call make_esp_file etc. And pass the loader file to make_esp_file instead
  of a directory name.
  
  Reported by:  ian
  Reviewed by:  ian,imp,tsoome
  Differential Revision:https://reviews.freebsd.org/D19992

Modified:
  head/tools/boot/install-boot.sh
  head/tools/boot/rootgen.sh

Modified: head/tools/boot/install-boot.sh
==
--- head/tools/boot/install-boot.sh Wed Apr 24 20:30:45 2019
(r346645)
+++ head/tools/boot/install-boot.sh Wed Apr 24 22:35:29 2019
(r346646)
@@ -134,29 +134,37 @@ make_esp_device() {
 echo "Copying loader to /EFI/freebsd on ESP"
 cp "${file}" "${mntpt}/EFI/freebsd/loader.efi"
 
-existingbootentryloaderfile=$(efibootmgr -v | grep 
"${mntpt}//EFI/freebsd/loader.efi")
+if [ -n "${updatesystem}" ]; then
+existingbootentryloaderfile=$(efibootmgr -v | grep 
"${mntpt}//EFI/freebsd/loader.efi")
 
-if [ -z "$existingbootentryloaderfile" ]; then
-# Try again without the double forward-slash in the path
-existingbootentryloaderfile=$(efibootmgr -v | grep 
"${mntpt}/EFI/freebsd/loader.efi")
-fi
-
-if [ -z "$existingbootentryloaderfile" ]; then
-echo "Creating UEFI boot entry for FreeBSD"
-efibootmgr --create --label FreeBSD --loader 
"${mntpt}/EFI/freebsd/loader.efi" > /dev/null
-if [ $? -ne 0 ]; then
-die "Failed to create new boot entry"
+if [ -z "$existingbootentryloaderfile" ]; then
+# Try again without the double forward-slash in the path
+existingbootentryloaderfile=$(efibootmgr -v | grep 
"${mntpt}/EFI/freebsd/loader.efi")
 fi
 
-# When creating new entries, efibootmgr doesn't mark them active, so 
we need to
-# do so. It doesn't make it easy to find which entry it just added, so 
rely on
-# the fact that it places the new entry first in BootOrder.
-bootorder=$(efivar --name 
8be4df61-93ca-11d2-aa0d-00e098032b8c-BootOrder --print --no-name --hex | head 
-1)
-bootentry=$(echo "${bootorder}" | cut -w -f 3)$(echo "${bootorder}" | 
cut -w -f 2)
-echo "Marking UEFI boot entry ${bootentry} active"
-efibootmgr --activate "${bootentry}" > /dev/null
+if [ -z "$existingbootentryloaderfile" ]; then
+echo "Creating UEFI boot entry for FreeBSD"
+efibootmgr --create --label FreeBSD --loader 
"${mntpt}/EFI/freebsd/loader.efi" > /dev/null
+if [ $? -ne 0 ]; then
+die "Failed to create new boot entry"
+fi
+
+# When creating new entries, efibootmgr doesn't mark them active, 
so we need to
+# do so. It doesn't make it easy to find which entry it just 
added, so rely on
+# the fact that it places the new entry first in BootOrder.
+bootorder=$(efivar --name 
8be4df61-93ca-11d2-aa0d-00e098032b8c-BootOrder --print --no-name --hex | head 
-1)
+bootentry=$(echo "${bootorder}" | cut -w -f 3)$(echo 
"${bootorder}" | cut -w -f 2)
+echo "Marking UEFI boot entry ${bootentry} active"
+efibootmgr --activate "${bootentry}" > /dev/null
+else
+echo "Existing UEFI FreeBSD boot entry found: not creating a new 
one"
+fi
 else
-echo "Existing UEFI FreeBSD boot entry found: not creating a new one"
+   # Configure for booting from removable media
+   if [ ! -d "${mntpt}/EFI/BOOT" ]; then
+   mkdir -p "${mntpt}/EFI/BOOT"
+   fi
+   cp "${file}" "${mntpt}/EFI/BOOT/${efibootname}.efi"
 fi
 
 umount "${mntpt}"
@@ -362,6 +370,8 @@ usage() {
printf ' -f fs filesystem type: ufs or zfs\n'
printf ' -g geli   yes or no\n'
printf ' -hthis help/usage text\n'
+   printf ' -uRun commands such as efibootmgr to update the\n'
+   printf '   currently running system\n'
printf ' -o optargsoptional arguments\n'
printf ' -s scheme mbr or gpt\n'
exit 0
@@ -372,7 +382,7 @@ srcroot=/
 # Note: we really don't support geli boot in this script yet.
 geli=nogeli
 
-while getopts "b:d:f:g:ho:s:" opt; do
+while getopts "b:d:f:g:ho:s:u" opt; do
 case "$opt" in
b)
bios=${OPTARG}
@@ -388,6 +398,9 @@ while getopts "b:d:f:g:ho:s:" 

Re: svn commit: r346039 - head/sys/conf

2019-04-09 Thread Rebecca Cran via svn-src-all

On 2019-04-08 12:25, Warner Losh wrote:

Author: imp
Date: Mon Apr  8 18:25:14 2019
New Revision: 346039
URL: https://svnweb.freebsd.org/changeset/base/346039

Log:
   Style only change: Prefer $() to ``
   
   $() is more modern and also nests. Convert the mix of styles to using

   only the former (although the latter was more common). It's the more
   dominant style in other shell scripts these days as well.
   
   Differential Revision:  https://reviews.freebsd.org/D19840


Modified:
   head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh



I thought I saw an email a few weeks ago that suggested that the list of 
people who reviewed the patch should be copied into a "Reviewed by:" 
line, to avoid only having that information in Phabricator.


Am I remembering correctly, or is just mentioning the Phab review 
considered sufficient?



--
Rebecca Cran

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344862 - head/usr.sbin/efivar

2019-03-06 Thread Rebecca Cran
Author: bcran
Date: Thu Mar  7 00:01:28 2019
New Revision: 344862
URL: https://svnweb.freebsd.org/changeset/base/344862

Log:
  Document the efivar --load-option option
  
  Reviewed by:  imp, kevans
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D19263

Modified:
  head/usr.sbin/efivar/efivar.8

Modified: head/usr.sbin/efivar/efivar.8
==
--- head/usr.sbin/efivar/efivar.8   Wed Mar  6 23:59:56 2019
(r344861)
+++ head/usr.sbin/efivar/efivar.8   Thu Mar  7 00:01:28 2019
(r344862)
@@ -1,5 +1,5 @@
 .\"
-.\" Copyright (c) 2017 Netflix, Inc.
+.\" Copyright (c) 2017-2019 Netflix, Inc.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 22, 2017
+.Dd March 6, 2019
 .Dt EFIVAR 8
 .Os
 .Sh NAME
@@ -46,6 +46,7 @@
 .Op Fl -hex
 .Op Fl -list-guids
 .Op Fl -list
+.Op Fl -load-option
 .Op Fl -name Ar name
 .Op Fl -no-name
 .Op Fl -print
@@ -147,6 +148,8 @@ List all the variables.
 If the
 .Fl -print
 flag is also listed, their values will be displayed.
+.It Fl -load-option
+Decode the variable as if it were a UEFI Boot Option, including information 
about what device and/or paths the UEFI DevicePaths decode to.
 .It Fl N Fl -no-name
 Do not display the variable name.
 .It Fl p Fl -print
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344839 - head/stand/efi/loader

2019-03-05 Thread Rebecca Cran
Author: bcran
Date: Wed Mar  6 05:39:40 2019
New Revision: 344839
URL: https://svnweb.freebsd.org/changeset/base/344839

Log:
  Add retry loop around GetMemoryMap call to fix fragmentation bug
  
  The call to BS->AllocatePages can cause the memory map to become framented,
  causing BS->GetMemoryMap to return EFI_BUFFER_TOO_SMALL more than once. For
  example this can happen on the MinnowBoard Turbot, causing the boot to stop
  with an error. Avoid this by calling GetMemoryMap in a loop.
  
  Reviewed by:  imp, tsoome, kevans
  Differential Revision:https://reviews.freebsd.org/D19341

Modified:
  head/stand/efi/loader/bootinfo.c
  head/stand/efi/loader/copy.c

Modified: head/stand/efi/loader/bootinfo.c
==
--- head/stand/efi/loader/bootinfo.cWed Mar  6 02:52:58 2019
(r344838)
+++ head/stand/efi/loader/bootinfo.cWed Mar  6 05:39:40 2019
(r344839)
@@ -287,12 +287,12 @@ static int
 bi_load_efi_data(struct preloaded_file *kfp)
 {
EFI_MEMORY_DESCRIPTOR *mm;
-   EFI_PHYSICAL_ADDRESS addr;
+   EFI_PHYSICAL_ADDRESS addr = 0;
EFI_STATUS status;
const char *efi_novmap;
size_t efisz;
UINTN efi_mapkey;
-   UINTN mmsz, pages, retry, sz;
+   UINTN dsz, pages, retry, sz;
UINT32 mmver;
struct efi_map_header *efihdr;
bool do_vmap;
@@ -323,76 +323,94 @@ bi_load_efi_data(struct preloaded_file *kfp)
efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf;
 
/*
-* Assgin size of EFI_MEMORY_DESCRIPTOR to keep compatible with
+* Assign size of EFI_MEMORY_DESCRIPTOR to keep compatible with
 * u-boot which doesn't fill this value when buffer for memory
 * descriptors is too small (eg. 0 to obtain memory map size)
 */
-   mmsz = sizeof(EFI_MEMORY_DESCRIPTOR);
+   dsz = sizeof(EFI_MEMORY_DESCRIPTOR);
 
/*
-* It is possible that the first call to ExitBootServices may change
-* the map key. Fetch a new map key and retry ExitBootServices in that
-* case.
+* Allocate enough pages to hold the bootinfo block and the
+* memory map EFI will return to us. The memory map has an
+* unknown size, so we have to determine that first. Note that
+* the AllocatePages call can itself modify the memory map, so
+* we have to take that into account as well. The changes to
+* the memory map are caused by splitting a range of free
+* memory into two, so that one is marked as being loader
+* data.
 */
+
+   sz = 0;
+
+   /*
+* Matthew Garrett has observed at least one system changing the
+* memory map when calling ExitBootServices, causing it to return an
+* error, probably because callbacks are allocating memory.
+* So we need to retry calling it at least once.
+*/
for (retry = 2; retry > 0; retry--) {
-   /*
-* Allocate enough pages to hold the bootinfo block and the
-* memory map EFI will return to us. The memory map has an
-* unknown size, so we have to determine that first. Note that
-* the AllocatePages call can itself modify the memory map, so
-* we have to take that into account as well. The changes to
-* the memory map are caused by splitting a range of free
-* memory into two (AFAICT), so that one is marked as being
-* loader data.
-*/
-   sz = 0;
-   BS->GetMemoryMap(, NULL, _mapkey, , );
-   sz += mmsz;
-   sz = (sz + 0xf) & ~0xf;
-   pages = EFI_SIZE_TO_PAGES(sz + efisz);
-   status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData,
-pages, );
-   if (EFI_ERROR(status)) {
-   printf("%s: AllocatePages error %lu\n", __func__,
-   EFI_ERROR_CODE(status));
-   return (ENOMEM);
-   }
+   for (;;) {
+   status = BS->GetMemoryMap(, mm, _mapkey, , 
);
+   if (!EFI_ERROR(status))
+   break;
 
-   /*
-* Read the memory map and stash it after bootinfo. Align the
-* memory map on a 16-byte boundary (the bootinfo block is page
-* aligned).
-*/
-   efihdr = (struct efi_map_header *)(uintptr_t)addr;
-   mm = (void *)((uint8_t *)efihdr + efisz);
-   sz = (EFI_PAGE_SIZE * pages) - efisz;
+   if (status != EFI_BUFFER_TOO_SMALL) {
+   printf("%s: GetMemoryMap error %lu\n", __func__,
+  EFI_ERROR_CODE(status));
+   return (EINVAL);
+   

svn commit: r344718 - in head/stand/efi/loader/arch: arm i386

2019-03-02 Thread Rebecca Cran
Author: bcran
Date: Sat Mar  2 04:02:11 2019
New Revision: 344718
URL: https://svnweb.freebsd.org/changeset/base/344718

Log:
  EFI: don't call printf after ExitBootServices, since it uses Boot Services
  
  ExitBootServices terminates all boot services including console access.
  Attempting to call printf afterwards can result in a crash, depending on the
  implementation.
  
  Move any printf statements to before we call bi_load, and remove any that
  depend on calling bi_load first.
  
  Reviewed by:  imp, tsoome
  Differential Revision:https://reviews.freebsd.org/D19374

Modified:
  head/stand/efi/loader/arch/arm/exec.c
  head/stand/efi/loader/arch/i386/elf32_freebsd.c

Modified: head/stand/efi/loader/arch/arm/exec.c
==
--- head/stand/efi/loader/arch/arm/exec.c   Sat Mar  2 03:17:23 2019
(r344717)
+++ head/stand/efi/loader/arch/arm/exec.c   Sat Mar  2 04:02:11 2019
(r344718)
@@ -74,16 +74,19 @@ __elfN(arm_exec)(struct preloaded_file *fp)
e = (Elf_Ehdr *)>md_data;
 
efi_time_fini();
+
+   entry = efi_translate(e->e_entry);
+
+   printf("Kernel entry at 0x%x...\n", (unsigned)entry);
+   printf("Kernel args: %s\n", fp->f_args);
+
if ((error = bi_load(fp->f_args, , )) != 0) {
efi_time_init();
return (error);
}
 
-   entry = efi_translate(e->e_entry);
-   printf("Kernel entry at 0x%x...\n", (unsigned)entry);
-   printf("Kernel args: %s\n", fp->f_args);
-   printf("modulep: %#x\n", modulep);
-   printf("relocation_offset %llx\n", __elfN(relocation_offset));
+   /* At this point we've called ExitBootServices, so we can't call
+* printf or any other function that uses Boot Services */
 
dev_cleanup();
 

Modified: head/stand/efi/loader/arch/i386/elf32_freebsd.c
==
--- head/stand/efi/loader/arch/i386/elf32_freebsd.c Sat Mar  2 03:17:23 
2019(r344717)
+++ head/stand/efi/loader/arch/i386/elf32_freebsd.c Sat Mar  2 04:02:11 
2019(r344718)
@@ -75,14 +75,19 @@ elf32_exec(struct preloaded_file *fp)
 ehdr = (Elf_Ehdr *)&(md->md_data);
 
 efi_time_fini();
+
+entry = ehdr->e_entry & 0xff;
+
+printf("Start @ 0x%x ...\n", entry);
+
 err = bi_load(fp->f_args, , );
 if (err != 0) {
efi_time_init();
return(err);
 }
-entry = ehdr->e_entry & 0xff;
 
-printf("Start @ 0x%x ...\n", entry);
+/* At this point we've called ExitBootServices, so we can't call
+ * printf or any other function that uses Boot Services */
 
 dev_cleanup();
 __exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop, modulep, 
kernend);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344337 - head/usr.sbin/efivar

2019-02-19 Thread Rebecca Cran
Author: bcran
Date: Wed Feb 20 05:19:16 2019
New Revision: 344337
URL: https://svnweb.freebsd.org/changeset/base/344337

Log:
  Add the unix path to the output of `efivar --load-option`
  
  Reviewed by:  imp
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D19242

Modified:
  head/usr.sbin/efivar/efiutil.c

Modified: head/usr.sbin/efivar/efiutil.c
==
--- head/usr.sbin/efivar/efiutil.c  Wed Feb 20 03:07:11 2019
(r344336)
+++ head/usr.sbin/efivar/efiutil.c  Wed Feb 20 05:19:16 2019
(r344337)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2017 Netflix, Inc.
+ * Copyright (c) 2017-2019 Netflix, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -120,6 +120,7 @@ bindump(uint8_t *data, size_t datalen)
 void
 efi_print_load_option(uint8_t *data, size_t datalen, int Aflag, int bflag, int 
uflag)
 {
+   char *dev, *relpath, *abspath;
uint8_t *ep = data + datalen;
uint8_t *walker = data;
uint32_t attr;
@@ -131,6 +132,7 @@ efi_print_load_option(uint8_t *data, size_t datalen, i
int len;
void *opt;
int optlen;
+   int rv;
 
if (datalen < sizeof(attr) + sizeof(fplen) + sizeof(efi_char))
return;
@@ -162,8 +164,15 @@ efi_print_load_option(uint8_t *data, size_t datalen, i
free(str);
while (dp < edp && SIZE(dp, edp) > sizeof(efidp_header)) {
efidp_format_device_path(buf, sizeof(buf), dp, SIZE(dp, edp));
+   rv = efivar_device_path_to_unix_path(dp, , , 
);
dp = (efidp)((char *)dp + efidp_size(dp));
printf(" %s\n", buf);
+   if (rv == 0) {
+   printf("  %*s:%s\n", len + (int)strlen(dev), dev, 
relpath);
+   free(dev);
+   free(relpath);
+   free(abspath);
+   }
}
if (optlen == 0)
return;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342666 - head/usr.sbin/efibootmgr

2018-12-31 Thread Rebecca Cran
Author: bcran
Date: Tue Jan  1 04:57:46 2019
New Revision: 342666
URL: https://svnweb.freebsd.org/changeset/base/342666

Log:
  Update the efibootmgr(8) man page to document changes to options.

Modified:
  head/usr.sbin/efibootmgr/efibootmgr.8

Modified: head/usr.sbin/efibootmgr/efibootmgr.8
==
--- head/usr.sbin/efibootmgr/efibootmgr.8   Tue Jan  1 00:48:25 2019
(r342665)
+++ head/usr.sbin/efibootmgr/efibootmgr.8   Tue Jan  1 04:57:46 2019
(r342666)
@@ -31,12 +31,13 @@
 .Nm efibootmgr 
 .Nd manipulate the EFI Boot Manager
 .Sh SYNOPSIS
-.Op Fl aAnNB Ar bootnum
+.Op Fl aAnNB
+.Op Fl b Ar bootnum
 .Op Fl t Ar timeout
 .Op Fl T
 .Op Fl o Ar bootorder
 .Op Fl v
-.Op Fl c l Ar loader [ Fl k Ar kernel ] [ Fl L Ar label ] [ Fl -dry-run ] [ Fl 
b Ar bootnum ]
+.Op Fl c l Ar loader [ Fl k Ar kernel ] [ Fl L Ar label ] [ Fl -dry-run ]
 .Sh "DESCRIPTION"
 .Nm
 manipulates how UEFI Boot Managers boot the system.
@@ -71,19 +72,19 @@ The path to and name of the loader.
 .It Fl k -kernel Ar kernel
 The path to and name of the kernel.
 .It Fl b -bootnum Ar bootnum
-When creating a new entry, use bootnum as the index.
-Fail if it already exists.
+When creating or modifying an entry, use bootnum as the index.
+When creating a new entry, fail if it already exists.
 .It Fl L -label Ar label
 An optional description for the entry.
 .It Fl D -dry-run
 Process but do not change any variables.
-.It Fl B -delete Ar bootnum
+.It Fl B -delete
 Delete the given bootnum boot entry.
-.It Fl a -activate Ar bootnum
-Activate the given bootnum boot entry.
-.It Fl A -deactivate Ar bootnum
+.It Fl a -activate
+Activate the given bootnum boot entry, or the new entry when used with -c.
+.It Fl A -deactivate
 Deactivate the given bootnum boot entry.
-.It Fl n -bootnext Ar bootnum
+.It Fl n -bootnext
 Set bootnum boot entry as the BootNext variable.
 .It Fl N -delete-bootnext 
 Delete the BootNext optional variable.
@@ -100,7 +101,7 @@ Display the device path of boot entries in the output.
 .Pp
 .Sh Examples
 .Pp
-To Display the current Boot related variables in the system:
+To display the current Boot related variables in the system:
 .Pp
 .Dl efibootmgr [-v]
 .Pp
@@ -130,18 +131,18 @@ into the first position of current BootOrder variable 
 must first be set to active before being considered available to attempt 
booting from, else they
 are ignored.
 .Pp
-.Dl efibootmgr -B 0009
+.Dl efibootmgr -B -b 0009
 .Pp
 Will delete the given boot entry Boot0009
 .Pp
 To set a given newly created boot entry active use:
 .Pp
-.Dl efibootmgr -a 0009
+.Dl efibootmgr -a -b 0009
 .Pp
 To set a given boot entry to be used as the BootNext variable, irrespective
 of its active state, use:
 .Pp
-.Dl efibootmgr -n 0009
+.Dl efibootmgr -n -b 0009
 .Pp
 To set the BootOrder for the next reboot  use:
 .Pp
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342635 - head/usr.sbin/efibootmgr

2018-12-30 Thread Rebecca Cran
Author: bcran
Date: Mon Dec 31 00:09:45 2018
New Revision: 342635
URL: https://svnweb.freebsd.org/changeset/base/342635

Log:
  Change the way efibootmgr works by specifying bootnum via -b parameter
  
  Instead of passing the bootnum to each different parameter, require users
  to specify -b when running operations that need a bootnum.
  
  This allows activation of a new boot entry at the same time it's created
  by adding -a onto the command line.
  
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D18648

Modified:
  head/usr.sbin/efibootmgr/efibootmgr.c

Modified: head/usr.sbin/efibootmgr/efibootmgr.c
==
--- head/usr.sbin/efibootmgr/efibootmgr.c   Sun Dec 30 23:08:06 2018
(r342634)
+++ head/usr.sbin/efibootmgr/efibootmgr.c   Mon Dec 31 00:09:45 2018
(r342635)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2017 Netflix, Inc.
+ * Copyright (c) 2017-2018 Netflix, Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -94,16 +94,16 @@ typedef struct _bmgr_opts {
 } bmgr_opts_t;
 
 static struct option lopts[] = {
-   {"activate", required_argument, NULL, 'a'},
-   {"bootnext", required_argument, NULL, 'n'}, /* set bootnext */
+   {"activate", no_argument, NULL, 'a'},
+   {"bootnext", no_argument, NULL, 'n'}, /* set bootnext */
{"bootnum", required_argument, NULL, 'b'},
{"bootorder", required_argument, NULL, 'o'}, /* set order */
{"copy", required_argument, NULL, 'C'}, /* Copy boot method */
{"create", no_argument, NULL, 'c'},
-   {"deactivate", required_argument, NULL, 'A'},
+   {"deactivate", no_argument, NULL, 'A'},
{"del-timout", no_argument, NULL, 'T'},
-   {"delete", required_argument, NULL, 'B'},
-   {"delete-bootnext", required_argument, NULL, 'N'},
+   {"delete", no_argument, NULL, 'B'},
+   {"delete-bootnext", no_argument, NULL, 'N'},
{"dry-run", no_argument, NULL, 'D'},
{"env", required_argument, NULL, 'e'},
{"help", no_argument, NULL, 'h'},
@@ -171,37 +171,35 @@ set_bootvar(const char *name, uint8_t *data, size_t si
 
 
 #define USAGE \
-   "   [-aAnNB Bootvar] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] 
[--help] \n\
-  [-c -l loader [-k kernel ] [-L label] [--dry-run] [-b Bootvar]]"
+   "   [-aAnB -b bootnum] [-N] [-t timeout] [-T] [-o bootorder] [-O] 
[--verbose] [--help]\n\
+  [-c -l loader [-k kernel] [-L label] [--dry-run] [-b bootnum]]"
 
 #define CREATE_USAGE \
-   "   efibootmgr -c -l loader [-k kernel] [-L label] [--dry-run]"
+   "   efibootmgr -c -l loader [-k kernel] [-L label] [--dry-run] [-b 
bootnum] [-a]"
 #define ORDER_USAGE \
"   efibootmgr -o bootvarnum1,bootvarnum2,..."
 #define TIMEOUT_USAGE \
"   efibootmgr -t seconds"
 #define DELETE_USAGE \
-   "   efibootmgr -B bootvarnum"
+   "   efibootmgr -B -b bootnum"
 #define ACTIVE_USAGE \
-   "   efibootmgr [-a | -A] bootvarnum"
+   "   efibootmgr [-a | -A] -b bootnum"
 #define BOOTNEXT_USAGE \
-   "   efibootmgr [-n | -N] bootvarnum"
+   "   efibootmgr [-n | -N] -b bootnum"
 
 static void
 parse_args(int argc, char *argv[])
 {
int ch;
 
-   while ((ch = getopt_long(argc, argv, "A:a:B:b:C:cDe:hk:L:l:Nn:Oo:Tt:v",
+   while ((ch = getopt_long(argc, argv, "AaBb:C:cDe:hk:L:l:NnOo:Tt:v",
lopts, NULL)) != -1) {
switch (ch) {
case 'A':
opts.set_inactive = true;
-   opts.bootnum = strtoul(optarg, NULL, 16);
break;
case 'a':
opts.set_active = true;
-   opts.bootnum = strtoul(optarg, NULL, 16);
break;
case 'b':
opts.has_bootnum = true;
@@ -209,7 +207,6 @@ parse_args(int argc, char *argv[])
break;
case 'B':
opts.delete = true;
-   opts.bootnum = strtoul(optarg, NULL, 16);
break;
case 'C':
opts.copy = true;
@@ -246,7 +243,6 @@ parse_args(int argc, char *argv[])
break;
case 'n':
opts.set_bootnext = true;
-   opts.bootnum = strtoul(optarg, NULL, 16);
break;
case 'O':
opts.once = true;
@@ -275,6 +271,15 @@ parse_args(int argc, char *argv[])
 
if (opts.order && !(opts.order))
errx(1, "%s", ORDER_USAGE);
+
+   if ((opts.set_inactive || opts.set_active) && !opts.has_bootnum)
+   errx(1, "%s", ACTIVE_USAGE);
+
+   if (opts.delete && !opts.has_bootnum)
+   

svn commit: r342636 - head

2018-12-30 Thread Rebecca Cran
Author: bcran
Date: Mon Dec 31 00:15:05 2018
New Revision: 342636
URL: https://svnweb.freebsd.org/changeset/base/342636

Log:
  Add UPDATING entry for r342635.
  
  Sponsored by: Netflix

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Mon Dec 31 00:09:45 2018(r342635)
+++ head/UPDATING   Mon Dec 31 00:15:05 2018(r342636)
@@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20181230:
+   r342635 changes the way efibootmgr(8) works by requiring users to add
+   the -b (bootnum) parameter for commands where the bootnum was previously
+   specified with each option. For example 'efibootmgr -B 0001' is now
+   'efibootmgr -B -b 0001'.
+
 20181220:
r342286 modifies the NFSv4 server so that it obeys vfs.nfsd.nfs_privport
in the same as it is applied to NFSv2 and 3.  This implies that NFSv4
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342638 - head/usr.sbin/bsdinstall/scripts

2018-12-30 Thread Rebecca Cran
Author: bcran
Date: Mon Dec 31 00:26:35 2018
New Revision: 342638
URL: https://svnweb.freebsd.org/changeset/base/342638

Log:
  Use the --activate efibootmgr(8) flag when creating entries in bootconfig
  
  Sponsored by: Netflix

Modified:
  head/usr.sbin/bsdinstall/scripts/bootconfig

Modified: head/usr.sbin/bsdinstall/scripts/bootconfig
==
--- head/usr.sbin/bsdinstall/scripts/bootconfig Mon Dec 31 00:20:58 2018
(r342637)
+++ head/usr.sbin/bsdinstall/scripts/bootconfig Mon Dec 31 00:26:35 2018
(r342638)
@@ -143,18 +143,12 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" 
fi
 
echo "Creating UEFI boot entry"
-   efibootmgr --create --label "$bootlabel" --loader 
"${mntpt}/EFI/freebsd/loader.efi" > /dev/null
+   efibootmgr --create --activate --label "$bootlabel" --loader 
"${mntpt}/EFI/freebsd/loader.efi" > /dev/null
 
echo "Unmounting ESP"
umount "${mntpt}"
rmdir "${mntpt}"
 
-   # When creating new entries, efibootmgr doesn't mark them 
active, so we need to
-   # do so. It doesn't make it easy to find which entry it just 
added, so rely on
-   # the fact that it places the new entry first in BootOrder.
-   bootorder=$(efivar --name 
8be4df61-93ca-11d2-aa0d-00e098032b8c-BootOrder --print --no-name --hex | head 
-1)
-   bootentry=$(echo "$bootorder" | cut -w -f 3)$(echo "$bootorder" 
| cut -w -f 2)
-   efibootmgr --activate "$bootentry" > /dev/null
echo "Finished configuring /dev/${esp} as ESP"
done
 fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342637 - head/usr.sbin/bsdinstall/scripts

2018-12-30 Thread Rebecca Cran
Author: bcran
Date: Mon Dec 31 00:20:58 2018
New Revision: 342637
URL: https://svnweb.freebsd.org/changeset/base/342637

Log:
  Fix ESP generation when using a gmirror, and when booting from RO medium
  
  When using a gmirror, entries in /dev can be removed. So instead of using
  kern.disks, get the list of disks from "gpart status -sg" instead.
  
  We assume that any 'efi' partition that can't be mounted as msdosfs should
  be used as an ESP. However, the ESP on the CD/DVD can't be mounted read-write
  and so was being treated as if unformatted. Try the mount as read-only
  instead, to catch cases like this.
  
  Relnotes: yes
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D18645

Modified:
  head/usr.sbin/bsdinstall/scripts/bootconfig

Modified: head/usr.sbin/bsdinstall/scripts/bootconfig
==
--- head/usr.sbin/bsdinstall/scripts/bootconfig Mon Dec 31 00:15:05 2018
(r342636)
+++ head/usr.sbin/bsdinstall/scripts/bootconfig Mon Dec 31 00:20:58 2018
(r342637)
@@ -84,10 +84,11 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" 
# The installer hasn't given us any ESPs to use.
# Try and figure out which to use by looking for an
# unformatted efi partition
-   for disk in $(sysctl -n kern.disks); do
-   hasfreebsd=$(gpart show "$disk" | cut -w -f 4,5 | grep 
"freebsd")
+
+   for geom in $(gpart status -sg | awk '{print $1}'); do
+   hasfreebsd=$(gpart show "${geom}" | cut -w -f 4,5 | 
grep "freebsd")
if [ -n "$hasfreebsd" ]; then
-   index=$(gpart show "$disk" | cut -w -f 4,5 | 
grep "efi" | cut -w -f 1)
+   index=$(gpart show "${geom}" | cut -w -f 4,5 | 
grep "efi" | cut -w -f 1)
# Check that $index is a valid integer
[ -n "$index" ] && [ "$index" -eq "$index" ] && 
[ "$index" -ge 0 ] 2> /dev/null 
if [ $? -ne 0 ]; then
@@ -95,17 +96,17 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" 
fi
 
mntpt=$(mktemp -d /tmp/stand-test.XX)
-   if [ -e "/dev/${disk}p${index}" ]; then
-   dev=${disk}p${index}
-   elif [ -e "/dev/${disk}s${index}" ]; then
-   dev=/${disk}s${index}
+   if [ -e "/dev/${geom}p${index}" ]; then
+   dev=${geom}p${index}
+   elif [ -e "/dev/${geom}s${index}" ]; then
+   dev=/${geom}s${index}
else
continue
fi
 
# Try and mount it. If it fails, assume it's
# unformatted and should be used.
-   mount -t msdosfs "/dev/${dev}" "${mntpt}"
+   mount -t msdosfs -o ro "/dev/${dev}" "${mntpt}"
if [ $? -ne 0 ]; then
ESPS="$ESPS ${dev}"
num_esps=$((num_esps + 1))
@@ -118,17 +119,20 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" 
fi
 
for esp in $ESPS; do
+   echo "Formatting /dev/${esp} as FAT32"
newfs_msdos -F 32 -c 1 -L EFISYS "/dev/$esp" > /dev/null 2>&1
if [ $? -ne 0 ]; then
die "Failed to format ESP $esp as FAT32"
fi
 
mntpt=$(mktemp -d /tmp/stand-test.XX)
+   echo "Mounting ESP /dev/${esp}"
mount -t msdosfs "/dev/${esp}" "${mntpt}"
if [ $? -ne 0 ]; then
die "Failed to mount ESP ${dev} on ${mntpt}"
fi
 
+   echo "Installing loader.efi onto ESP"
mkdir -p "$mntpt/EFI/freebsd"
cp "$BSDINSTALL_CHROOT/boot/loader.efi" 
"${mntpt}/EFI/freebsd/loader.efi"
 
@@ -138,8 +142,10 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" 
bootlabel="FreeBSD"
fi
 
+   echo "Creating UEFI boot entry"
efibootmgr --create --label "$bootlabel" --loader 
"${mntpt}/EFI/freebsd/loader.efi" > /dev/null
 
+   echo "Unmounting ESP"
umount "${mntpt}"
rmdir "${mntpt}"
 
@@ -149,6 +155,7 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" 
bootorder=$(efivar --name 
8be4df61-93ca-11d2-aa0d-00e098032b8c-BootOrder --print --no-name --hex | head 
-1)

svn commit: r342579 - head/usr.sbin/efibootmgr

2018-12-28 Thread Rebecca Cran
Author: bcran
Date: Fri Dec 28 21:26:45 2018
New Revision: 342579
URL: https://svnweb.freebsd.org/changeset/base/342579

Log:
  Improve the efibootmgr(8) man page
  
  Fix formatting, typos, and attempt to improve the wording.
  
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D18646

Modified:
  head/usr.sbin/efibootmgr/efibootmgr.8

Modified: head/usr.sbin/efibootmgr/efibootmgr.8
==
--- head/usr.sbin/efibootmgr/efibootmgr.8   Fri Dec 28 19:49:58 2018
(r342578)
+++ head/usr.sbin/efibootmgr/efibootmgr.8   Fri Dec 28 21:26:45 2018
(r342579)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2017 Netflix, Inc
+.\" Copyright (c) 2017-2018 Netflix, Inc
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,19 +24,19 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 8, 2018
+.Dd December 28, 2018
 .Dt EFIBOOTMGR 8
 .Os
 .Sh NAME
 .Nm efibootmgr 
 .Nd manipulate the EFI Boot Manager
 .Sh SYNOPSIS
-.Op Fl aAnNB Ar Bootvar
+.Op Fl aAnNB Ar bootnum
 .Op Fl t Ar timeout
 .Op Fl T
 .Op Fl o Ar bootorder
-.Op Fl verbose
-.Op Fl c -k Ar kernel -l Ar loader [-L Ar label] [--dry-run] [-b Bootvar]
+.Op Fl v
+.Op Fl c l Ar loader [ Fl k Ar kernel ] [ Fl L Ar label ] [ Fl -dry-run ] [ Fl 
b Ar bootnum ]
 .Sh "DESCRIPTION"
 .Nm
 manipulates how UEFI Boot Managers boot the system.
@@ -59,7 +59,7 @@ The currently booting method is communicated using 
 A global timeout can also be set.
 .Pp
 .Nm
-requires that the kernel efirt module to get and set these
+requires that the kernel efirt module be loaded to get and set these
 non-volatile variables.
 .Pp
 The following options are available:
@@ -70,45 +70,45 @@ Create a new Boot Variable
 The path to and name of the loader.
 .It Fl k -kernel Ar kernel
 The path to and name of the kernel.
-.It Fl b Bootvar
-When creating an entry, use Bootvar as the index.
+.It Fl b -bootnum Ar bootnum
+When creating a new entry, use bootnum as the index.
 Fail if it already exists.
 .It Fl L -label Ar label
 An optional description for the entry.
 .It Fl D -dry-run
-Process but do not set the given BootVar.
-.It Fl B -delete Ar BootVarNum
-Delete the given BootVar Num.
-.It Fl a -activate Ar BootVarNum
-Activate the given BootVarNum.
-.It Fl A -deactivate Ar BootVarNum
-Deactivate the given BootVarNum.
-.It Fl n -bootnext  Ar BootVarNum
-Set BootVarNum as the BootNext variable.
+Process but do not change any variables.
+.It Fl B -delete Ar bootnum
+Delete the given bootnum boot entry.
+.It Fl a -activate Ar bootnum
+Activate the given bootnum boot entry.
+.It Fl A -deactivate Ar bootnum
+Deactivate the given bootnum boot entry.
+.It Fl n -bootnext Ar bootnum
+Set bootnum boot entry as the BootNext variable.
 .It Fl N -delete-bootnext 
-Delete the BootNext optional BootVar.
+Delete the BootNext optional variable.
 .It Fl o -bootorder Ar bootorder
-Set BootOrder variable to the given comma delimited set of BootVarNums.
+Set BootOrder variable to the given comma delimited set of bootnums.
 The numbers are in hex to match Boot, but may omit leading zeros.
 .It Fl t -set-timeout Ar timeout
 Set the bootmenu timeout value.
 .It Fl T -del-timeout
 Delete the BootTimeout variable.
 .It Fl v -verbose
-Display the device path of BootVars in the output.
+Display the device path of boot entries in the output.
 .El
 .Pp
-.Sh Exammples
+.Sh Examples
 .Pp
 To Display the current Boot related variables in the system:
 .Pp
 .Dl efibootmgr [-v]
 .Pp
-This will display the optional BootNext BootVar, BootCurrent,
-or currently booted BootVar, followed by the optional Timeout value, any
-BootOrder that maybe set, followed finally by all currently defined Boot
+This will display the optional BootNext bootnum, BootCurrent,
+or currently booted bootnum, followed by the optional Timeout value, any
+BootOrder that may be set, followed finally by all currently defined Boot
 variables, active or not. The verbose flag will augment this output with
-the hardrive partition uuids, size/offset and device-path of the
+the disk partition uuids, size/offset and device-path of the
 variable.
 .Pp
 The
@@ -117,28 +117,28 @@ program can be used to create new EFI boot variables. 
 boot var pointing to an installation with its EFI partition mounted
 under /mnt, the given loader and a label "FreeBSD-11":
 .Pp
-.Dl efibootmgr -c -l /mnt/EFI/BOOT/BOOTX64.EFI -L FreeBSD-11
+.Dl efibootmgr -c -l /mnt/EFI/freebsd/loader.efi -L FreeBSD-11
 .Pp
-This will result in the next available BootVarNum being assigned to a
-new UEFI load variable, and given the label "FreeBSD-11" such as:
+This will result in the next available bootnum being assigned to a
+new UEFI boot variable, and given the label "FreeBSD-11" such as:
 .Pp
 .Dl Boot0009 FreeBSD-11
 .Pp
-Note newly created BootVars are created inactive. The active state is denoted
-by an '*' following the BootVar name in the output.  

svn commit: r342396 - head/usr.sbin/efibootmgr

2018-12-24 Thread Rebecca Cran
Author: bcran
Date: Mon Dec 24 15:38:36 2018
New Revision: 342396
URL: https://svnweb.freebsd.org/changeset/base/342396

Log:
  Activate support for efibootmgr(8) -b --bootnum parameter
  
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D18647

Modified:
  head/usr.sbin/efibootmgr/efibootmgr.c

Modified: head/usr.sbin/efibootmgr/efibootmgr.c
==
--- head/usr.sbin/efibootmgr/efibootmgr.c   Mon Dec 24 15:08:19 2018
(r342395)
+++ head/usr.sbin/efibootmgr/efibootmgr.c   Mon Dec 24 15:38:36 2018
(r342396)
@@ -96,6 +96,7 @@ typedef struct _bmgr_opts {
 static struct option lopts[] = {
{"activate", required_argument, NULL, 'a'},
{"bootnext", required_argument, NULL, 'n'}, /* set bootnext */
+   {"bootnum", required_argument, NULL, 'b'},
{"bootorder", required_argument, NULL, 'o'}, /* set order */
{"copy", required_argument, NULL, 'C'}, /* Copy boot method */
{"create", no_argument, NULL, 'c'},
@@ -191,7 +192,7 @@ parse_args(int argc, char *argv[])
 {
int ch;
 
-   while ((ch = getopt_long(argc, argv, "A:a:B:C:cDe:hk:L:l:Nn:Oo:Tt:v",
+   while ((ch = getopt_long(argc, argv, "A:a:B:b:C:cDe:hk:L:l:Nn:Oo:Tt:v",
lopts, NULL)) != -1) {
switch (ch) {
case 'A':
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r342283 - in head: release/amd64 release/arm64 release/i386 release/tools share/man/man8 tools/boot tools/tools/nanobsd/embedded usr.sbin/bsdinstall/partedit usr.sbin/bsdinstall/script

2018-12-20 Thread Rebecca Cran via svn-src-all
On December 20, 2018 at 12:51:36 PM, Shawn Webb (shawn.w...@hardenedbsd.org) 
wrote:

Are there any other bits of the build process that touch files outside 
of ${MAKEOBJDIRPREFIX}? 


Grepping for “/tmp” shows lots of other scripts that use /tmp .



— 

Rebecca

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342283 - in head: release/amd64 release/arm64 release/i386 release/tools share/man/man8 tools/boot tools/tools/nanobsd/embedded usr.sbin/bsdinstall/partedit usr.sbin/bsdinstall/scripts

2018-12-20 Thread Rebecca Cran
t.sh which will install
 # the appropriate boot files in the appropriate locations.
 #
 # These images assume ada0 will be the root image. We should likely
 # use labels, but we don't.
 #
-# ASsumes you've already rebuilt... maybe bad? Also maybe bad: the env
+# Assumes you've already rebuilt... maybe bad? Also maybe bad: the env
 # vars should likely be conditionally set to allow better automation.
 #
 
@@ -34,29 +35,6 @@ cpsys() {
 (cd $src ; tar cf - .) | (cd $dst; tar xf -)
 }
 
-make_esp()
-{
-local src dst md mntpt
-src=$1
-dst=$2
-
-if [ "${do_boot1_efi}" -eq 1 ]; then
-   cp ${src}/boot/boot1.efifat ${dst}
-else
-   dd if=/dev/zero of=${dst} count=1 seek=$((100 * 1024 * 1024 / 512))
-   md=$(mdconfig -f ${dst})
-   newfs_msdos -a 32 /dev/${md}
-   mntpt=$(mktemp -d /tmp/stand-test.XX)
-   mount -t msdos /dev/${md} ${mntpt}
-#  mkdir -p ${mntpt}/efi/freebsd # not yet
-   mkdir -p ${mntpt}/efi/boot
-   cp ${src}/boot/loader.efi ${mntpt}/efi/boot/bootx64.efi
-   umount ${mntpt}
-   rmdir ${mntpt}
-   mdconfig -d -u ${md}
-fi
-}
-
 mk_nogeli_gpt_ufs_legacy() {
 src=$1
 img=$2
@@ -78,7 +56,7 @@ mk_nogeli_gpt_ufs_uefi() {
 cat > ${src}/etc/fstab < ${src}/etc/fstab < ${src}/etc/fstab < ${src}/etc/fstab <
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -192,7 +193,9 @@ newfs_command(const char *fstype, char *command, int u
for (i = 0; i < (int)nitems(items); i++) {
if (items[i].state == 0)
continue;
-   if (strcmp(items[i].name, "FAT16") == 0)
+   if (strcmp(items[i].name, "FAT32") == 0)
+   strcat(command, "-F 32 -c 1");
+   else if (strcmp(items[i].name, "FAT16") == 0)
strcat(command, "-F 16 ");
else if (strcmp(items[i].name, "FAT12") == 0)
strcat(command, "-F 12 ");
@@ -400,7 +403,7 @@ gpart_bootcode(struct ggeom *gp)
TRUE);
return;
}
-   
+
bootsize = lseek(bootfd, 0, SEEK_END);
boot = malloc(bootsize);
lseek(bootfd, 0, SEEK_SET);
@@ -706,8 +709,17 @@ set_default_part_metadata(const char *name, const char
if (strcmp(type, "freebsd-swap") == 0)
mountpoint = "none";
if (strcmp(type, bootpart_type(scheme, _bootmount)) == 0) {
-   if (default_bootmount == NULL)
+   if (default_bootmount == NULL) {
+
+   int fd = open("/tmp/bsdinstall-esps", O_CREAT | 
O_WRONLY | O_APPEND,
+ 0600);
+   if (fd > 0) {
+   write(fd, md->name, strlen(md->name));
+   close(fd);
+   }
+
md->bootcode = 1;
+   }
else if (mountpoint == NULL || strlen(mountpoint) == 0)
mountpoint = default_bootmount;
}

Modified: head/usr.sbin/bsdinstall/partedit/partedit_arm64.c
==
--- head/usr.sbin/bsdinstall/partedit/partedit_arm64.c  Thu Dec 20 19:27:46 
2018(r342282)
+++ head/usr.sbin/bsdinstall/partedit/partedit_arm64.c  Thu Dec 20 19:39:37 
2018(r342283)
@@ -35,8 +35,7 @@
 #include "partedit.h"
 
 /* EFI partition size in bytes */
-#defineEFI_BOOTPART_SIZE   (200 * 1024 * 1024)
-#defineEFI_BOOTPART_PATH   "/boot/boot1.efifat"
+#defineEFI_BOOTPART_SIZE   (260 * 1024 * 1024)
 
 const char *
 default_scheme(void)
@@ -95,10 +94,7 @@ const char *
 partcode_path(const char *part_type, const char *fs_type)
 {
 
-   if (strcmp(part_type, "GPT") == 0)
-   return (EFI_BOOTPART_PATH);
-
-   /* No boot partition data for non-GPT */
+   /* No boot partition data for ARM64 */
return (NULL);
 }
 

Modified: head/usr.sbin/bsdinstall/partedit/partedit_x86.c
==
--- head/usr.sbin/bsdinstall/partedit/partedit_x86.cThu Dec 20 19:27:46 
2018(r342282)
+++ head/usr.sbin/bsdinstall/partedit/partedit_x86.cThu Dec 20 19:39:37 
2018(r342283)
@@ -35,8 +35,7 @@
 #include "partedit.h"
 
 /* EFI partition size in bytes */
-#defineEFI_BOOTPART_SIZE   (200 * 1024 * 1024)
-#defineEFI_BOOTPART_PATH   "/boot/boot1.efifat"
+#defineEFI_BOOTPART_SIZE   (260 * 1024 * 1024)
 
 static const char *
 x86_bootmethod(void)
@@ -141,16 +140,14 @@ const char *
 partcode_path(const char *part_type, const char *fs_typ

svn commit: r342282 - head/stand/libsa

2018-12-20 Thread Rebecca Cran
Author: bcran
Date: Thu Dec 20 19:27:46 2018
New Revision: 342282
URL: https://svnweb.freebsd.org/changeset/base/342282

Log:
  Wait a maximum of 300 seconds for network send/recv in libsa
  
  The reason for this change is that currently, a send/recv
  takes many hours to time out.
  This is suboptimal in the bootloader because it means for example
  that NFS will take hours to fail before allowing subsequent access
  methods such as gzip to be tried.
  
  Setting MAXWAIT to 300 seconds (5 minutes) still allows slow
  connections of 1Mb to be used to download a 30MB kernel file.
  
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D18544

Modified:
  head/stand/libsa/net.c

Modified: head/stand/libsa/net.c
==
--- head/stand/libsa/net.c  Thu Dec 20 18:28:53 2018(r342281)
+++ head/stand/libsa/net.c  Thu Dec 20 19:27:46 2018(r342282)
@@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$");
  * timeout is hit.
  */
 #ifndef MAXWAIT
-#define MAXWAIT 0  /* seconds */
+#define MAXWAIT 300/* seconds */
 #endif
 
 #if MAXWAIT < 0
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342055 - head/stand/efi/loader

2018-12-13 Thread Rebecca Cran
Author: bcran
Date: Thu Dec 13 23:49:20 2018
New Revision: 342055
URL: https://svnweb.freebsd.org/changeset/base/342055

Log:
  Cast error message in efi_main.c to CHAR16* to avoid build error

Modified:
  head/stand/efi/loader/efi_main.c

Modified: head/stand/efi/loader/efi_main.c
==
--- head/stand/efi/loader/efi_main.cThu Dec 13 23:20:58 2018
(r342054)
+++ head/stand/efi/loader/efi_main.cThu Dec 13 23:49:20 2018
(r342055)
@@ -95,7 +95,7 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *sy
status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData,
EFI_SIZE_TO_PAGES(heapsize), );
if (status != EFI_SUCCESS) {
-   ST->ConOut->OutputString(ST->ConOut, L"Failed to allocate 
memory for heap.\r\n");
+   ST->ConOut->OutputString(ST->ConOut, (CHAR16 *)L"Failed to 
allocate memory for heap.\r\n");
BS->Exit(IH, status, 0, NULL);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342054 - head/stand/efi/loader

2018-12-13 Thread Rebecca Cran
Author: bcran
Date: Thu Dec 13 23:20:58 2018
New Revision: 342054
URL: https://svnweb.freebsd.org/changeset/base/342054

Log:
  Print an error message in efi_main.c if we can't allocate memory for the heap
  
  With the default Qemu parameters, only 128MB RAM gets given to a VM. This 
causes
  the loader to be unable to allocate the 64MB it needs for the heap. This 
change
  makes the cause of the error more obvious.
  
  Differential Revision:https://reviews.freebsd.org/D17958

Modified:
  head/stand/efi/loader/efi_main.c

Modified: head/stand/efi/loader/efi_main.c
==
--- head/stand/efi/loader/efi_main.cThu Dec 13 20:09:38 2018
(r342053)
+++ head/stand/efi/loader/efi_main.cThu Dec 13 23:20:58 2018
(r342054)
@@ -94,8 +94,10 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *sy
heapsize = 64 * 1024 * 1024;
status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData,
EFI_SIZE_TO_PAGES(heapsize), );
-   if (status != EFI_SUCCESS)
+   if (status != EFI_SUCCESS) {
+   ST->ConOut->OutputString(ST->ConOut, L"Failed to allocate 
memory for heap.\r\n");
BS->Exit(IH, status, 0, NULL);
+   }
 
setheap((void *)(uintptr_t)heap, (void *)(uintptr_t)(heap + heapsize));
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339796 - head/stand/efi/libefi

2018-10-26 Thread Rebecca Cran
Author: bcran
Date: Fri Oct 26 21:57:22 2018
New Revision: 339796
URL: https://svnweb.freebsd.org/changeset/base/339796

Log:
  Simplify the EFI delay() function by calling BS->Stall()
  
  Differential Revision: https://reviews.freebsd.org/D16753

Modified:
  head/stand/efi/libefi/delay.c

Modified: head/stand/efi/libefi/delay.c
==
--- head/stand/efi/libefi/delay.c   Fri Oct 26 21:20:04 2018
(r339795)
+++ head/stand/efi/libefi/delay.c   Fri Oct 26 21:57:22 2018
(r339796)
@@ -33,15 +33,5 @@ __FBSDID("$FreeBSD$");
 void
 delay(int usecs)
 {
-   static EFI_EVENT ev = 0;
-   UINTN junk;
-
-   if (!ev) {
-   if (BS->CreateEvent(EVT_TIMER, TPL_APPLICATION, 0, 0, )
-   != EFI_SUCCESS)
-   return;
-   }
-
-   BS->SetTimer(ev, TimerRelative, usecs * 10);
-   BS->WaitForEvent(1, , );
+   BS->Stall(usecs);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334198 - in head: share/man/man5 tools/build/options

2018-05-24 Thread Rebecca Cran
Author: bcran
Date: Fri May 25 01:38:59 2018
New Revision: 334198
URL: https://svnweb.freebsd.org/changeset/base/334198

Log:
  Remove extra space before parenthesis in src.conf(5)
  
  Reviewed by:  eadler
  Differential Revision:https://reviews.freebsd.org/D15528

Modified:
  head/share/man/man5/src.conf.5
  head/tools/build/options/WITHOUT_BINUTILS

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Fri May 25 01:27:39 2018
(r334197)
+++ head/share/man/man5/src.conf.5  Fri May 25 01:38:59 2018
(r334198)
@@ -1,7 +1,7 @@
 .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman.
 .\" $FreeBSD$
 .\" @generated
-.Dd May 23, 2018
+.Dd May 24, 2018
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -145,7 +145,7 @@ associated utilities, and examples.
 .Pp
 This option only affects amd64/amd64.
 .It Va WITHOUT_BINUTILS
-Set to not build or install binutils (as, ld, objcopy, and objdump ) as part
+Set to not build or install binutils (as, ld, objcopy, and objdump) as part
 of the normal system build.
 The resulting system cannot build programs from source.
 .Pp

Modified: head/tools/build/options/WITHOUT_BINUTILS
==
--- head/tools/build/options/WITHOUT_BINUTILS   Fri May 25 01:27:39 2018
(r334197)
+++ head/tools/build/options/WITHOUT_BINUTILS   Fri May 25 01:38:59 2018
(r334198)
@@ -1,4 +1,4 @@
 .\" $FreeBSD$
-Set to not build or install binutils (as, ld, objcopy, and objdump ) as part
+Set to not build or install binutils (as, ld, objcopy, and objdump) as part
 of the normal system build.
 The resulting system cannot build programs from source.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r333097 - head/share/misc

2018-04-29 Thread Rebecca Cran
Author: bcran
Date: Mon Apr 30 04:02:48 2018
New Revision: 333097
URL: https://svnweb.freebsd.org/changeset/base/333097

Log:
  Add back the historical information about being mentored by rrs
  
  Reviewed by:  imp, eadler
  Differential Revision:https://reviews.freebsd.org/D15230

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Mon Apr 30 02:18:19 2018
(r333096)
+++ head/share/misc/committers-src.dot  Mon Apr 30 04:02:48 2018
(r333097)
@@ -753,6 +753,7 @@ rpaulo -> jmmv
 rpaulo -> lidl
 rpaulo -> ngie
 
+rrs -> bcran
 rrs -> jchandra
 rrs -> tuexen
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332874 - head/share/misc

2018-04-22 Thread Rebecca Cran
Author: bcran
Date: Sun Apr 22 21:27:59 2018
New Revision: 332874
URL: https://svnweb.freebsd.org/changeset/base/332874

Log:
  Update committers-src.dot to show the mentorship arrangement for myself: 
eadler has agreed to mentor me.

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Sun Apr 22 20:47:16 2018
(r332873)
+++ head/share/misc/committers-src.dot  Sun Apr 22 21:27:59 2018
(r332874)
@@ -476,6 +476,8 @@ dwmalone -> fanf
 dwmalone -> peadar
 dwmalone -> snb
 
+eadler -> bcran
+
 ed -> dim
 ed -> gavin
 ed -> jilles
@@ -751,7 +753,6 @@ rpaulo -> jmmv
 rpaulo -> lidl
 rpaulo -> ngie
 
-rrs -> bcran
 rrs -> jchandra
 rrs -> tuexen
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332873 - in head: share/misc usr.bin/calendar/calendars

2018-04-22 Thread Rebecca Cran
Author: bcran
Date: Sun Apr 22 20:47:16 2018
New Revision: 332873
URL: https://svnweb.freebsd.org/changeset/base/332873

Log:
  Update account and given names in committers-src.dot and calendar.freebsd
  
  I have changed my given name from Bruce to Rebecca, and my FreeBSD account
  from brucec to bcran.
  Update committers-src.dot and calendar.freebsd to show these changes.
  
  Reviewed by:  rrs
  Differential Revision: https://reviews.freebsd.org/D15125

Modified:
  head/share/misc/committers-src.dot
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Sun Apr 22 17:56:39 2018
(r332872)
+++ head/share/misc/committers-src.dot  Sun Apr 22 20:47:16 2018
(r332873)
@@ -122,6 +122,7 @@ avg [label="Andriy Gapon\n...@freebsd.org\n2009/02/18"
 avos [label="Andriy Voskoboinyk\na...@freebsd.org\n2015/09/24"]
 badger [label="Eric Badger\nbad...@freebsd.org\n2016/07/01"]
 bapt [label="Baptiste Daroussin\nb...@freebsd.org\n2011/12/23"]
+bcran [label="Rebecca Cran\nbc...@freebsd.org\n2010/01/29"]
 bde [label="Bruce Evans\n...@freebsd.org\n1994/08/20"]
 bdrewery [label="Bryan Drewery\nbdrew...@freebsd.org\n2013/12/14"]
 benl [label="Ben Laurie\nb...@freebsd.org\n2011/05/18"]
@@ -130,7 +131,6 @@ bms [label="Bruce M Simpson\n...@freebsd.org\n2003/08/
 br [label="Ruslan Bukin\n...@freebsd.org\n2013/09/02"]
 brian [label="Brian Somers\nbr...@freebsd.org\n1996/12/16"]
 brooks [label="Brooks Davis\nbro...@freebsd.org\n2001/06/21"]
-brucec [label="Bruce Cran\nbru...@freebsd.org\n2010/01/29"]
 brueffer [label="Christian Brueffer\nbruef...@freebsd.org\n2006/02/28"]
 bruno [label="Bruno Ducrot\nbr...@freebsd.org\n2005/07/18"]
 bryanv [label="Bryan Venteicher\nbry...@freebsd.org\n2012/11/03"]
@@ -751,7 +751,7 @@ rpaulo -> jmmv
 rpaulo -> lidl
 rpaulo -> ngie
 
-rrs -> brucec
+rrs -> bcran
 rrs -> jchandra
 rrs -> tuexen
 

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdSun Apr 22 17:56:39 
2018(r332872)
+++ head/usr.bin/calendar/calendars/calendar.freebsdSun Apr 22 20:47:16 
2018(r332873)
@@ -185,7 +185,7 @@
 05/13  Pete Fritchman <pe...@freebsd.org> born in Lansdale, Pennsylvania, 
United States, 1983
 05/14  Tatsumi Hosokawa <hosok...@freebsd.org> born in Tokyo, Japan, 1968
 05/14  Shigeyuku Fukushima <sh...@freebsd.org> born in Osaka, Japan, 1974
-05/14  Bruce Cran <bru...@freebsd.org> born in Cambridge, United Kingdom, 1981
+05/14  Rebecca Cran <bc...@freebsd.org> born in Cambridge, United Kingdom, 1981
 05/15  Hans Petter Selasky <hsela...@freebsd.org> born in Flekkefjord, Norway, 
1982
 05/16  Johann Kois <jk...@freebsd.org> born in Wolfsberg, Austria, 1975
 05/16  Marcus Alves Grando <m...@freebsd.org> born in Florianopolis, Santa 
Catarina, Brazil, 1979
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"