arch/x86: Use 'enum cb_err'
Change-Id: I38e4b8c6adfaaa45377b2fbe0644285d21841cd1
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/68369
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
diff --git a/src/arch/x86/pirq_routing.c b/src/arch/x86/pirq_routing.c
index 0a1e75d..7244536 100644
--- a/src/arch/x86/pirq_routing.c
+++ b/src/arch/x86/pirq_routing.c
@@ -1,10 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
-#include <console/console.h>
#include <arch/pirq_routing.h>
#include <commonlib/helpers.h>
-#include <string.h>
+#include <console/console.h>
#include <device/pci.h>
+#include <string.h>
+#include <types.h>
static void check_pirq_routing_table(struct irq_routing_table *rt)
{
@@ -59,7 +60,7 @@
printk(BIOS_INFO, "done.\n");
}
-static int verify_copy_pirq_routing_table(unsigned long addr,
+static enum cb_err verify_copy_pirq_routing_table(unsigned long addr,
const struct irq_routing_table *routing_table)
{
int i;
@@ -73,14 +74,14 @@
for (i = 0; i < routing_table->size; i++) {
if (*(rt_curr + i) != *(rt_orig + i)) {
printk(BIOS_INFO, "failed\n");
- return -1;
+ return CB_ERR;
}
}
printk(BIOS_INFO, "done\n");
check_pirq_routing_table((struct irq_routing_table *)addr);
- return 0;
+ return CB_SUCCESS;
}
static u8 pirq_get_next_free_irq(u8 *pirq, u16 bitmap)
diff --git a/src/arch/x86/postcar_loader.c b/src/arch/x86/postcar_loader.c
index be4a235..a8a77e0 100644
--- a/src/arch/x86/postcar_loader.c
+++ b/src/arch/x86/postcar_loader.c
@@ -20,7 +20,7 @@
return sizeof(struct var_mtrr_context) + mtrr_count * 2 * sizeof(msr_t);
}
-static int postcar_frame_init(struct postcar_frame *pcf)
+static enum cb_err postcar_frame_init(struct postcar_frame *pcf)
{
memset(pcf, 0, sizeof(*pcf));
@@ -29,13 +29,13 @@
ctx = cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK, var_mtrr_ctx_size());
if (ctx == NULL) {
printk(BIOS_ERR, "Couldn't add var_mtrr_ctx setup in cbmem.\n");
- return -1;
+ return CB_ERR;
}
pcf->mtrr = ctx;
var_mtrr_context_init(pcf->mtrr);
- return 0;
+ return CB_SUCCESS;
}
void postcar_frame_add_mtrr(struct postcar_frame *pcf,
diff --git a/src/arch/x86/rdrand.c b/src/arch/x86/rdrand.c
index 985aeba..31958db 100644
--- a/src/arch/x86/rdrand.c
+++ b/src/arch/x86/rdrand.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <random.h>
-#include <stdint.h>
+#include <types.h>
/*
* Intel recommends that applications attempt 10 retries in a tight loop
@@ -41,19 +41,19 @@
}
#endif
-int get_random_number_32(uint32_t *rand)
+enum cb_err get_random_number_32(uint32_t *rand)
{
int i;
/* Perform a loop call until RDRAND succeeds or returns failure. */
for (i = 0; i < RDRAND_RETRY_LOOPS; i++) {
if (rdrand_32(rand))
- return 0;
+ return CB_SUCCESS;
}
- return -1;
+ return CB_ERR;
}
-int get_random_number_64(uint64_t *rand)
+enum cb_err get_random_number_64(uint64_t *rand)
{
int i;
uint32_t rand_high, rand_low;
@@ -62,13 +62,13 @@
for (i = 0; i < RDRAND_RETRY_LOOPS; i++) {
#if ENV_X86_64
if (rdrand_64(rand))
- return 0;
+ return CB_SUCCESS;
#endif
if (rdrand_32(&rand_high) && rdrand_32(&rand_low)) {
*rand = ((uint64_t)rand_high << 32) |
(uint64_t)rand_low;
- return 0;
+ return CB_SUCCESS;
}
}
- return -1;
+ return CB_ERR;
}