git: 36b05c058892 - main - stand/powerpc/ofw: Initialize archsw at compile time
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 May 2025 15:33:34 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=36b05c058892618c9411bcb7231c7ce9d15e52dd commit 36b05c058892618c9411bcb7231c7ce9d15e52dd Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2025-05-26 03:34:16 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2025-05-26 15:30:37 +0000 stand/powerpc/ofw: Initialize archsw at compile time There's no real reason to do this at runtime. Sponsored by: Netflix --- stand/powerpc/ofw/main.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/stand/powerpc/ofw/main.c b/stand/powerpc/ofw/main.c index 34c7e12778e3..093dda27ae04 100644 --- a/stand/powerpc/ofw/main.c +++ b/stand/powerpc/ofw/main.c @@ -35,7 +35,21 @@ #include <machine/asm.h> #include <machine/psl.h> -struct arch_switch archsw; /* MI/MD interface boundary */ +#ifdef CAS +static int ppc64_autoload(void); +#endif + +struct arch_switch archsw = { /* MI/MD interface boundary */ + .arch_getdev = ofw_getdev, + .arch_copyin = ofw_copyin, + .arch_copyout = ofw_copyout, + .arch_readin = ofw_readin, +#ifdef CAS + .arch_autoload = ppc64_autoload, +#else + .arch_autoload = ofw_autoload, +#endif +}; uint32_t acells, scells; @@ -163,15 +177,8 @@ main(int (*openfirm)(void *)) */ cons_probe(); - archsw.arch_getdev = ofw_getdev; - archsw.arch_copyin = ofw_copyin; - archsw.arch_copyout = ofw_copyout; - archsw.arch_readin = ofw_readin; #ifdef CAS setenv("cas", "1", 0); - archsw.arch_autoload = ppc64_autoload; -#else - archsw.arch_autoload = ofw_autoload; #endif /* Set up currdev variable to have hooks in place. */