• Nathan Lynch's avatar
    powerpc/rtas: introduce rtas_function_token() API · 716bfc97
    Nathan Lynch authored
    Users of rtas_token() supply a string argument that can't be validated
    at build time. A typo or misspelling has to be caught by inspection or
    by observing wrong behavior at runtime.
    
    Since the core RTAS code now has consolidated the names of all
    possible RTAS functions and mapped them to their tokens, token lookup
    can be implemented using symbolic constants to index a static array.
    
    So introduce rtas_function_token(), a replacement API which does that,
    along with a rtas_service_present()-equivalent helper,
    rtas_function_implemented(). Callers supply an opaque predefined
    function handle which is used internally to index the function
    table. Typos or other inappropriate arguments yield build errors, and
    the function handle is a type that can't be easily confused with RTAS
    tokens or other integer types.
    Signed-off-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20230125-b4-powerpc-rtas-queue-v3-19-26929c8cce78@linux.ibm.com
    716bfc97
rtas.h 22.6 KB