[PATCH v3 3/4] arm: x86: qemu: unify qfw driver functions as qfw_

Asherah Connor ashe at kivikakk.ee
Tue Feb 23 12:43:28 CET 2021


There's a mixture of "qemu_fwcfg_"-prefixed functions and
"qfw_"-prefixed ones.  Now that the qfw name is applied in multiple
places (i.e. the uclass itself, and each of its drivers), let's
consistently use the prefix "qfw_" for anything relating to the
drivers.

Signed-off-by: Asherah Connor <ashe at kivikakk.ee>
---

(no changes since v1)

 arch/x86/cpu/qemu/cpu.c |  2 +-
 arch/x86/cpu/qfw_cpu.c  |  2 +-
 cmd/qfw.c               | 10 +++++-----
 common/qfw.c            | 14 +++++++-------
 drivers/misc/qfw.c      | 20 ++++++++++----------
 include/qfw.h           | 16 ++++++++--------
 6 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/arch/x86/cpu/qemu/cpu.c b/arch/x86/cpu/qemu/cpu.c
index 09499aad78..0a3962df41 100644
--- a/arch/x86/cpu/qemu/cpu.c
+++ b/arch/x86/cpu/qemu/cpu.c
@@ -27,7 +27,7 @@ static int cpu_qemu_get_count(const struct udevice *dev)
 	if (!qfw_dev)
 		return -ENODEV;
 
-	return qemu_fwcfg_online_cpus(qfw_dev);
+	return qfw_online_cpus(qfw_dev);
 }
 
 static const struct cpu_ops cpu_qemu_ops = {
diff --git a/arch/x86/cpu/qfw_cpu.c b/arch/x86/cpu/qfw_cpu.c
index e80cec0ca4..3b94686193 100644
--- a/arch/x86/cpu/qfw_cpu.c
+++ b/arch/x86/cpu/qfw_cpu.c
@@ -55,7 +55,7 @@ int qemu_cpu_fixup(void)
 	}
 
 	/* get actual cpu number */
-	cpu_online = qemu_fwcfg_online_cpus(qfwdev);
+	cpu_online = qfw_online_cpus(qfwdev);
 	if (cpu_online < 0) {
 		printf("unable to get online cpu number: %d\n", cpu_online);
 		return cpu_online;
diff --git a/cmd/qfw.c b/cmd/qfw.c
index a983a45380..e972b26d1e 100644
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -82,13 +82,13 @@ static int qemu_fwcfg_cmd_list_firmware(void)
 	struct fw_file *file;
 
 	/* make sure fw_list is loaded */
-	ret = qemu_fwcfg_read_firmware_list(qfw_dev);
+	ret = qfw_read_firmware_list(qfw_dev);
 	if (ret)
 		return ret;
 
-	for (file = qemu_fwcfg_file_iter_init(qfw_dev, &iter);
-	     !qemu_fwcfg_file_iter_end(&iter);
-	     file = qemu_fwcfg_file_iter_next(&iter)) {
+	for (file = qfw_file_iter_init(qfw_dev, &iter);
+	     !qfw_file_iter_end(&iter);
+	     file = qfw_file_iter_next(&iter)) {
 		printf("%-56s\n", file->cfg.name);
 	}
 
@@ -107,7 +107,7 @@ static int qemu_fwcfg_do_list(struct cmd_tbl *cmdtp, int flag,
 static int qemu_fwcfg_do_cpus(struct cmd_tbl *cmdtp, int flag,
 			      int argc, char *const argv[])
 {
-	printf("%d cpu(s) online\n", qemu_fwcfg_online_cpus(qfw_dev));
+	printf("%d cpu(s) online\n", qfw_online_cpus(qfw_dev));
 	return 0;
 }
 
diff --git a/common/qfw.c b/common/qfw.c
index b4c9e4483c..36b19bdc9b 100644
--- a/common/qfw.c
+++ b/common/qfw.c
@@ -20,7 +20,7 @@ struct udevice *qfw_get_dev(void)
 	return dev;
 }
 
-int qemu_fwcfg_online_cpus(struct udevice *dev)
+int qfw_online_cpus(struct udevice *dev)
 {
 	u16 nb_cpus;
 
@@ -29,7 +29,7 @@ int qemu_fwcfg_online_cpus(struct udevice *dev)
 	return le16_to_cpu(nb_cpus);
 }
 
-int qemu_fwcfg_read_firmware_list(struct udevice *dev)
+int qfw_read_firmware_list(struct udevice *dev)
 {
 	int i;
 	u32 count;
@@ -70,7 +70,7 @@ err:
 	return -ENOMEM;
 }
 
-struct fw_file *qemu_fwcfg_find_file(struct udevice *dev, const char *name)
+struct fw_file *qfw_find_file(struct udevice *dev, const char *name)
 {
 	struct list_head *entry;
 	struct fw_file *file;
@@ -86,8 +86,8 @@ struct fw_file *qemu_fwcfg_find_file(struct udevice *dev, const char *name)
 	return NULL;
 }
 
-struct fw_file *qemu_fwcfg_file_iter_init(struct udevice *dev,
-					  struct fw_cfg_file_iter *iter)
+struct fw_file *qfw_file_iter_init(struct udevice *dev,
+				   struct fw_cfg_file_iter *iter)
 {
 	struct qfw_dev *qdev = dev_get_uclass_priv(dev);
 
@@ -97,14 +97,14 @@ struct fw_file *qemu_fwcfg_file_iter_init(struct udevice *dev,
 			  struct fw_file, list);
 }
 
-struct fw_file *qemu_fwcfg_file_iter_next(struct fw_cfg_file_iter *iter)
+struct fw_file *qfw_file_iter_next(struct fw_cfg_file_iter *iter)
 {
 	iter->entry = ((struct list_head *)iter->entry)->next;
 	return list_entry((struct list_head *)iter->entry,
 			  struct fw_file, list);
 }
 
-bool qemu_fwcfg_file_iter_end(struct fw_cfg_file_iter *iter)
+bool qfw_file_iter_end(struct fw_cfg_file_iter *iter)
 {
 	return iter->entry == iter->end;
 }
diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c
index 25b203375b..4569f1886b 100644
--- a/drivers/misc/qfw.c
+++ b/drivers/misc/qfw.c
@@ -43,7 +43,7 @@ static int bios_linker_allocate(struct udevice *dev,
 		return -EINVAL;
 	}
 
-	file = qemu_fwcfg_find_file(dev, entry->alloc.file);
+	file = qfw_find_file(dev, entry->alloc.file);
 	if (!file) {
 		printf("error: can't find file %s\n", entry->alloc.file);
 		return -ENOENT;
@@ -99,10 +99,10 @@ static int bios_linker_add_pointer(struct udevice *dev,
 	uint32_t offset = le32_to_cpu(entry->pointer.offset);
 	uint64_t pointer = 0;
 
-	dest = qemu_fwcfg_find_file(dev, entry->pointer.dest_file);
+	dest = qfw_find_file(dev, entry->pointer.dest_file);
 	if (!dest || !dest->addr)
 		return -ENOENT;
-	src = qemu_fwcfg_find_file(dev, entry->pointer.src_file);
+	src = qfw_find_file(dev, entry->pointer.src_file);
 	if (!src || !src->addr)
 		return -ENOENT;
 
@@ -133,7 +133,7 @@ static int bios_linker_add_checksum(struct udevice *dev,
 	uint8_t *data, cksum = 0;
 	uint8_t *cksum_start;
 
-	file = qemu_fwcfg_find_file(dev, entry->cksum.file);
+	file = qfw_find_file(dev, entry->cksum.file);
 	if (!file || !file->addr)
 		return -ENOENT;
 
@@ -163,13 +163,13 @@ ulong write_acpi_tables(ulong addr)
 	}
 
 	/* make sure fw_list is loaded */
-	ret = qemu_fwcfg_read_firmware_list(dev);
+	ret = qfw_read_firmware_list(dev);
 	if (ret) {
 		printf("error: can't read firmware file list\n");
 		return addr;
 	}
 
-	file = qemu_fwcfg_find_file(dev, "etc/table-loader");
+	file = qfw_find_file(dev, "etc/table-loader");
 	if (!file) {
 		printf("error: can't find etc/table-loader\n");
 		return addr;
@@ -215,9 +215,9 @@ ulong write_acpi_tables(ulong addr)
 out:
 	if (ret) {
 		struct fw_cfg_file_iter iter;
-		for (file = qemu_fwcfg_file_iter_init(dev, &iter);
-		     !qemu_fwcfg_file_iter_end(&iter);
-		     file = qemu_fwcfg_file_iter_next(&iter)) {
+		for (file = qfw_file_iter_init(dev, &iter);
+		     !qfw_file_iter_end(&iter);
+		     file = qfw_file_iter_next(&iter)) {
 			if (file->addr) {
 				free((void *)file->addr);
 				file->addr = 0;
@@ -240,7 +240,7 @@ ulong acpi_get_rsdp_addr(void)
 		return 0;
 	}
 
-	file = qemu_fwcfg_find_file(dev, "etc/acpi/rsdp");
+	file = qfw_find_file(dev, "etc/acpi/rsdp");
 	return file->addr;
 }
 #endif
diff --git a/include/qfw.h b/include/qfw.h
index d7e16651a2..52ca1533f5 100644
--- a/include/qfw.h
+++ b/include/qfw.h
@@ -8,7 +8,7 @@
 
 #include <linux/list.h>
 
-enum qemu_fwcfg_items {
+enum {
 	FW_CFG_SIGNATURE	= 0x00,
 	FW_CFG_ID		= 0x01,
 	FW_CFG_UUID		= 0x02,
@@ -192,21 +192,21 @@ struct udevice;
 struct udevice *qfw_get_dev(void);
 
 void qfw_read_entry(struct udevice *dev, u16 entry, u32 length, void *address);
-int qemu_fwcfg_read_firmware_list(struct udevice *dev);
-struct fw_file *qemu_fwcfg_find_file(struct udevice *dev, const char *name);
+int qfw_read_firmware_list(struct udevice *dev);
+struct fw_file *qfw_find_file(struct udevice *dev, const char *name);
 
 /**
  * Get system cpu number
  *
  * @return:   cpu number in system
  */
-int qemu_fwcfg_online_cpus(struct udevice *dev);
+int qfw_online_cpus(struct udevice *dev);
 
 /* helper functions to iterate firmware file list */
-struct fw_file *qemu_fwcfg_file_iter_init(struct udevice *dev,
-					  struct fw_cfg_file_iter *iter);
-struct fw_file *qemu_fwcfg_file_iter_next(struct fw_cfg_file_iter *iter);
-bool qemu_fwcfg_file_iter_end(struct fw_cfg_file_iter *iter);
+struct fw_file *qfw_file_iter_init(struct udevice *dev,
+				   struct fw_cfg_file_iter *iter);
+struct fw_file *qfw_file_iter_next(struct fw_cfg_file_iter *iter);
+bool qfw_file_iter_end(struct fw_cfg_file_iter *iter);
 
 /**
  * qemu_cpu_fixup() - Fix up the CPUs for QEMU
-- 
2.20.1



More information about the U-Boot mailing list