Shuo Liu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/80578?usp=email )
Change subject: soc/intel/xeon_sp: Add support for is_ioat_iio_stack_res
......................................................................
Patch Set 8:
(1 comment)
File src/soc/intel/xeon_sp/include/soc/util.h:
https://review.coreboot.org/c/coreboot/+/80578/comment/3976c87d_3d24e24e :
PS7, Line 28: #if CONFIG(HAVE_IOAT_DOMAINS)
> something maybe for a follow-up patch, but i'd prefer to put the is_ioat_iio_stack_res call in the c […]
sure, will have one.
--
To view, visit https://review.coreboot.org/c/coreboot/+/80578?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I376928ad89b68b294734000678dad6f070d3c97d
Gerrit-Change-Number: 80578
Gerrit-PatchSet: 8
Gerrit-Owner: Shuo Liu <shuo.liu(a)intel.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Christian Walter <christian.walter(a)9elements.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Johnny Lin <Johnny_Lin(a)wiwynn.com>
Gerrit-Reviewer: Lean Sheng Tan <sheng.tan(a)9elements.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Patrick Rudolph <patrick.rudolph(a)9elements.com>
Gerrit-Reviewer: Shuo Liu <shuo.liu(a)intel.com>
Gerrit-Reviewer: Tim Chu <Tim.Chu(a)quantatw.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Wed, 21 Feb 2024 02:42:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-MessageType: comment
Attention is currently required from: Nicholas Sudsgaard.
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/80411?usp=email
to look at the new patch set (#13).
The following approvals got outdated and were removed:
Verified+1 by build bot (Jenkins)
Change subject: Documentation/mainboard/lenovo: Add ThinkCentre M710s
......................................................................
Documentation/mainboard/lenovo: Add ThinkCentre M710s
Change-Id: I90311257a28bd463712c4d43f8b83baa745509cc
Signed-off-by: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
---
M Documentation/mainboard/index.md
A Documentation/mainboard/lenovo/ch341a_pinout.jpg
A Documentation/mainboard/lenovo/thinkcentre_m710s.md
A Documentation/mainboard/lenovo/thinkcentre_m710s_spi_location.jpg
4 files changed, 208 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/80411/13
--
To view, visit https://review.coreboot.org/c/coreboot/+/80411?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I90311257a28bd463712c4d43f8b83baa745509cc
Gerrit-Change-Number: 80411
Gerrit-PatchSet: 13
Gerrit-Owner: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
Gerrit-MessageType: newpatchset
Attention is currently required from: Alexander Couzens, Felix Singer, Nicholas Chin, Nico Huber, Paul Menzel.
Hello Alexander Couzens, Nico Huber, Paul Menzel, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/80343?usp=email
to look at the new patch set (#15).
The following approvals got outdated and were removed:
Verified+1 by build bot (Jenkins)
Change subject: mainboard/lenovo: Add ThinkCentre M710s (Skylake)
......................................................................
mainboard/lenovo: Add ThinkCentre M710s (Skylake)
The processor may be a Pentium or 6/7th generation Core i3/i5/i7.
This port was tested on an i5-7400.
Working:
- Can boot Ubuntu 22.04.1 (Linux 6.5.0) using payloads:
- SeaBIOS
- TianoCore EDK 2
- Internal flashing
- PEG
- PCIe
- SATA
- M.2 SSD
- M.2 WLAN (+ Bluetooth)
- LAN
- USB
- Memory card reader
- CPU fan
- VGA (DP bridge)
- Display ports
- Audio (output)
- COM1
- TPM
Not Working:
- SATA ACPI error
- SuperIO related things
- Power button LED
- PCIe clock related things and AER issues (LiveCD)
- Some drm issue when using EDK 2 and libgfxinit (LiveCD)
- ME cleaner
Untested:
- Audio (input)
Won't Test:
- COM2 header
- LPT header
- PS/2 keyboard and mouse
Thanks to Nico Huber and everyone else on the IRC for helping me write
my first port!
Change-Id: I551753aecfbd2c0ee57d85bb22cb943eb21af3cc
Signed-off-by: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
---
A src/mainboard/lenovo/thinkcentre_m710s/Kconfig
A src/mainboard/lenovo/thinkcentre_m710s/Kconfig.name
A src/mainboard/lenovo/thinkcentre_m710s/Makefile.mk
A src/mainboard/lenovo/thinkcentre_m710s/acpi/ec.asl
A src/mainboard/lenovo/thinkcentre_m710s/acpi/superio.asl
A src/mainboard/lenovo/thinkcentre_m710s/board_info.txt
A src/mainboard/lenovo/thinkcentre_m710s/bootblock.c
A src/mainboard/lenovo/thinkcentre_m710s/data.vbt
A src/mainboard/lenovo/thinkcentre_m710s/devicetree.cb
A src/mainboard/lenovo/thinkcentre_m710s/dsdt.asl
A src/mainboard/lenovo/thinkcentre_m710s/gma-mainboard.ads
A src/mainboard/lenovo/thinkcentre_m710s/gpio.h
A src/mainboard/lenovo/thinkcentre_m710s/hda_verb.c
A src/mainboard/lenovo/thinkcentre_m710s/ramstage.c
A src/mainboard/lenovo/thinkcentre_m710s/romstage.c
15 files changed, 700 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/43/80343/15
--
To view, visit https://review.coreboot.org/c/coreboot/+/80343?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I551753aecfbd2c0ee57d85bb22cb943eb21af3cc
Gerrit-Change-Number: 80343
Gerrit-PatchSet: 15
Gerrit-Owner: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
Gerrit-Reviewer: Alexander Couzens <lynxis(a)fe80.eu>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Felix Singer <service+coreboot-gerrit(a)felixsinger.de>
Gerrit-CC: Nicholas Chin <nic.c3.14(a)gmail.com>
Gerrit-Attention: Felix Singer <service+coreboot-gerrit(a)felixsinger.de>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nicholas Chin <nic.c3.14(a)gmail.com>
Gerrit-Attention: Alexander Couzens <lynxis(a)fe80.eu>
Gerrit-MessageType: newpatchset
Attention is currently required from: Derek Huang, Kapil Porwal, Nick Vaccaro, Rasheed Hsueh, Subrata Banik.
Eric Lai has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/80342?usp=email )
Change subject: mb/google/brya: Create yavista variant
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
> Please select appropriate baseboard and I2C bus of TPM
I think that can update in following patch.
--
To view, visit https://review.coreboot.org/c/coreboot/+/80342?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I6fa464a4dcd9551a42e8746e64c724b3582dbe02
Gerrit-Change-Number: 80342
Gerrit-PatchSet: 2
Gerrit-Owner: Rasheed Hsueh <hsueh.rasheed(a)inventec.corp-partner.google.com>
Gerrit-Reviewer: Derek Huang <derekhuang(a)google.com>
Gerrit-Reviewer: Eric Lai <ericllai(a)google.com>
Gerrit-Reviewer: Kapil Porwal <kapilporwal(a)google.com>
Gerrit-Reviewer: Nick Vaccaro <nvaccaro(a)chromium.org>
Gerrit-Reviewer: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Henry Sun <henrysun(a)google.com>
Gerrit-CC: Ryan Lin <ryan.lin(a)intel.corp-partner.google.com>
Gerrit-Attention: Subrata Banik <subratabanik(a)google.com>
Gerrit-Attention: Derek Huang <derekhuang(a)google.com>
Gerrit-Attention: Kapil Porwal <kapilporwal(a)google.com>
Gerrit-Attention: Rasheed Hsueh <hsueh.rasheed(a)inventec.corp-partner.google.com>
Gerrit-Attention: Nick Vaccaro <nvaccaro(a)chromium.org>
Gerrit-Comment-Date: Wed, 21 Feb 2024 01:47:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Kapil Porwal <kapilporwal(a)google.com>
Gerrit-MessageType: comment
Attention is currently required from: Andrey Petrov, Ronak Kanabar, Subrata Banik.
Hello Andrey Petrov, Ronak Kanabar, Subrata Banik, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/80574?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Verified+1 by build bot (Jenkins)
Change subject: drivers/intel/fsp2_0/ppi: Fix FSP PPI callback calling convention
......................................................................
drivers/intel/fsp2_0/ppi: Fix FSP PPI callback calling convention
Multi Processor PEIM-to-PEIM Interface deals with pointer to function
living in FSP space and which therefore need to be called with the
appropriate calling convention.
By casting the callback pointer to a `void (*)(void *)' when calling
`mp_run_on_all_aps' the C calling convention attribute is lost and the
the code generated by the compiler does not match the FSP function
calling convention.
This commit adds a function indirection to ensure FSP callbacks are
invoked correctly.
TEST=verified on Lunar Lake RVP board (lnlrvp)
Change-Id: If0397f5cc8d0f4f1872bd37a001fe42e0c37ec95
Signed-off-by: Jeremy Compostella <jeremy.compostella(a)intel.com>
---
M src/drivers/intel/fsp2_0/ppi/mp_service_ppi.c
1 file changed, 32 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/74/80574/4
--
To view, visit https://review.coreboot.org/c/coreboot/+/80574?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: If0397f5cc8d0f4f1872bd37a001fe42e0c37ec95
Gerrit-Change-Number: 80574
Gerrit-PatchSet: 4
Gerrit-Owner: Jérémy Compostella <jeremy.compostella(a)intel.com>
Gerrit-Reviewer: Andrey Petrov <andrey.petrov(a)gmail.com>
Gerrit-Reviewer: Ronak Kanabar <ronak.kanabar(a)intel.com>
Gerrit-Reviewer: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Subrata Banik <subratabanik(a)google.com>
Gerrit-Attention: Ronak Kanabar <ronak.kanabar(a)intel.com>
Gerrit-Attention: Andrey Petrov <andrey.petrov(a)gmail.com>
Gerrit-MessageType: newpatchset
Attention is currently required from: Arthur Heymans.
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/68160?usp=email )
Change subject: util/cbfstool: Add a new mechanism to provide a memory map
......................................................................
Patch Set 8:
(1 comment)
File util/cbfstool/cbfstool.c:
https://review.coreboot.org/c/coreboot/+/68160/comment/006e9c25_59341f2d :
PS8, Line 1974: " [--ext-win-base win-base --ext-win-size win-size] "
I just noticed that you forgot to update the help text here, it still says --ext-win-base today.
--
To view, visit https://review.coreboot.org/c/coreboot/+/68160?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I38ab4c369704497f711e14ecda3ff3a8cdc0d089
Gerrit-Change-Number: 68160
Gerrit-PatchSet: 8
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Bao Zheng <fishbaozi(a)gmail.com>
Gerrit-CC: Kapil Porwal <kapilporwal(a)google.com>
Gerrit-CC: Maximilian Brune <maximilian.brune(a)9elements.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Comment-Date: Wed, 21 Feb 2024 01:21:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Derek Huang, Nick Vaccaro, Rasheed Hsueh, Subrata Banik.
Ryan Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/80342?usp=email )
Change subject: mb/google/brya: Create yavista variant
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
Could you refer to "config BOARD_GOOGLE_YAVIKS" to select "BOARD_GOOGLE_BASEBOARD_NISSA" and other functions which will be applied to Yavista.
--
To view, visit https://review.coreboot.org/c/coreboot/+/80342?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I6fa464a4dcd9551a42e8746e64c724b3582dbe02
Gerrit-Change-Number: 80342
Gerrit-PatchSet: 2
Gerrit-Owner: Rasheed Hsueh <hsueh.rasheed(a)inventec.corp-partner.google.com>
Gerrit-Reviewer: Derek Huang <derekhuang(a)google.com>
Gerrit-Reviewer: Eric Lai <ericllai(a)google.com>
Gerrit-Reviewer: Kapil Porwal <kapilporwal(a)google.com>
Gerrit-Reviewer: Nick Vaccaro <nvaccaro(a)chromium.org>
Gerrit-Reviewer: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Henry Sun <henrysun(a)google.com>
Gerrit-CC: Ryan Lin <ryan.lin(a)intel.corp-partner.google.com>
Gerrit-Attention: Subrata Banik <subratabanik(a)google.com>
Gerrit-Attention: Derek Huang <derekhuang(a)google.com>
Gerrit-Attention: Rasheed Hsueh <hsueh.rasheed(a)inventec.corp-partner.google.com>
Gerrit-Attention: Nick Vaccaro <nvaccaro(a)chromium.org>
Gerrit-Comment-Date: Wed, 21 Feb 2024 01:08:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Nicholas Chin, Nicholas Sudsgaard.
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/80577?usp=email )
Change subject: include/device/azalia.h: Add enum for misc field
......................................................................
Patch Set 1:
(1 comment)
File src/include/device/azalia.h:
https://review.coreboot.org/c/coreboot/+/80577/comment/fcb5621a_8cbe2164 :
PS1, Line 110: enum AzaliaPinCfgMisc misc:4;
I just saw this patch go by and I don't know what this driver is about, but just wanted to mention that I'd generally caution about using enumerated types in bitfields like this. Maybe that's just superstition but I think the general folk wisdom in C is to never mix types within a bitfield because the details of how different compilers allocate that can be unpredictable. (There's also not much benefit of using the enum types here since you don't get any extra type checking from that.)
I would recommend writing a type like this this way:
```
union AzaliaPinConfiguration {
uint32_t value;
struct {
uint32_t port:2;
uint32_t location:6;
uint32_t device:4;
uint32_t connection:4;
uint32_t color:4;
uint32_t misc:4;
uint32_t association:4;
uint32_t sequence:4;
};
}
```
Using the same fixed-width type for every field should make sure the compiler allocates all fields within that single 4-byte region. You shouldn't need any explicit alignment or packing attributes, since the alignment defaults to the alignment of the uint32_t type and there's no reason for the compiler to insert padding between bitfields of the same type. (In cases where not all bits of the full 4-byte space are used, it would also be best practice to insert an explicit "padding" field at the end for the remaining bits so that the compiler doesn't need to make any padding decisions by itself.)
--
To view, visit https://review.coreboot.org/c/coreboot/+/80577?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Iff9d146fe8fbff3d11655ddfcc415b1a2c582ccf
Gerrit-Change-Number: 80577
Gerrit-PatchSet: 1
Gerrit-Owner: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Julius Werner <jwerner(a)chromium.org>
Gerrit-CC: Nicholas Chin <nic.c3.14(a)gmail.com>
Gerrit-Attention: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
Gerrit-Attention: Nicholas Chin <nic.c3.14(a)gmail.com>
Gerrit-Comment-Date: Wed, 21 Feb 2024 00:54:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Jakub Czapiga.
Hello Jakub Czapiga,
I'd like you to do a code review.
Please visit
https://review.coreboot.org/c/coreboot/+/80650?usp=email
to review the following change.
Change subject: libpayload: Remove legacy CBFS API
......................................................................
libpayload: Remove legacy CBFS API
It's been several years already since we announced the deprecation of
the legacy CBFS API for payloads. It's time to remove it completely.
Change-Id: I0ed157ac2d1376b8dff4537af9a63731064b45f6
Signed-off-by: Julius Werner <jwerner(a)chromium.org>
---
M payloads/libpayload/arch/arm/Makefile.mk
D payloads/libpayload/arch/arm/dummy_media.c
M payloads/libpayload/arch/arm64/Makefile.mk
D payloads/libpayload/arch/arm64/dummy_media.c
M payloads/libpayload/arch/mock/Makefile.mk
D payloads/libpayload/arch/mock/mock_media.c
M payloads/libpayload/arch/x86/Makefile.mk
D payloads/libpayload/arch/x86/rom_media.c
M payloads/libpayload/include/cbfs.h
D payloads/libpayload/include/cbfs_core.h
D payloads/libpayload/include/cbfs_legacy.h
D payloads/libpayload/include/cbfs_ram.h
M payloads/libpayload/include/libpayload.h
M payloads/libpayload/libc/fmap.c
M payloads/libpayload/libcbfs/Makefile.mk
D payloads/libpayload/libcbfs/cbfs_core.c
D payloads/libpayload/libcbfs/cbfs_legacy.c
D payloads/libpayload/libcbfs/ram_media.c
18 files changed, 0 insertions(+), 1,268 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/80650/1
diff --git a/payloads/libpayload/arch/arm/Makefile.mk b/payloads/libpayload/arch/arm/Makefile.mk
index c973601..f71138b 100644
--- a/payloads/libpayload/arch/arm/Makefile.mk
+++ b/payloads/libpayload/arch/arm/Makefile.mk
@@ -43,8 +43,6 @@
libgdb-y += gdb.c
-libcbfs-$(CONFIG_LP_CBFS) += dummy_media.c
-
# Add other classes here when you put assembly files into them!
head.o-S-ccopts += $(arm_asm_flags)
libc-S-ccopts += $(arm_asm_flags)
diff --git a/payloads/libpayload/arch/arm/dummy_media.c b/payloads/libpayload/arch/arm/dummy_media.c
deleted file mode 100644
index 4e16635..0000000
--- a/payloads/libpayload/arch/arm/dummy_media.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * Copyright (C) 2013 Google, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#define LIBPAYLOAD
-
-#include <cbfs.h>
-#include <string.h>
-
-/* The generic cbfs code relies on the libpayload_init_default_cbfs_media
- * symbol. Therefore, provide an implementation that just throws an error. */
-
-int libpayload_init_default_cbfs_media(struct cbfs_media *media);
-
-__attribute__((weak)) int libpayload_init_default_cbfs_media(
- struct cbfs_media *media)
-{
- return -1;
-}
diff --git a/payloads/libpayload/arch/arm64/Makefile.mk b/payloads/libpayload/arch/arm64/Makefile.mk
index 6eb9fe8..b478c77 100644
--- a/payloads/libpayload/arch/arm64/Makefile.mk
+++ b/payloads/libpayload/arch/arm64/Makefile.mk
@@ -38,7 +38,6 @@
libc-y += cache.c cpu.S
libc-y += selfboot.c
libc-y += mmu.c
-libcbfs-$(CONFIG_LP_CBFS) += dummy_media.c
libgdb-y += gdb.c
diff --git a/payloads/libpayload/arch/arm64/dummy_media.c b/payloads/libpayload/arch/arm64/dummy_media.c
deleted file mode 100644
index 4e16635..0000000
--- a/payloads/libpayload/arch/arm64/dummy_media.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * Copyright (C) 2013 Google, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#define LIBPAYLOAD
-
-#include <cbfs.h>
-#include <string.h>
-
-/* The generic cbfs code relies on the libpayload_init_default_cbfs_media
- * symbol. Therefore, provide an implementation that just throws an error. */
-
-int libpayload_init_default_cbfs_media(struct cbfs_media *media);
-
-__attribute__((weak)) int libpayload_init_default_cbfs_media(
- struct cbfs_media *media)
-{
- return -1;
-}
diff --git a/payloads/libpayload/arch/mock/Makefile.mk b/payloads/libpayload/arch/mock/Makefile.mk
index 415886a..e3f10a6 100644
--- a/payloads/libpayload/arch/mock/Makefile.mk
+++ b/payloads/libpayload/arch/mock/Makefile.mk
@@ -4,6 +4,4 @@
libc-y += virtual.c
-libcbfs-$(CONFIG_LP_CBFS) += mock_media.c
-
CFLAGS += -Wno-address-of-packed-member
diff --git a/payloads/libpayload/arch/mock/mock_media.c b/payloads/libpayload/arch/mock/mock_media.c
deleted file mode 100644
index 2bb06ed..0000000
--- a/payloads/libpayload/arch/mock/mock_media.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <cbfs.h>
-
-int libpayload_init_default_cbfs_media(struct cbfs_media *media);
-
-__attribute__((weak)) int libpayload_init_default_cbfs_media(struct cbfs_media *media)
-{
- return -1;
-}
diff --git a/payloads/libpayload/arch/x86/Makefile.mk b/payloads/libpayload/arch/x86/Makefile.mk
index 653412e..196415d 100644
--- a/payloads/libpayload/arch/x86/Makefile.mk
+++ b/payloads/libpayload/arch/x86/Makefile.mk
@@ -43,7 +43,6 @@
libgdb-y += gdb.c
-libcbfs-$(CONFIG_LP_CBFS) += rom_media.c
libcbfs-$(CONFIG_LP_CBFS) += boot_media.c
# Multiboot support is configurable
diff --git a/payloads/libpayload/arch/x86/rom_media.c b/payloads/libpayload/arch/x86/rom_media.c
deleted file mode 100644
index ffb3809..0000000
--- a/payloads/libpayload/arch/x86/rom_media.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *
- * Copyright (C) 2013 Google, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#define LIBPAYLOAD
-
-#include <cbfs.h>
-#include <string.h>
-
-#ifdef LIBPAYLOAD
-# define printk(x...)
-# define init_default_cbfs_media libpayload_init_default_cbfs_media
- extern int libpayload_init_default_cbfs_media(struct cbfs_media *media);
-#else
-# include <console/console.h>
-#endif
-
-// Implementation of memory-mapped ROM media source on X86.
-
-static int x86_rom_open(struct cbfs_media *media) {
- return 0;
-}
-
-static void *x86_rom_map(struct cbfs_media *media, size_t offset, size_t count) {
- void *ptr;
- // Some address (ex, pointer to master header) may be given in memory
- // mapped location. To workaround that, we handle >0xf0000000 as real
- // memory pointer.
-
- if ((uint32_t)offset > (uint32_t)0xf0000000)
- ptr = (void*)offset;
- else
- ptr = (void*)(0 - (uint32_t)media->context + offset);
- return ptr;
-}
-
-static void *x86_rom_unmap(struct cbfs_media *media, const void *address) {
- return NULL;
-}
-
-static size_t x86_rom_read(struct cbfs_media *media, void *dest, size_t offset,
- size_t count) {
- void *ptr = x86_rom_map(media, offset, count);
- memcpy(dest, ptr, count);
- x86_rom_unmap(media, ptr);
- return count;
-}
-
-static int x86_rom_close(struct cbfs_media *media) {
- return 0;
-}
-
-int init_x86rom_cbfs_media(struct cbfs_media *media);
-int init_x86rom_cbfs_media(struct cbfs_media *media) {
- // On X86, we always keep a reference of pointer to CBFS header in
- // 0xfffffffc, and the pointer is still a memory-mapped address.
- // Since the CBFS core always use ROM offset, we need to figure out
- // header->romsize even before media is initialized.
- struct cbfs_header *header = (struct cbfs_header*)
- *(uint32_t*)(0xfffffffc);
- if (CBFS_HEADER_MAGIC != ntohl(header->magic)) {
-#if CONFIG(LP_ROM_SIZE)
- printk(BIOS_ERR, "Invalid CBFS master header at %p\n", header);
- media->context = (void*)CONFIG_LP_ROM_SIZE;
-#else
- return -1;
-#endif
- } else {
- uint32_t romsize = ntohl(header->romsize);
- media->context = (void*)romsize;
-#if CONFIG(LP_ROM_SIZE)
- if (CONFIG_LP_ROM_SIZE != romsize)
- printk(BIOS_WARNING, "rom size unmatch (%d/%d)\n",
- CONFIG_LP_ROM_SIZE, romsize);
-#endif
- }
- media->open = x86_rom_open;
- media->close = x86_rom_close;
- media->map = x86_rom_map;
- media->unmap = x86_rom_unmap;
- media->read = x86_rom_read;
- return 0;
-}
-
-int init_default_cbfs_media(struct cbfs_media *media) {
- return init_x86rom_cbfs_media(media);
-}
diff --git a/payloads/libpayload/include/cbfs.h b/payloads/libpayload/include/cbfs.h
index 23b9669..9420cb0 100644
--- a/payloads/libpayload/include/cbfs.h
+++ b/payloads/libpayload/include/cbfs.h
@@ -139,8 +139,4 @@
return _cbfs_boot_lookup(name, true, &mdata) >= 0;
}
-
-/* Legacy API. Designated for removal in the future. */
-#include <cbfs_legacy.h>
-
#endif
diff --git a/payloads/libpayload/include/cbfs_core.h b/payloads/libpayload/include/cbfs_core.h
deleted file mode 100644
index 4a638d9..0000000
--- a/payloads/libpayload/include/cbfs_core.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *
- * Copyright (C) 2008 Jordan Crouse <jordan(a)cosmicpenguin.net>
- * Copyright (C) 2012 Google, Inc.
- *
- * This file is dual-licensed. You can choose between:
- * - The GNU GPL, version 2, as published by the Free Software Foundation
- * - The revised BSD license (without advertising clause)
- *
- * ---------------------------------------------------------------------------
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * ---------------------------------------------------------------------------
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ---------------------------------------------------------------------------
- */
-
-#ifndef _CBFS_CORE_H_
-#define _CBFS_CORE_H_
-
-#include <commonlib/bsd/cbfs_serialized.h>
-#include <endian.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define CBFS_HEADER_INVALID_ADDRESS ((void*)(0xffffffff))
-
-struct cbfs_stage {
- uint32_t compression; /** Compression type */
- uint64_t entry; /** entry point */
- uint64_t load; /** Where to load in memory */
- uint32_t len; /** length of data to load */
- uint32_t memlen; /** total length of object in memory */
-} __packed;
-
-#define CBFS_MEDIA_INVALID_MAP_ADDRESS ((void*)(0xffffffff))
-#define CBFS_DEFAULT_MEDIA ((void*)(0x0))
-
-/* Media for CBFS to load files. */
-struct cbfs_media {
-
- /* implementation dependent context, to hold resource references */
- void *context;
-
- /* opens media and returns 0 on success, -1 on failure */
- int (*open)(struct cbfs_media *media);
-
- /* returns number of bytes read from media into dest, starting from
- * offset for count of bytes */
- size_t (*read)(struct cbfs_media *media, void *dest, size_t offset,
- size_t count);
-
- /* returns a pointer to memory with count of bytes from media source
- * starting from offset, or CBFS_MEDIA_INVALID_MAP_ADDRESS on failure.
- * Note: mapped data can't be free unless unmap is called, even if you
- * do close first. */
- void * (*map)(struct cbfs_media *media, size_t offset, size_t count);
-
- /* returns NULL and releases the memory by address, which was allocated
- * by map */
- void * (*unmap)(struct cbfs_media *media, const void *address);
-
- /* closes media and returns 0 on success, -1 on failure. */
- int (*close)(struct cbfs_media *media);
-};
-
-/*
- * Returns pointer to a copy of the file content or NULL on error.
- * If the file is compressed, data will be decompressed.
- * The caller owns the returned memory.
- */
-void *cbfs_get_file_content(struct cbfs_media *media, const char *name,
- int type, size_t *sz);
-
-/* Returns decompressed size on success, 0 on failure. */
-size_t cbfs_decompress(int algo, const void *src, size_t srcn, void *dst,
- size_t dstn);
-
-/* returns a pointer to CBFS master header, or CBFS_HEADER_INVALID_ADDRESS
- * on failure */
-const struct cbfs_header *cbfs_get_header(struct cbfs_media *media);
-
-/* Persistent handle to a CBFS file that has not yet been fully mapped. */
-struct cbfs_handle {
- struct cbfs_media media; /* copy of original media object */
- u32 type; /* CBFS file type */
- u32 media_offset; /* offset from beginning of media */
- u32 attribute_offset; /* relative offset of attributes */
- u32 content_offset; /* relative offset of contents */
- u32 content_size; /* length of file contents in bytes */
-};
-
-/* Returns handle to CBFS file, or NULL on error. Does not yet map contents.
- * Caller is responsible to free() returned handle after use. */
-struct cbfs_handle *cbfs_get_handle(struct cbfs_media *media, const char *name);
-
-/* Given a cbfs_handle and an attribute tag, return a mapping for the first
- * instance of the attribute or NULL if none found. */
-void *cbfs_get_attr(struct cbfs_handle *handle, uint32_t tag);
-
-/* Given a cbfs_handle, returns the (decompressed) file contents in a buffer,
- * or NULL on error. If |size| is passed, will store amount of bytes read there.
- * If |limit| is not 0, will only return up to that many bytes. */
-void *cbfs_get_contents(struct cbfs_handle *handle, size_t *size, size_t limit);
-
-#endif
diff --git a/payloads/libpayload/include/cbfs_legacy.h b/payloads/libpayload/include/cbfs_legacy.h
deleted file mode 100644
index c98da0c..0000000
--- a/payloads/libpayload/include/cbfs_legacy.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *
- * Copyright (C) 2008 Jordan Crouse <jordan(a)cosmicpenguin.net>
- * Copyright (C) 2013 Google, Inc.
- *
- * This file is dual-licensed. You can choose between:
- * - The GNU GPL, version 2, as published by the Free Software Foundation
- * - The revised BSD license (without advertising clause)
- *
- * ---------------------------------------------------------------------------
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * ---------------------------------------------------------------------------
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ---------------------------------------------------------------------------
- */
-
-#ifndef _CBFS_LEGACY_H_
-#define _CBFS_LEGACY_H_
-
-#include <cbfs_core.h>
-
-/* legacy APIs */
-const struct cbfs_header *get_cbfs_header(void);
-struct cbfs_file *cbfs_find(const char *name);
-void *cbfs_find_file(const char *name, int type);
-
-int cbfs_execute_stage(struct cbfs_media *media, const char *name);
-void *cbfs_load_optionrom(struct cbfs_media *media, uint16_t vendor,
- uint16_t device);
-void *cbfs_load_payload(struct cbfs_media *media, const char *name);
-void *cbfs_load_stage(struct cbfs_media *media, const char *name);
-
-/* Simple buffer for streaming media. */
-struct cbfs_simple_buffer {
- char *buffer;
- size_t allocated;
- size_t size;
- size_t last_allocate;
-};
-
-void *cbfs_simple_buffer_map(struct cbfs_simple_buffer *buffer,
- struct cbfs_media *media,
- size_t offset, size_t count);
-
-void *cbfs_simple_buffer_unmap(struct cbfs_simple_buffer *buffer,
- const void *address);
-
-// Utility functions
-int run_address(void *f);
-
-/* Defined in individual arch / board implementation. */
-int init_default_cbfs_media(struct cbfs_media *media);
-
-#endif
diff --git a/payloads/libpayload/include/cbfs_ram.h b/payloads/libpayload/include/cbfs_ram.h
deleted file mode 100644
index e245162..0000000
--- a/payloads/libpayload/include/cbfs_ram.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Copyright (C) 2013 Google, Inc.
- *
- * This file is dual-licensed. You can choose between:
- * - The GNU GPL, version 2, as published by the Free Software Foundation
- * - The revised BSD license (without advertising clause)
- *
- * ---------------------------------------------------------------------------
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * ---------------------------------------------------------------------------
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ---------------------------------------------------------------------------
- */
-
-#ifndef _CBFS_RAM_H_
-#define _CBFS_RAM_H_
-
-#include <stdint.h>
-
-struct cbfs_media;
-
-/* The following functions return 0 for success. None-zero on error. */
-int init_cbfs_ram_media(struct cbfs_media *media, void *start, size_t size);
-int setup_cbfs_from_ram(void *start, uint32_t size);
-int setup_cbfs_from_flash(void);
-
-#endif /* _CBFS_RAM_H_ */
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h
index 5e34124..61dbd27 100644
--- a/payloads/libpayload/include/libpayload.h
+++ b/payloads/libpayload/include/libpayload.h
@@ -537,8 +537,4 @@
/* Defined in arch/${ARCH}/selfboot.c */
void selfboot(void *entry);
-/* look for area "name" in "fmap", setting offset and size to describe it.
- Returns 0 on success, < 0 on error. */
-int fmap_region_by_name(const uint32_t fmap_offset, const char * const name,
- uint32_t * const offset, uint32_t * const size);
#endif
diff --git a/payloads/libpayload/libc/fmap.c b/payloads/libpayload/libc/fmap.c
index 2ee9e3e..87a531a 100644
--- a/payloads/libpayload/libc/fmap.c
+++ b/payloads/libpayload/libc/fmap.c
@@ -78,56 +78,3 @@
return fmap_find_area(_fmap_cache, name, offset, size);
}
-
-/***********************************************************************************************
- * LEGACY CODE *
- **********************************************************************************************/
-
-int fmap_region_by_name(const uint32_t fmap_offset, const char * const name,
- uint32_t * const offset, uint32_t * const size)
-{
- int i;
-
- struct fmap *fmap;
- struct fmap fmap_head;
- struct cbfs_media default_media;
- struct cbfs_media *media = &default_media;
-
- if (init_default_cbfs_media(media) != 0)
- return -1;
-
- media->open(media);
-
- if (!media->read(media, &fmap_head, fmap_offset, sizeof(fmap_head)))
- return -1;
-
- if (memcmp(fmap_head.signature, FMAP_SIGNATURE, sizeof(fmap_head.signature))) {
- return -1;
- }
-
- int fmap_size = sizeof(*fmap) +
- fmap_head.nareas * sizeof(struct fmap_area);
-
- fmap = malloc(fmap_size);
- if (!fmap)
- return -1;
-
- if (!media->read(media, fmap, fmap_offset, fmap_size))
- goto err;
-
- media->close(media);
-
- for (i = 0; i < fmap->nareas; i++) {
- if (strcmp((const char *)fmap->areas[i].name, name) != 0)
- continue;
- if (offset)
- *offset = fmap->areas[i].offset;
- if (size)
- *size = fmap->areas[i].size;
- free(fmap);
- return 0;
- }
-err:
- free(fmap);
- return -1;
-}
diff --git a/payloads/libpayload/libcbfs/Makefile.mk b/payloads/libpayload/libcbfs/Makefile.mk
index 53e6f7f..0c82e4d 100644
--- a/payloads/libpayload/libcbfs/Makefile.mk
+++ b/payloads/libpayload/libcbfs/Makefile.mk
@@ -27,8 +27,6 @@
##
libcbfs-$(CONFIG_LP_CBFS) += cbfs.c
-libcbfs-$(CONFIG_LP_CBFS) += ram_media.c
-libcbfs-$(CONFIG_LP_CBFS) += cbfs_legacy.c
ifeq ($(CONFIG_LP_CBFS),y)
libcbfs-srcs += $(coreboottop)/src/commonlib/bsd/cbfs_private.c
diff --git a/payloads/libpayload/libcbfs/cbfs_core.c b/payloads/libpayload/libcbfs/cbfs_core.c
deleted file mode 100644
index 82c2846..0000000
--- a/payloads/libpayload/libcbfs/cbfs_core.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- *
- * Copyright (C) 2011 secunet Security Networks AG
- * Copyright (C) 2013 Google, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* The CBFS core requires a couple of #defines or functions to adapt it to the
- * target environment:
- *
- * CBFS_CORE_WITH_LZMA (must be #define)
- * if defined, ulzma() must exist for decompression of data streams
- *
- * CBFS_CORE_WITH_LZ4 (must be #define)
- * if defined, ulz4f() must exist for decompression of data streams
- *
- * ERROR(x...)
- * print an error message x (in printf format)
- *
- * LOG(x...)
- * print a message x (in printf format)
- *
- * DEBUG(x...)
- * print a debug message x (in printf format)
- *
- */
-
-#include <libpayload.h>
-#include <cbfs.h>
-#include <string.h>
-#include <sysinfo.h>
-
-/* returns a pointer to CBFS master header, or CBFS_HEADER_INVALID_ADDRESS
- * on failure */
-const struct cbfs_header *cbfs_get_header(struct cbfs_media *media)
-{
- int32_t rel_offset;
- const struct cbfs_header *header;
- struct cbfs_media default_media;
-
- if (media == CBFS_DEFAULT_MEDIA) {
- media = &default_media;
- if (init_default_cbfs_media(media) != 0) {
- ERROR("Failed to initialize default media.\n");
- return CBFS_HEADER_INVALID_ADDRESS;
- }
- }
- media->open(media);
-
- if (!media->read(media, &rel_offset, (size_t)(0 - sizeof(int32_t)),
- sizeof(int32_t))) {
- ERROR("Could not read CBFS master header offset!\n");
- return CBFS_HEADER_INVALID_ADDRESS;
- }
- header = media->map(media, (size_t)rel_offset, sizeof(*header));
- DEBUG("CBFS header at %#zx (-%#zx from end of image).\n",
- (size_t)rel_offset, (size_t)-rel_offset);
- media->close(media);
-
- if (header == CBFS_MEDIA_INVALID_MAP_ADDRESS) {
- ERROR("Failed to load CBFS header from %#zx(-%#zx)\n",
- (size_t)rel_offset, (size_t)-rel_offset);
- return CBFS_HEADER_INVALID_ADDRESS;
- }
-
- if (CBFS_HEADER_MAGIC != ntohl(header->magic)) {
- ERROR("Could not find valid CBFS master header at %#zx(-%#zx): "
- "magic %#.8x vs %#.8x.\n", (size_t)rel_offset,
- (size_t)-rel_offset, CBFS_HEADER_MAGIC,
- ntohl(header->magic));
- if (header->magic == 0xffffffff) {
- ERROR("Maybe ROM is not mapped properly?\n");
- }
- return CBFS_HEADER_INVALID_ADDRESS;
- }
- return header;
-}
-
-static int get_cbfs_range(uint32_t *offset, uint32_t *cbfs_end,
- struct cbfs_media *media)
-{
- const struct cbfs_header *header;
-
- if (media == CBFS_DEFAULT_MEDIA &&
- lib_sysinfo.cbfs_offset && lib_sysinfo.cbfs_size) {
- *offset = lib_sysinfo.cbfs_offset;
- *cbfs_end = *offset + lib_sysinfo.cbfs_size;
- return 0;
- }
-
- /* read offset and size from cbfs master header */
- DEBUG("Read CBFS offset & size from master header\n");
- header = cbfs_get_header(media);
- if (header == CBFS_HEADER_INVALID_ADDRESS)
- return -1;
- // Logical offset (for source media) of first file.
- *offset = ntohl(header->offset);
- *cbfs_end = ntohl(header->romsize);
-#if CONFIG(LP_ARCH_X86)
- // resolve actual length of ROM used for CBFS components
- // the bootblock size was not taken into account
- *cbfs_end -= ntohl(header->bootblocksize);
-
- // fine tune the length to handle alignment positioning.
- // using (bootblock size) % align, to derive the
- // number of bytes the bootblock is off from the alignment size.
- if ((ntohl(header->bootblocksize) % CBFS_ALIGNMENT))
- *cbfs_end -= (CBFS_ALIGNMENT -
- (ntohl(header->bootblocksize) % CBFS_ALIGNMENT));
- else
- *cbfs_end -= 1;
-#endif
- return 0;
-}
-
-/* public API starts here*/
-struct cbfs_handle *cbfs_get_handle(struct cbfs_media *media, const char *name)
-{
- const char *vardata;
- uint32_t offset, cbfs_end, vardata_len;
- struct cbfs_file file;
- struct cbfs_handle *handle = malloc(sizeof(*handle));
-
- if (!handle)
- return NULL;
-
- if (get_cbfs_range(&offset, &cbfs_end, media)) {
- ERROR("Failed to find cbfs range\n");
- free(handle);
- return NULL;
- }
-
- if (media == CBFS_DEFAULT_MEDIA) {
- media = &handle->media;
- if (init_default_cbfs_media(media) != 0) {
- ERROR("Failed to initialize default media.\n");
- free(handle);
- return NULL;
- }
- } else {
- memcpy(&handle->media, media, sizeof(*media));
- }
-
- DEBUG("CBFS location: 0x%x~0x%x\n", offset, cbfs_end);
- DEBUG("Looking for '%s' starting from 0x%x.\n", name, offset);
-
- media->open(media);
- while (offset < cbfs_end &&
- media->read(media, &file, offset, sizeof(file)) == sizeof(file)) {
- if (memcmp(CBFS_FILE_MAGIC, file.magic,
- sizeof(file.magic)) != 0) {
- uint32_t new_align = CBFS_ALIGNMENT;
- if (offset % CBFS_ALIGNMENT)
- new_align += CBFS_ALIGNMENT -
- (offset % CBFS_ALIGNMENT);
- ERROR("ERROR: No file header found at 0x%xx - "
- "try next aligned address: 0x%x.\n", offset,
- offset + new_align);
- offset += new_align;
- continue;
- }
- vardata_len = ntohl(file.offset) - sizeof(file);
- DEBUG(" - load entry 0x%x variable data (%d bytes)...\n",
- offset, vardata_len);
-
- // load file name (arbitrary length).
- vardata = (const char*)media->map(
- media, offset + sizeof(file), vardata_len);
- if (vardata == CBFS_MEDIA_INVALID_MAP_ADDRESS) {
- ERROR("ERROR: Failed to get filename: 0x%x.\n", offset);
- } else if (strcmp(vardata, name) == 0) {
- int file_offset = ntohl(file.offset),
- file_len = ntohl(file.len);
- DEBUG("Found file (offset=0x%x, len=%d).\n",
- offset + file_offset, file_len);
- media->unmap(media, vardata);
- media->close(media);
- handle->type = ntohl(file.type);
- handle->media_offset = offset;
- handle->content_offset = file_offset;
- handle->content_size = file_len;
- handle->attribute_offset =
- ntohl(file.attributes_offset);
- return handle;
- } else {
- DEBUG(" (unmatched file @0x%x: %s)\n", offset,
- vardata);
- media->unmap(media, vardata);
- }
-
- // Move to next file.
- uint32_t next_offset = offset + ntohl(file.len) + ntohl(file.offset);
- if (next_offset % CBFS_ALIGNMENT)
- next_offset += CBFS_ALIGNMENT - (next_offset % CBFS_ALIGNMENT);
- // Check that offset is strictly monotonic to prevent infinite loop
- if (next_offset <= offset) {
- ERROR("ERROR: corrupted CBFS file header at 0x%x.\n", offset);
- break;
- }
- offset = next_offset;
- }
- media->close(media);
- LOG("WARNING: '%s' not found.\n", name);
- free(handle);
- return NULL;
-}
-
-void *cbfs_get_contents(struct cbfs_handle *handle, size_t *size, size_t limit)
-{
- struct cbfs_media *m = &handle->media;
- size_t on_media_size = handle->content_size;
- int algo = CBFS_COMPRESS_NONE;
- void *ret = NULL;
- size_t dummy_size;
-
- if (!size)
- size = &dummy_size;
-
- struct cbfs_file_attr_compression *comp =
- cbfs_get_attr(handle, CBFS_FILE_ATTR_TAG_COMPRESSION);
- if (comp) {
- algo = ntohl(comp->compression);
- DEBUG("File '%s' is compressed (alg=%d)\n", name, algo);
- *size = ntohl(comp->decompressed_size);
- /* TODO: Implement partial decompression with |limit| */
- }
-
- if (algo == CBFS_COMPRESS_NONE) {
- if (limit != 0 && limit < on_media_size)
- on_media_size = limit;
- *size = on_media_size;
- }
-
- void *data = m->map(m, handle->media_offset + handle->content_offset,
- on_media_size);
- if (data == CBFS_MEDIA_INVALID_MAP_ADDRESS)
- return NULL;
-
- ret = malloc(*size);
- if (ret != NULL) {
- size_t final_size = cbfs_decompress(algo, data, on_media_size,
- ret, *size);
- if (final_size != *size) {
- ERROR("Expect %zu bytes but got %zu bytes after "
- "decompression.\n", *size, final_size);
- free(ret);
- ret = NULL;
- }
- }
-
- m->unmap(m, data);
- return ret;
-}
-
-void *cbfs_get_file_content(struct cbfs_media *media, const char *name,
- int type, size_t *sz)
-{
- void *ret = NULL;
- struct cbfs_handle *handle = cbfs_get_handle(media, name);
-
- if (!handle)
- return NULL;
-
- if (handle->type == type)
- ret = cbfs_get_contents(handle, sz, 0);
- else
- ERROR("File '%s' is of type %x, but we requested %x.\n", name,
- handle->type, type);
-
- free(handle);
- return ret;
-}
-
-void *cbfs_get_attr(struct cbfs_handle *handle, uint32_t tag)
-{
- struct cbfs_media *m = &handle->media;
- uint32_t offset = handle->media_offset + handle->attribute_offset;
- uint32_t end = handle->media_offset + handle->content_offset;
- struct cbfs_file_attribute attr;
- void *ret;
-
- /* attribute_offset should be 0 when there is no attribute, but all
- * values that point into the cbfs_file header are invalid, too. */
- if (handle->attribute_offset <= sizeof(struct cbfs_file))
- return NULL;
-
- m->open(m);
- while (offset + sizeof(attr) <= end) {
- if (m->read(m, &attr, offset, sizeof(attr)) != sizeof(attr)) {
- ERROR("Failed to read attribute header %#x\n", offset);
- m->close(m);
- return NULL;
- }
- if (ntohl(attr.tag) != tag) {
- uint32_t next_offset = offset + ntohl(attr.len);
- // Check that offset is strictly monotonic to prevent infinite loop
- if (next_offset <= offset) {
- ERROR("ERROR: corrupted CBFS attribute at 0x%x.\n", offset);
- m->close(m);
- return NULL;
- }
- offset = next_offset;
- continue;
- }
- ret = m->map(m, offset, ntohl(attr.len));
- if (ret == CBFS_MEDIA_INVALID_MAP_ADDRESS) {
- ERROR("Failed to map attribute at %#x\n", offset);
- m->close(m);
- return NULL;
- }
- return ret;
- }
- m->close(m);
-
- return NULL;
-}
-
-size_t cbfs_decompress(int algo, const void *src, size_t srcn, void *dst,
- size_t dstn)
-{
- size_t len;
- switch (algo) {
- case CBFS_COMPRESS_NONE:
- len = MIN(srcn, dstn);
- memcpy(dst, src, len);
- return len;
-#ifdef CBFS_CORE_WITH_LZMA
- case CBFS_COMPRESS_LZMA:
- return ulzman(src, srcn, dst, dstn);
-#endif
-#ifdef CBFS_CORE_WITH_LZ4
- case CBFS_COMPRESS_LZ4:
- return ulz4fn(src, srcn, dst, dstn);
-#endif
- default:
- ERROR("tried to decompress %zu bytes with algorithm "
- "#%x, but that algorithm id is unsupported.\n",
- srcn, algo);
- return 0;
- }
-}
diff --git a/payloads/libpayload/libcbfs/cbfs_legacy.c b/payloads/libpayload/libcbfs/cbfs_legacy.c
deleted file mode 100644
index d24b528..0000000
--- a/payloads/libpayload/libcbfs/cbfs_legacy.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- *
- * Copyright (C) 2011 secunet Security Networks AG
- * Copyright (C) 2013 Google, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#define LIBPAYLOAD
-
-#ifdef LIBPAYLOAD
-# include <libpayload-config.h>
-# if CONFIG(LP_LZMA)
-# include <lzma.h>
-# define CBFS_CORE_WITH_LZMA
-# endif
-# if CONFIG(LP_LZ4)
-# include <lz4.h>
-# define CBFS_CORE_WITH_LZ4
-# endif
-# define CBFS_MINI_BUILD
-#elif defined(__SMM__)
-# define CBFS_MINI_BUILD
-#else
-# define CBFS_CORE_WITH_LZMA
-# define CBFS_CORE_WITH_LZ4
-# include <lib.h>
-#endif
-
-#include <cbfs.h>
-#include <string.h>
-
-#ifdef LIBPAYLOAD
-# include <stdio.h>
-# define DEBUG(x...)
-# define LOG(x...)
-# define ERROR(x...) printf(x)
-#else
-# include <console/console.h>
-# define ERROR(x...) printk(BIOS_ERR, "CBFS: " x)
-# define LOG(x...) printk(BIOS_INFO, "CBFS: " x)
-# if CONFIG_LP_DEBUG_CBFS
-# define DEBUG(x...) printk(BIOS_SPEW, "CBFS: " x)
-# else
-# define DEBUG(x...)
-# endif
-#endif
-
-#include "cbfs_core.c"
-
-#ifndef __SMM__
-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_load_optionrom(struct cbfs_media *media, uint16_t vendor,
- uint16_t device)
-{
- char name[17] = "pciXXXX,XXXX.rom";
-
- tohex16(vendor, name+3);
- tohex16(device, name+8);
-
- return cbfs_get_file_content(media, name, CBFS_TYPE_OPTIONROM, NULL);
-}
-
-void * cbfs_load_stage(struct cbfs_media *media, const char *name)
-{
- struct cbfs_stage *stage = (struct cbfs_stage *)
- cbfs_get_file_content(media, name, CBFS_TYPE_STAGE, NULL);
- /* this is a mess. There is no ntohll. */
- /* for now, assume compatible byte order until we solve this. */
- uintptr_t entry;
- uint32_t final_size;
-
- if (stage == NULL)
- return (void *) -1;
-
- LOG("loading stage %s @ %p (%d bytes), entry @ 0x%llx\n",
- name,
- (void*)(uintptr_t) stage->load, stage->memlen,
- stage->entry);
-
- final_size = cbfs_decompress(stage->compression,
- ((unsigned char *) stage) +
- sizeof(struct cbfs_stage),
- stage->len,
- (void *) (uintptr_t) stage->load,
- stage->memlen);
- if (!final_size) {
- entry = -1;
- goto out;
- }
-
- memset((void *)((uintptr_t)stage->load + final_size), 0,
- stage->memlen - final_size);
-
- DEBUG("stage loaded.\n");
-
- entry = stage->entry;
- // entry = ntohll(stage->entry);
-
-out:
- free(stage);
- return (void *) entry;
-}
-
-int cbfs_execute_stage(struct cbfs_media *media, const char *name)
-{
- struct cbfs_stage *stage = (struct cbfs_stage *)
- cbfs_get_file_content(media, name, CBFS_TYPE_STAGE, NULL);
-
- if (stage == NULL)
- return 1;
-
- if (ntohl(stage->compression) != CBFS_COMPRESS_NONE) {
- LOG("Unable to run %s: Compressed file"
- "Not supported for in-place execution\n", name);
- free(stage);
- return 1;
- }
-
- LOG("run @ %p\n", (void *) (uintptr_t)ntohll(stage->entry));
- int result = run_address((void *)(uintptr_t)ntohll(stage->entry));
- free(stage);
- return result;
-}
-
-void *cbfs_load_payload(struct cbfs_media *media, const char *name)
-{
- return (struct cbfs_payload *)cbfs_get_file_content(
- media, name, CBFS_TYPE_SELF, NULL);
-}
-
-struct cbfs_file *cbfs_find(const char *name) {
- struct cbfs_handle *handle = cbfs_get_handle(CBFS_DEFAULT_MEDIA, name);
- struct cbfs_media *m = &handle->media;
- void *ret;
-
- if (!handle)
- return NULL;
-
- ret = m->map(m, handle->media_offset,
- handle->content_offset + handle->content_size);
- if (ret == CBFS_MEDIA_INVALID_MAP_ADDRESS) {
- free(handle);
- return NULL;
- }
-
- free(handle);
- return ret;
-}
-
-void *cbfs_find_file(const char *name, int type) {
- return cbfs_get_file_content(CBFS_DEFAULT_MEDIA, name, type, NULL);
-}
-
-const struct cbfs_header *get_cbfs_header(void) {
- return cbfs_get_header(CBFS_DEFAULT_MEDIA);
-}
-
-/* Simple buffer */
-
-void *cbfs_simple_buffer_map(struct cbfs_simple_buffer *buffer,
- struct cbfs_media *media,
- size_t offset, size_t count) {
- void *address = buffer->buffer + buffer->allocated;
- DEBUG("simple_buffer_map(offset=%zu, count=%zu): "
- "allocated=%zu, size=%zu, last_allocate=%zu\n",
- offset, count, buffer->allocated, buffer->size,
- buffer->last_allocate);
- if (buffer->allocated + count >= buffer->size)
- return CBFS_MEDIA_INVALID_MAP_ADDRESS;
- if (media->read(media, address, offset, count) != count) {
- ERROR("simple_buffer: fail to read %zd bytes from 0x%zx\n",
- count, offset);
- return CBFS_MEDIA_INVALID_MAP_ADDRESS;
- }
- buffer->allocated += count;
- buffer->last_allocate = count;
- return address;
-}
-
-void *cbfs_simple_buffer_unmap(struct cbfs_simple_buffer *buffer,
- const void *address) {
- // TODO Add simple buffer management so we can free more than last
- // allocated one.
- DEBUG("simple_buffer_unmap(address=%p): "
- "allocated=%zu, size=%zu, last_allocate=%zu\n",
- address, buffer->allocated, buffer->size,
- buffer->last_allocate);
- if ((buffer->buffer + buffer->allocated - buffer->last_allocate) ==
- address) {
- buffer->allocated -= buffer->last_allocate;
- buffer->last_allocate = 0;
- }
- return NULL;
-}
-
-/**
- * run_address is passed the address of a function taking no parameters and
- * jumps to it, returning the result.
- * @param f the address to call as a function.
- * @return value returned by the function.
- */
-
-int run_address(void *f)
-{
- int (*v) (void);
- v = f;
- return v();
-}
-
-#endif
diff --git a/payloads/libpayload/libcbfs/ram_media.c b/payloads/libpayload/libcbfs/ram_media.c
deleted file mode 100644
index 153bc83..0000000
--- a/payloads/libpayload/libcbfs/ram_media.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *
- * Copyright (C) 2013 Google, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#include <cbfs.h>
-#include <cbfs_ram.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-// Implementation of a media source based on given memory buffer.
-struct ram_media {
- char *start;
- size_t size;
-};
-
-static int ram_open(struct cbfs_media *media) {
- return 0;
-}
-
-static void *ram_map(struct cbfs_media *media, size_t offset, size_t count) {
- struct ram_media *m = (struct ram_media*)media->context;
- /* assume addressing from top of image in this case */
- if (offset > 0xf0000000) {
- offset = m->size + offset;
- }
- if (offset + count > m->size) {
- printf("ERROR: ram_map: request out of range (0x%zx+0x%zx)\n",
- offset, count);
- return CBFS_MEDIA_INVALID_MAP_ADDRESS;
- }
- return (void*)(m->start + offset);
-}
-
-static void *ram_unmap(struct cbfs_media *media, const void *address) {
- return NULL;
-}
-
-static size_t ram_read(struct cbfs_media *media, void *dest, size_t offset,
- size_t count) {
- void *ptr = ram_map(media, offset, count);
- if (ptr == CBFS_MEDIA_INVALID_MAP_ADDRESS)
- return 0;
- memcpy(dest, ptr, count);
- ram_unmap(media, ptr);
- return count;
-}
-
-static int ram_close(struct cbfs_media *media) {
- return 0;
-}
-
-int init_cbfs_ram_media(struct cbfs_media *media, void *start, size_t size) {
- // TODO Find a way to release unused media. Maybe adding media->destroy.
- struct ram_media *m = (struct ram_media*)malloc(sizeof(*m));
- m->start = start;
- m->size = size;
- media->context = (void*)m;
- media->open = ram_open;
- media->close = ram_close;
- media->map = ram_map;
- media->unmap = ram_unmap;
- media->read = ram_read;
- return 0;
-}
-
-// Legacy setup_cbfs_from_*.
-static int is_default_cbfs_media_initialized;
-static struct cbfs_media default_cbfs_media;
-
-int setup_cbfs_from_ram(void *start, uint32_t size) {
- int result = init_cbfs_ram_media(&default_cbfs_media, start, size);
- if (result == 0)
- is_default_cbfs_media_initialized = 1;
- return result;
-}
-
-extern int libpayload_init_default_cbfs_media(struct cbfs_media *media);
-int setup_cbfs_from_flash(void) {
- int result = libpayload_init_default_cbfs_media(&default_cbfs_media);
- if (result == 0)
- is_default_cbfs_media_initialized = 1;
- return result;
-}
-
-int init_default_cbfs_media(struct cbfs_media *media) {
- int result = 0;
- if (is_default_cbfs_media_initialized != 1) {
- result = setup_cbfs_from_flash();
- }
- if (result == 0)
- memcpy(media, &default_cbfs_media, sizeof(*media));
- return result;
-}
--
To view, visit https://review.coreboot.org/c/coreboot/+/80650?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I0ed157ac2d1376b8dff4537af9a63731064b45f6
Gerrit-Change-Number: 80650
Gerrit-PatchSet: 1
Gerrit-Owner: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Jakub Czapiga <czapiga(a)google.com>
Gerrit-Attention: Jakub Czapiga <czapiga(a)google.com>
Gerrit-MessageType: newchange