Annotation of qemu/roms/SLOF/lib/libipmi/libipmi.code, revision 1.1.1.1

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 <libipmi.h>
                     14: 
                     15: // : ipmi-kcs-cmd  ( in-buf in-len out-buf out-maxlen -- out-len errorcode )
                     16: PRIM(IPMI_X2d_KCS_X2d_CMD)
                     17:        cell maxlen = TOS; POP;
                     18:        cell outbuf = TOS; POP;
                     19:        int len = TOS.n; POP;
                     20:        cell inbuf = TOS;
                     21:        int retval;
                     22:        retval = ipmi_kcs_cmd(inbuf.a, outbuf.a, maxlen.n, (uint32_t *) &len);
                     23:        TOS.n = len;
                     24:        PUSH; TOS.n = retval;
                     25: MIRP
                     26: 
                     27: 
                     28: PRIM(IPMI_X2d_SYSTEM_X2d_REBOOT)
                     29:        ipmi_system_reboot();
                     30: MIRP
                     31: 
                     32: 
                     33: PRIM(IPMI_X2d_POWER_X2d_OFF)
                     34:        ipmi_power_off();
                     35: MIRP
                     36: 
                     37: 
                     38: // : ipmi-oem-stop-bootwatchdog  ( -- errorcode )
                     39: PRIM(IPMI_X2d_OEM_X2d_STOP_X2d_BOOTWATCHDOG)
                     40:        PUSH;
                     41:        TOS.n = ipmi_oem_stop_bootwatchdog();
                     42: MIRP
                     43: 
                     44: 
                     45: // : ipmi-oem-set-bootwatchdog  ( seconds -- errorcode )
                     46: PRIM(IPMI_X2d_OEM_X2d_SET_X2d_BOOTWATCHDOG)
                     47:        int sec = TOS.n;
                     48:        TOS.n = ipmi_oem_set_bootwatchdog(sec);
                     49: MIRP
                     50: 
                     51: 
                     52: // : ipmi-oem-reset-bootwatchdog  ( -- errorcode )
                     53: PRIM(IPMI_X2d_OEM_X2d_RESET_X2d_BOOTWATCHDOG)
                     54:        PUSH;
                     55:        TOS.n = ipmi_oem_reset_bootwatchdog();
                     56: MIRP
                     57: 
                     58: 
                     59: // : ipmi-oem-led-set  ( type instance state -- errorcode )
                     60: PRIM(IPMI_X2d_OEM_X2d_LED_X2d_SET)
                     61:        int state = TOS.n; POP;
                     62:        int instance = TOS.n; POP;
                     63:        int type = TOS.n;
                     64:        TOS.n = ipmi_oem_led_set(type, instance, state);
                     65: MIRP
                     66: 
                     67: 
                     68: // : ipmi-oem-read-vpd  ( offset length dst -- status )
                     69: PRIM(IPMI_X2d_OEM_X2d_READ_X2d_VPD)
                     70:        cell dest = TOS; POP;
                     71:        int len = TOS.n; POP;
                     72:        int offset = TOS.n;
                     73:        TOS.n = ipmi_oem_read_vpd(dest.a, len, offset);
                     74: MIRP
                     75: 
                     76: // : ipmi-oem-write-vpd  ( offset length src -- status )
                     77: PRIM(IPMI_X2d_OEM_X2d_WRITE_X2d_VPD)
                     78:        cell src = TOS; POP;
                     79:        int len = TOS.n; POP;
                     80:        int offset = TOS.n;
                     81:        TOS.n = ipmi_oem_write_vpd(src.a, len, offset);
                     82: MIRP
                     83: 
                     84: 
                     85: // : ipmi-oem-get-blade-descr  ( buf maxlen -- len status )
                     86: PRIM(IPMI_X2d_OEM_X2d_GET_X2d_BLADE_X2d_DESCR)
                     87:        int maxlen = TOS.n; POP;
                     88:        cell buf = TOS;
                     89:        int len = 0;
                     90:        int retval;
                     91:        retval = ipmi_oem_get_blade_descr(buf.a, maxlen, (uint32_t *) &len);
                     92:        TOS.n = len;
                     93:        PUSH; TOS.n = retval;
                     94: MIRP
                     95: 
                     96: 
                     97: // : ipmi-oem-bios2sp  ( str-ptr str-len swid type -- errorcode )
                     98: PRIM(IPMI_X2d_OEM_X2d_BIOS2SP)
                     99:        int type = TOS.n; POP;
                    100:        int swid = TOS.n; POP;
                    101:        int len = TOS.n; POP;
                    102:        void* addr = TOS.a;
                    103:        TOS.n = ipmi_oem_bios2sp(swid, type, addr, len);
                    104: MIRP
                    105: 
                    106: // : ipmi-set-sensor ( param-1 ... param-n n command sensor - errorcode )
                    107: PRIM(IPMI_X2d_SET_X2d_SENSOR)
                    108:        int sensor = TOS.n; POP;
                    109:        int cmd    = TOS.n; POP;
                    110:        int n      = TOS.n;
                    111:        int i      = n;
                    112:        uint8_t param[10];
                    113:        while (i>0) {
                    114:                i--;
                    115:                POP; param[i]=TOS.n;
                    116:        };
                    117:        TOS.n = ipmi_set_sensor((cmd<<8)+sensor,n,
                    118:                param[0],param[1],param[2],param[3],param[4],
                    119:                param[5],param[6],param[7],param[8],param[9]);
                    120: MIRP

unix.superglobalmegacorp.com

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