4 * @brief Utility functions
7 * IXP400 SW Release version 2.0
9 * -- Copyright Notice --
12 * Copyright 2001-2005, Intel Corporation.
13 * All rights reserved.
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 * 3. Neither the name of the Intel Corporation nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
30 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 * -- End of Copyright Notice --
46 #include "IxFeatureCtrl.h"
47 #include "IxEthDB_p.h"
50 IxEthDBStatus ixEthDBSingleEthNpeCheck(IxEthDBPortId portID)
52 /* If not IXP42X A0 stepping, proceed to check for existence of coprocessors */
53 if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
54 (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
55 || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
58 (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH0) ==
59 IX_FEATURE_CTRL_COMPONENT_DISABLED))
61 return IX_ETH_DB_FAIL;
65 (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH1) ==
66 IX_FEATURE_CTRL_COMPONENT_DISABLED))
68 return IX_ETH_DB_FAIL;
72 (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA_ETH) ==
73 IX_FEATURE_CTRL_COMPONENT_DISABLED))
75 return IX_ETH_DB_FAIL;
79 return IX_ETH_DB_SUCCESS;
83 BOOL ixEthDBCheckSingleBitValue(UINT32 value)
85 #if (CPU != SIMSPARCSOLARIS) && !defined (__wince)
88 /* use the count-leading-zeros XScale instruction */
89 __asm__ ("clz %0, %1\n" : "=r" (shift) : "r" (value));
91 return ((value << shift) == 0x80000000UL);
97 if (value == 1) return TRUE;
98 else if ((value & 1) == 1) return FALSE;
108 const char *mac2string(const unsigned char *mac)
117 sprintf(str, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);