Annotation of qemu/roms/SLOF/rtas/rtas_call.c, revision 1.1.1.2

1.1       root        1: /******************************************************************************
                      2:  * Copyright (c) 2004, 2008 IBM Corporation
                      3:  * All rights reserved.
                      4:  * This program and the accompanying materials
                      5:  * are made available under the terms of the BSD License
                      6:  * which accompanies this distribution, and is available at
                      7:  * http://www.opensource.org/licenses/bsd-license.php
                      8:  *
                      9:  * Contributors:
                     10:  *     IBM Corporation - initial implementation
                     11:  *****************************************************************************/
                     12: 
                     13: #include <stdint.h>
                     14: #include <rtas.h>
                     15: #include "rtas_table.h"
                     16: 
                     17: 
                     18: //#define _RTAS_TRACE
                     19: //#define _RTAS_COUNT_CALLS
                     20: 
                     21: 
                     22: #ifdef _RTAS_COUNT_CALLS
                     23: int rtas_callcount[0x40] __attribute__((aligned (16)));
                     24: #endif
                     25: 
                     26: /* rtas_config is used to store the run-time configuration flags (which are
                     27:  * provided by SLOF during instantiate-rtas) */
                     28: long rtas_config;
                     29: 
                     30: 
1.1.1.2 ! root       31: /* Prototype */
        !            32: void rtas_call (rtas_args_t *rtas_args);
        !            33: 
        !            34: 
1.1       root       35: /* 
                     36: Function: rtas_call
                     37:        Input:
                     38:                rtas_args: pointer to RTAS arguments structure
                     39:        Output:
                     40:                
                     41: Decription: Handle RTAS call. This C function is called
                     42:                from the asm function rtas_entry.
                     43: */
                     44: 
                     45: void
                     46: rtas_call (rtas_args_t *rtas_args)
                     47: {
                     48:        int idx;
                     49: 
                     50: #ifdef _RTAS_COUNT_CALLS
                     51:        /* Count how often every RTAS function is called. */
                     52:        if (rtas_args->token < (int)(sizeof(rtas_callcount)/sizeof(rtas_callcount[0]))) {
                     53:                static int callcount_initialized = 0;
                     54:                /* If the array is used the first time, we have to set all entries to 0 */
                     55:                if (!callcount_initialized) {
                     56:                        unsigned int i;
                     57:                        callcount_initialized = 1;
                     58:                        for (i = 0; i < sizeof(rtas_callcount)/sizeof(rtas_callcount[0]); i++)
                     59:                                rtas_callcount[i] = 0;
                     60:                }
                     61:                /* Increment the counter of the RTAS call */
                     62:                rtas_callcount[rtas_args->token] += 1;
                     63:        }
                     64: #endif
                     65: 
                     66: #ifdef _RTAS_TRACE
                     67:        unsigned int parCnt = rtas_args->nargs;
                     68:        unsigned int *pInt = rtas_args->args;
                     69:        printf("\n\r*** rtas_call=0x%x", rtas_args->token);
                     70: #ifdef _RTAS_COUNT_CALLS
                     71:        printf(" count=0x%x", rtas_callcount[rtas_args->token]);
                     72: #endif
                     73:        printf(" len=0x%x", parCnt);
                     74:        printf("\n\r ");
                     75:        while(parCnt--) {
                     76:                printf("0x%x ", *pInt++);
                     77:        }
                     78: #endif
                     79: 
                     80:        idx = rtas_args->token - 1;
                     81: 
                     82:        /* Check if there's a function for the token: */
                     83:        if (idx >= 0 && idx < rtas_func_tab_size
                     84:            && rtas_func_tab[idx].func != NULL) {
                     85:                /* Now jump to the RTAS function: */
                     86:                rtas_func_tab[idx].func(rtas_args);
                     87:        }
                     88:        else {
                     89:                /* We didn't find a function - return error code: */
                     90:                rtas_args->args[rtas_args->nargs] = -1;
                     91:        }
                     92: 
                     93: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.