arm64/armv8: Use 'enum cb_err'

Change-Id: Ic4ce44865544c94c39e8582780a7eca7876f5c38
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/68370
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Elyes Haouas 2022-10-13 12:06:50 +02:00 committed by Felix Held
parent d91f73b1d3
commit 000490a221
2 changed files with 10 additions and 9 deletions

View File

@ -65,25 +65,25 @@ static void print_regs(struct exc_state *exc_state)
static struct exception_handler *handlers[NUM_EXC_VIDS]; static struct exception_handler *handlers[NUM_EXC_VIDS];
int exception_handler_register(uint64_t vid, struct exception_handler *h) enum cb_err exception_handler_register(uint64_t vid, struct exception_handler *h)
{ {
if (vid >= NUM_EXC_VIDS) if (vid >= NUM_EXC_VIDS)
return -1; return CB_ERR;
/* Just place at head of queue. */ /* Just place at head of queue. */
h->next = handlers[vid]; h->next = handlers[vid];
store_release(&handlers[vid], h); store_release(&handlers[vid], h);
return 0; return CB_SUCCESS;
} }
int exception_handler_unregister(uint64_t vid, struct exception_handler *h) enum cb_err exception_handler_unregister(uint64_t vid, struct exception_handler *h)
{ {
struct exception_handler *cur; struct exception_handler *cur;
struct exception_handler **prev; struct exception_handler **prev;
if (vid >= NUM_EXC_VIDS) if (vid >= NUM_EXC_VIDS)
return -1; return CB_ERR;
prev = &handlers[vid]; prev = &handlers[vid];
@ -92,11 +92,11 @@ int exception_handler_unregister(uint64_t vid, struct exception_handler *h)
continue; continue;
/* Update previous pointer. */ /* Update previous pointer. */
store_release(prev, cur->next); store_release(prev, cur->next);
return 0; return CB_SUCCESS;
} }
/* Not found */ /* Not found */
return -1; return CB_ERR;
} }
static void print_exception_info(struct exc_state *state, uint64_t idx) static void print_exception_info(struct exc_state *state, uint64_t idx)

View File

@ -4,6 +4,7 @@
#define _ARCH_EXCEPTION_H #define _ARCH_EXCEPTION_H
#include <arch/transition.h> #include <arch/transition.h>
#include <types.h>
/* Initialize the exception handling on the current CPU. */ /* Initialize the exception handling on the current CPU. */
void exception_init(void); void exception_init(void);
@ -31,12 +32,12 @@ struct exception_handler {
* Register a handler provided with the associated vector id. Returns 0 on * Register a handler provided with the associated vector id. Returns 0 on
* success, < 0 on error. Note that registration is not thread/interrupt safe. * success, < 0 on error. Note that registration is not thread/interrupt safe.
*/ */
int exception_handler_register(uint64_t vid, struct exception_handler *h); enum cb_err exception_handler_register(uint64_t vid, struct exception_handler *h);
/* /*
* Unregister a handler from the vector id. Return 0 on success, < 0 on error. * Unregister a handler from the vector id. Return 0 on success, < 0 on error.
* Note that the unregistration is not thread/interrupt safe. * Note that the unregistration is not thread/interrupt safe.
*/ */
int exception_handler_unregister(uint64_t vid, struct exception_handler *h); enum cb_err exception_handler_unregister(uint64_t vid, struct exception_handler *h);
#endif #endif