[coreboot-gerrit] Change in coreboot[master]: lib/cbfs: Remove cbfs_boot_map_optionrom from cbfs impl

Philipp Deppenwiese (Code Review) gerrit at coreboot.org
Mon Mar 5 11:41:42 CET 2018


Philipp Deppenwiese has uploaded this change for review. ( https://review.coreboot.org/24994


Change subject: lib/cbfs: Remove cbfs_boot_map_optionrom from cbfs impl
......................................................................

lib/cbfs: Remove cbfs_boot_map_optionrom from cbfs impl

* Move cbfs_boot_map_optionrom to device/pci_rom.c

Change-Id: I57a35d3ce95850d22f79a1045a30b7c6b011bb68
Signed-off-by: zaolin <zaolin at das-labor.org>
---
M src/device/pci_rom.c
M src/include/cbfs.h
M src/lib/cbfs.c
3 files changed, 25 insertions(+), 26 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/24994/1

diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c
index a411f06..e2a62cb 100644
--- a/src/device/pci_rom.c
+++ b/src/device/pci_rom.c
@@ -24,11 +24,35 @@
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
 #include <string.h>
-#include <cbfs.h>
+#include <blob_provider.h>
 
 /* Rmodules don't like weak symbols. */
 u32 __attribute__((weak)) map_oprom_vendev(u32 vendev) { return vendev; }
 
+static inline int tohex4(unsigned int c)
+{
+	return (c <= 9) ? (c + '0') : (c - 10 + 'a');
+}
+
+static void tohex16(unsigned int val, char *dest)
+{
+	dest[0] = tohex4(val >> 12);
+	dest[1] = tohex4((val >> 8) & 0xf);
+	dest[2] = tohex4((val >> 4) & 0xf);
+	dest[3] = tohex4(val & 0xf);
+}
+
+static void *cbfs_boot_map_optionrom(uint16_t vendor, uint16_t device)
+{
+	char name[17] = "pciXXXX,XXXX.rom";
+
+	tohex16(vendor, name + 3);
+	tohex16(device, name + 8);
+
+	return blob_read_arbitrary_map(COREBOOT_REGION, name,
+				       CBFS_TYPE_OPTIONROM, NULL);
+}
+
 struct rom_header *pci_rom_probe(struct device *dev)
 {
 	struct rom_header *rom_header;
diff --git a/src/include/cbfs.h b/src/include/cbfs.h
index 1dac504..0dcd0cd 100644
--- a/src/include/cbfs.h
+++ b/src/include/cbfs.h
@@ -23,8 +23,6 @@
  * Perform CBFS operations on the boot device. *
  ***********************************************/
 
-/* Return mapping of option ROM found in boot device. NULL on error. */
-void *cbfs_boot_map_optionrom(uint16_t vendor, uint16_t device);
 /* Load stage by name into memory. Returns entry address on success. NULL on
  * failure. */
 void *cbfs_boot_load_stage_by_name(const char *name);
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 596abc5..709a9ee 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -141,29 +141,6 @@
 	}
 }
 
-static inline int tohex4(unsigned int c)
-{
-	return (c <= 9) ? (c + '0') : (c - 10 + 'a');
-}
-
-static void tohex16(unsigned int val, char *dest)
-{
-	dest[0] = tohex4(val>>12);
-	dest[1] = tohex4((val>>8) & 0xf);
-	dest[2] = tohex4((val>>4) & 0xf);
-	dest[3] = tohex4(val & 0xf);
-}
-
-void *cbfs_boot_map_optionrom(uint16_t vendor, uint16_t device)
-{
-	char name[17] = "pciXXXX,XXXX.rom";
-
-	tohex16(vendor, name+3);
-	tohex16(device, name+8);
-
-	return cbfs_boot_map_with_leak(name, CBFS_TYPE_OPTIONROM, NULL);
-}
-
 void *cbfs_boot_load_stage_by_name(const char *name)
 {
 	struct cbfsf fh;

-- 
To view, visit https://review.coreboot.org/24994
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I57a35d3ce95850d22f79a1045a30b7c6b011bb68
Gerrit-Change-Number: 24994
Gerrit-PatchSet: 1
Gerrit-Owner: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180305/450557dc/attachment-0001.html>


More information about the coreboot-gerrit mailing list