mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/5] efi: Fix typo in description string
@ 2019-10-16  7:21 Ahmad Fatoum
  2019-10-16  7:21 ` [PATCH 2/5] efi: retire efi_compare_guid in favor of efi_guidcmp Ahmad Fatoum
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2019-10-16  7:21 UTC (permalink / raw)
  To: barebox

s/Conosle/Console/

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 common/efi-guid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/efi-guid.c b/common/efi-guid.c
index 1e45ccf4d238..2bf2395e8540 100644
--- a/common/efi-guid.c
+++ b/common/efi-guid.c
@@ -52,7 +52,7 @@ const char *efi_guid_string(efi_guid_t *g)
 	EFI_GUID_STRING(EFI_ISA_IO_PROTOCOL_GUID, "ISA IO Protocol", "ISA IO Protocol");
 	EFI_GUID_STRING(EFI_STANDARD_ERROR_DEVICE_GUID, "Standard Error Device Guid", "EFI Standard Error Device Guid");
 	EFI_GUID_STRING(EFI_CONSOLE_OUT_DEVICE_GUID, "Console Out Device Guid", "EFI Console Out Device Guid");
-	EFI_GUID_STRING(EFI_CONSOLE_IN_DEVICE_GUID, "Console In Device Guid", "EFI Conosle In Device Guid");
+	EFI_GUID_STRING(EFI_CONSOLE_IN_DEVICE_GUID, "Console In Device Guid", "EFI Console In Device Guid");
 	EFI_GUID_STRING(EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID, "Simple Text Out Protocol", "EFI 1.0 Simple Text Out Protocol");
 	EFI_GUID_STRING(EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID, "Simple Text Input Ex Protocol", "UEFI 2.1 Simple Text Input Ex Protocol");
 	EFI_GUID_STRING(EFI_SIMPLE_TEXT_IN_PROTOCOL_GUID, "Simple Text In Protocol", "EFI 1.0 Simple Text In Protocol");
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/5] efi: retire efi_compare_guid in favor of efi_guidcmp
  2019-10-16  7:21 [PATCH 1/5] efi: Fix typo in description string Ahmad Fatoum
@ 2019-10-16  7:21 ` Ahmad Fatoum
  2019-10-16  7:21 ` [PATCH 3/5] efi: use efi_guidcmp helper where appropriate Ahmad Fatoum
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2019-10-16  7:21 UTC (permalink / raw)
  To: barebox

Both functions wrap the same memcmp except that one uses pointers to
GUIDs and the other passes the GUIDs by value.

The function is static inline, so it doesn't really matter which one we
keep. We'll drop efi_compare_guid because it's been used once only in the
code base so far.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 common/efi-devicepath.c | 2 +-
 include/efi.h           | 5 -----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/common/efi-devicepath.c b/common/efi-devicepath.c
index 24722284b4a7..3db2cea061ca 100644
--- a/common/efi-devicepath.c
+++ b/common/efi-devicepath.c
@@ -572,7 +572,7 @@ dev_path_vendor(struct string *str, void *dev_path)
 	}
 
 	cprintf(str, "Ven%s(%pU", type, &Vendor->Guid);
-	if (efi_compare_guid(&Vendor->Guid, &efi_unknown_device_guid) == 0) {
+	if (efi_guidcmp(Vendor->Guid, efi_unknown_device_guid) == 0) {
 		/* GUID used by EFI to enumerate an EDD 1.1 device */
 		unknown_dev_path =
 		    (struct unknown_device_vendor_device_path *) Vendor;
diff --git a/include/efi.h b/include/efi.h
index 218333f82426..166803a58f39 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -664,11 +664,6 @@ typedef union {
 	efi_ipv6_address v6;
 } efi_ip_address;
 
-static inline int efi_compare_guid(efi_guid_t *a, efi_guid_t *b)
-{
-	return memcmp(a, b, sizeof(efi_guid_t));
-}
-
 struct efi_device_path *device_path_from_handle(efi_handle_t Handle);
 char *device_path_to_str(struct efi_device_path *dev_path);
 u8 device_path_to_type(struct efi_device_path *dev_path);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/5] efi: use efi_guidcmp helper where appropriate
  2019-10-16  7:21 [PATCH 1/5] efi: Fix typo in description string Ahmad Fatoum
  2019-10-16  7:21 ` [PATCH 2/5] efi: retire efi_compare_guid in favor of efi_guidcmp Ahmad Fatoum
@ 2019-10-16  7:21 ` Ahmad Fatoum
  2019-10-16  7:21 ` [PATCH 4/5] x86: include: add asmlinkage 'storage class' Ahmad Fatoum
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2019-10-16  7:21 UTC (permalink / raw)
  To: barebox

We have a helper for it. Let's use it.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/efi/efi-device.c | 2 +-
 fs/efivarfs.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/efi/efi-device.c b/drivers/efi/efi-device.c
index 305d337aabf5..68d81caf010b 100644
--- a/drivers/efi/efi-device.c
+++ b/drivers/efi/efi-device.c
@@ -311,7 +311,7 @@ static int efi_bus_match(struct device_d *dev, struct driver_d *drv)
 	int i;
 
 	for (i = 0; i < efidev->num_guids; i++) {
-		if (!memcmp(&efidrv->guid, &efidev->guids[i], sizeof(efi_guid_t))) {
+		if (!efi_guidcmp(efidrv->guid, efidev->guids[i])) {
 			BS->handle_protocol(efidev->handle, &efidev->guids[i],
 					&efidev->protocol);
 			return 0;
diff --git a/fs/efivarfs.c b/fs/efivarfs.c
index 1e8049362168..9eadda41215c 100644
--- a/fs/efivarfs.c
+++ b/fs/efivarfs.c
@@ -145,7 +145,7 @@ static int efivars_create(struct device_d *dev, const char *pathname, mode_t mod
 	if (ret)
 		return -ENOENT;
 
-	if (memcmp(&vendor, &EFI_BAREBOX_VENDOR_GUID, sizeof(efi_guid_t)))
+	if (efi_guidcmp(vendor, EFI_BAREBOX_VENDOR_GUID))
 		return -EPERM;
 
 	inode = xzalloc(sizeof(*inode));
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/5] x86: include: add asmlinkage 'storage class'
  2019-10-16  7:21 [PATCH 1/5] efi: Fix typo in description string Ahmad Fatoum
  2019-10-16  7:21 ` [PATCH 2/5] efi: retire efi_compare_guid in favor of efi_guidcmp Ahmad Fatoum
  2019-10-16  7:21 ` [PATCH 3/5] efi: use efi_guidcmp helper where appropriate Ahmad Fatoum
@ 2019-10-16  7:21 ` Ahmad Fatoum
  2019-10-16  7:21 ` [PATCH 5/5] efi: silence warning about un-prototyped assembly-called functions Ahmad Fatoum
  2019-10-18 11:56 ` [PATCH 1/5] efi: Fix typo in description string Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2019-10-16  7:21 UTC (permalink / raw)
  To: barebox

We've a number of C functions with external linkage that are only called
from assembly. -Wmissing-prototypes warns about these unless they have
a prototype that goes unused. Let's standardize on using the asmlinkage
'storage class' to mark such declarations.

As <linux/linkage.h> defines asmlinkage to naught unless <asm/linkage.h>
does, it's sufficient to add an empty header to make this usable on x86
as well.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/x86/include/asm/linkage.h | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 arch/x86/include/asm/linkage.h

diff --git a/arch/x86/include/asm/linkage.h b/arch/x86/include/asm/linkage.h
new file mode 100644
index 000000000000..a8d1bdb7de1f
--- /dev/null
+++ b/arch/x86/include/asm/linkage.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_LINKAGE_H
+#define __ASM_LINKAGE_H
+
+/* referenced by <linux/linkage.h> */
+
+#endif
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 5/5] efi: silence warning about un-prototyped assembly-called functions
  2019-10-16  7:21 [PATCH 1/5] efi: Fix typo in description string Ahmad Fatoum
                   ` (2 preceding siblings ...)
  2019-10-16  7:21 ` [PATCH 4/5] x86: include: add asmlinkage 'storage class' Ahmad Fatoum
@ 2019-10-16  7:21 ` Ahmad Fatoum
  2019-10-18 11:56 ` [PATCH 1/5] efi: Fix typo in description string Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2019-10-16  7:21 UTC (permalink / raw)
  To: barebox

Both _relocate and efi_main are only called from assembly, but
-Wmissing-prototypes doesn't know that and warns about them.
Pre-declare prototypes to silence the warnings.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/x86/mach-efi/reloc_x86_64.c | 3 +++
 common/efi/efi.c                 | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/arch/x86/mach-efi/reloc_x86_64.c b/arch/x86/mach-efi/reloc_x86_64.c
index 1db72f5dbc52..e83bacb302ca 100644
--- a/arch/x86/mach-efi/reloc_x86_64.c
+++ b/arch/x86/mach-efi/reloc_x86_64.c
@@ -35,11 +35,14 @@
     SUCH DAMAGE.
 */
 
+#include <linux/linkage.h>
 #include <common.h>
 #include <efi.h>
 
 #include <elf.h>
 
+asmlinkage efi_status_t _relocate (long, Elf64_Dyn *, efi_handle_t, efi_system_table_t *);
+
 efi_status_t _relocate (long ldbase, Elf64_Dyn *dyn, efi_handle_t image, efi_system_table_t *systab)
 {
 	long relsz = 0, relent = 0;
diff --git a/common/efi/efi.c b/common/efi/efi.c
index a7b25cbbe251..73cea3703695 100644
--- a/common/efi/efi.c
+++ b/common/efi/efi.c
@@ -17,6 +17,7 @@
  *
  */
 
+#include <linux/linkage.h>
 #include <common.h>
 #include <linux/sizes.h>
 #include <memory.h>
@@ -318,6 +319,8 @@ static int efi_init(void)
 }
 device_initcall(efi_init);
 
+asmlinkage efi_status_t efi_main(efi_handle_t, efi_system_table_t *);
+
 /**
  * efi-main - Entry point for EFI images
  */
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/5] efi: Fix typo in description string
  2019-10-16  7:21 [PATCH 1/5] efi: Fix typo in description string Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2019-10-16  7:21 ` [PATCH 5/5] efi: silence warning about un-prototyped assembly-called functions Ahmad Fatoum
@ 2019-10-18 11:56 ` Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2019-10-18 11:56 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Wed, Oct 16, 2019 at 09:21:35AM +0200, Ahmad Fatoum wrote:
> s/Conosle/Console/
> 
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
>  common/efi-guid.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-18 11:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16  7:21 [PATCH 1/5] efi: Fix typo in description string Ahmad Fatoum
2019-10-16  7:21 ` [PATCH 2/5] efi: retire efi_compare_guid in favor of efi_guidcmp Ahmad Fatoum
2019-10-16  7:21 ` [PATCH 3/5] efi: use efi_guidcmp helper where appropriate Ahmad Fatoum
2019-10-16  7:21 ` [PATCH 4/5] x86: include: add asmlinkage 'storage class' Ahmad Fatoum
2019-10-16  7:21 ` [PATCH 5/5] efi: silence warning about un-prototyped assembly-called functions Ahmad Fatoum
2019-10-18 11:56 ` [PATCH 1/5] efi: Fix typo in description string Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox