summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleksij Rempel <o.rempel@pengutronix.de>2019-02-15 10:00:37 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-02-18 14:25:05 +0100
commit5f7ed0da830d40fd738068d0fe5613076f3a4631 (patch)
tree1b095a3140ccad1af4976c33f165d879e8c37e40
parentd1bebc03b3005b33da3d1541782bb037974d1486 (diff)
downloadbarebox-5f7ed0da830d40fd738068d0fe5613076f3a4631.tar.gz
efi: cleanups
make local functions static and remove unused code Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/efi-devicepath.c222
-rw-r--r--common/efi/efi-image.c2
-rw-r--r--drivers/block/efi-block-io.c2
-rw-r--r--drivers/clocksource/efi_x86.c4
-rw-r--r--drivers/efi/efi-device.c2
-rw-r--r--drivers/net/efi-snp.c2
-rw-r--r--fs/efi.c2
-rw-r--r--fs/efivarfs.c2
8 files changed, 9 insertions, 229 deletions
diff --git a/common/efi-devicepath.c b/common/efi-devicepath.c
index 54c2f4e..2472228 100644
--- a/common/efi-devicepath.c
+++ b/common/efi-devicepath.c
@@ -453,34 +453,6 @@ struct efi_device_path end_instance_device_path = {
.length = END_DEVICE_PATH_LENGTH,
};
-unsigned long
-device_path_size(struct efi_device_path *dev_path)
-{
- struct efi_device_path *Start;
-
- Start = dev_path;
- while (!is_device_path_end(dev_path))
- dev_path = next_device_path_node(dev_path);
-
- return ((unsigned long) dev_path - (unsigned long) Start) +
- sizeof (struct efi_device_path);
-}
-
-struct efi_device_path *
-duplicate_device_path(struct efi_device_path *dev_path)
-{
- struct efi_device_path *new_dev_path;
- unsigned long Size;
-
- Size = device_path_size(dev_path);
-
- new_dev_path = malloc(Size);
- if (new_dev_path)
- memcpy(new_dev_path, dev_path, Size);
-
- return new_dev_path;
-}
-
struct efi_device_path *
device_path_from_handle(efi_handle_t Handle)
{
@@ -495,134 +467,7 @@ device_path_from_handle(efi_handle_t Handle)
return device_path;
}
-struct efi_device_path *
-device_path_instance(struct efi_device_path **device_path, unsigned long *Size)
-{
- struct efi_device_path *Start, *Next, *dev_path;
- unsigned long Count;
-
- dev_path = *device_path;
- Start = dev_path;
-
- if (!dev_path)
- return NULL;
-
- for (Count = 0;; Count++) {
- Next = next_device_path_node(dev_path);
-
- if (is_device_path_end_type(dev_path))
- break;
-
- dev_path = Next;
- }
-
- if (dev_path->sub_type == END_ENTIRE_DEVICE_PATH_SUBTYPE)
- Next = NULL;
-
- *device_path = Next;
-
- *Size = ((u8 *) dev_path) - ((u8 *) Start);
-
- return Start;
-}
-
-unsigned long
-device_path_instance_count(struct efi_device_path *device_path)
-{
- unsigned long Count, Size;
-
- Count = 0;
- while (device_path_instance(&device_path, &Size)) {
- Count += 1;
- }
-
- return Count;
-}
-
-struct efi_device_path *
-append_device_path(struct efi_device_path *Src1, struct efi_device_path *Src2)
-/*
- * Src1 may have multiple "instances" and each instance is appended
- * Src2 is appended to each instance is Src1. (E.g., it's possible
- * to append a new instance to the complete device path by passing
- * it in Src2)
- */
-{
- unsigned long src1_size, src1_inst, src2_size, Size;
- struct efi_device_path *Dst, *Inst;
- u8 *dst_pos;
-
- if (!Src1)
- return duplicate_device_path(Src2);
-
- if (!Src2) {
- return duplicate_device_path(Src1);
- }
-
- src1_size = device_path_size(Src1);
- src1_inst = device_path_instance_count(Src1);
- src2_size = device_path_size(Src2);
- Size = src1_size * src1_inst + src2_size;
-
- Dst = malloc(Size);
- if (Dst) {
- dst_pos = (u8 *) Dst;
-
- /* Copy all device path instances */
-
- while ((Inst = device_path_instance(&Src1, &Size))) {
-
- memcpy(dst_pos, Inst, Size);
- dst_pos += Size;
-
- memcpy(dst_pos, Src2, src2_size);
- dst_pos += src2_size;
-
- memcpy(dst_pos, &end_instance_device_path,
- sizeof (struct efi_device_path));
- dst_pos += sizeof (struct efi_device_path);
- }
-
- /* Change last end marker */
- dst_pos -= sizeof (struct efi_device_path);
- memcpy(dst_pos, &end_device_path,
- sizeof (struct efi_device_path));
- }
-
- return Dst;
-}
-
-struct efi_device_path *
-append_device_path_node(struct efi_device_path *Src1,
- struct efi_device_path *Src2)
-/*
- * Src1 may have multiple "instances" and each instance is appended
- * Src2 is a signal device path node (without a terminator) that is
- * appended to each instance is Src1.
- */
-{
- struct efi_device_path *Temp, *Eop;
- unsigned long length;
-
- /* Build a Src2 that has a terminator on it */
-
- length = Src2->length;
- Temp = malloc(length + sizeof (struct efi_device_path));
- if (!Temp)
- return NULL;
-
- memcpy(Temp, Src2, length);
- Eop = next_device_path_node(Temp);
- set_device_path_end_node(Eop);
-
- /* Append device paths */
-
- Src1 = append_device_path(Src1, Temp);
- free(Temp);
- return Src1;
-}
-
-struct efi_device_path *
+static struct efi_device_path *
unpack_device_path(struct efi_device_path *dev_path)
{
struct efi_device_path *Src, *Dest, *new_path;
@@ -665,71 +510,6 @@ unpack_device_path(struct efi_device_path *dev_path)
return new_path;
}
-struct efi_device_path *
-append_device_path_instance(struct efi_device_path *Src,
- struct efi_device_path *Instance)
-{
- u8 *Ptr;
- struct efi_device_path *dev_path;
- unsigned long src_size;
- unsigned long instance_size;
-
- if (Src == NULL)
- return duplicate_device_path(Instance);
-
- src_size = device_path_size(Src);
- instance_size = device_path_size(Instance);
- Ptr = malloc(src_size + instance_size);
- dev_path = (struct efi_device_path *) Ptr;
-
- memcpy(Ptr, Src, src_size);
-
- while (!is_device_path_end(dev_path))
- dev_path = next_device_path_node(dev_path);
-
- /*
- * Convert the End to an End Instance, since we are
- * appending another instacne after this one its a good
- * idea.
- */
- dev_path->sub_type = END_INSTANCE_DEVICE_PATH_SUBTYPE;
-
- dev_path = next_device_path_node(dev_path);
- memcpy(dev_path, Instance, instance_size);
-
- return (struct efi_device_path *) Ptr;
-}
-
-efi_status_t
-lib_device_path_to_interface(efi_guid_t * Protocol,
- struct efi_device_path *file_path,
- void **Interface)
-{
- efi_status_t Status;
- efi_handle_t Device;
-
- Status = BS->locate_device_path(Protocol, &file_path, &Device);
-
- if (!EFI_ERROR(Status)) {
-
- /* If we didn't get a direct match return not found */
- Status = EFI_NOT_FOUND;
-
- if (is_device_path_end(file_path)) {
-
- /* It was a direct match, lookup the protocol interface */
-
- Status =
- BS->handle_protocol(Device, Protocol, Interface);
- }
- }
-
- if (EFI_ERROR(Status))
- *Interface = NULL;
-
- return Status;
-}
-
static void
dev_path_pci(struct string *str, void *dev_path)
{
diff --git a/common/efi/efi-image.c b/common/efi/efi-image.c
index 885348d..939663a 100644
--- a/common/efi/efi-image.c
+++ b/common/efi/efi-image.c
@@ -88,7 +88,7 @@ struct linux_kernel_header {
uint32_t handover_offset; /** */
} __attribute__ ((packed));
-int efi_load_image(const char *file, efi_loaded_image_t **loaded_image,
+static int efi_load_image(const char *file, efi_loaded_image_t **loaded_image,
efi_handle_t *h)
{
void *exe;
diff --git a/drivers/block/efi-block-io.c b/drivers/block/efi-block-io.c
index 2bbeb99..d167d81 100644
--- a/drivers/block/efi-block-io.c
+++ b/drivers/block/efi-block-io.c
@@ -142,7 +142,7 @@ static int is_bio_usbdev(struct efi_device *efidev)
return 0;
}
-int efi_bio_probe(struct efi_device *efidev)
+static int efi_bio_probe(struct efi_device *efidev)
{
int ret;
struct efi_bio_priv *priv;
diff --git a/drivers/clocksource/efi_x86.c b/drivers/clocksource/efi_x86.c
index 4d2657e..f8d3ff8 100644
--- a/drivers/clocksource/efi_x86.c
+++ b/drivers/clocksource/efi_x86.c
@@ -6,7 +6,7 @@
#include <clock.h>
#ifdef __x86_64__
-uint64_t ticks_read(void)
+static uint64_t ticks_read(void)
{
uint64_t a, d;
@@ -15,7 +15,7 @@ uint64_t ticks_read(void)
return (d << 32) | a;
}
#else
-uint64_t ticks_read(void)
+static uint64_t ticks_read(void)
{
uint64_t val;
diff --git a/drivers/efi/efi-device.c b/drivers/efi/efi-device.c
index 5cc68fb..305d337 100644
--- a/drivers/efi/efi-device.c
+++ b/drivers/efi/efi-device.c
@@ -32,7 +32,7 @@
#include <efi/efi-device.h>
#include <linux/err.h>
-int efi_locate_handle(enum efi_locate_search_type search_type,
+static int efi_locate_handle(enum efi_locate_search_type search_type,
efi_guid_t *protocol,
void *search_key,
unsigned long *no_handles,
diff --git a/drivers/net/efi-snp.c b/drivers/net/efi-snp.c
index 4e32513..def2714 100644
--- a/drivers/net/efi-snp.c
+++ b/drivers/net/efi-snp.c
@@ -231,7 +231,7 @@ static int efi_snp_set_ethaddr(struct eth_device *edev, const unsigned char *adr
return 0;
}
-int efi_snp_probe(struct efi_device *efidev)
+static int efi_snp_probe(struct efi_device *efidev)
{
struct eth_device *edev;
struct efi_snp_priv *priv;
diff --git a/fs/efi.c b/fs/efi.c
index 81c1ffe..944d6aa 100644
--- a/fs/efi.c
+++ b/fs/efi.c
@@ -513,7 +513,7 @@ coredevice_initcall(efifs_init);
static int index;
-int efi_fs_probe(struct efi_device *efidev)
+static int efi_fs_probe(struct efi_device *efidev)
{
char *path, *device;
int ret;
diff --git a/fs/efivarfs.c b/fs/efivarfs.c
index a911eac..1e80493 100644
--- a/fs/efivarfs.c
+++ b/fs/efivarfs.c
@@ -67,7 +67,7 @@ static int read_byte_str(const char *str, u8 *out)
return 0;
}
-int efi_guid_parse(const char *str, efi_guid_t *guid)
+static int efi_guid_parse(const char *str, efi_guid_t *guid)
{
int i, ret;
u8 idx[] = { 3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15 };