00001 /* 00002 Copyright (C) 2000-2003, Intel Corporation 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without modification, 00006 are permitted provided that the following conditions are met: 00007 00008 Redistributions of source code must retain the above copyright notice, this list 00009 of conditions and the following disclaimer. 00010 00011 Redistributions in binary form must reproduce the above copyright notice, this list 00012 of conditions and the following disclaimer in the documentation and/or other materials 00013 provided with the distribution. 00014 00015 Neither the name of the owner nor the names of its contributors may be used to endorse or 00016 promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR 00021 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00022 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 00023 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00024 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 00028 //-*-c++-*- 00029 //============================================================================= 00030 // 00031 // Module : ekapi_properties.cxx 00032 // $Date : $ 00033 // $Author: marcel $ 00034 // $Source: /proj/osprey/CVS/open64/osprey1.0/common/ipfec_targ_info/access/ekapi_properties.cxx,v $ 00035 // 00036 // Description: 00037 // ============ 00038 // hold all isa properties functions in access layer of IPFEC. 00039 // and encapsulate KAPI first layer opcode of access layer. 00040 //============================================================================= 00041 00042 #include <stdio.h> 00043 #include "ekapi_ia64.h" 00044 #include "ekapi_util.h" 00045 00046 // Return operate code properties count 00047 int EKAPI_OppCount(void *pknobs) 00048 { 00049 return KAPI_EnumCardinality(pknobs, "opp_t"); 00050 } 00051 00052 // Return operate code properties count which is never owned by any op 00053 int EKAPI_FalseOppCount(void *pknobs) 00054 { 00055 return KAPI_EnumCardinality(pknobs, "false_opp_t"); 00056 } 00057 00058 // Return op properties Name for an opp id 00059 char *EKAPI_Oppid2Name(void *pknobs, int index) 00060 { 00061 char *name; 00062 name = KAPI_EnumName(pknobs, index, "opp_t"); 00063 FmtAssert(name, 00064 ("KNOBS FILE Error: opp_t index %d is not existed\n", index) 00065 ); 00066 return name; 00067 } 00068 00069 // Return op flase properties Name for an opp id 00070 char *EKAPI_FalseOppid2Name(void *pknobs, int index) 00071 { 00072 char *name; 00073 name = KAPI_EnumName(pknobs, index, "false_opp_t"); 00074 FmtAssert(name, 00075 ("KNOBS FILE Error: false_opp_t index %d is not existed\n", index) 00076 ); 00077 return name; 00078 } 00079 00080 // Return flag composed by op properties for an op 00081 UINT64 EKAPI_OppMask4op(void *pknobs, int opid) 00082 { 00083 bv_t *bv; 00084 char op[100]="%"; 00085 BOOL b; 00086 int j, iknob; 00087 UINT64 flag=0; 00088 char errmsg[200]; 00089 00090 strcat(op,EKAPI_OpName4id(pknobs, opid)); 00091 00092 // here use function of pro64 because pass opcode test 00093 iknob = KAPI_ArrayIndex(pknobs, "opprop", op); 00094 sprintf( errmsg, "Op %s's properties not exist!\n", op); 00095 Is_True(iknob>=0, (errmsg)); 00096 00097 bv = KAPI_GetBvVariable(pknobs,"opprop", iknob); 00098 00099 // print flag 00100 for ( j=0; j<bv->n32Chunks * 32; j++ ) { 00101 b = ( 0 != isbvBITSET( bv, j ) ); 00102 if (b) { 00103 flag |= 1ULL << j ; 00104 } 00105 } 00106 return flag; 00107 }
1.5.6