// ========== Copyright Header Begin ========================================== // // OpenSPARC T2 Processor File: pktConfig.vr // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved // 4150 Network Circle, Santa Clara, California 95054, U.S.A. // // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // For the avoidance of doubt, and except that if any non-GPL license // choice is available it will apply instead, Sun elects to use only // the General Public License version 2 (GPLv2) at this time for any // software where a choice of GPL license versions is made // available with the language indicating that GPLv2 or any later version // may be used, or where a choice of which version of the GPL is applied is // otherwise unspecified. // // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, // CA 95054 USA or visit www.sun.com if you need additional information or // have any questions. // // ========== Copyright Header End ============================================ #include #include // Check these #include "pcg_defines.vri" #include "pcg_types.vri" #include "pack_db.vrh" #include "flow_db.vrh" #include "flow_db_tasks.vrh" #include "pg_top_pp.vrh" #include "pc_top_pp.vrh" #include "pcg_token.vrh" #include "mbox_class.vrh" #include "get_mbox_id.vrh" #include "niu_rxtoken.vrh" #include "ip_ingress_classes.vrh" #include "ip_util.vrh" #include "pgIdgen.vrh" #include "niu_lptoken.vrh" extern mbox_class mbox_id; extern pg pack_gen[16]; class CpktConfig { // Top level class which hold packet generator etc. setup_cam_ram_fcram_class cam_ram_cl; CpgIdgen pgIdgen; bit [3:0] MAC_LOOP_BACK_MODE; bit[15:0] packet_id[4]; integer modify_mac_src_addr = 0; // details to be worked out task new() { integer i,j; string init_loopback,temp_port; bit [31:0] loopback; if (get_plus_arg(CHECK, "ENABLE_CTRL_FIFO_CHKR")) cam_ram_cl = new; pgIdgen = new(); for(i=0;i<4;i++) { packet_id[i] = 0; } for(i=0;i<4;i++) { if(mbox_id.niu_pktcfglp[i] == -1) { mbox_id.niu_pktcfglp[i] = alloc(MAILBOX,0,1); } } for(i=0;i<4;i++) { if(mbox_id.niu_rxpath_mb[i] == -1) { // Alocate Mailbox mbox_id.niu_rxpath_mb[i] = alloc(MAILBOX,0,1); // Check if we were succesfull allocating the mailbox if(mbox_id.niu_rxpath_mb[i] == 0) { printf("ERROR Could not allocate the outgoing mailbox port %d \n",i); mbox_id.niu_rxpath_mb[i] = -1; return; } } } for(i=0;i<4;i++) { if(mbox_id.mac_opp[i] == -1) { // Alocate Mailbox mbox_id.mac_opp[i] = alloc(MAILBOX,0,1); // Check if we were succesfull allocating the mailbox if(mbox_id.mac_opp[i] == 0) { printf("ERROR Could not allocate the outgoing mailbox port0\n"); mbox_id.mac_opp[i] = -1; return; } } } if (get_plus_arg (CHECK, "RX_DROP_PKT_CHECK")) modify_mac_src_addr = 1; // tmp added until we find a place to add the id else modify_mac_src_addr =0; if( get_plus_arg( CHECK, "MAC_LOOP_BACK=")) { loopback = get_plus_arg( STR, "MAC_LOOP_BACK="); init_loopback.bittostr(loopback); for (j=0; j