summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_driver.c
diff options
context:
space:
mode:
authorMichael Brown2011-04-08 00:01:05 +0200
committerMichael Brown2011-04-08 00:15:06 +0200
commit870524a3b26de3b22bef680a783c2356c88f6433 (patch)
treea3345565b250160d55d5856bb04115041e63fd5d /src/interface/efi/efi_driver.c
parent[device] Make driver name a generic device property (diff)
downloadipxe-870524a3b26de3b22bef680a783c2356c88f6433.tar.gz
ipxe-870524a3b26de3b22bef680a783c2356c88f6433.tar.xz
ipxe-870524a3b26de3b22bef680a783c2356c88f6433.zip
[efi] Add EFI string formatting functions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_driver.c')
-rw-r--r--src/interface/efi/efi_driver.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/interface/efi/efi_driver.c b/src/interface/efi/efi_driver.c
index 17ec881d..4aa976f9 100644
--- a/src/interface/efi/efi_driver.c
+++ b/src/interface/efi/efi_driver.c
@@ -23,6 +23,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/efi/efi.h>
#include <ipxe/efi/Protocol/DriverBinding.h>
#include <ipxe/efi/Protocol/ComponentName2.h>
+#include <ipxe/efi/efi_strings.h>
#include <ipxe/efi/efi_driver.h>
#include <config/general.h>
@@ -107,8 +108,6 @@ EFI_STATUS efi_driver_install ( struct efi_driver *efidrv ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_DRIVER_BINDING_PROTOCOL *driver = &efidrv->driver;
EFI_COMPONENT_NAME2_PROTOCOL *wtf = &efidrv->wtf;
- char buf[ sizeof ( efidrv->wname ) / sizeof ( efidrv->wname[0] ) ];
- unsigned int i;
EFI_STATUS efirc;
/* Configure driver binding protocol */
@@ -120,12 +119,10 @@ EFI_STATUS efi_driver_install ( struct efi_driver *efidrv ) {
wtf->SupportedLanguages = "en";
/* Fill in driver name */
- snprintf ( buf, sizeof ( buf ), PRODUCT_SHORT_NAME " - %s",
- efidrv->name );
- for ( i = 0 ; i < sizeof ( buf ) ; i++ ) {
- /* Damn Unicode names */
- efidrv->wname[i] = *( ( ( unsigned char * ) buf ) + i );
- }
+ efi_snprintf ( efidrv->wname,
+ ( sizeof ( efidrv->wname ) /
+ sizeof ( efidrv->wname[0] ) ),
+ PRODUCT_SHORT_NAME " - %s", efidrv->name );
/* Install driver */
if ( ( efirc = bs->InstallMultipleProtocolInterfaces (