Merge branch 'efi-2022-01' of https://source.denx.de/u-boot/custodians/u-boot-efi

Scripts:
* Update spelling.txt

LMB:
* remove extern keyword in lmb.h
* drop unused lmb_size_bytes()

Test:
* test truncation in snprintf()

Documentation:
* add include/lmb.h to HTML documentation

UEFI:
* reduce non-debug logging output for measured boot
* fix use after free in measured boot
* startup the tpm device when installing the protocol
* implement EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES
* record capsule result only if capsule is read
diff --git a/doc/api/index.rst b/doc/api/index.rst
index 281d1dc..806c738 100644
--- a/doc/api/index.rst
+++ b/doc/api/index.rst
@@ -10,6 +10,7 @@
    efi
    getopt
    linker_lists
+   lmb
    logging
    pinctrl
    rng
diff --git a/doc/api/lmb.rst b/doc/api/lmb.rst
new file mode 100644
index 0000000..2095bfa
--- /dev/null
+++ b/doc/api/lmb.rst
@@ -0,0 +1,7 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Logical memory blocks
+=====================
+
+.. kernel-doc:: include/lmb.h
+   :internal:
diff --git a/doc/develop/trace.rst b/doc/develop/trace.rst
index 7776c48..09f5745 100644
--- a/doc/develop/trace.rst
+++ b/doc/develop/trace.rst
@@ -4,7 +4,7 @@
 Tracing in U-Boot
 =================
 
-U-Boot supports a simple tracing feature which allows a record of excecution
+U-Boot supports a simple tracing feature which allows a record of execution
 to be collected and sent to a host machine for analysis. At present the
 main use for this is to profile boot time.
 
@@ -161,10 +161,10 @@
 no more data will be collected.
 
 Collecting trace data has an affect on execution time/performance. You
-will notice this particularly with trvial functions - the overhead of
+will notice this particularly with trivial functions - the overhead of
 recording their execution may even exceed their normal execution time.
 In practice this doesn't matter much so long as you are aware of the
-effect. Once you have done your optimisations, turn off tracing before
+effect. Once you have done your optimizations, turn off tracing before
 doing end-to-end timing.
 
 The best time to start tracing is right at the beginning of U-Boot. The
@@ -184,7 +184,7 @@
 variable at this point. This variable should have a short script which
 collects the trace data and writes it somewhere.
 
-Trace data collection relies on a microsecond timer, accesed through
+Trace data collection relies on a microsecond timer, accessed through
 timer_get_us(). So the first think you should do is make sure that
 this produces sensible results for your board. Suitable sources for
 this timer include high resolution timers, PWMs or profile timers if
@@ -285,7 +285,7 @@
     Specify U-Boot map file
 
 -p <trace_file>
-    Specifiy profile/trace file
+    Specify profile/trace file
 
 Commands:
 
@@ -315,11 +315,11 @@
 2. Build U-Boot with tracing and run it. Note the difference in boot time
    (it is common for tracing to add 10% to the time)
 
-3. Collect the trace information as descibed above. Use this to find where
+3. Collect the trace information as described above. Use this to find where
    all the time is being spent.
 
-4. Take a look at that code and see if you can optimise it. Perhaps it is
-   possible to speed up the initialisation of a device, or remove an unused
+4. Take a look at that code and see if you can optimize it. Perhaps it is
+   possible to speed up the initialization of a device, or remove an unused
    feature.
 
 5. Rebuild, run and collect again. Compare your results.
diff --git a/include/efi_api.h b/include/efi_api.h
index 0accad0..80109f0 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -20,8 +20,8 @@
 #include <charset.h>
 #include <pe.h>
 
-/* UEFI spec version 2.8 */
-#define EFI_SPECIFICATION_VERSION (2 << 16 | 80)
+/* UEFI spec version 2.9 */
+#define EFI_SPECIFICATION_VERSION (2 << 16 | 90)
 
 /* Types and defines for EFI CreateEvent */
 enum efi_timer_delay {
@@ -360,10 +360,15 @@
 };
 
 /* EFI event group GUID definitions */
+
 #define EFI_EVENT_GROUP_EXIT_BOOT_SERVICES \
 	EFI_GUID(0x27abf055, 0xb1b8, 0x4c26, 0x80, 0x48, \
 		 0x74, 0x8f, 0x37, 0xba, 0xa2, 0xdf)
 
+#define EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES \
+	EFI_GUID(0x8be0e274, 0x3970, 0x4b44, 0x80, 0xc5, \
+		 0x1a, 0xb9, 0x50, 0x2f, 0x3b, 0xfc)
+
 #define EFI_EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE \
 	EFI_GUID(0x13fa7698, 0xc831, 0x49c7, 0x87, 0xea, \
 		 0x8f, 0x43, 0xfc, 0xc2, 0x51, 0x96)
@@ -376,6 +381,10 @@
 	EFI_GUID(0x7ce88fb3, 0x4bd7, 0x4679, 0x87, 0xa8, \
 		 0xa8, 0xd8, 0xde, 0xe5, 0x0d, 0x2b)
 
+#define EFI_EVENT_GROUP_AFTER_READY_TO_BOOT \
+	EFI_GUID(0x3a2a00ad, 0x98b9, 0x4cdf, 0xa4, 0x78, \
+		 0x70, 0x27, 0x77, 0xf1, 0xc1, 0xb)
+
 #define EFI_EVENT_GROUP_RESET_SYSTEM \
 	EFI_GUID(0x62da6a56, 0x13fb, 0x485a, 0xa8, 0xda, \
 		 0xa3, 0xdd, 0x79, 0x12, 0xcb, 0x6b)
@@ -417,6 +426,15 @@
 	EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, \
 		 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25)
 
+/**
+ * struct efi_configuration_table - EFI Configuration Table
+ *
+ * This table contains a set of GUID/pointer pairs.
+ * The EFI Configuration Table may contain at most one instance of each table type.
+ *
+ * @guid:		GUID that uniquely identifies the system configuration table
+ * @table:		A pointer to the table associated with guid
+ */
 struct efi_configuration_table {
 	efi_guid_t guid;
 	void *table;
@@ -424,6 +442,29 @@
 
 #define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
 
+/**
+ * struct efi_system_table - EFI System Table
+ *
+ * EFI System Table contains pointers to the runtime and boot services tables.
+ *
+ * @hdr:		The table header for the EFI System Table
+ * @fw_vendor:		A pointer to a null terminated string that identifies the vendor
+ *			that produces the system firmware
+ * @fw_revision:	The revision of the system firmware
+ * @con_in_handle:	The handle for the active console input device
+ * @con_in:		A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface
+ *			that is associated with con_in_handle
+ * @con_out_handle:	The handle for the active console output device
+ * @con_out:		A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
+ *			that is associated with con_out_handle
+ * @stderr_handle:	The handle for the active standard error console device
+ * @std_err:		A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
+ *			that is associated with stderr_handle
+ * @runtime:		A pointer to the EFI Runtime Services Table
+ * @boottime:		A pointer to the EFI Boot Services Table
+ * @nr_tables:		The number of system configuration tables
+ * @tables:		A pointer to the system configuration tables
+ */
 struct efi_system_table {
 	struct efi_table_hdr hdr;
 	u16 *fw_vendor;   /* physical addr of wchar_t vendor string */
@@ -870,8 +911,8 @@
  * @fields:	'fields' replaces the bit-fields defined in the EFI
  *		specification to to avoid possible compiler incompatibilities::
  *
- *		u32 length:24;
- *		u32 type:8;
+ *		    u32 length:24;
+ *		    u32 type:8;
  */
 struct efi_hii_package_header {
 	u32 fields;
@@ -1809,7 +1850,7 @@
 		 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7)
 
 /**
- * win_certificate_uefi_guid - A certificate that encapsulates
+ * struct win_certificate_uefi_guid - A certificate that encapsulates
  * a GUID-specific signature
  *
  * @hdr:	Windows certificate header
@@ -1823,7 +1864,7 @@
 } __attribute__((__packed__));
 
 /**
- * efi_variable_authentication_2 - A time-based authentication method
+ * struct efi_variable_authentication_2 - A time-based authentication method
  * descriptor
  *
  * This structure describes an authentication information for
@@ -1840,7 +1881,7 @@
 } __attribute__((__packed__));
 
 /**
- * efi_firmware_image_authentication - Capsule authentication method
+ * struct efi_firmware_image_authentication - Capsule authentication method
  * descriptor
  *
  * This structure describes an authentication information for
@@ -1858,7 +1899,7 @@
 
 
 /**
- * efi_signature_data - A format of signature
+ * struct efi_signature_data - A format of signature
  *
  * This structure describes a single signature in signature database.
  *
@@ -1871,7 +1912,7 @@
 } __attribute__((__packed__));
 
 /**
- * efi_signature_list - A format of signature database
+ * struct efi_signature_list - A format of signature database
  *
  * This structure describes a list of signatures with the same type.
  * An authenticated variable's value is a concatenation of one or more
diff --git a/include/lmb.h b/include/lmb.h
index 1984291..ab277ca 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -25,8 +25,9 @@
 /**
  * struct lmb_property - Description of one region.
  *
- * @base: Base address of the region.
- * @size: Size of the region
+ * @base:	Base address of the region.
+ * @size:	Size of the region
+ * @flags:	memory region attributes
  */
 struct lmb_property {
 	phys_addr_t base;
@@ -73,64 +74,49 @@
 #endif
 };
 
-extern void lmb_init(struct lmb *lmb);
-extern void lmb_init_and_reserve(struct lmb *lmb, struct bd_info *bd,
-				 void *fdt_blob);
-extern void lmb_init_and_reserve_range(struct lmb *lmb, phys_addr_t base,
-				       phys_size_t size, void *fdt_blob);
-extern long lmb_add(struct lmb *lmb, phys_addr_t base, phys_size_t size);
-extern long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size);
+void lmb_init(struct lmb *lmb);
+void lmb_init_and_reserve(struct lmb *lmb, struct bd_info *bd, void *fdt_blob);
+void lmb_init_and_reserve_range(struct lmb *lmb, phys_addr_t base,
+				phys_size_t size, void *fdt_blob);
+long lmb_add(struct lmb *lmb, phys_addr_t base, phys_size_t size);
+long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size);
 /**
  * lmb_reserve_flags - Reserve one region with a specific flags bitfield.
  *
- * @lmb		the logical memory block struct
- * @base	base address of the memory region
- * @size	size of the memory region
- * @flags	flags for the memory region
- * @return 0 if OK, > 0 for coalesced region or a negative error code.
+ * @lmb:	the logical memory block struct
+ * @base:	base address of the memory region
+ * @size:	size of the memory region
+ * @flags:	flags for the memory region
+ * Return:	0 if OK, > 0 for coalesced region or a negative error code.
  */
 long lmb_reserve_flags(struct lmb *lmb, phys_addr_t base,
 		       phys_size_t size, enum lmb_flags flags);
-extern phys_addr_t lmb_alloc(struct lmb *lmb, phys_size_t size, ulong align);
-extern phys_addr_t lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align,
-			    phys_addr_t max_addr);
-extern phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align,
-			      phys_addr_t max_addr);
-extern phys_addr_t lmb_alloc_addr(struct lmb *lmb, phys_addr_t base,
-				  phys_size_t size);
-extern phys_size_t lmb_get_free_size(struct lmb *lmb, phys_addr_t addr);
-extern int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr);
+phys_addr_t lmb_alloc(struct lmb *lmb, phys_size_t size, ulong align);
+phys_addr_t lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align,
+			   phys_addr_t max_addr);
+phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align,
+			     phys_addr_t max_addr);
+phys_addr_t lmb_alloc_addr(struct lmb *lmb, phys_addr_t base, phys_size_t size);
+phys_size_t lmb_get_free_size(struct lmb *lmb, phys_addr_t addr);
+int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr);
 /**
  * lmb_is_reserved_flags - test if tha address is in reserved region with a bitfield flag
  *
- * @lmb		the logical memory block struct
- * @addr	address to be tested
- * @flags	flags bitfied to be tested
- * @return 0 if not reserved or reserved without the requested flag else 1
+ * @lmb:	the logical memory block struct
+ * @addr:	address to be tested
+ * @flags:	flags bitfied to be tested
+ * Return:	if not reserved or reserved without the requested flag else 1
  */
 int lmb_is_reserved_flags(struct lmb *lmb, phys_addr_t addr, int flags);
-extern long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size);
+long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size);
 
-extern void lmb_dump_all(struct lmb *lmb);
-extern void lmb_dump_all_force(struct lmb *lmb);
-
-static inline phys_size_t
-lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
-{
-	return type->region[region_nr].size;
-}
+void lmb_dump_all(struct lmb *lmb);
+void lmb_dump_all_force(struct lmb *lmb);
 
 void board_lmb_reserve(struct lmb *lmb);
 void arch_lmb_reserve(struct lmb *lmb);
 void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end, ulong align);
 
-/* Low level functions */
-
-static inline bool lmb_is_nomap(struct lmb_property *m)
-{
-	return m->flags & LMB_NOMAP;
-}
-
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_LMB_H */
diff --git a/lib/Kconfig b/lib/Kconfig
index 70bf8e7..807a4c6 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -793,7 +793,7 @@
 	  Support the library logical memory blocks.
 
 config LMB_USE_MAX_REGIONS
-	bool "Use a commun number of memory and reserved regions in lmb lib"
+	bool "Use a common number of memory and reserved regions in lmb lib"
 	depends on LMB
 	default y
 	help
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 1823990..6fdd0ef 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -71,6 +71,9 @@
 /* event group ExitBootServices() invoked */
 const efi_guid_t efi_guid_event_group_exit_boot_services =
 			EFI_EVENT_GROUP_EXIT_BOOT_SERVICES;
+/* event group before ExitBootServices() invoked */
+const efi_guid_t efi_guid_event_group_before_exit_boot_services =
+			EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES;
 /* event group SetVirtualAddressMap() invoked */
 const efi_guid_t efi_guid_event_group_virtual_address_change =
 			EFI_EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE;
@@ -2123,6 +2126,16 @@
 	if (!systab.boottime)
 		goto out;
 
+	/* Notify EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES event group. */
+	list_for_each_entry(evt, &efi_events, link) {
+		if (evt->group &&
+		    !guidcmp(evt->group,
+			     &efi_guid_event_group_before_exit_boot_services)) {
+			efi_signal_event(evt);
+			break;
+		}
+	}
+
 	/* Stop all timer related activities */
 	timers_enabled = false;
 
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 850937f..502bcfc 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -1108,13 +1108,13 @@
 				log_err("Applying capsule %ls failed\n",
 					files[i]);
 
+			/* create CapsuleXXXX */
+			set_capsule_result(index, capsule, ret);
+
 			free(capsule);
 		} else {
 			log_err("Reading capsule %ls failed\n", files[i]);
 		}
-		/* create CapsuleXXXX */
-		set_capsule_result(index, capsule, ret);
-
 		/* delete a capsule either in case of success or failure */
 		ret = efi_capsule_delete_file(files[i]);
 		if (ret != EFI_SUCCESS)
diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index 189e4a5..8c1f22e 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -18,6 +18,7 @@
 #include <smbios.h>
 #include <version_string.h>
 #include <tpm-v2.h>
+#include <tpm_api.h>
 #include <u-boot/hash-checksum.h>
 #include <u-boot/sha1.h>
 #include <u-boot/sha256.h>
@@ -27,6 +28,17 @@
 #include <linux/unaligned/generic.h>
 #include <hexdump.h>
 
+/**
+ * struct event_log_buffer - internal eventlog management structure
+ *
+ * @buffer:		eventlog buffer
+ * @final_buffer:	finalevent config table buffer
+ * @pos:		current position of 'buffer'
+ * @final_pos:		current position of 'final_buffer'
+ * @get_event_called:	true if GetEventLog has been invoked at least once
+ * @ebs_called:		true if ExitBootServices has been invoked
+ * @truncated:		true if the 'buffer' is truncated
+ */
 struct event_log_buffer {
 	void *buffer;
 	void *final_buffer;
@@ -34,6 +46,7 @@
 	size_t final_pos; /* final events config table position */
 	size_t last_event_size;
 	bool get_event_called;
+	bool ebs_called;
 	bool truncated;
 };
 
@@ -186,39 +199,29 @@
 	return EFI_SUCCESS;
 }
 
-/* tcg2_agile_log_append - Append an agile event to out eventlog
+/* put_event - Append an agile event to an eventlog
  *
  * @pcr_index:		PCR index
  * @event_type:		type of event added
  * @digest_list:	list of digest algorithms to add
  * @size:		size of event
  * @event:		event to add
+ * @log:		log buffer to append the event
  *
- * @Return: status code
  */
-static efi_status_t tcg2_agile_log_append(u32 pcr_index, u32 event_type,
-					  struct tpml_digest_values *digest_list,
-					  u32 size, u8 event[])
+static void put_event(u32 pcr_index, u32 event_type,
+		      struct tpml_digest_values *digest_list, u32 size,
+		      u8 event[], void *log)
 {
-	void *log = (void *)((uintptr_t)event_log.buffer + event_log.pos);
 	size_t pos;
 	size_t i;
 	u32 event_size;
 
-	if (event_log.get_event_called)
-		log = (void *)((uintptr_t)event_log.final_buffer +
-			       event_log.final_pos);
-
 	/*
 	 * size refers to the length of event[] only, we need to check against
 	 * the final tcg_pcr_event2 size
 	 */
 	event_size = size + tcg_event_final_size(digest_list);
-	if (event_log.pos + event_size > TPM2_EVENT_LOG_SIZE ||
-	    event_log.final_pos + event_size > TPM2_EVENT_LOG_SIZE) {
-		event_log.truncated = true;
-		return EFI_VOLUME_FULL;
-	}
 
 	put_unaligned_le32(pcr_index, log);
 	pos = offsetof(struct tcg_pcr_event2, event_type);
@@ -242,25 +245,62 @@
 	memcpy((void *)((uintptr_t)log + pos), event, size);
 	pos += size;
 
-	/* make sure the calculated buffer is what we checked against */
+	/*
+	 * make sure the calculated buffer is what we checked against
+	 * This check should never fail.  It checks the code above is
+	 * calculating the right length for the event we are adding
+	 */
 	if (pos != event_size)
-		return EFI_INVALID_PARAMETER;
+		log_err("Appending to the EventLog failed\n");
+}
 
-	/* if GetEventLog hasn't been called update the normal log */
-	if (!event_log.get_event_called) {
-		event_log.pos += pos;
-		event_log.last_event_size = pos;
-	} else {
-	/* if GetEventLog has been called update config table log */
-		struct efi_tcg2_final_events_table *final_event;
+/* tcg2_agile_log_append - Append an agile event to an eventlog
+ *
+ * @pcr_index:		PCR index
+ * @event_type:		type of event added
+ * @digest_list:	list of digest algorithms to add
+ * @size:		size of event
+ * @event:		event to add
+ * @log:		log buffer to append the event
+ *
+ * @Return: status code
+ */
+static efi_status_t tcg2_agile_log_append(u32 pcr_index, u32 event_type,
+					  struct tpml_digest_values *digest_list,
+					  u32 size, u8 event[])
+{
+	void *log = (void *)((uintptr_t)event_log.buffer + event_log.pos);
+	u32 event_size = size + tcg_event_final_size(digest_list);
+	struct efi_tcg2_final_events_table *final_event;
+	efi_status_t ret = EFI_SUCCESS;
 
-		final_event =
-			(struct efi_tcg2_final_events_table *)(event_log.final_buffer);
-		final_event->number_of_events++;
-		event_log.final_pos += pos;
+	/* if ExitBootServices hasn't been called update the normal log */
+	if (!event_log.ebs_called) {
+		if (event_log.truncated ||
+		    event_log.pos + event_size > TPM2_EVENT_LOG_SIZE) {
+			event_log.truncated = true;
+			return EFI_VOLUME_FULL;
+		}
+		put_event(pcr_index, event_type, digest_list, size, event, log);
+		event_log.pos += event_size;
+		event_log.last_event_size = event_size;
 	}
 
-	return EFI_SUCCESS;
+	if (!event_log.get_event_called)
+		return ret;
+
+	/* if GetEventLog has been called update FinalEventLog as well */
+	if (event_log.final_pos + event_size > TPM2_EVENT_LOG_SIZE)
+		return EFI_VOLUME_FULL;
+
+	log = (void *)((uintptr_t)event_log.final_buffer + event_log.final_pos);
+	put_event(pcr_index, event_type, digest_list, size, event, log);
+
+	final_event = event_log.final_buffer;
+	final_event->number_of_events++;
+	event_log.final_pos += event_size;
+
+	return ret;
 }
 
 /**
@@ -1303,6 +1343,7 @@
 	event_log.pos = 0;
 	event_log.last_event_size = 0;
 	event_log.get_event_called = false;
+	event_log.ebs_called = false;
 	event_log.truncated = false;
 
 	/*
@@ -1472,7 +1513,7 @@
 				      &var_data_size);
 
 		if (!bootvar) {
-			log_info("%ls not found\n", boot_name);
+			log_debug("%ls not found\n", boot_name);
 			continue;
 		}
 
@@ -1792,6 +1833,7 @@
 
 	EFI_ENTRY("%p, %p", event, context);
 
+	event_log.ebs_called = true;
 	ret = platform_get_tpm2_device(&dev);
 	if (ret != EFI_SUCCESS)
 		goto out;
@@ -1902,6 +1944,7 @@
 	efi_status_t ret = EFI_SUCCESS;
 	struct udevice *dev;
 	struct efi_event *event;
+	u32 err;
 
 	ret = platform_get_tpm2_device(&dev);
 	if (ret != EFI_SUCCESS) {
@@ -1909,6 +1952,13 @@
 		return EFI_SUCCESS;
 	}
 
+	/* initialize the TPM as early as possible. */
+	err = tpm_startup(dev, TPM_ST_CLEAR);
+	if (err) {
+		log_err("TPM startup failed\n");
+		goto fail;
+	}
+
 	ret = efi_init_event_log();
 	if (ret != EFI_SUCCESS)
 		goto fail;
diff --git a/lib/efi_selftest/efi_selftest_exitbootservices.c b/lib/efi_selftest/efi_selftest_exitbootservices.c
index 4fecd1b..59ab154 100644
--- a/lib/efi_selftest/efi_selftest_exitbootservices.c
+++ b/lib/efi_selftest/efi_selftest_exitbootservices.c
@@ -10,9 +10,34 @@
 
 #include <efi_selftest.h>
 
+static efi_guid_t guid_before_exit_boot_services =
+	EFI_GUID(0x8be0e274, 0x3970, 0x4b44, 0x80, 0xc5,
+		 0x1a, 0xb9, 0x50, 0x2f, 0x3b, 0xfc);
+#define CAPACITY 4
+
+struct notification_record {
+	unsigned int count;
+	unsigned int type[CAPACITY];
+};
+
+struct notification_context {
+	struct notification_record *record;
+	unsigned int type;
+};
+
 static struct efi_boot_services *boottime;
 static struct efi_event *event_notify;
-static unsigned int notification_count;
+struct notification_record record;
+
+struct notification_context context_before = {
+	.record = &record,
+	.type = 1,
+};
+
+struct notification_context context = {
+	.record = &record,
+	.type = 2,
+};
 
 /*
  * Notification function, increments the notification count.
@@ -20,11 +45,15 @@
  * @event	notified event
  * @context	pointer to the notification count
  */
-static void EFIAPI notify(struct efi_event *event, void *context)
+static void EFIAPI ebs_notify(struct efi_event *event, void *context)
 {
-	unsigned int *count = context;
+	struct notification_context *ctx = context;
+
+	if (ctx->record->count >= CAPACITY)
+		return;
 
-	++*count;
+	ctx->record->type[ctx->record->count] = ctx->type;
+	ctx->record->count++;
 }
 
 /*
@@ -43,15 +72,23 @@
 
 	boottime = systable->boottime;
 
-	notification_count = 0;
 	ret = boottime->create_event(EVT_SIGNAL_EXIT_BOOT_SERVICES,
-				     TPL_CALLBACK, notify,
-				     (void *)&notification_count,
+				     TPL_CALLBACK, ebs_notify,
+				     &context,
 				     &event_notify);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("could not create event\n");
 		return EFI_ST_FAILURE;
 	}
+	ret = boottime->create_event_ex(0, TPL_CALLBACK, ebs_notify,
+					&context_before,
+					&guid_before_exit_boot_services,
+					&event_notify);
+	if (ret != EFI_SUCCESS) {
+		efi_st_error("could not create event\n");
+		return EFI_ST_FAILURE;
+	}
+
 	return EFI_ST_SUCCESS;
 }
 
@@ -68,13 +105,21 @@
  */
 static int execute(void)
 {
-	if (notification_count != 1) {
-		efi_st_error("ExitBootServices was not notified\n");
+	if (record.count != 2) {
+		efi_st_error("Incorrect event count %u\n", record.count);
+		return EFI_ST_FAILURE;
+	}
+	if (record.type[0] != 1) {
+		efi_st_error("EFI_GROUP_BEFORE_EXIT_BOOT_SERVICE not notified\n");
+		return EFI_ST_FAILURE;
+	}
+	if (record.type[1] != 2) {
+		efi_st_error("EVT_SIGNAL_EXIT_BOOT_SERVICES was not notified\n");
 		return EFI_ST_FAILURE;
 	}
 	efi_st_exit_boot_services();
-	if (notification_count != 1) {
-		efi_st_error("ExitBootServices was notified twice\n");
+	if (record.count != 2) {
+		efi_st_error("Incorrect event count %u\n", record.count);
 		return EFI_ST_FAILURE;
 	}
 	return EFI_ST_SUCCESS;
diff --git a/scripts/spelling.txt b/scripts/spelling.txt
index 9a058cf..17fdc62 100644
--- a/scripts/spelling.txt
+++ b/scripts/spelling.txt
@@ -9,7 +9,12 @@
 #
 abandonning||abandoning
 abigious||ambiguous
+abitrary||arbitrary
 abitrate||arbitrate
+abnornally||abnormally
+abnrormal||abnormal
+abord||abort
+aboslute||absolute
 abov||above
 abreviated||abbreviated
 absense||absence
@@ -17,6 +22,7 @@
 absoulte||absolute
 acccess||access
 acceess||access
+accelaration||acceleration
 acceleratoin||acceleration
 accelleration||acceleration
 accesing||accessing
@@ -25,6 +31,7 @@
 accesss||access
 accidentaly||accidentally
 accidentually||accidentally
+acclerated||accelerated
 accoding||according
 accomodate||accommodate
 accomodates||accommodates
@@ -34,8 +41,11 @@
 accquire||acquire
 accquired||acquired
 accross||across
+accumalate||accumulate
+accumalator||accumulator
 acessable||accessible
 acess||access
+acessing||accessing
 achitecture||architecture
 acient||ancient
 acitions||actions
@@ -49,7 +59,9 @@
 actived||activated
 actualy||actually
 acumulating||accumulating
+acumulative||accumulative
 acumulator||accumulator
+acutally||actually
 adapater||adapter
 addional||additional
 additionaly||additionally
@@ -58,18 +70,22 @@
 adddress||address
 addreses||addresses
 addresss||address
+addrress||address
 aditional||additional
 aditionally||additionally
 aditionaly||additionally
 adminstrative||administrative
 adress||address
 adresses||addresses
+adrresses||addresses
+advertisment||advertisement
 adviced||advised
 afecting||affecting
 againt||against
 agaist||against
 aggreataon||aggregation
 aggreation||aggregation
+ajust||adjust
 albumns||albums
 alegorical||allegorical
 algined||aligned
@@ -77,6 +93,7 @@
 algorithmical||algorithmically
 algoritm||algorithm
 algoritms||algorithms
+algorithmn||algorithm
 algorrithm||algorithm
 algorritm||algorithm
 aligment||alignment
@@ -88,6 +105,7 @@
 allocatote||allocate
 allocatrd||allocated
 allocte||allocate
+allocted||allocated
 allpication||application
 alocate||allocate
 alogirhtms||algorithms
@@ -95,11 +113,16 @@
 alot||a lot
 alow||allow
 alows||allows
+alreay||already
+alredy||already
 altough||although
 alue||value
 ambigious||ambiguous
+ambigous||ambiguous
 amoung||among
 amout||amount
+amplifer||amplifier
+amplifyer||amplifier
 an union||a union
 an user||a user
 an userspace||a userspace
@@ -130,6 +153,7 @@
 architechture||architecture
 arguement||argument
 arguements||arguments
+arithmatic||arithmetic
 aritmetic||arithmetic
 arne't||aren't
 arraival||arrival
@@ -138,27 +162,42 @@
 asign||assign
 asser||assert
 assertation||assertion
+assertting||asserting
+assgined||assigned
 assiged||assigned
 assigment||assignment
 assigments||assignments
 assistent||assistant
+assocaited||associated
+assocating||associating
 assocation||association
 associcated||associated
 assotiated||associated
+asssert||assert
 assum||assume
 assumtpion||assumption
 asuming||assuming
 asycronous||asynchronous
 asynchnous||asynchronous
+asynchromous||asynchronous
+asymetric||asymmetric
+asymmeric||asymmetric
+atleast||at least
 atomatically||automatically
 atomicly||atomically
 atempt||attempt
+atrributes||attributes
 attachement||attachment
+attatch||attach
 attched||attached
+attemp||attempt
 attemps||attempts
 attemping||attempting
+attepmpt||attempt
+attnetion||attention
 attruibutes||attributes
 authentification||authentication
+authenicated||authenticated
 automaticaly||automatically
 automaticly||automatically
 automatize||automate
@@ -172,6 +211,7 @@
 availabe||available
 availabled||available
 availablity||availability
+availaible||available
 availale||available
 availavility||availability
 availble||available
@@ -205,28 +245,42 @@
 borad||board
 boundry||boundary
 brievely||briefly
+brigde||bridge
+broadcase||broadcast
 broadcat||broadcast
+bufer||buffer
+bufufer||buffer
 cacluated||calculated
+caculate||calculate
 caculation||calculation
+cadidate||candidate
+cahces||caches
 calender||calendar
 calescing||coalescing
 calle||called
 callibration||calibration
+callled||called
+callser||caller
 calucate||calculate
 calulate||calculate
 cancelation||cancellation
 cancle||cancel
+canot||cannot
 capabilites||capabilities
+capabilties||capabilities
 capabilty||capability
 capabitilies||capabilities
+capablity||capability
 capatibilities||capabilities
 capapbilities||capabilities
+caputure||capture
 carefuly||carefully
 cariage||carriage
 catagory||category
 cehck||check
 challange||challenge
 challanges||challenges
+chache||cache
 chanell||channel
 changable||changeable
 chanined||chained
@@ -240,6 +294,7 @@
 charcter||character
 chcek||check
 chck||check
+checksumed||checksummed
 checksuming||checksumming
 childern||children
 childs||children
@@ -255,7 +310,9 @@
 clared||cleared
 closeing||closing
 clustred||clustered
+cnfiguration||configuration
 coexistance||coexistence
+colescing||coalescing
 collapsable||collapsible
 colorfull||colorful
 comand||command
@@ -266,14 +323,17 @@
 commited||committed
 commiting||committing
 committ||commit
+commnunication||communication
 commoditiy||commodity
 comsume||consume
 comsumer||consumer
 comsuming||consuming
 compability||compatibility
 compaibility||compatibility
+comparsion||comparison
 compatability||compatibility
 compatable||compatible
+compatibililty||compatibility
 compatibiliy||compatibility
 compatibilty||compatibility
 compatiblity||compatibility
@@ -285,22 +345,32 @@
 complient||compliant
 componnents||components
 compoment||component
+comppatible||compatible
 compres||compress
 compresion||compression
 comression||compression
+comunicate||communicate
 comunication||communication
 conbination||combination
 conditionaly||conditionally
+conditon||condition
+condtion||condition
 conected||connected
-connecetd||connected
+conector||connector
+configration||configuration
+configred||configured
 configuartion||configuration
+configuation||configuration
+configued||configured
 configuratoin||configuration
 configuraton||configuration
 configuretion||configuration
 configutation||configuration
 conider||consider
 conjuction||conjunction
+connecetd||connected
 connectinos||connections
+connetor||connector
 connnection||connection
 connnections||connections
 consistancy||consistency
@@ -310,11 +380,13 @@
 contaisn||contains
 contant||contact
 contence||contents
+contiguos||contiguous
 continious||continuous
 continous||continuous
 continously||continuously
 continueing||continuing
 contraints||constraints
+contruct||construct
 contol||control
 contoller||controller
 controled||controlled
@@ -340,15 +412,23 @@
 curently||currently
 cylic||cyclic
 dafault||default
+deactive||deactivate
 deafult||default
 deamon||daemon
+debouce||debounce
+decendant||descendant
+decendants||descendants
 decompres||decompress
+decsribed||described
 decription||description
 dectected||detected
 defailt||default
+deferal||deferral
+deffered||deferred
 defferred||deferred
 definate||definite
 definately||definitely
+definiation||definition
 defintion||definition
 defintions||definitions
 defualt||default
@@ -362,29 +442,35 @@
 delares||declares
 delaring||declaring
 delemiter||delimiter
+delievered||delivered
 demodualtor||demodulator
 demension||dimension
 dependancies||dependencies
 dependancy||dependency
 dependant||dependent
+dependend||dependent
 depreacted||deprecated
 depreacte||deprecate
 desactivate||deactivate
 desciptor||descriptor
 desciptors||descriptors
+descripto||descriptor
 descripton||description
 descrition||description
 descritptor||descriptor
 desctiptor||descriptor
 desriptor||descriptor
 desriptors||descriptors
+desination||destination
 destionation||destination
+destoried||destroyed
 destory||destroy
 destoryed||destroyed
 destorys||destroys
 destroied||destroyed
 detabase||database
 deteced||detected
+detectt||detect
 develope||develop
 developement||development
 developped||developed
@@ -394,44 +480,74 @@
 deveolpment||development
 devided||divided
 deviece||device
+devision||division
 diable||disable
+diabled||disabled
+dicline||decline
 dictionnary||dictionary
 didnt||didn't
 diferent||different
 differrence||difference
 diffrent||different
+differenciate||differentiate
 diffrentiate||differentiate
 difinition||definition
+digial||digital
+dimention||dimension
 dimesions||dimensions
+diconnected||disconnected
+disabed||disabled
+disble||disable
+disgest||digest
+disired||desired
+dispalying||displaying
 diplay||display
+directon||direction
+direcly||directly
 direectly||directly
+diregard||disregard
 disassocation||disassociation
 disapear||disappear
 disapeared||disappeared
 disappared||disappeared
+disbale||disable
+disbaled||disabled
 disble||disable
 disbled||disabled
 disconnet||disconnect
 discontinous||discontinuous
+disharge||discharge
+disnabled||disabled
 dispertion||dispersion
 dissapears||disappears
+dissconect||disconnect
 distiction||distinction
+divisable||divisible
+divsiors||divisors
 docuentation||documentation
 documantation||documentation
 documentaion||documentation
 documment||document
 doesnt||doesn't
+donwload||download
+donwloading||downloading
 dorp||drop
 dosen||doesn
 downlad||download
 downlads||downloads
+droped||dropped
+droput||dropout
 druing||during
+dyanmic||dynamic
 dynmaic||dynamic
+eanable||enable
+eanble||enable
 easilly||easily
 ecspecially||especially
 edditable||editable
 editting||editing
 efective||effective
+effectivness||effectiveness
 efficently||efficiently
 ehther||ether
 eigth||eight
@@ -439,16 +555,23 @@
 eletronic||electronic
 embeded||embedded
 enabledi||enabled
+enbale||enable
+enble||enable
 enchanced||enhanced
 encorporating||incorporating
 encrupted||encrypted
 encrypiton||encryption
 encryptio||encryption
 endianess||endianness
+enpoint||endpoint
 enhaced||enhanced
 enlightnment||enlightenment
+enqueing||enqueuing
+entires||entries
+entites||entities
 entrys||entries
 enocded||encoded
+enought||enough
 enterily||entirely
 enviroiment||environment
 enviroment||environment
@@ -460,13 +583,23 @@
 equivilant||equivalent
 eror||error
 errorr||error
+errror||error
 estbalishment||establishment
 etsablishment||establishment
 etsbalishment||establishment
+evalute||evaluate
+evalutes||evaluates
+evalution||evaluation
 excecutable||executable
 exceded||exceeded
+exceds||exceeds
+exceeed||exceed
 excellant||excellent
+execeeded||exceeded
+execeeds||exceeds
 exeed||exceed
+exeeds||exceeds
+exeuction||execution
 existance||existence
 existant||existent
 exixt||exist
@@ -474,6 +607,7 @@
 exlcusive||exclusive
 exmaple||example
 expecially||especially
+experies||expires
 explicite||explicit
 explicitely||explicitly
 explict||explicit
@@ -482,11 +616,16 @@
 expresion||expression
 exprimental||experimental
 extened||extended
+exteneded||extended
 extensability||extensibility
 extention||extension
+extenstion||extension
 extracter||extractor
-falied||failed
+faied||failed
+faield||failed
 faild||failed
+failded||failed
+failer||failure
 faill||fail
 failied||failed
 faillure||failure
@@ -504,8 +643,12 @@
 fetaure||feature
 fetaures||features
 fileystem||filesystem
+fimrware||firmware
 fimware||firmware
+firmare||firmware
+firmaware||firmware
 firware||firmware
+firwmare||firmware
 finanize||finalize
 findn||find
 finilizes||finalizes
@@ -520,13 +663,18 @@
 forse||force
 fortan||fortran
 forwardig||forwarding
+frambuffer||framebuffer
 framming||framing
 framwork||framework
+frequence||frequency
 frequncy||frequency
+frequancy||frequency
 frome||from
 fucntion||function
 fuction||function
 fuctions||functions
+fullill||fulfill
+funcation||function
 funcion||function
 functionallity||functionality
 functionaly||functionally
@@ -537,14 +685,19 @@
 furthur||further
 futhermore||furthermore
 futrue||future
+gatable||gateable
+gateing||gating
+gauage||gauge
 gaurenteed||guaranteed
 generiously||generously
 genereate||generate
+genereted||generated
 genric||generic
 globel||global
 grabing||grabbing
 grahical||graphical
 grahpical||graphical
+granularty||granularity
 grapic||graphic
 grranted||granted
 guage||gauge
@@ -553,14 +706,22 @@
 halfs||halves
 hander||handler
 handfull||handful
+hanlde||handle
 hanled||handled
 happend||happened
+hardare||hardware
 harware||hardware
+havind||having
 heirarchically||hierarchically
+heirarchy||hierarchy
 helpfull||helpful
+hearbeat||heartbeat
+heterogenous||heterogeneous
+hexdecimal||hexadecimal
 hybernate||hibernate
 hierachy||hierarchy
 hierarchie||hierarchy
+homogenous||homogeneous
 howver||however
 hsould||should
 hypervior||hypervisor
@@ -568,12 +729,16 @@
 identidier||identifier
 iligal||illegal
 illigal||illegal
+illgal||illegal
+iomaped||iomapped
 imblance||imbalance
 immeadiately||immediately
 immedaite||immediate
+immedate||immediate
 immediatelly||immediately
 immediatly||immediately
 immidiate||immediate
+immutible||immutable
 impelentation||implementation
 impementated||implemented
 implemantation||implementation
@@ -591,10 +756,13 @@
 incomming||incoming
 incompatabilities||incompatibilities
 incompatable||incompatible
+incompatble||incompatible
 inconsistant||inconsistent
 increas||increase
 incremeted||incremented
 incrment||increment
+incuding||including
+inculde||include
 indendation||indentation
 indended||intended
 independant||independent
@@ -603,6 +771,8 @@
 indiate||indicate
 indicat||indicate
 inexpect||inexpected
+inferface||interface
+infinit||infinite
 infomation||information
 informatiom||information
 informations||information
@@ -617,14 +787,24 @@
 initation||initiation
 initators||initiators
 initialiazation||initialization
+initializationg||initialization
 initializiation||initialization
+initialze||initialize
 initialzed||initialized
+initialzing||initializing
 initilization||initialization
 initilize||initialize
+initliaze||initialize
+initilized||initialized
 inofficial||unofficial
+inrerface||interface
 insititute||institute
+instace||instance
 instal||install
+instanciate||instantiate
 instanciated||instantiated
+instuments||instruments
+insufficent||insufficient
 inteface||interface
 integreated||integrated
 integrety||integrity
@@ -635,17 +815,20 @@
 interchangable||interchangeable
 interferring||interfering
 interger||integer
+intergrated||integrated
 intermittant||intermittent
 internel||internal
 interoprability||interoperability
 interuupt||interrupt
+interupt||interrupt
+interupts||interrupts
 interrface||interface
 interrrupt||interrupt
 interrup||interrupt
 interrups||interrupts
 interruptted||interrupted
 interupted||interrupted
-interupt||interrupt
+intiailized||initialized
 intial||initial
 intialisation||initialisation
 intialised||initialised
@@ -654,10 +837,14 @@
 intialized||initialized
 intialize||initialize
 intregral||integral
+intrerrupt||interrupt
 intrrupt||interrupt
 intterrupt||interrupt
 intuative||intuitive
+inavlid||invalid
 invaid||invalid
+invaild||invalid
+invailid||invalid
 invald||invalid
 invalde||invalid
 invalide||invalid
@@ -666,14 +853,18 @@
 invididual||individual
 invokation||invocation
 invokations||invocations
+ireelevant||irrelevant
 irrelevent||irrelevant
 isnt||isn't
 isssue||issue
+issus||issues
+iteraions||iterations
 iternations||iterations
 itertation||iteration
 itslef||itself
 jave||java
 jeffies||jiffies
+jumpimng||jumping
 juse||just
 jus||just
 kown||known
@@ -683,6 +874,7 @@
 langugage||language
 lauch||launch
 layed||laid
+legnth||length
 leightweight||lightweight
 lengh||length
 lenght||length
@@ -693,29 +885,45 @@
 librairies||libraries
 libraris||libraries
 licenceing||licencing
+limted||limited
+logaritmic||logarithmic
 loggging||logging
 loggin||login
 logile||logfile
+loobpack||loopback
 loosing||losing
 losted||lost
+maangement||management
 machinary||machinery
+maibox||mailbox
 maintainance||maintenance
 maintainence||maintenance
 maintan||maintain
 makeing||making
+mailformed||malformed
 malplaced||misplaced
 malplace||misplace
 managable||manageable
+managament||management
 managment||management
 mangement||management
+manger||manager
 manoeuvering||maneuvering
+manufaucturing||manufacturing
 mappping||mapping
+maping||mapping
+matchs||matches
 mathimatical||mathematical
 mathimatic||mathematic
 mathimatics||mathematics
+maximium||maximum
 maxium||maximum
 mechamism||mechanism
 meetign||meeting
+memeory||memory
+memmber||member
+memoery||memory
+memroy||memory
 ment||meant
 mergable||mergeable
 mesage||message
@@ -723,11 +931,14 @@
 messgaes||messages
 messsage||message
 messsages||messages
+metdata||metadata
 micropone||microphone
 microprocesspr||microprocessor
+migrateable||migratable
 milliseonds||milliseconds
 minium||minimum
 minimam||minimum
+miniumum||minimum
 minumum||minimum
 misalinged||misaligned
 miscelleneous||miscellaneous
@@ -736,21 +947,28 @@
 mispelt||misspelt
 mising||missing
 mismactch||mismatch
+missign||missing
 missmanaged||mismanaged
 missmatch||mismatch
+misssing||missing
 miximum||maximum
 mmnemonic||mnemonic
 mnay||many
+modfiy||modify
+modifer||modifier
 modulues||modules
 momery||memory
 memomry||memory
+monitring||monitoring
 monochorome||monochrome
 monochromo||monochrome
 monocrome||monochrome
 mopdule||module
 mroe||more
+multipler||multiplier
 mulitplied||multiplied
 multidimensionnal||multidimensional
+multipe||multiple
 multple||multiple
 mumber||number
 muticast||multicast
@@ -772,21 +990,30 @@
 nescessary||necessary
 nessessary||necessary
 noticable||noticeable
+notication||notification
 notications||notifications
+notifcations||notifications
 notifed||notified
+notity||notify
+nubmer||number
 numebr||number
 numner||number
 obtaion||obtain
+obusing||abusing
 occassionally||occasionally
 occationally||occasionally
 occurance||occurrence
 occurances||occurrences
+occurd||occurred
 occured||occurred
 occurence||occurrence
 occure||occurred
-occured||occurred
 occuring||occurring
+offser||offset
 offet||offset
+offlaod||offload
+offloded||offloaded
+offseting||offsetting
 omited||omitted
 omiting||omitting
 omitt||omit
@@ -794,22 +1021,28 @@
 ommitted||omitted
 onself||oneself
 ony||only
+openning||opening
 operatione||operation
 opertaions||operations
+opportunies||opportunities
 optionnal||optional
 optmizations||optimizations
 orientatied||orientated
 orientied||oriented
 orignal||original
+originial||original
 otherise||otherwise
 ouput||output
 oustanding||outstanding
 overaall||overall
 overhread||overhead
 overlaping||overlapping
+overflw||overflow
+overlfow||overflow
 overide||override
 overrided||overridden
 overriden||overridden
+overrrun||overrun
 overun||overrun
 overwritting||overwriting
 overwriten||overwritten
@@ -820,6 +1053,7 @@
 packge||package
 packtes||packets
 pakage||package
+paket||packet
 pallette||palette
 paln||plan
 paramameters||parameters
@@ -829,23 +1063,34 @@
 parametised||parametrised
 paramter||parameter
 paramters||parameters
+parmaters||parameters
 particuarly||particularly
 particularily||particularly
+partion||partition
+partions||partitions
 partiton||partition
 pased||passed
 passin||passing
 pathes||paths
+pattrns||patterns
 pecularities||peculiarities
 peformance||performance
+peforming||performing
 peice||piece
 pendantic||pedantic
 peprocessor||preprocessor
+perfomance||performance
 perfoming||performing
+perfomring||performing
+periperal||peripheral
+peripherial||peripheral
 permissons||permissions
 peroid||period
 persistance||persistence
 persistant||persistent
+phoneticly||phonetically
 plalform||platform
+platfoem||platform
 platfrom||platform
 plattform||platform
 pleaes||please
@@ -857,7 +1102,10 @@
 posible||possible
 positon||position
 possibilites||possibilities
+potocol||protocol
 powerfull||powerful
+pramater||parameter
+preamle||preamble
 preample||preamble
 preapre||prepare
 preceeded||preceded
@@ -868,9 +1116,16 @@
 preemptable||preemptible
 prefered||preferred
 prefferably||preferably
+prefitler||prefilter
+preform||perform
 premption||preemption
 prepaired||prepared
+prepate||prepare
+preperation||preparation
+preprare||prepare
 pressre||pressure
+presuambly||presumably
+previosuly||previously
 primative||primitive
 princliple||principle
 priorty||priority
@@ -878,6 +1133,7 @@
 privilage||privilege
 priviledge||privilege
 priviledges||privileges
+privleges||privileges
 probaly||probably
 procceed||proceed
 proccesors||processors
@@ -891,12 +1147,16 @@
 processsing||processing
 procteted||protected
 prodecure||procedure
+progamming||programming
 progams||programs
 progess||progress
+programable||programmable
 programers||programmers
 programm||program
 programms||programs
 progresss||progress
+prohibitted||prohibited
+prohibitting||prohibiting
 promiscous||promiscuous
 promps||prompts
 pronnounced||pronounced
@@ -906,35 +1166,45 @@
 propery||property
 propigate||propagate
 propigation||propagation
+propogation||propagation
 propogate||propagate
 prosess||process
 protable||portable
 protcol||protocol
 protecion||protection
+protedcted||protected
 protocoll||protocol
 promixity||proximity
 psudo||pseudo
 psuedo||pseudo
 psychadelic||psychedelic
+purgable||purgeable
 pwoer||power
+queing||queuing
 quering||querying
+queus||queues
 randomally||randomly
 raoming||roaming
 reasearcher||researcher
 reasearchers||researchers
 reasearch||research
+receieve||receive
 recepient||recipient
+recevied||received
 receving||receiving
+recievd||received
 recieved||received
 recieve||receive
 reciever||receiver
 recieves||receives
+recieving||receiving
 recogniced||recognised
 recognizeable||recognizable
 recommanded||recommended
 recyle||recycle
 redircet||redirect
 redirectrion||redirection
+redundacy||redundancy
 reename||rename
 refcounf||refcount
 refence||reference
@@ -944,7 +1214,9 @@
 refernces||references
 refernnce||reference
 refrence||reference
+registed||registered
 registerd||registered
+registeration||registration
 registeresd||registered
 registerred||registered
 registes||registers
@@ -957,6 +1229,7 @@
 reigstration||registration
 releated||related
 relevent||relevant
+reloade||reload
 remoote||remote
 remore||remote
 removeable||removable
@@ -967,25 +1240,38 @@
 reponse||response
 representaion||representation
 reqeust||request
+reqister||register
+requed||requeued
 requestied||requested
 requiere||require
 requirment||requirement
 requred||required
 requried||required
 requst||request
+requsted||requested
+reregisteration||reregistration
 reseting||resetting
+reseved||reserved
+reseverd||reserved
 resizeable||resizable
 resouce||resource
 resouces||resources
 resoures||resources
 responce||response
+resrouce||resource
 ressizes||resizes
 ressource||resource
 ressources||resources
+restesting||retesting
+resumbmitting||resubmitting
 retransmited||retransmitted
 retreived||retrieved
 retreive||retrieve
+retreiving||retrieving
 retrive||retrieve
+retrived||retrieved
+retrun||return
+retun||return
 retuned||returned
 reudce||reduce
 reuest||request
@@ -1006,30 +1292,42 @@
 safly||safely
 safty||safety
 savable||saveable
+scaleing||scaling
 scaned||scanned
 scaning||scanning
 scarch||search
+schdule||schedule
 seach||search
 searchs||searches
+secion||section
 secquence||sequence
 secund||second
 segement||segment
+seleted||selected
+semaphone||semaphore
+senario||scenario
 senarios||scenarios
 sentivite||sensitive
 separatly||separately
 sepcify||specify
-sepc||spec
 seperated||separated
 seperately||separately
 seperate||separate
 seperatly||separately
 seperator||separator
 sepperate||separate
+seqeunce||sequence
+seqeuncer||sequencer
+seqeuencer||sequencer
 sequece||sequence
+sequemce||sequence
 sequencial||sequential
+serivce||service
 serveral||several
+servive||service
 setts||sets
 settting||setting
+shapshot||snapshot
 shotdown||shutdown
 shoud||should
 shouldnt||shouldn't
@@ -1037,6 +1335,7 @@
 shrinked||shrunk
 siginificantly||significantly
 signabl||signal
+significanly||significantly
 similary||similarly
 similiar||similar
 simlar||similar
@@ -1046,15 +1345,22 @@
 singal||signal
 singed||signed
 sleeped||slept
+sliped||slipped
+softwade||software
 softwares||software
+soley||solely
+souce||source
 speach||speech
 specfic||specific
+specfield||specified
 speciefied||specified
 specifc||specific
 specifed||specified
 specificatin||specification
 specificaton||specification
+specificed||specified
 specifing||specifying
+specifiy||specify
 specifiying||specifying
 speficied||specified
 speicify||specify
@@ -1071,8 +1377,12 @@
 standardss||standards
 standartization||standardization
 standart||standard
+standy||standby
+stardard||standard
 staticly||statically
+statuss||status
 stoped||stopped
+stoping||stopping
 stoppped||stopped
 straming||streaming
 struc||struct
@@ -1084,13 +1394,17 @@
 subdirectoires||subdirectories
 suble||subtle
 substract||subtract
+submited||submitted
 submition||submission
+succeded||succeeded
+suceed||succeed
 succesfully||successfully
 succesful||successful
 successed||succeeded
 successfull||successful
 successfuly||successfully
 sucessfully||successfully
+sucessful||successful
 sucess||success
 superflous||superfluous
 superseeded||superseded
@@ -1103,11 +1417,13 @@
 suppoted||supported
 suppported||supported
 suppport||support
+supprot||support
 supress||suppress
 surpressed||suppressed
 surpresses||suppresses
 susbsystem||subsystem
 suspeneded||suspended
+suspsend||suspend
 suspicously||suspiciously
 swaping||swapping
 switchs||switches
@@ -1119,9 +1435,11 @@
 swithed||switched
 swithing||switching
 swtich||switch
+syfs||sysfs
 symetric||symmetric
 synax||syntax
 synchonized||synchronized
+synchronuously||synchronously
 syncronize||synchronize
 syncronized||synchronized
 syncronizing||synchronizing
@@ -1130,28 +1448,43 @@
 sytem||system
 sythesis||synthesis
 taht||that
+tansmit||transmit
 targetted||targeted
 targetting||targeting
+taskelt||tasklet
 teh||the
 temorary||temporary
 temproarily||temporarily
+temperture||temperature
+thead||thread
 therfore||therefore
 thier||their
 threds||threads
+threee||three
 threshhold||threshold
 thresold||threshold
 throught||through
+trackling||tracking
 troughput||throughput
+trys||tries
 thses||these
+tiggers||triggers
 tiggered||triggered
 tipically||typically
+timeing||timing
 timout||timeout
 tmis||this
+toogle||toggle
 torerable||tolerable
+traget||target
+traking||tracking
 tramsmitted||transmitted
 tramsmit||transmit
 tranasction||transaction
+tranceiver||transceiver
 tranfer||transfer
+tranmission||transmission
+transcevier||transceiver
 transciever||transceiver
 transferd||transferred
 transfered||transferred
@@ -1162,6 +1495,8 @@
 trasfer||transfer
 trasmission||transmission
 treshold||threshold
+triggerd||triggered
+trigerred||triggered
 trigerring||triggering
 trun||turn
 tunning||tuning
@@ -1169,8 +1504,12 @@
 tyep||type
 udpate||update
 uesd||used
+uknown||unknown
+usccess||success
 uncommited||uncommitted
+uncompatible||incompatible
 unconditionaly||unconditionally
+undeflow||underflow
 underun||underrun
 unecessary||unnecessary
 unexecpted||unexpected
@@ -1181,11 +1520,16 @@
 unexpexted||unexpected
 unfortunatelly||unfortunately
 unifiy||unify
+uniterrupted||uninterrupted
 unintialized||uninitialized
+unitialized||uninitialized
 unkmown||unknown
 unknonw||unknown
+unknouwn||unknown
 unknow||unknown
 unkown||unknown
+unamed||unnamed
+uneeded||unneeded
 unneded||unneeded
 unneccecary||unnecessary
 unneccesary||unnecessary
@@ -1194,6 +1538,7 @@
 unneedingly||unnecessarily
 unnsupported||unsupported
 unmached||unmatched
+unprecise||imprecise
 unregester||unregister
 unresgister||unregister
 unrgesiter||unregister
@@ -1203,13 +1548,17 @@
 unsuccessfull||unsuccessful
 unsuported||unsupported
 untill||until
+ununsed||unused
 unuseful||useless
+unvalid||invalid
 upate||update
+upsupported||unsupported
 usefule||useful
 usefull||useful
 usege||usage
 usera||users
 usualy||usually
+usupported||unsupported
 utilites||utilities
 utillities||utilities
 utilties||utilities
@@ -1224,6 +1573,8 @@
 varient||variant
 vaule||value
 verbse||verbose
+veify||verify
+veriosn||version
 verisons||versions
 verison||version
 verson||version
@@ -1233,7 +1584,9 @@
 virtiual||virtual
 visiters||visitors
 vitual||virtual
+vunerable||vulnerable
 wakeus||wakeups
+wathdog||watchdog
 wating||waiting
 wiat||wait
 wether||whether
@@ -1247,8 +1600,10 @@
 wirte||write
 withing||within
 wnat||want
+wont||won't
 workarould||workaround
 writeing||writing
 writting||writing
+wtih||with
 zombe||zombie
 zomebie||zombie
diff --git a/test/lib/lmb.c b/test/lib/lmb.c
index b2c2b99..157c263 100644
--- a/test/lib/lmb.c
+++ b/test/lib/lmb.c
@@ -12,6 +12,11 @@
 #include <test/test.h>
 #include <test/ut.h>
 
+static inline bool lmb_is_nomap(struct lmb_property *m)
+{
+	return m->flags & LMB_NOMAP;
+}
+
 static int check_lmb(struct unit_test_state *uts, struct lmb *lmb,
 		     phys_addr_t ram_base, phys_size_t ram_size,
 		     unsigned long num_reserved,
diff --git a/test/print_ut.c b/test/print_ut.c
index 152a8c3..7b2e7bb 100644
--- a/test/print_ut.c
+++ b/test/print_ut.c
@@ -31,6 +31,7 @@
 		1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
 	};
 	char str[40];
+	int ret;
 
 	sprintf(str, "%pUb", guid);
 	ut_assertok(strcmp("01020304-0506-0708-090a-0b0c0d0e0f10", str));
@@ -40,6 +41,9 @@
 	ut_assertok(strcmp("04030201-0605-0807-090a-0b0c0d0e0f10", str));
 	sprintf(str, "%pUL", guid);
 	ut_assertok(strcmp("04030201-0605-0807-090A-0B0C0D0E0F10", str));
+	ret = snprintf(str, 4, "%pUL", guid);
+	ut_asserteq(0, str[3]);
+	ut_asserteq(36, ret);
 
 	return 0;
 }
@@ -349,6 +353,20 @@
 }
 PRINT_TEST(print_itoa, 0);
 
+static int snprint(struct unit_test_state *uts)
+{
+	char buf[10] = "xxxxxxxxx";
+	int ret;
+
+	ret = snprintf(buf, 4, "%s:%s", "abc", "def");
+	ut_asserteq(0, buf[3]);
+	ut_asserteq(7, ret);
+	ret = snprintf(buf, 4, "%s:%d", "abc", 9999);
+	ut_asserteq(8, ret);
+	return 0;
+}
+PRINT_TEST(snprint, 0);
+
 static int print_xtoa(struct unit_test_state *uts)
 {
 	ut_asserteq_str("7f", simple_xtoa(127));