svn commit: r247378 - in projects/uefi/sys/boot/efi: include libefi
Benno Rice
benno at FreeBSD.org
Wed Feb 27 04:50:29 UTC 2013
Author: benno
Date: Wed Feb 27 04:50:27 2013
New Revision: 247378
URL: http://svnweb.freebsd.org/changeset/base/247378
Log:
Add the ability for a device to have an "alias" handle.
Modified:
projects/uefi/sys/boot/efi/include/efilib.h
projects/uefi/sys/boot/efi/libefi/efipart.c
projects/uefi/sys/boot/efi/libefi/handles.c
Modified: projects/uefi/sys/boot/efi/include/efilib.h
==============================================================================
--- projects/uefi/sys/boot/efi/include/efilib.h Wed Feb 27 04:44:48 2013 (r247377)
+++ projects/uefi/sys/boot/efi/include/efilib.h Wed Feb 27 04:50:27 2013 (r247378)
@@ -41,7 +41,7 @@ extern struct netif_driver efinetif;
void *efi_get_table(EFI_GUID *tbl);
void efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table);
-int efi_register_handles(struct devsw *, EFI_HANDLE *, int);
+int efi_register_handles(struct devsw *, EFI_HANDLE *, EFI_HANDLE *, int);
EFI_HANDLE efi_find_handle(struct devsw *, int);
int efi_handle_lookup(EFI_HANDLE, struct devsw **, int *);
Modified: projects/uefi/sys/boot/efi/libefi/efipart.c
==============================================================================
--- projects/uefi/sys/boot/efi/libefi/efipart.c Wed Feb 27 04:44:48 2013 (r247377)
+++ projects/uefi/sys/boot/efi/libefi/efipart.c Wed Feb 27 04:50:27 2013 (r247378)
@@ -62,7 +62,7 @@ static int
efipart_init(void)
{
EFI_BLOCK_IO *blkio;
- EFI_HANDLE *hin, *hout;
+ EFI_HANDLE *hin, *hout, *aliases;
EFI_STATUS status;
UINTN sz;
u_int n, nin, nout;
@@ -72,7 +72,7 @@ efipart_init(void)
hin = NULL;
status = BS->LocateHandle(ByProtocol, &blkio_guid, 0, &sz, 0);
if (status == EFI_BUFFER_TOO_SMALL) {
- hin = (EFI_HANDLE *)malloc(sz * 2);
+ hin = (EFI_HANDLE *)malloc(sz * 3);
status = BS->LocateHandle(ByProtocol, &blkio_guid, 0, &sz,
hin);
if (EFI_ERROR(status))
@@ -84,8 +84,11 @@ efipart_init(void)
/* Filter handles to only include FreeBSD partitions. */
nin = sz / sizeof(EFI_HANDLE);
hout = hin + nin;
+ aliases = hout + nin;
nout = 0;
+ bzero(aliases, nin * sizeof(EFI_HANDLE));
+
for (n = 0; n < nin; n++) {
status = BS->HandleProtocol(hin[n], &blkio_guid, &blkio);
if (EFI_ERROR(status))
@@ -96,7 +99,7 @@ efipart_init(void)
nout++;
}
- err = efi_register_handles(&efipart_dev, hout, nout);
+ err = efi_register_handles(&efipart_dev, hout, aliases, nout);
free(hin);
return (err);
}
Modified: projects/uefi/sys/boot/efi/libefi/handles.c
==============================================================================
--- projects/uefi/sys/boot/efi/libefi/handles.c Wed Feb 27 04:44:48 2013 (r247377)
+++ projects/uefi/sys/boot/efi/libefi/handles.c Wed Feb 27 04:50:27 2013 (r247378)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
struct entry {
EFI_HANDLE handle;
+ EFI_HANDLE alias;
struct devsw *dev;
int unit;
};
@@ -40,7 +41,8 @@ struct entry *entry;
int nentries;
int
-efi_register_handles(struct devsw *sw, EFI_HANDLE *handles, int count)
+efi_register_handles(struct devsw *sw, EFI_HANDLE *handles,
+ EFI_HANDLE *aliases, int count)
{
size_t sz;
int idx, unit;
@@ -51,6 +53,7 @@ efi_register_handles(struct devsw *sw, E
entry = (entry == NULL) ? malloc(sz) : realloc(entry, sz);
for (unit = 0; idx < nentries; idx++, unit++) {
entry[idx].handle = handles[unit];
+ entry[idx].alias = aliases[unit];
entry[idx].dev = sw;
entry[idx].unit = unit;
}
@@ -78,7 +81,7 @@ efi_handle_lookup(EFI_HANDLE h, struct d
int idx;
for (idx = 0; idx < nentries; idx++) {
- if (entry[idx].handle != h)
+ if (entry[idx].handle != h && entry[idx].alias != h)
continue;
if (dev != NULL)
*dev = entry[idx].dev;
More information about the svn-src-projects
mailing list