diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-12-08 14:34:35 -0600 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2015-12-10 04:44:09 +0100 |
commit | 7e7a4df58075fdff4293d2203b035b970d21aeb8 (patch) | |
tree | 5897c05b07adaa7d12f747a49dc3f513d2dc2d9e /src/include | |
parent | 6d720f38e06d14cc8a89635f66dc124dcd5ac150 (diff) | |
download | coreboot-7e7a4df58075fdff4293d2203b035b970d21aeb8.tar.xz |
lib: remove assets infrastructure
Now that only CBFS access is supported for finding resources
within the boot media the assets infrastructure can be removed.
Remove it.
BUG=chromium:445938
BRANCH=None
TEST=Built and ran on glados.
Change-Id: I383fd6579280cf9cfe5a18c2851baf74cad004e9
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/12690
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/assets.h | 88 | ||||
-rw-r--r-- | src/include/program_loading.h | 40 |
2 files changed, 27 insertions, 101 deletions
diff --git a/src/include/assets.h b/src/include/assets.h deleted file mode 100644 index ac168a9965..0000000000 --- a/src/include/assets.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright 2015 Google Inc. - * - * 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. - */ -#ifndef ASSETS_H -#define ASSETS_H - -#include <commonlib/region.h> - -/* An asset represents data used to boot the system. It can be found within - * CBFS or some other mechanism. While CBFS can be a source of an asset, note - * that using the asset API implies querying of other sources. */ - -enum asset_type { - ASSET_UNKNOWN, - ASSET_VERSTAGE, - ASSET_ROMSTAGE, - ASSET_RAMSTAGE, - ASSET_REFCODE, - ASSET_PAYLOAD, - ASSET_BL31, - ASSET_BL32, -}; - -struct asset { - enum asset_type type; - const char *name; - struct region_device rdev; -}; - -static inline const char *asset_name(const struct asset *asset) -{ - return asset->name; -} - -static inline enum asset_type asset_type(const struct asset *asset) -{ - return asset->type; -} - -static struct region_device *asset_rdev(struct asset *asset) -{ - return &asset->rdev; -} - -static inline size_t asset_size(const struct asset *asset) -{ - return region_device_sz(&asset->rdev); -} - -/* Returns NULL on error. */ -static inline void *asset_mmap(const struct asset *asset) -{ - return rdev_mmap_full(&asset->rdev); -} - -#define ASSET_INIT(type_, name_) \ - { \ - .type = (type_), \ - .name = (name_), \ - } - -/* Locate the asset as described by the parameter. It will query all known - * asset providers. Returns 0 on success. < 0 on error. */ -int asset_locate(struct asset *asset); - -struct asset_provider { - const char *name; - /* Determines if the provider is the active one. If so returns 1 else 0 - * or < 0 on error. */ - int (*is_active)(struct asset *asset); - /* Returns < 0 on error or 0 on success. This function locates - * the rdev representing the file data associated with the passed in - * prog. */ - int (*locate)(struct asset *asset); -}; - -#endif /* ASSETS_H */ diff --git a/src/include/program_loading.h b/src/include/program_loading.h index 4385e3602e..f71dcb79e5 100644 --- a/src/include/program_loading.h +++ b/src/include/program_loading.h @@ -16,9 +16,9 @@ #ifndef PROGRAM_LOADING_H #define PROGRAM_LOADING_H +#include <commonlib/region.h> #include <stdint.h> #include <stddef.h> -#include <assets.h> enum { /* Last segment of program. Can be used to take different actions for @@ -26,17 +26,30 @@ enum { SEG_FINAL = 1 << 0, }; +enum prog_type { + PROG_UNKNOWN, + PROG_VERSTAGE, + PROG_ROMSTAGE, + PROG_RAMSTAGE, + PROG_REFCODE, + PROG_PAYLOAD, + PROG_BL31, + PROG_BL32, +}; + /* Called for each segment of a program loaded. The SEG_FINAL flag will be * set on the last segment loaded. */ void arch_segment_loaded(uintptr_t start, size_t size, int flags); /* Representation of a program. */ struct prog { - /* The region_device within the asset is the source of program content - * to load. After loading program it represents the memory region of - * the stages and payload. For architectures that use a bounce buffer + /* The region_device is the source of program content to load. After + * loading program it represents the memory region of the stages and + * payload. For architectures that use a bounce buffer * then it would represent the bounce buffer. */ - struct asset asset; + enum prog_type type; + const char *name; + struct region_device rdev; /* Entry to program with optional argument. It's up to the architecture * to decide if argument is passed. */ void (*entry)(void *); @@ -45,34 +58,35 @@ struct prog { #define PROG_INIT(type_, name_) \ { \ - .asset = ASSET_INIT(type_, name_), \ + .type = (type_), \ + .name = (name_), \ } static inline const char *prog_name(const struct prog *prog) { - return asset_name(&prog->asset); + return prog->name; } -static inline enum asset_type prog_type(const struct prog *prog) +static inline enum prog_type prog_type(const struct prog *prog) { - return asset_type(&prog->asset); + return prog->type; } static inline struct region_device *prog_rdev(struct prog *prog) { - return asset_rdev(&prog->asset); + return &prog->rdev; } /* Only valid for loaded programs. */ static inline size_t prog_size(const struct prog *prog) { - return asset_size(&prog->asset); + return region_device_sz(&prog->rdev); } /* Only valid for loaded programs. */ static inline void *prog_start(const struct prog *prog) { - return asset_mmap(&prog->asset); + return rdev_mmap_full(&prog->rdev); } static inline void *prog_entry(const struct prog *prog) @@ -91,7 +105,7 @@ extern const struct mem_region_device addrspace_32bit; static inline void prog_memory_init(struct prog *prog, uintptr_t ptr, size_t size) { - rdev_chain(&prog->asset.rdev, &addrspace_32bit.rdev, ptr, size); + rdev_chain(&prog->rdev, &addrspace_32bit.rdev, ptr, size); } static inline void prog_set_area(struct prog *prog, void *start, size_t size) |