1164426Ssam/*- 2164426Ssam * Copyright (c) 2006 Sam Leffler. All rights reserved. 3164426Ssam * 4164426Ssam * Redistribution and use in source and binary forms, with or without 5164426Ssam * modification, are permitted provided that the following conditions 6164426Ssam * are met: 7164426Ssam * 1. Redistributions of source code must retain the above copyright 8164426Ssam * notice, this list of conditions and the following disclaimer. 9164426Ssam * 2. Redistributions in binary form must reproduce the above copyright 10164426Ssam * notice, this list of conditions and the following disclaimer in the 11164426Ssam * documentation and/or other materials provided with the distribution. 12164426Ssam * 13164426Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14164426Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15164426Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16164426Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17164426Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18164426Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19164426Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20164426Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21164426Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22164426Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23164426Ssam * 24164426Ssam * $FreeBSD$ 25164426Ssam */ 26164426Ssam 27164426Ssam#ifndef _IXP425_NPEVAR_H_ 28164426Ssam#define _IXP425_NPEVAR_H_ 29164426Ssam 30164426Ssam/* 31164426Ssam * Intel (R) IXP400 Software NPE Image ID Definition 32164426Ssam * 33164426Ssam * Firmware Id's for current firmware image. These are typed by 34164426Ssam * NPE ID and the feature set. Not all features are available 35169954Ssam * on all NPE's. The Image ID has the following structure: 36164426Ssam * 37169954Ssam * Field [Bit Location] 38169954Ssam * ----------------------------------- 39169954Ssam * Device ID [28..31] 40169954Ssam * NPE ID [24..27] 41169954Ssam * NPE Functionality ID [16..23] 42169954Ssam * Major Release Number [8..15] 43169954Ssam * Minor Release Number [0..7] 44169954Ssam * 45169954Ssam * The following "feature sets" are known to exist: 46169954Ssam * 47164426Ssam * HSS-0: supports 32 channelized and 4 packetized. 48164426Ssam * HSS-0 + ATM + SPHY: 49164426Ssam * For HSS, 16/32 channelized and 4/0 packetized. 50164426Ssam * For ATM, AAL5, AAL0 and OAM for UTOPIA SPHY, 1 logical port, 32 VCs. 51164426Ssam * Fast Path support. 52164426Ssam * HSS-0 + ATM + MPHY: 53164426Ssam * For HSS, 16/32 channelized and 4/0 packetized. 54164426Ssam * For ATM, AAL5, AAL0 and OAM for UTOPIA MPHY, 1 logical port, 32 VCs. 55164426Ssam * Fast Path support. 56164426Ssam * ATM-Only: 57164426Ssam * AAL5, AAL0 and OAM for UTOPIA MPHY, 12 logical ports, 32 VCs. 58164426Ssam * Fast Path support. 59164426Ssam * HSS-2: 60164426Ssam * HSS-0 and HSS-1. 61164426Ssam * Each HSS port supports 32 channelized and 4 packetized. 62164426Ssam * ETH: Ethernet Rx/Tx which includes: 63164426Ssam * MAC_FILTERING, MAC_LEARNING, SPANNING_TREE, FIREWALL 64164426Ssam * ETH+VLAN Ethernet Rx/Tx which includes: 65164426Ssam * MAC_FILTERING, MAC_LEARNING, SPANNING_TREE, FIREWALL, VLAN_QOS 66164426Ssam * ETH+VLAN+HDR: Ethernet Rx/Tx which includes: 67164426Ssam * SPANNING_TREE, FIREWALL, VLAN_QOS, HEADER_CONVERSION 68164426Ssam */ 69169954Ssam#define NPEIMAGE_DEVID(id) (((id) >> 28) & 0xf) 70169954Ssam#define NPEIMAGE_NPEID(id) (((id) >> 24) & 0xf) 71169954Ssam#define NPEIMAGE_FUNCID(id) (((id) >> 16) & 0xff) 72169954Ssam#define NPEIMAGE_MAJOR(id) (((id) >> 8) & 0xff) 73169954Ssam#define NPEIMAGE_MINOR(id) (((id) >> 0) & 0xff) 74169954Ssam#define NPEIMAGE_MAKEID(dev, npe, func, maj, min) \ 75169954Ssam ((((dev) & 0xf) << 28) | (((npe) & 0xf) << 24) | \ 76169954Ssam (((func) & 0xff) << 16) (((maj) & 0xff) << 8) | (((min) & 0xff) << 0)) 77169954Ssam 78164426Ssam/* XXX not right, revise */ 79164426Ssam/* NPE A Firmware Image Id's */ 80164426Ssam#define NPEFW_A_HSS0 0x00010000 /* HSS-0: 32 chan+4 packet */ 81164426Ssam#define NPEFW_A_HSS0_ATM_S_1 0x00020000 /* HSS-0+ATM UTOPIA SPHY (1 port) */ 82164426Ssam#define NPEFW_A_HSS0_ATM_M_1 0x00020000 /* HSS-0+ATM UTOPIA MPHY (1 port) */ 83164426Ssam#define NPEFW_A_ATM_M_12 0x00040000 /* ATM UTOPIA MPHY (12 ports) */ 84164426Ssam#define NPEFW_A_DMA 0x00150100 /* DMA only */ 85164426Ssam#define NPEFW_A_HSS2 0x00090000 /* HSS-0 + HSS-1 */ 86164426Ssam#define NPEFW_A_ETH 0x10800200 /* Basic Ethernet */ 87164426Ssam#define NPEFW_A_ETH_VLAN 0x10810200 /* NPEFW_A_ETH + VLAN QoS */ 88164426Ssam#define NPEFW_A_ETH_VLAN_HDR 0x10820200 /* NPEFW_A_ETH_VLAN + Hdr conv */ 89164426Ssam/* XXX ... more not included */ 90164426Ssam 91164426Ssam/* NPE B Firmware Image Id's */ 92164426Ssam#define NPEFW_B_ETH 0x01000200 /* Basic Ethernet */ 93164426Ssam#define NPEFW_B_ETH_VLAN 0x01010200 /* NPEFW_B_ETH + VLAN QoS */ 94164426Ssam#define NPEFW_B_ETH_VLAN_HDR 0x01020201 /* NPEFW_B_ETH_VLAN + Hdr conv */ 95164426Ssam#define NPEFW_B_DMA 0x01020100 /* DMA only */ 96164426Ssam/* XXX ... more not include */ 97164426Ssam 98186352Ssam/* NPE ID's */ 99186352Ssam#define NPE_A 0 100186352Ssam#define NPE_B 1 101186352Ssam#define NPE_C 2 102186352Ssam#define NPE_MAX (NPE_C+1) 103164426Ssam 104186352Ssam#define IXP425_NPE_A_IMAGEID 0x10820200 105186352Ssam#define IXP425_NPE_B_IMAGEID 0x01020201 106186352Ssam#define IXP425_NPE_C_IMAGEID 0x02050201 107186352Ssam 108164426Ssamstruct ixpnpe_softc; 109186352Ssamstruct ixpnpe_softc *ixpnpe_attach(device_t, int npeid); 110164426Ssamvoid ixpnpe_detach(struct ixpnpe_softc *); 111164426Ssamint ixpnpe_stopandreset(struct ixpnpe_softc *); 112164426Ssamint ixpnpe_start(struct ixpnpe_softc *); 113164426Ssamint ixpnpe_stop(struct ixpnpe_softc *); 114186420Ssamint ixpnpe_init(struct ixpnpe_softc *); 115164426Ssamint ixpnpe_getfunctionality(struct ixpnpe_softc *sc); 116164426Ssam 117186352Ssamint ixpnpe_sendmsg_async(struct ixpnpe_softc *, const uint32_t msg[2]); 118186352Ssamint ixpnpe_recvmsg_async(struct ixpnpe_softc *, uint32_t msg[2]); 119186352Ssamint ixpnpe_sendandrecvmsg_sync(struct ixpnpe_softc *, 120186352Ssam const uint32_t send[2], uint32_t recv[2]); 121186352Ssamint ixpnpe_recvmsg_sync(struct ixpnpe_softc *, uint32_t msg[2]); 122164426Ssam#endif /* _IXP425_NPEVAR_H_ */ 123