summaryrefslogtreecommitdiff
path: root/src/lib/reg_script.c
diff options
context:
space:
mode:
authorLee Leahy <leroy.p.leahy@intel.com>2016-04-29 17:26:36 -0700
committerLeroy P Leahy <leroy.p.leahy@intel.com>2016-04-30 20:44:58 +0200
commitefcee9fadd496945c55828c79dff8e0b19ae0053 (patch)
treea81656fa16c258bf001acc9b1c70966f53704492 /src/lib/reg_script.c
parent6bcbe5749b9f1a82004299bb63fba7e99b8ed358 (diff)
downloadcoreboot-efcee9fadd496945c55828c79dff8e0b19ae0053.tar.xz
lib/reg_script: Allow multiple independent handlers
Remove the platform_bus_table routine and replace it with a link time table. This allows the handlers to be spread across multiple modules without any one module knowing about all of the handlers. Establish number ranges for both the SOC and mainboard. TEST=Build and run on Galileo Gen2 Change-Id: I0823d443d3352f31ba7fa20845bbf550b585c86f Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com> Reviewed-on: https://review.coreboot.org/14554 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/lib/reg_script.c')
-rw-r--r--src/lib/reg_script.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/lib/reg_script.c b/src/lib/reg_script.c
index 7530dc32b8..9e20134e85 100644
--- a/src/lib/reg_script.c
+++ b/src/lib/reg_script.c
@@ -393,35 +393,27 @@ static void reg_script_write_msr(struct reg_script_context *ctx)
#endif
}
-#ifndef __PRE_RAM__
-/* Default routine provided for systems without platform specific busses */
-const struct reg_script_bus_entry *__attribute__((weak))
- platform_bus_table(size_t *table_entries)
-{
- /* No platform bus type table supplied */
- *table_entries = 0;
- return NULL;
-}
-
/* Locate the structure containing the platform specific bus access routines */
static const struct reg_script_bus_entry
*find_bus(const struct reg_script *step)
{
- const struct reg_script_bus_entry *bus;
+ extern const struct reg_script_bus_entry *_rsbe_init_begin[];
+ extern const struct reg_script_bus_entry *_ersbe_init_begin[];
+ const struct reg_script_bus_entry * const * bus;
size_t table_entries;
size_t i;
/* Locate the platform specific bus */
- bus = platform_bus_table(&table_entries);
+ bus = _rsbe_init_begin;
+ table_entries = &_ersbe_init_begin[0] - &_rsbe_init_begin[0];
for (i = 0; i < table_entries; i++) {
- if (bus[i].type == step->type)
- return &bus[i];
+ if (bus[i]->type == step->type)
+ return bus[i];
}
/* Bus not found */
return NULL;
}
-#endif
static uint64_t reg_script_read(struct reg_script_context *ctx)
{
@@ -443,7 +435,6 @@ static uint64_t reg_script_read(struct reg_script_context *ctx)
return reg_script_read_iosf(ctx);
#endif /* HAS_IOSF */
default:
-#ifndef __PRE_RAM__
{
const struct reg_script_bus_entry *bus;
@@ -452,7 +443,6 @@ static uint64_t reg_script_read(struct reg_script_context *ctx)
if (NULL != bus)
return bus->reg_script_read(ctx);
}
-#endif
printk(BIOS_ERR,
"Unsupported read type (0x%x) for this device!\n",
step->type);
@@ -487,7 +477,6 @@ static void reg_script_write(struct reg_script_context *ctx)
break;
#endif /* HAS_IOSF */
default:
-#ifndef __PRE_RAM__
{
const struct reg_script_bus_entry *bus;
@@ -498,7 +487,6 @@ static void reg_script_write(struct reg_script_context *ctx)
return;
}
}
-#endif
printk(BIOS_ERR,
"Unsupported write type (0x%x) for this device!\n",
step->type);