diff options
19 files changed, 0 insertions, 2188 deletions
diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/Remove_from_ecore_files_solaris.txt b/usr/src/uts/common/io/qede/579xx/drivers/ecore/Remove_from_ecore_files_solaris.txt deleted file mode 100644 index eeb79a22cd..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/Remove_from_ecore_files_solaris.txt +++ /dev/null @@ -1,29 +0,0 @@ -From Directory 579xx/drivers/ecore :
-
-core
-ecore.vcxproj
-ecore_chain.c
-ecore_dbg_values.bin
-ecore_fcoe.c
-ecore_hsi_eth.h
-ecore_hsi_iwarp.h
-ecore_iscsi.c
-ecore_ll2.c
-ecore_mng_tlv.c
-ecore_ooo.c
-ecore_ptp.c
-ecore_ptp.h
-ecore_roce.c
-ecore_self_test.c
-ecore_sriov.c
-ecore_tcp_ip.h
-ecore_user_dbg_fw_funcs.c
-ecore_vf.c
-
-From Directory 579xx/drivers/ecore/hsi_repository :
-drv_fcoe_fw_funcs.c
-drv_fcoe_fw_funcs.h
-drv_iscsi_fw_funcs.c
-drv_iscsi_fw_funcs.h
-drv_scsi_fw_funcs.c
-drv_scsi_fw_funcs.h
\ No newline at end of file diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore.vpj b/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore.vpj deleted file mode 100644 index 9dea8e23db..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore.vpj +++ /dev/null @@ -1,122 +0,0 @@ -<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd"> -<Project - Version="10.0" - VendorName="SlickEdit" - WorkingDir="." - VCSProject="SCC:Perforce SCM:drv-win-michals-work"> - <Config - Name="Release" - OutputFile="" - CompilerConfigName="Latest Version"> - <Menu> - <Target - Name="Compile" - MenuCaption="&Compile" - CaptureOutputWith="ProcessBuffer" - SaveOption="SaveCurrent" - RunFromDir="%rw"> - <Exec/> - </Target> - <Target - Name="Build" - MenuCaption="&Build" - CaptureOutputWith="ProcessBuffer" - SaveOption="SaveWorkspaceFiles" - RunFromDir="%rw"> - <Exec/> - </Target> - <Target - Name="Rebuild" - MenuCaption="&Rebuild" - CaptureOutputWith="ProcessBuffer" - SaveOption="SaveWorkspaceFiles" - RunFromDir="%rw"> - <Exec/> - </Target> - <Target - Name="Debug" - MenuCaption="&Debug" - SaveOption="SaveNone" - RunFromDir="%rw"> - <Exec/> - </Target> - <Target - Name="Execute" - MenuCaption="E&xecute" - SaveOption="SaveNone" - RunFromDir="%rw"> - <Exec CmdLine='"ecore.exe"'/> - </Target> - </Menu> - </Config> - <Files> - <Folder - Name="Source Files" - Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl"> - <F N="tools/e2l.pl"/> - <F N="ecore_cxt.c"/> - <F N="ecore_dev.c"/> - <F N="ecore_fcoe.c"/> - <F N="ecore_fw_funcs.c"/> - <F N="ecore_hw.c"/> - <F N="ecore_init_ops.c"/> - <F N="ecore_int.c"/> - <F N="ecore_iscsi.c"/> - <F N="ecore_ll2.c"/> - <F N="ecore_mcp.c"/> - <F N="ecore_roce.c"/> - <F N="ecore_sp_commands.c"/> - <F N="ecore_l2.c"/> - <F N="ecore_spq.c"/> - <F N="ecore_sriov.c"/> - <F N="ecore_vf.c"/> - </Folder> - <Folder - Name="Header Files" - Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if"> - <F N="ecore.h"/> - <F N="ecore_attn_defs.h"/> - <F N="ecore_attn_values.h"/> - <F N="ecore_hw.h"/> - <F N="ecore_chain.h"/> - <F N="ecore_cxt.h"/> - <F N="ecore_dev.h"/> - <F N="ecore_err.h"/> - <F N="ecore_fcoe.h"/> - <F N="ecore_fw_funcs.h"/> - <F N="ecore_gtt_reg_addr.h"/> - <F N="ecore_gtt_values.h"/> - <F N="ecore_hsi_common.h"/> - <F N="ecore_hsi_eth.h"/> - <F N="ecore_hsi_fcoe.h"/> - <F N="ecore_hsi_iscsi.h"/> - <F N="ecore_hsi_toe.h"/> - <F N="ecore_hw_defs.h"/> - <F N="ecore_hwif.h"/> - <F N="ecore_init_defs.h"/> - <F N="ecore_init_ops.h"/> - <F N="ecore_init_values.h"/> - <F N="ecore_init_values_zipped.h"/> - <F N="ecore_int.h"/> - <F N="ecore_iro.h"/> - <F N="ecore_iro_values.h"/> - <F N="ecore_iscsi.h"/> - <F N="ecore_ll2.h"/> - <F N="ecore_mcp.h"/> - <F N="ecore_pcics_reg.h"/> - <F N="ecore_proto_if.h"/> - <F N="ecore_rt_defs.h"/> - <F N="ecore_sp_commands.h"/> - <F N="ecore_l2.h"/> - <F N="ecore_l2_api.h"/> - <F N="ecore_spq.h"/> - <F N="ecore_sriov.h"/> - <F N="ecore_status.h"/> - <F N="ecore_vf.h"/> - <F N="ecore_vfpf_if.h"/> - <F N="idle_check.sh"/> - <F N="../../hsi/hw/reg_addr.h"/> - <F N="tools/replace_fw.sh"/> - </Folder> - </Files> -</Project> diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/idle_check.sh b/usr/src/uts/common/io/qede/579xx/drivers/ecore/idle_check.sh deleted file mode 100644 index 1467822a69..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/idle_check.sh +++ /dev/null @@ -1,421 +0,0 @@ -#!/bin/bash - -IDLE_CHECK_LOCATION=../../tools/idle_chk_build - -cat << end > ecore_self_test.c -/* self test */ - -#include "bcm_osal.h" -#include "ecore_gtt_reg_addr.h" -#include "ecore_hsi_common.h" -#include "ecore.h" -#include "ecore_hw.h" -#include "reg_addr.h" - -/*statistics and error reporting*/ -static int idle_chk_errors; -static int idle_chk_warnings; - -#define NA 0xCD - -#define IDLE_CHK_ERROR 1 -#define IDLE_CHK_ERROR_NO_TRAFFIC 2 -#define IDLE_CHK_WARNING 3 - -#define MAX_FAIL_MSG 200 - -#define SNPRINTF(a, ...) do{a[0]=a[0];}while(0) /* FIXME */ - -/*struct for the argument list for a predicate in the self test database*/ -struct st_pred_args { - u32 val1; /* value read from first register*/ - u32 val2; /* value read from second register, if applicable */ - u32 imm1; /* 1st value in predicate condition, left-to-right */ - u32 imm2; /* 2nd value in predicate condition, left-to-right */ - u32 imm3; /* 3rd value in predicate condition, left-to-right */ - u32 imm4; /* 4th value in predicate condition, left-to-right */ -}; - -/*struct representing self test record - a single test*/ -struct st_record { - u8 chip_mask; - u8 macro; - u32 reg1; - u32 reg2; - u16 loop; - u16 incr; - int(*predicate)(struct st_pred_args *); - u32 reg3; - u8 severity; - char *failMsg; - struct st_pred_args pred_args; -}; - -/* predicates for self test */ -static int peq(struct st_pred_args *args) -{ - return (args->val1 == args->imm1); -} - -static int pneq(struct st_pred_args *args) -{ - return (args->val1 != args->imm1); -} - -static int pand_neq(struct st_pred_args *args) -{ - return ((args->val1 & args->imm1) != args->imm2); -} - -static int pand_neq_x2(struct st_pred_args *args) -{ - return (((args->val1 & args->imm1) != args->imm2) && - ((args->val1 & args->imm3) != args->imm4)); -} - -static int pneq_err(struct st_pred_args *args) -{ - return ((args->val1 != args->imm1) && (idle_chk_errors > args->imm2)); -} - -static int pgt(struct st_pred_args *args) -{ - return (args->val1 > args->imm1); -} - -static int pneq_r2(struct st_pred_args *args) -{ - return (args->val1 != args->val2); -} - -static int plt_sub_r2(struct st_pred_args *args) -{ - return (args->val1 < (args->val2 - args->imm1)); -} - -static int pne_sub_r2(struct st_pred_args *args) -{ - return (args->val1 != (args->val2 - args->imm1)); -} - -static int prsh_and_neq(struct st_pred_args *args) -{ - return (((args->val1 >> args->imm1) & args->imm2) != args->imm3); -} - -static int peq_neq_r2(struct st_pred_args *args) -{ - return ((args->val1 == args->imm1) && (args->val2 != args->imm2)); -} - -static int peq_neq_neq_r2(struct st_pred_args *args) -{ - return ((args->val1 == args->imm1) && (args->val2 != args->imm2) && - (args->val2 != args->imm3)); -} - -/* handle self test fails according to severity and type*/ -static void ecore_self_test_log(struct ecore_dev *p_dev, - u8 severity, - char *p_message) -{ - switch (severity) { - case IDLE_CHK_ERROR: - DP_ERR(p_dev, "ERROR %s", p_message); - idle_chk_errors++; - break; - case IDLE_CHK_ERROR_NO_TRAFFIC: - DP_INFO(p_dev, "INFO %s", p_message); - break; - case IDLE_CHK_WARNING: - DP_NOTICE(p_dev, "WARNING %s", p_message); - idle_chk_warnings++; - break; - } -} - -static void ecore_idle_reg_rd(struct ecore_path *p_path, - u32 *p_dst, - u32 reg, - u32 offset, - int ptt) -{ - ecore_ptt_set_win(p_path, ptt, reg - (reg % 4)); /* FIXME */ - *p_dst = REG_RD(p_path, offset + (reg % 4)); -} - -/*specific test for QM rd/wr pointers and rd/wr banks*/ -static void ecore_idle_chk6(struct ecore_path *p_path, - struct st_record *p_rec, - char *p_message, - int ptt) -{ - int i; - u32 rd_ptr, wr_ptr, rd_bank, wr_bank, offset; - - offset = ecore_bar_get_ext_addr(p_path, ptt); - - for (i = 0; i < p_rec->loop; i++) { - /* read regs */ - ecore_idle_reg_rd(p_path, &p_rec->pred_args.val1, - p_rec->reg1 + i * p_rec->incr, offset, ptt); - ecore_idle_reg_rd(p_path, &p_rec->pred_args.val2, - p_rec->reg1 + i * p_rec->incr + 4, offset, - ptt); - - /* calc read and write pointers */ - rd_ptr = ((p_rec->pred_args.val1 & 0x3FFFFFC0) >> 6); - wr_ptr = ((((p_rec->pred_args.val1 & 0xC0000000) >> 30) & 0x3) | - ((p_rec->pred_args.val2 & 0x3FFFFF) << 2)); - - /* perfrom pointer test */ - if (rd_ptr != wr_ptr) { - SNPRINTF(p_message, MAX_FAIL_MSG, - "QM: PTRTBL entry %d - rd_ptr is not equal to wr_ptr. Values are 0x%x and 0x%x\n", - i, rd_ptr, wr_ptr); - ecore_self_test_log(p_path->p_dev, p_rec->severity, - p_message); - } - - /* calculate read and write banks */ - rd_bank = ((p_rec->pred_args.val1 & 0x30) >> 4); - wr_bank = (p_rec->pred_args.val1 & 0x03); - - /* perform bank test */ - if (rd_bank != wr_bank) { - SNPRINTF(p_message, MAX_FAIL_MSG, - "QM: PTRTBL entry %d - rd_bank is not equal to wr_bank. Values are 0x%x 0x%x\n", - i, rd_bank, wr_bank); - ecore_self_test_log(p_path->p_dev, p_rec->severity, - p_message); - } - } -} - -/* specific test for cfc info ram and cid cam*/ -static void ecore_idle_chk7(struct ecore_path *p_path, - struct st_record *p_rec, - char *p_message, - int ptt) -{ - int i; - u32 offset, tmp = 0; - - offset = ecore_bar_get_ext_addr(p_path, ptt); - - /* iterate through lcids */ - for (i = 0; i < p_rec->loop; i++) { - /* make sure cam entry is valid (bit 0) */ - ecore_idle_reg_rd(p_path, &tmp, p_rec->reg2 + i *4, - offset, ptt); - if ((tmp & 0x1) != 0x1) - continue; - - /* get connection type (multiple reads due to widebus) */ - ecore_idle_reg_rd(p_path, &tmp, p_rec->reg1 + i * p_rec->incr, - offset, ptt); - ecore_idle_reg_rd(p_path, &tmp, - p_rec->reg1 + i * p_rec->incr + 4, - offset, ptt); - ecore_idle_reg_rd(p_path, &p_rec->pred_args.val1, - p_rec->reg1 + i * p_rec->incr + 8, - offset, ptt); - ecore_idle_reg_rd(p_path, &tmp, - p_rec->reg1 + i * p_rec->incr + 12, - offset, ptt); - - /* obtain connection type */ - p_rec->pred_args.val1 &= 0x1E000000; - p_rec->pred_args.val1 >>= 25; - - /* get activity counter value */ - ecore_idle_reg_rd(p_path, &p_rec->pred_args.val2, - p_rec->reg3 + i * 4, offset, ptt); - - /* validate ac value is legal for con_type at idle state */ - if (p_rec->predicate(&p_rec->pred_args)) { - SNPRINTF(p_message, MAX_FAIL_MSG, "%s. Values are " - "0x%x 0x%x\n", p_rec->failMsg, - p_rec->pred_args.val1, p_rec->pred_args.val2); - ecore_self_test_log(p_path->p_dev, p_rec->severity, - p_message); - } - } -} - -/* struct holding the database of self test checks (registers and predicates) */ -/* lines start from 2 since line 1 is heading in csv*/ -end - -perl ${IDLE_CHECK_LOCATION}/idle_chk_db.pl ${IDLE_CHECK_LOCATION}/idle_check.csv >> ecore_self_test.c - -cat << end >> ecore_self_test.c - -/* self test procedure - * scan auto-generated database - * for each line: - * 1. compare chip mask - * 2. determine type (according to maro number) - * 3. read registers - * 4. call predicate - * 5. collate results and statistics - */ -int ecore_idle_chk(struct ecore_path *p_path, bool b_print) -{ - u16 i; /* loop counter */ - u16 st_ind; /* self test database access index */ - struct st_record rec; /* current record variable */ - char message[MAX_FAIL_MSG]; /* message to log */ - int ptt; - u32 offset, tmp = 0; - - /*init stats*/ - idle_chk_errors = 0; - idle_chk_warnings = 0; - - ptt = ecore_ptt_acquire(p_path, 0xdeadbadd); /* FIXME - owner? */ - offset = ecore_bar_get_ext_addr(p_path, ptt); - - /*database main loop*/ - for (st_ind = 0; st_ind < ST_DB_LINES; st_ind++) { - rec = st_database[st_ind]; - - /* identify macro */ - switch (rec.macro) { - case 1: - /* read single reg and call predicate */ - ecore_idle_reg_rd(p_path, &rec.pred_args.val1, - rec.reg1, offset, ptt); - DP_VERBOSE(p_path->p_dev, ECORE_MSG_HW, - "mac1 add %x\n", rec.reg1); - if (rec.predicate(&rec.pred_args)) { - SNPRINTF(message, sizeof(message), - "%s.Value is 0x%x\n", rec.failMsg, - rec.pred_args.val1); - ecore_self_test_log(p_path->p_dev, rec.severity, - message); - } - break; - case 2: - /* read repeatedly starting from reg1 and call - * predicate after each read - */ - for (i = 0; i < rec.loop; i++) { - ecore_idle_reg_rd(p_path, &rec.pred_args.val1, - rec.reg1 + i * rec.incr, - offset, ptt); - DP_VERBOSE(p_path->p_dev, ECORE_MSG_HW, - "mac2 add %x\n", rec.reg1); - if (rec.predicate(&rec.pred_args)) { - SNPRINTF(message, sizeof(message), - "%s. Value is 0x%x in loop %d\n", - rec.failMsg, - rec.pred_args.val1, i); - ecore_self_test_log(p_path->p_dev, - rec.severity, - message); - } - } - break; - case 3: - /* read two regs and call predicate */ - ecore_idle_reg_rd(p_path, &rec.pred_args.val1, - rec.reg1, offset, ptt); - ecore_idle_reg_rd(p_path, &rec.pred_args.val2, - rec.reg2, offset, ptt); - DP_VERBOSE(p_path->p_dev, ECORE_MSG_HW, - "mac3 add1 %x add2 %x\n", - rec.reg1, rec.reg2); - if (rec.predicate(&rec.pred_args)) { - SNPRINTF(message, sizeof(message), - "%s. Values are 0x%x 0x%x\n", - rec.failMsg, rec.pred_args.val1, - rec.pred_args.val2); - ecore_self_test_log(p_path->p_dev, rec.severity, - message); - } - break; - case 4: - /*unused to-date*/ - for (i = 0; i < rec.loop; i++) { - ecore_idle_reg_rd(p_path, &rec.pred_args.val1, - rec.reg1 + i * rec.incr, - offset, ptt); - ecore_idle_reg_rd(p_path, &rec.pred_args.val2, - rec.reg2 + i * rec.incr, - offset, ptt); - rec.pred_args.val2 >>= 1; - if (rec.predicate(&rec.pred_args)) { - SNPRINTF(message, sizeof(message), - "%s. Values are 0x%x 0x%x in loop %d\n", rec.failMsg, - rec.pred_args.val1, - rec.pred_args.val2, i); - ecore_self_test_log(p_path->p_dev, - rec.severity, - message); - } - } - break; - case 5: - /* compare two regs, pending - * the value of a condition reg - */ - ecore_idle_reg_rd(p_path, &rec.pred_args.val1, - rec.reg1, offset, ptt); - ecore_idle_reg_rd(p_path, &rec.pred_args.val2, - rec.reg2, offset, ptt); - DP_VERBOSE(p_path->p_dev, ECORE_MSG_HW, - "mac3 add1 %x add2 %x add3 %x\n", - rec.reg1, rec.reg2, rec.reg3); - ecore_idle_reg_rd(p_path, &tmp, - rec.reg3, offset, ptt); - if (!tmp && rec.predicate(&rec.pred_args)) { - SNPRINTF(message, sizeof(message), - "%s. Values are 0x%x 0x%x\n", - rec.failMsg, rec.pred_args.val1, - rec.pred_args.val2); - ecore_self_test_log(p_path->p_dev, - rec.severity, - message); - } - break; - case 6: - /* compare read and write pointers - * and read and write banks in QM - */ - ecore_idle_chk6(p_path, &rec, message, ptt); - break; - case 7: - /*compare cfc info cam with cid cam*/ - ecore_idle_chk7(p_path, &rec, message, ptt); - break; - default: - DP_VERBOSE(p_path->p_dev, ECORE_MSG_HW, - "unknown macro in self test data base. macro %d line %d", - rec.macro, st_ind); - } - } - - ecore_ptt_release(p_path, ptt); - - if (!b_print) - return idle_chk_errors; - - /* return value accorindg to statistics */ - if (idle_chk_errors == 0) { - DP_VERBOSE(p_path->p_dev, ECORE_MSG_HW, - "completed successfully (logged %d warnings)\n", - idle_chk_warnings); - } else { - DP_NOTICE(p_path->p_dev, - "failed (with %d errors, %d warnings)\n", - idle_chk_errors, idle_chk_warnings); - } - - return idle_chk_errors; -} - -end - -echo ecore_self_test.c is ready - diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/dos2unix.sh b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/dos2unix.sh deleted file mode 100644 index 85c22bd995..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/dos2unix.sh +++ /dev/null @@ -1,9 +0,0 @@ -err_file='/tmp/dos2unix.err' - -for file in $* -do - dos2unix -n $file $file.new 2> $err_file - grep -v 'dos2unix: converting file' $err_file - rm -f $err_file - mv -f $file.new $file -done diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/e2l.pl b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/e2l.pl deleted file mode 100644 index 852f3d28ce..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/e2l.pl +++ /dev/null @@ -1,771 +0,0 @@ -#!/usr/bin/perl -w -use File::Basename; - -############################################################################## -# Data Base # -############################################################################## - -# When translating OSAL code into linux code, sometimes linux headers are need to define data structures or functionality. -# E.g., when using osal_list_t, on linux we'll need to add "#include "linux/list.h" -our %includes_global_table = ( - mutex => "linux/mutex.h", - list => "linux/list.h", - semaphore => "linux/semaphore.h", - delay => "linux/delay.h", - sleep => "linux/delay.h", - alloc => "linux/slab.h", - DIV_ROUND_UP => "linux/kernel.h", - roundup => "linux/kernel.h", - ARRAY_SIZE => "linux/kernel.h", - memset => "linux/string.h", - REG_WR => "linux/io.h", - ENOMEM => "linux/errno.h", - DP_MODULE => "linux/compiler.h", - DP_LEVEL => "linux/kernel.h", - list_first_entry => "linux/kernel.h", - LINUX_VERSION_CODE => "linux/version.h", - NULL => "linux/kernel.h", - spinlock => "linux/spinlock.h", - spin_lock => "linux/spinlock.h", - coherent => "linux/dma-mapping.h", - cpu_to_le32 => "asm/byteorder.h", - le32_to_cpu => "asm/byteorder.h", - cpu_to_le16 => "asm/byteorder.h", - le16_to_cpu => "asm/byteorder.h", - cpu_to_be32 => "asm/byteorder.h", - be32_to_cpu => "asm/byteorder.h", - memcpy => "linux/string.h", - mmiowb => "linux/io.h", - pdev => "linux/pci.h", - _bit => "linux/bitops.h", - is_valid_ether_addr => "linux/etherdevice.h", - PCI_EXT_CAP_ID_SRIOV => "linux/pci_regs.h", - roundup_pow_of_two => "linux/log2.h", - ilog2 => "linux/log2.h", - tasklet => "linux/interrupt.h", - BUILD_BUG_ON => "linux/bug.h", - EXPORT_SYMBOL => "linux/module.h", - delayed_work => "linux/workqueue.h", - z_stream_s => "linux/zlib.h", - "struct firmware" => "linux/firmware.h", - vzalloc => "linux/vmalloc.h", - num_present_cpus => "linux/cpumask.h", - vlan_ethhdr => "linux/if_vlan.h", - ethhdr => "linux/if_ether.h", - iphdr => "linux/ip.h", - ipv6hdr => "linux/ipv6.h", - tcphdr => "linux/tcp.h", - WARN => "linux/bug.h", - crc32 => "linux/crc32.h", - kstrtoul => "linux/kernel.h", - DECLARE_CRC8_TABLE => "linux/crc8.h", - crc8_populate_msb => "linux/crc8.h", # 'crc8' is not explicitly listed since this string appears also in ecore_dbg_values.h - L1_CACHE_BYTES => "asm/cache.h", -); - -# Like previous, only here global headers are added under some ifdef, mostly due to compatibility -our %includes_global_dependent_table = ( - DECLARE_HASHTABLE => { "HEADER" => "linux/hashtable.h", "LIMIT" => "defined(QED_UPSTREAM)" }, - "linux/fs.h" => { "HEADER" => "linux/fs.h", "LIMIT" => "defined(CONFIG_DEBUG_FS)" }, - "linux/debugfs.h" => { "HEADER" => "linux/debugfs.h", "LIMIT" => "defined(CONFIG_DEBUG_FS)" }, - -); - -# Due [mostly] to relocation of code, it's possible that new local inclusion will be needed. -# E.g., eth_stats are moved into a qed interface file, so that file needs to be included whenever the struct is accessed. -our %includes_local_table = ( - DECLARE_HASHTABLE => "qed_compat.h", - eth_stats => "qed_if.h", - fcoe_stats => "qed_fcoe_if.h", - iscsi_stats => "qed_iscsi_if.h", - qed_ll2_stats => "qed_ll2_if.h", - rdma_start_in_params => "qed_roce_if.h", - qed_copy_preconfig_to_bus => "qed_debugfs.h", - QED_RSS => "qed_eth_if.h", -); - -# Same relation to the local_table as the global_dependent had to the global_table -our %includes_local_dependent_table = ( - "qed_init_values_zipped.h" => { "HEADER" => "qed_init_values_zipped.h", "LIMIT" => "defined(CONFIG_QED_ZIPPED_FW) && !defined(CONFIG_QED_BINARY_FW)" }, - "qed_init_values.h" => { "HEADER" => "qed_init_values.h", "LIMIT" => "!defined(CONFIG_QED_ZIPPED_FW) && !defined(CONFIG_QED_BINARY_FW)" }, -); - -# Until we'll have a working binary file that replaces generated arrays, we need to prevent the inclusion of some of them, -# dependent on their actual usage. -our %prevent_table = ( - dump_mem => {"prevent_symbol" => "DUMP_MEM_ARR", "found" => 0 }, - pxp_global_win => {"prevent_symbol" => "PXP_GLOBAL_WIN", "found" => 0 }, -); - -# Hashes to mark whether a given symbol was found or not -our %used_ig = (); -our @il_order = ( "common_hsi.h", "storage_common.h", "tcp_common.h", "fcoe_common.h", "iscsi_common.h" ); -our %used_il = (); -our %used_igt = (); -our %used_igdt = (); -our %used_ilt = (); -our %used_ildt = (); - -# These should remain as "xxx_t" and not transformed into "struct xxx" -our $allowed_t = qr {(?<!dma_addr)(?<!size)(?<!spinlock)(?<!qed_int_comp_cb)(?<!iscsi_event_cb)(?<!affiliated_event)(?<!unaffiliated_event)(?<!pci_power)(?<!skb_frag)}; - -# A parameter is anything between the "," - it can contain "struct", sizeof(), -# ->, . and many other things - in short, anything that is not a comma. -our $parm = qr{\s*([^,\s][^,]*[^,\s]:?)\s*}; - -our $comment_start = qr{\/\*}; -our $comment_end = qr{\*\/}; -our $c_line_end = qr{\;|\{|\}|$comment_end}; - -our $pp_line = qr{\s*\#\s*}; -# when set, current scope is inside a pre-processor segment -our $pp_segment = 0; -# when set, we're inside the context of a multi-lined comment -our $inside_cmt = 0; - -############################################################################## -# Subroutines # -############################################################################## - -sub correct_include { - my ($inc_file, $name_to_use, $file_arr) = @_; - - for my $filename (@$file_arr) { - if (${$inc_file} eq $filename) { - ${$inc_file} = $name_to_use; - return 1; - } - } - - return 0; -} - -# Given a local include header, make sure we're not including a united file. -# If so, include the combined file instead. Also make sure we're not including -# ourselves. -sub translate_include_private { - my @file_add_qed = ( "reg_addr.h" ); - my @file_common = ( "common_hsi.h", "qed_utils.h" ); - my @file_cxt = ( "qed_cxt.h", "qed_cxt_api.h" ); - my @file_fcoe = ( "qed_fcoe.h", "qed_fcoe_api.h" ); - my @file_iscsi = ( "qed_iscsi.h", "qed_iscsi_api.h" ); - my @file_roce = ( "qed_roce.h", "qed_roce_api.h" ); - my @file_l2 = ( "qed_l2.h", "qed_l2_api.h" ); - my @file_ll2 = ( "qed_ll2.h", "qed_ll2_api.h" ); - my @file_mcp = ( "qed_mcp.h", "qed_mcp_api.h" ); - my @file_dcbx = ( "qed_dcbx.h", "qed_dcbx_api.h" ); - my @file_int = ( "qed_int.h", "qed_int_api.h", "qed_hw_defs.h" ); - my @file_sp = ( "qed_sp_commands.h", "qed_sp_api.h", "qed_spq.h" ); - my @file_sriov = ( "qed_sriov.h", "qed_iov_api.h" ); - my @file_qed_if = ( "qed_proto_if.h" ); - my @file_vf = ( "qed_vf.h", "qed_vf_api.h" , "qed_vfpf_if.h" ); - my @file_ptp = ( "qed_ptp_api.h" ); - my @file_selftest = ( "qed_selftest_api.h" ); - my @file_hsi = ( "pcics_reg_driver.h", "qed_attn_values.h" , "qed_dbg_fw_funcs.h" , "qed_dbg_values.h" , "qed_fw_funcs_defs.h" , "qed_gtt_reg_addr.h" , "qed_gtt_values.h" , "qed_init_defs.h" , "qed_init_fw_funcs.h", "qed_iro.h" , "qed_iro_values.h", "qed_rt_defs.h" , "qed_hsi_common.h" , "qed_hsi_eth.h" , "qed_hsi_toe.h" , "qed_hsi_roce.h" , "qed_hsi_iwarp.h", "qed_hsi_rdma.h" , "qed_hsi_fcoe.h" , "qed_hsi_iscsi.h" , "mcp_public.h" , "nvm_cfg.h", "mfw_hsi.h" , "spad_layout.h", "nvm_map.h" , "qed_hsi_debug_tools.h", "qed_hsi_init_func.h", "qed_hsi_init_tool.h"); - - # Skip certain inclusions - if ($_[0] =~ m/bcm_osal.h|qed_status.h/) { - return 1; - } - - if (correct_include(\$_[0], "qed_$_[0]", \@file_add_qed)) {} - elsif (correct_include(\$_[0], "qed_hsi.h", \@file_hsi)) {} - elsif (correct_include(\$_[0], "common_hsi.h", \@file_common)) {} - elsif (correct_include(\$_[0], "qed_cxt.h", \@file_cxt)) {} - elsif (correct_include(\$_[0], "qed_fcoe.h", \@file_fcoe)) {} - elsif (correct_include(\$_[0], "qed_iscsi.h", \@file_iscsi)) {} - elsif (correct_include(\$_[0], "qed_roce.h", \@file_roce)) {} - elsif (correct_include(\$_[0], "qed_l2.h", \@file_l2)) {} - elsif (correct_include(\$_[0], "qed_ll2.h", \@file_ll2)) {} - elsif (correct_include(\$_[0], "qed_mcp.h", \@file_mcp)) {} - elsif (correct_include(\$_[0], "qed_dcbx.h", \@file_dcbx)) {} - elsif (correct_include(\$_[0], "qed_int.h", \@file_int)) {} - elsif (correct_include(\$_[0], "qed_sp.h", \@file_sp)) {} - elsif (correct_include(\$_[0], "qed_sriov.h", \@file_sriov)) {} - elsif (correct_include(\$_[0], "qed_vf.h", \@file_vf)) {} - elsif (correct_include(\$_[0], "qed_if.h", \@file_qed_if)) {} - elsif (correct_include(\$_[0], "qed_ptp_api.h", \@file_ptp)) {} - elsif (correct_include(\$_[0], "qed_selftest.h", \@file_selftest)) {} - - - # Skip this inclusion if it's same as current filename - if ($_[0] eq $target_filename) { - return 1; - } - - return 0; -} - -sub create_include_list { - if ($_[0] =~ m/${pp_line}include/) { - if ($_[0] =~ m/${pp_line}include\s*\"(.+)\"/) { - #Translate private includes - my $inc_file = $1; - if (translate_include_private($inc_file) == 0) { - if (exists $includes_local_dependent_table{$inc_file}) { - $used_ildt{$inc_file} = 1; - } else { - $used_il{$inc_file} = 1; - } - } - } elsif ($_[0] =~ /${pp_line}include\s*<(.+)>/) { - my $inc_file = $1; - if (exists $includes_global_dependent_table{$inc_file}) { - $used_igdt{$inc_file} = 1; - } else { - $used_ig{$inc_file} = 1; - } - } - return 1; - } else { - # There isn't an explicit #include; Instead, need to determine whether - # there's need to include something as result of line's content. - foreach $inc (keys %includes_global_table) { - if ($_[0] =~ m/$inc/) { - $used_igt{$includes_global_table{$inc}} = 1; - } - } - foreach $inc (keys %includes_global_dependent_table) { - if ($_[0] =~ m/$inc/) { - $used_igdt{$inc} = 1; - } - } - foreach $inc (keys %includes_local_table) { - if ($_[0] =~ m/$inc/) { - my $include_name = $includes_local_table{$inc}; - if (translate_include_private($include_name) == 0) { - $used_ilt{$include_name} = 1; - } - } - } - foreach $inc (keys %includes_local_dependent_table) { - if ($_[0] =~ m/$inc/) { - my $include_name = $includes_local_dependent_table{$inc}{"HEADER"}; - if (translate_include_private($include_name) == 0) { - $used_ildt{$inc} = 1; - } - } - } - foreach $inc (keys %prevent_table) { - if ($_[0] =~ m/$inc/) { - $prevent_table{$inc}{"found"} = 1; - } - } - } - - return 0; -} - -# Translation function - each line of the code will go through this function -# after consolidating all functions and macros to a single line (the 80 columns -# will be enforced later) -sub translate_line { - # The for loop is just there to avoid the "@_ =~" prefix in each line: - for (@_) { - s/OSAL_DIV_S64/div64_s64/go; - s/\bROUNDUP\b/roundup/go; - s/OSAL_UDELAY/udelay/go; - s/OSAL_NUM_ACTIVE_CPU/num_present_cpus/go; - s/OSAL_ROUNDUP_POW_OF_TWO/roundup_pow_of_two/g; - s/OSAL_LOG2/ilog2/g; - - s/OSAL_SET_BIT/__set_bit/go; - s/OSAL_CLEAR_BIT/clear_bit/go; - s/OSAL_TEST_BIT/test_bit/go; - s/OSAL_TEST_AND_CLEAR_BIT/test_and_clear_bit/go; - s/OSAL_FIND_FIRST_ZERO_BIT/find_first_zero_bit/go; - s/OSAL_FIND_FIRST_BIT/find_first_bit/go; - s/OSAL_BITMAP_WEIGHT/bitmap_weight/go; - s/OSAL_TEST_AND_FLIP_BIT/test_and_change_bit/go; - s/OFFSETOF/offsetof/go; - s/\(sizeof\(unsigned long\) \* 8 \/\* BITS_PER_LONG \*\/\)/BITS_PER_LONG/go; - - s/OSAL_MEMSET/memset/g; - s/OSAL_ARRAY_SIZE/ARRAY_SIZE/g; - s/OSAL_STRCPY/strcpy/g; - s/OSAL_STRNCPY/strncpy/g; - s/OSAL_STRLEN/strlen/g; - s/OSAL_STRCMP/strcmp/g; - s/OSAL_SPRINTF/sprintf/g; - s/OSAL_SNPRINTF/snprintf/g; - s/OSAL_STRTOUL/kstrtoul/g; - s/OSAL_INLINE/inline/g; - s/OSAL_NULL/NULL/g; - s/OSAL_MIN_T/min_t/g; - s/OSAL_MAX_T/max_t/g; - s/OSAL_REG_ADDR/REG_ADDR/g; - s/OSAL_PAGE_SIZE/PAGE_SIZE/g; - s/OSAL_CACHE_LINE_SIZE/L1_CACHE_BYTES/g; - s/OSAL_BUILD_BUG_ON/BUILD_BUG_ON/g; - s/OSAL_IOMEM/__iomem/g; - s/OSAL_UNLIKELY/unlikely/g; - s/osal_size_t/size_t/g; - s/osal_uintptr_t/uintptr_t/g; - s/U64_HI/upper_32_bits/g; - s/U64_LO/lower_32_bits/g; - - # OSAL_MSLEEP --> msleep for big values - if ($_ =~ /OSAL_MSLEEP\(([0-9]*)\)/) { - $value = $1; - if ($value < 20) { - $down = $value * 1000; - $up = $value * 2000; - s/OSAL_MSLEEP\(([0-9]*)\)/usleep_range($down, $up)/go; - } else { - s/OSAL_MSLEEP/msleep/go; - } - } - s/OSAL_MSLEEP/msleep/go; - - s/OSAL_NVM_IS_ACCESS_ENABLED\(p_hwfn\)/1/go; - - #DPC related - s/OSAL_DPC_INIT\($parm,$parm\)/tasklet_init($1, ecore_int_sp_dpc, (long unsigned int)$2)/go; - s/osal_dpc_t/struct tasklet_struct */go; - s/OSAL_DPC_ALLOC\($parm\)/kmalloc(sizeof(struct tasklet_struct), GFP_KERNEL)/go; - s/OSAL_POLL_MODE_DPC\($parm\)//go; - s/OSAL_DPC_SYNC\($parm\)/qed_slowpath_irq_sync($1)/go; - s/osal_int_ptr_t/long unsigned int/go; - - s/OSAL_ALLOC\($parm,$parm,$parm\)/kmalloc($3, $2)/g; - s/OSAL_ZALLOC\($parm,$parm,$parm\)/kzalloc($3, $2)/g; - s/OSAL_CALLOC\($parm,$parm,$parm,$parm\)/kcalloc($3, $4, $2)/g; - s/OSAL_VZALLOC\($parm,$parm\)/vzalloc($2)/g; - s/OSAL_FREE\($parm,$parm\)/kfree($2)/g; - s/OSAL_VFREE\($parm,$parm\)/vfree($2)/g; - s/OSAL_MEM_ZERO\($parm,$parm\)/memset($1, 0, $2)/g; - s/OSAL_MEMCPY/memcpy/g; - s/OSAL_MEMCMP/memcmp/g; - - s/OSAL_DMA_ALLOC_COHERENT\($parm,$parm,$parm\)/dma_alloc_coherent(\&$1->pdev->dev, $3, $2, GFP_KERNEL)/g; - s/OSAL_DMA_FREE_COHERENT\($parm,$parm,$parm,$parm\)/dma_free_coherent(\&$1->pdev->dev, $4, $2, $3)/g; - s/OSAL_MMIOWB\($parm\)/mmiowb()/go; - s/OSAL_BARRIER\($parm\)/barrier()/go; - s/OSAL_SMP_WMB\($parm\)/smp_wmb()/go; - s/OSAL_SMP_RMB\($parm\)/smp_rmb()/go; - s/OSAL_RMB\($parm\)/rmb()/go; - s/OSAL_WMB\($parm\)/wmb()/go; - - # There are some OSALs that simply need to be removed - s/OSAL_SPIN_LOCK_ALLOC\([\s\S]*\)//go; - s/OSAL_SPIN_LOCK_DEALLOC\($parm\)//go; - s/OSAL_MUTEX_ALLOC\([\s\S]*\)//go; - s/OSAL_MUTEX_DEALLOC\($parm\)//go; - s/OSAL_DMA_SYNC\([\s\S]*\)//go; - s/OSAL_HW_INFO_CHANGE\([\s\S]*\)\s*;//go; - - s/osal_mutex/mutex/go; - s/OSAL_MUTEX_INIT/mutex_init/go; - s/OSAL_MUTEX_ACQUIRE\($parm\)/mutex_lock($1)/g; - s/OSAL_MUTEX_RELEASE\($parm\)/mutex_unlock($1)/g; - s/osal_spinlock_t/spinlock_t/go; - s/OSAL_SPIN_LOCK_INIT/spin_lock_init/go; - s/OSAL_SPIN_LOCK_IRQSAVE/spin_lock_irqsave/go; - s/OSAL_SPIN_UNLOCK_IRQSAVE/spin_unlock_irqrestore/go; - s/OSAL_SPIN_LOCK/spin_lock_bh/go; - s/OSAL_SPIN_UNLOCK/spin_unlock_bh/go; - - s/OSAL_LIST_INIT/INIT_LIST_HEAD/go; - s/OSAL_LIST_PUSH_TAIL\($parm,$parm\)/list_add_tail($1, $2)/g; - s/OSAL_LIST_PUSH_HEAD\($parm,$parm\)/list_add($1, $2)/g; - s/OSAL_LIST_REMOVE_ENTRY\($parm,$parm\)/list_del($1)/g; - s/OSAL_LIST_FOR_EACH_ENTRY\($parm,$parm,$parm,$parm\)/list_for_each_entry($1, $2, $3)/g; - s/OSAL_LIST_FOR_EACH_ENTRY_SAFE\($parm,$parm,$parm,$parm,$parm\)/list_for_each_entry_safe($1, $2, $3, $4)/g; - s/OSAL_LIST_FIRST_ENTRY\($parm,$parm,$parm\)/list_first_entry($1, $2, $3)/g; - s/OSAL_LIST_IS_EMPTY\($parm\)/list_empty($1)/g; - s/osal_list_entry/list_head/go; - s/osal_list/list_head/go; - - # OSAL_LIST_INSERT_ENTRY_BEFORE --> list_add_tail - s/OSAL_LIST_INSERT_ENTRY_BEFORE\($parm,$parm,$parm\)/list_add_tail($1, $2)/g; - - # OSAL_LIST_INSERT_ENTRY_AFTER --> list_add - s/OSAL_LIST_INSERT_ENTRY_AFTER\($parm,$parm,$parm\)/list_add($1, $2)/g; - - # OSAL_LIST_SPLICE_INIT --> list_splice_init - s/OSAL_LIST_SPLICE_INIT\($parm,$parm\)/list_splice_init($1, $2)/g; - - # OSAL_LIST_SPLICE_TAIL_INIT --> list_splice_tail_init - s/OSAL_LIST_SPLICE_TAIL_INIT\($parm,$parm\)/list_splice_tail_init($1, $2)/g; - - # SRIOV related - s/ECORE_IOV/QED_IOV/go; - s/OSAL_VF_SEND_MSG2PF\(.*\)/0/g; - s/return OSAL_PF_VF_MSG\($parm,$parm\)/qed_schedule_iov($1, QED_IOV_WQ_MSG_FLAG);\nreturn 0/g; - s/OSAL_PF_VF_MALICIOUS\($parm,$parm\);//g; - s/OSAL_IOV_CHK_UCAST/qed_iov_chk_ucast/g; - s/OSAL_VF_UPDATE_ACQUIRE_RESC_RESP\(.*\)/0/g; - s/OSAL_VF_FILL_ACQUIRE_RESC_REQ\(${parm},${parm},${parm}/qed_vf_fill_driver_data\($1, $3/g; - s/OSAL_VF_CQE_COMPLETION\(.*\)/0/g; - s/OSAL_IOV_GET_OS_TYPE\(\)/VFPF_ACQUIRE_OS_LINUX/g; - s/OSAL_VF_FLR_UPDATE\($parm\)/qed_schedule_iov($1, QED_IOV_WQ_FLR_FLAG)/g; - s/OSAL_BEFORE_PF_START/qed_copy_preconfig_to_bus/go; - s/OSAL_AFTER_PF_STOP/qed_copy_bus_to_postconfig/go; - s/OSAL_IOV_POST_START_VPORT\([\s\S]*\);//go; - s/OSAL_IOV_PRE_START_VPORT/qed_iov_pre_start_vport/go; - s/OSAL_IOV_VF_CLEANUP/qed_iov_clean_vf/go; - s/OSAL_IOV_VF_VPORT_UPDATE/qed_iov_pre_update_vport/go; - s/OSAL_IOV_VF_VPORT_STOP\($parm,$parm\);//go; - s/OSAL_PF_VALIDATE_MODIFY_TUNN_CONFIG/qed_pf_validate_modify_tunn_config/go; - s/OSAL_IOV_VF_MSG_TYPE\([\s\S]*\);//go; - s/OSAL_IOV_PF_RESP_TYPE\([\s\S]*\);//go; - - # Zipped firmwre data related - s/OSAL_UNZIP_DATA/qed_unzip_data/g; - - # Link related - s/OSAL_LINK_UPDATE/qed_link_update/g; - - # DCBX Async Event Notification - s/OSAL_DCBX_AEN/qed_dcbx_aen/g; - - # Recovery related - s/OSAL_SCHEDULE_RECOVERY_HANDLER/qed_schedule_recovery_handler/g; - s/OSAL_HW_ERROR_OCCURRED/qed_hw_error_occurred/g; - - # Statistics related - s/OSAL_GET_PROTOCOL_STATS/qed_get_protocol_stats/g; - - # Prepare ISR for the slowpath interrupt - s/OSAL_SLOWPATH_IRQ_REQ/qed_slowpath_irq_req/g; - - # ROCE related - s/OSAL_GET_RDMA_SB_ID\($parm,$parm\)/qed_rdma_get_sb_id\($1, $2)/g; - - # MFW TLV related - s/OSAL_MFW_TLV_REQ/qed_mfw_tlv_req/g; - - # MFW TLV related - s/OSAL_MFW_FILL_TLV_DATA/qed_mfw_fill_tlv_data/g; - - # Some black voodoo magic for DP_NOTICE, to allow ecore sources to use 'is_assert' - # While qed sources don't use that parameter [but those sources might still be processed here. - s/DP_NOTICE\(${parm},${parm},\s*\"${parm}/DP_NOTICE\($1, \"$3/g; - s/DP_NOTICE\(p_dev, is_assert, fmt/DP_NOTICE\(cdev, fmt/g; - - s/\(1 << ${parm}\)/BIT\($1\)/g; - - s/OSAL_ASSERT.*;//go; - s/OSAL_WARN/WARN/go; - s/#define CHECK_ARR_SIZE.*//go; - s/CHECK_ARR_SIZE.*;//go; - - # This is hard-coded, but it's unlikely the DP_* macros would change in ecore.h. - # If they do - we'll fix this as well. - s/PRINT_ERR\(${parm}, /pr_err\(/go; - s/PRINT\(${parm}, /pr_notice\(/go; - s/\(p_dev\)->name/DP_NAME\(cdev\)/go; - s/ECORE_MSG_DRV/NETIF_MSG_DRV/go; - s/ECORE_MSG_PROBE/NETIF_MSG_PROBE/go; - s/ECORE_MSG_LINK/NETIF_MSG_LINK/go; - s/ECORE_MSG_TIMER/NETIF_MSG_TIMER/go; - s/ECORE_MSG_IFDOWN/NETIF_MSG_IFDOWN/go; - s/ECORE_MSG_IFUP/NETIF_MSG_IFUP/go; - s/ECORE_MSG_RX_ERR/NETIF_MSG_RX_ERR/go; - s/ECORE_MSG_TX_ERR/NETIF_MSG_TX_ERR/go; - s/ECORE_MSG_TX_QUEUED/NETIF_MSG_TX_QUEUED/go; - s/ECORE_MSG_INTR/NETIF_MSG_INTR/go; - s/ECORE_MSG_TX_DONE/NETIF_MSG_TX_DONE/go; - s/ECORE_MSG_RX_STATUS/NETIF_MSG_RX_STATUS/go; - s/ECORE_MSG_PKTDATA/NETIF_MSG_PKTDATA/go; - s/ECORE_MSG_HW/NETIF_MSG_HW/go; - s/ECORE_MSG_WOL/NETIF_MSG_WOL/go; - - # Change the components ifdefs - s/CONFIG_ECORE_ROCE/CONFIG_QEDR/go; - s/CONFIG_ECORE_IWARP/CONFIG_IWARP/go; - s/CONFIG_ECORE_FCOE/CONFIG_QEDF/go; - s/CONFIG_ECORE_ISCSI/CONFIG_QEDI/go; - s/CONFIG_ECORE_L2/CONFIG_QEDE/go; - - #Endianity - s/OSAL_BE32_TO_CPU/be32_to_cpu/g; - s/OSAL_CPU_TO_BE32/cpu_to_be32/g; - s/OSAL_CPU_TO_BE64/cpu_to_be64/g; - s/OSAL_BE32/__be32/g; - s/OSAL_CPU_TO_LE32/cpu_to_le32/g; - s/OSAL_CPU_TO_LE16/cpu_to_le16/g; - s/OSAL_LE32_TO_CPU/le32_to_cpu/g; - s/OSAL_LE16_TO_CPU/le16_to_cpu/g; - - # CRC-32 - s/OSAL_CRC32/crc32/g; - - # CRC-8 - s/static u8 cdu_crc8_table\[CRC8_TABLE_SIZE\]/DECLARE_CRC8_TABLE(cdu_crc8_table)/g; - s/OSAL_CRC8_POPULATE/crc8_populate_msb/g; - s/OSAL_CRC8/crc8/g; - - # Struct initialization (C99): - s/${comment_start}\s*SF\:${parm}${comment_end}/.$1 = /g; - - # Ecore return values - s/enum _ecore_status_t/int/go; - s/ECORE_SUCCESS/0/go; - s/ECORE_NOMEM/-ENOMEM/go; - s/ECORE_BUSY/-EBUSY/go; - s/ECORE_TIMEOUT/-EBUSY/go; # FIXME - probably not the right one - s/ECORE_ABORTED/-EBUSY/go; - s/ECORE_INVAL/-EINVAL/go; - s/ECORE_NORESOURCES/-EINVAL/go; - s/ECORE_NOTIMPL/-EINVAL/go; - s/ECORE_UNKNOWN_ERROR/-EINVAL/go; - s/ECORE_AGAIN/-EAGAIN/go; - s/ECORE_EXISTS/-EEXIST/go; - s/ECORE_NODEV/-ENODEV/go; - s/ECORE_IO/-EIO/go; - s/ECORE_CONN_RESET/-ECONNRESET/go; - s/ECORE_CONN_REFUSED/-ECONNREFUSED/go; - - # TODO - this should be generated, but currently we don't - # have a tight 'expression-element' definition which isn't - # greedy, so we solve most cases explicitly. - s/if \(rc != 0\)/if (rc)/go; - s/if \(rc == 0\)/if (!rc)/go; - - # Register access - remove the unnecessary hwfn reference - s/DIRECT_REG_WR\(${parm},${parm},${parm}\)/DIRECT_REG_WR($2, $3)/g; - s/DIRECT_REG_RD\(${parm},${parm}\)/DIRECT_REG_RD($2)/g; - - # ecore --> qed - s/ecore/qed/go; - s/ECORE/QED/go; - s/p_dev/cdev/go; - - s/OSAL_PCI_FIND_CAPABILITY\(([^,]*)/pci_find_capability\($1->pdev/g; - s/OSAL_PCI_FIND_EXT_CAPABILITY\(([^,]*)/pci_find_ext_capability\($1->pdev/g; - s/OSAL_PCI_READ_CONFIG_DWORD\(([^,]*)/pci_read_config_dword\($1->pdev/g; - s/OSAL_PCI_READ_CONFIG_WORD\(([^,]*)/pci_read_config_word\($1->pdev/g; - s/OSAL_PCI_READ_CONFIG_BYTE\(([^,]*)/pci_read_config_byte\($1->pdev/g; - s/OSAL_PCI_WRITE_CONFIG_WORD\(([^,]*)/pci_write_config_word\($1->pdev/g; - s/PCICFG_DEVICE_STATUS_CONTROL_2_ATOMIC_REQ_ENABLE/PCI_EXP_DEVCTL2_LTR_EN/g; - s/PCICFG_DEVICE_STATUS_CONTROL_2/p_hwfn->cdev->pdev->pcie_cap + PCI_EXP_DEVCTL2/g; - s/PCICFG_VENDOR_ID_OFFSET/PCI_VENDOR_ID/g; - s/PCICFG_DEVICE_ID_OFFSET/PCI_DEVICE_ID/g; - - s/OSAL_BAR_SIZE\(${parm},${parm}\)/pci_resource_len($1->pdev, ($2 > 0) ? 2 : 0)/g; - #there is already an existing defination of SECTION_SIZE in - #./arch/arm64/include/asm/pgtable.h. This fixes compilation error on arm64 - s/SECTION_SIZE/QED_SECTION_SIZE/go; - - # typedef struct name --> struct name - s/typedef\s+struct\s+$parm/struct $1/g; - s/typedef\s+struct$parm;/struct $1;/g; - - # ^} name_t; --> }; - s/^\s*\}\w+_t;/\};/go; - - # enum name_t --> enum name { - s/enum\s+(${allowed_t})_t/enum $1/g; - - # name_t --> struct name (unless it is in the allowed_t list) - if (!(m/enum/g)) { - s/(\w+${allowed_t})_t\s$parm/struct $1 $2/g; - } - }; -}; - -sub translate_segment { - my $was_comment = $inside_cmt; - my $orig_line = $_[0]; - my $combined_line = $_[0]; - my $combined_ref = ""; - - # The assumption is that in the ecore, no comment will start again in a - # line that just ended a comment - if ($_[0] =~ m/${comment_end}/g) { - $inside_cmt = 0; - } elsif ($_[0] =~ m/${comment_start}.*/g) { - $inside_cmt = 1; - } - - if ($_[0] =~ m/${pp_line}/) { - $pp_segment = 1; - } - - translate_line($orig_line); - $combined_ref = $orig_line; - - # Assuming that multi comment line will not start after code but on a - # separate line. Combine lines until the line-ending character. - if ($inside_cmt == 0 && $was_comment == 0 && $_[0] !~ m/\/\//go && $pp_segment == 0) { - while ($combined_line !~ m/$c_line_end\s*/) { - my $curr_pos = tell(EFILE); - my $newline = <EFILE> || last; - chomp $newline; - if ($newline =~ m/${comment_start}|\/\/|${pp_line}/go) { - seek(EFILE, $curr_pos, 0); - last; - } - $combined_line .= " " . $newline; - translate_line($newline); - $orig_line .= "\n" . $newline; - $combined_ref .= " " . $newline; -# print STDERR "Combining lines: '$combined_ref'\n"; - } - } - translate_line($combined_line); - if ($combined_ref eq $combined_line) { - # Translating each line seperately yeild the same result - # as the combined line together - $_[0] = $orig_line; - } elsif ($combined_line =~ m/^\s*$/) { - $_[0] = ""; - } else { - # Use the combined line - save the original indent, and colapse - # all other white-spaces to a single space. - $combined_line =~ m/^(\s*)(\S.*)/o; - my $indent = $1; - my $content = $2; - - $content =~ s/\s+/ /go; - $_[0] = $indent . $content; - } - - # only if the current line is pre-processor and it ends with "\" the next - # one is still pre-processor line - if ($pp_segment != 1 || $_[0] !~ m/\\\s*$/go) { - $pp_segment = 0; - } -} - -sub add_crc8_header_prefix { - my $prefix = "\#if \(!defined \(_DEFINE_CRC8\) && !defined\(_MISSING_CRC8_MODULE\)\) /* QED_UPSTREAM */\n"; - print "$prefix"; -} - -sub add_crc_header_suffix { - my $suffix = "\#else\n"; - $suffix .= "\#include \"qed_compat.h\"\n"; - $suffix .= "\#endif\n"; - print "$suffix"; -} - -############################################################################## -# Script entry point # -############################################################################## -die ("Need to receive <input file> as argument\n") unless(@ARGV > 0); -open(EFILE, "<$ARGV[0]") || die("Cannot open $ARGV[0]: $!\n"); -our ($target_filename, $target_dir, $target_tmp) = fileparse($ARGV[0], qr/\.[^.]*/); -my $target_output = ""; - -# There are a couple of large files which we skip instead of process -if ($target_filename =~ m/init_values|reg_addr/) { - while (<EFILE>) { - print $_; - } - goto out; -} - -# Process the data -NEXT: while (my $inline = <EFILE>) { - chomp $inline; - - # Take empty lines as-is - if ($inline =~ m/^\s*$/go) { - $target_output .= "\n"; - goto NEXT; - } - - # This might read a couple more lines, to allow multi-line pattern matching - # following this, line would be translated into linux format - translate_segment($inline); - - # Find out which includes need to be added, and populate the 'used' hashes accordingly - if (create_include_list($inline) == 0) { - $target_output .= "$inline\n"; - } -} - -# If a header file, add an encapsulating ifdef -if ($target_filename =~ m/.*\.h/) { - my $ifdef_name = uc $target_filename; - $ifdef_name =~ s/\./_/go; - print "\#ifndef _$ifdef_name\n\#define _$ifdef_name\n"; -} - -# Print the new file; Start with the inclusions -our %printed_globals = (); -print "\#include <linux/types.h>\n"; -foreach my $include_header (sort keys %used_ig) { - print "\#include <$include_header>\n"; - $printed_globals{$include_header} = 1; -} -foreach my $include_header (sort keys %used_igt) { - unless ($printed_globals{$include_header}) { - if ($include_header =~ m/linux\/crc8.h/) { - add_crc8_header_prefix(); - } - print "\#include <$include_header>\n"; - if ($include_header =~ m/linux\/crc8.h/) { - add_crc_header_suffix(); - } - } - $printed_globals{$include_header} = 1; -} -foreach my $include_header (sort keys %used_igdt) { - my $header_name = $includes_global_dependent_table{$include_header}{"HEADER"}; - my $header_cond = $includes_global_dependent_table{$include_header}{"LIMIT"}; - print "\#if $header_cond\n\#include <$header_name>\n\#endif\n" unless ($printed_globals{$header_name}); - $printed_globals{$header_name} = 1; -} - -# Until we'll use a binary file, we need to put the local inclusions prior to the local includes -if ($target_filename =~ m/.*\.c/) { - my $prevent_include = ""; - foreach my $struct_name (sort keys %prevent_table) { - unless ($prevent_table{$struct_name}{"found"}) { - my $symbol = $prevent_table{$struct_name}{"prevent_symbol"}; - $prevent_include .= "\#define __PREVENT_${symbol}__\n"; - } - } - print $prevent_include; -} - -our %printed_locals = (); -foreach my $include_header (sort { - #There are a couple of headers that we want to keep in order - my $a_index = 0; - my $b_index = 0; - - ++$a_index until $il_order[$a_index] eq $a or $a_index >= $#il_order; - ++$b_index until $il_order[$b_index] eq $b or $b_index >= $#il_order; - - my $val = 0; - if ($a_index < $b_index) { - $val = -1; - } elsif ($a_index > $b_index) { - $val = 1; - } - if ($val != 0) { - $val - } else { - $a cmp $b; - } -} keys %used_il) { - print "\#include \"$include_header\"\n"; - $printed_locals{$include_header} = 1; -} -foreach my $include_header (sort keys %used_ilt) { - print "\#include \"$include_header\"\n"; - $printed_locals{$include_header} = 1; -} -foreach my $include_header (sort keys %used_ildt) { - my $header_name = $includes_local_dependent_table{$include_header}{"HEADER"}; - my $header_cond = $includes_local_dependent_table{$include_header}{"LIMIT"}; - print "\#if $header_cond\n\#include \"$header_name\"\n\#endif\n" unless ($printed_locals{$header_name}); - $printed_locals{$header_name} = 1; -} - -# Print actual contents [non-include] -print $target_output; - -# If a header file, add the closure to the encapsulating ifdef -if ($target_filename =~ m/.*\.h/) { - print "\#endif"; -} - - -out: -close EFILE; -exit 0; diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/e2l_extract.pl b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/e2l_extract.pl deleted file mode 100644 index 8c4dc575e1..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/e2l_extract.pl +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/perl -w - -our $pp_line = qr{\s*\#\s*}; -our $pp_if = qr{${pp_line}if}; -our $pp_ifndef = qr{${pp_line}ifndef}; -our $pp_elif = qr{${pp_line}elif}; -our $pp_else = qr{${pp_line}else}; -our $pp_end = qr{${pp_line}endif}; -our $pp_control = qr{${pp_if}|${pp_ifndef}|${pp_elif}|${pp_else}|${pp_else}|${pp_end}}; -our @pp_stack = (); - -our $defined = qr{(ifdef|[^\!]defined)[\s|\(]*}; -our $not_defined = qr{(ifndef|\!defined)[\s|\(]*}; - -our $to_extract = 0; - -# These are a bit confusing, since we've inherited all kind of '#ifndef SYMBOL\n#define SYMBOL (foo)' expressions from the ecore. -# And thus those we want to take would be placed under the 'throw_segments' and those that we want to remove under 'take_segments'. -our $take_segments = qr{ATTN_DESC|aligned_u64|QM_OTHER_PQS_PER_PF|MISC_REG_DRIVER_CONTROL_0|LINUX_REMOVE|REMOVE_DBG|USE_DBG_BIN_FILE}; -#our $take_segments = qr{CONFIG_ECORE_ZIPPED_FW}; -our $throw_segments = qr{CONFIG_ECORE_SW_CHANNEL|CONFIG_ECORE_LOCK_ALLOC|UEFI|U64_HI|U64_LO|DIRECT_REG|ECORE_CONFIG_DIRECT_HWFN|MFW}; - -our $take_pp = qr{${pp_line}ifdef\s*${take_segments}|${pp_line}ifndef\s*${throw_segments}|${pp_line}if\s*${take_segments}}; -our $throw_pp = qr{${pp_line}ifdef\s*${throw_segments}|${pp_line}ifndef\s*${take_segments}}; - -############################################################################## -# Subroutines # -############################################################################## - -# Take / discard according to the 'pp_stack' and extraction. -sub process_line { - my $string_stack = join(' ', @pp_stack); - - if ((@pp_stack == 0) || ($pp_stack[$#pp_stack] eq "INITIAL")) { - return $to_extract; - } elsif ((($string_stack =~ m/EXTRACT/) && ($to_extract == 0)) || - (($string_stack !~ m/EXTRACT/) && ($to_extract == 1))) { - return 1; - } elsif ($string_stack =~ m/REM|WAS/) { - return 1; - } - - return 0; -} - - -# List of assumptions: -# - 'Special' segements that marked to be taken are NOT nested inside segments marked for deletion. -# - 'Special' marked segments always start with '#ifdef SYMBOL' or '#ifndef SYMBOL' [or special HSI conditions for '#if SYMBOL'] -# - __EXTRACT__LINUX__ doesn't have else/elif clauses. -# - Ecore .h enclosing ifndefs are for symbols prefixed with __ECORE, #define of symbol on subsequent line. -# [and qed's sources with __QED]; HSI files are an exception, as they come in various flavours. -sub process_pp_line { - my $inline = $_[0]; - my $encolsing_ifndef = qr{__ECORE|__QED|_FW_FUNCS_DEFS_H|_INIT_DEFS_H|_DBG_FW_FUNCS_H|GTT_REG_ADDR_H|_INIT_FW_FUNCS_H|MCP_PUBLIC_H|NVM_CFG_H}; - - # First, take the special cases into account - if ($inline =~ m/\#ifndef __EXTRACT__LINUX__/) { - # We're starting a segment that will be taken ONLY if 'to_extract' - # is set. But we need to skip it. - push(@pp_stack, "EXTRACT"); - return 1; - } - - if ($inline =~ m/${pp_ifndef}\s*${encolsing_ifndef}/) { - # We've hit a header-file surrounding ifndef; Need to extract it, - # since it's possible this is only a part of a resulting file. - $_[0] = <EFILE>; # Skip the following '#define'. - push(@pp_stack, "INITIAL"); - return 1; - } - - # Handle all regular pre-processor macros - if ($inline =~ m/${pp_if}/) { - if ($inline =~ m/${take_pp}/) { - # This Segement needs to silently be taken; This line has to be discarded. - push(@pp_stack, "ADD"); - return 1; - } elsif ($inline =~ m/${throw_pp}/) { - # This Segmennt needs to be thrown silently; This line has to be discarded. - push(@pp_stack, "REM"); - return 1; - } else { - # This is an actual if condition, needs to be added/removed only according to nesting. - push(@pp_stack, "SEG"); - } - } elsif ($inline =~ m/${pp_else}|${pp_elif}/) { - if( ($pp_stack[$#pp_stack] eq "REM") && ($inline =~ m/${pp_else}/)){ - # Else-clause of a special 'remove' segment becomes an 'add'. - pop(@pp_stack); - push(@pp_stack, "ADD"); - return 1; - } elsif ($pp_stack[$#pp_stack] eq "ADD") { - # Mark all remaining else/elif clauses of special 'add' as 'was' for removal. - pop(@pp_stack); - push(@pp_stack, "WAS"); - return 1; - } - } elsif ($inline =~ m/${pp_end}/) { - my $last_symbol = pop(@pp_stack); - if (!($last_symbol eq "SEG")) { - # The closure of all special segments needs to be removed - return 1; - } - } - - return process_line($inline); -} - -############################################################################## -# Script entry point # -############################################################################## -my $output_string = ""; - -die ("Need to receive <input file> <optional 'extract'> as arguments\n") unless(@ARGV > 0); -open(EFILE, "<$ARGV[0]") || die("Cannot open $ARGV[0]: $!\n"); - -# There are a couple of large files which we skip instead of process -if (($ARGV[0] =~ m/init_values|reg_addr/) && ($ARGV[0] !~ m/gtt_reg_addr/)) { - while (<EFILE>) { - print $_; - } - goto out; -} - -# Mark whether to extract; When extracting will take ONLY content under -# ifndef __EXTRACT__LINUX__ -if (@ARGV > 1) { - $to_extract = 1; -} - -NEXT_LINE: while (my $inline = <EFILE>) { - chomp $inline; - my $to_skip = 0; - - if ($inline =~ m/${pp_control}/) { - $to_skip = process_pp_line($inline); - } else { - $to_skip = process_line($inline); - } - - if ($to_skip == 0) { - $output_string .= "$inline\n"; - } -} - -print $output_string; - -out: -close EFILE; -exit 0; diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/generate_pdf.sh b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/generate_pdf.sh deleted file mode 100644 index d3b80565fb..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/generate_pdf.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# -# This Script generates a .pdf from Latex src -############################################### - -TEX_FILE="" -TEX_DIR="" -CUR_DIR=`pwd`; - -# Check inputs -if [ $# -eq 1 ]; then - TEX_FILE=$(basename $1) - TEX_DIR=$(dirname $1) - echo "File is located at $TEX_DIR" -else - echo "Need to receive a .tex file as input" - exit 1 -fi - -cd $TEX_DIR - -# Create temporary directory for products -if [ -d tmp ]; then - rm -rf tmp/* -else - mkdir tmp -fi - -# Create list of funcs -FUNCS=`grep myfunc ${TEX_FILE}.tex | grep -v newcommand | grep -v "^%" | sed -e 's/.*\myfunc{\([a-zA-Z0-9_\\]*\)}.*/\1/' | sed -e 's/\\\_/\_/g' ` - -# Create Snippets -for func in $FUNCS; do - API_FILE=`grep -l ecore_$func\( ../*_api*.h` - if [ -z "$API_FILE" ]; then - echo "$func - Missing definition in API header files" - continue - fi - - BACK=1 - while [ $BACK -lt 100 ]; do - EMPTY_BACK=`grep ${func}\( -B${BACK} $API_FILE | grep "^$" | wc --lines`; - if [ $EMPTY_BACK -gt 0 ]; then - BACK=`expr $BACK - 1` - break; - else - BACK=`expr $BACK + 1` - fi - done - - FORWARD=0 - while [ $FORWARD -lt 100 ]; do - EMPTY_FORWARD=`grep ${func}\( -A${FORWARD} $API_FILE | grep ");" | wc --lines`; - EMPTY_FORWARD2=`grep ${func}\( -A${FORWARD} $API_FILE | grep "{" | wc --lines`; - EMPTY=`expr $EMPTY_FORWARD + $EMPTY_FORWARD2` - if [ $EMPTY -gt 0 ]; then - break; - else - FORWARD=`expr $FORWARD + 1` - fi - done - - snippet=`grep ${func}\( -A${FORWARD} -B${BACK} $API_FILE | sed -e 's/ {/;/g' | grep -v "^\s*\*\s*$"` - - echo "$snippet" > snippets/${func}_generated.h -done - -# Generate the File -pdflatex -output-directory=tmp -interaction=nonstopmode $TEX_FILE.tex -pdflatex -output-directory=tmp -interaction=nonstopmode $TEX_FILE.tex -makeindex tmp/$TEX_FILE.idx -makeindex tmp/$TEX_FILE.idx -bibtex -terse tmp/$TEX_FILE.aux -bibtex -terse tmp/$TEX_FILE.aux -pdflatex -output-directory=tmp -interaction=nonstopmode $TEX_FILE.tex -pdflatex -output-directory=tmp -interaction=nonstopmode $TEX_FILE.tex - -# Move the Generated file and cleanup -cp tmp/$TEX_FILE.pdf . -rm -rf tmp - -cd $CUR_DIR - diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/install_req_latex.sh b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/install_req_latex.sh deleted file mode 100644 index f57e68ebf1..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/install_req_latex.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# -# Install the necessary packages to enable the pdf generate script to work properly on the ecore_documentation. -# The script assumes yum is supported and was tested on Fedora. -############################################################################################################### - -yum install -y texmaker -yum install -y texlive-tocbibind -yum install -y texlive-titlesec -yum install -y texlive-lipsum -yum install -y texlive-mdframed - -# -# May 2016 - by Ram -# I have had no success with the above script. So here is what I did to make it work for me: -# 1) Install texmaker. Since yum experienced issues finding a libpoppler-qt4.so.14 I forced the installation -# 2) I have installed the below packages. Note that I didn't check what is the minimum required from the list -# yum install -y texlive-latex-bin-bin -# yum install -y texlive-bibtex-bin-bin -# yum install -y texlive-bibtex-bin -# yum install -y texlive-babel-english -# yum install -y texlive-fancyhdr -# yum install -y texlive-amscls -# yum install -y pandoc-pdf -# yum install -y texlive-cm-super -# yum install -y texlive\*fonts\* - diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/replace_fw.csv b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/replace_fw.csv deleted file mode 100644 index 720608a7c1..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/replace_fw.csv +++ /dev/null @@ -1,69 +0,0 @@ -Enable,Tag,Group,Source,Destination,Skip_P4,Prefix,Sed,Type,Binary -1,,Init,Init/gtt_reg_addr.h,ecore_gtt_reg_addr.h,,,,FW_TOOLS, -1,,Init,Init/gtt_values.h,ecore_gtt_values.h,,,,FW_TOOLS, -1,,Init,Init/init_values.h,ecore_init_values.h,,,,FW_TOOLS, -1,,Init,Init/init_values_zipped.h,ecore_init_values_zipped.h,,,,FW_TOOLS, -1,,Init,Init/iro.h,ecore_iro.h,,,,FW_TOOLS, -1,,Init,Init/iro_values.h,ecore_iro_values.h,,,,FW_TOOLS, -1,,Init,Init/reg_addr.h,../../hsi/hw/reg_addr.h,,,,FW_TOOLS, -1,,Init,Init/rt_defs.h,ecore_rt_defs.h,,,,FW_TOOLS, -1,debug_tools,Init,Init/dbg_values.h,ecore_dbg_values.h,,,,FW_TOOLS, -1,debug_tools,Init,Init/dbg_values_user.h,ecore_dbg_values_user.h,,,,, -1,debug_tools,Init,Init/dbg_values.bin,ecore_dbg_values.bin,,,,FW_TOOLS,yes -1,,Init,Init/init_values.bin,ecore_init_values.bin,,,,FW_TOOLS,yes -1,,Init,Init/init_values_zipped.bin,ecore_init_values_zipped.bin,,,,FW_TOOLS,yes -1,,Init,Init/bb.rdf,../ediag/rdfs/bb.rdf,,,,, -1,,Init,Init/k2.rdf,../ediag/rdfs/k2.rdf,,,,, -1,,Init,Init/e5.rdf,../ediag/rdfs/e5.rdf,,,,, -1,,Init,Init/except.tcl,../ediag/scripts/except.tcl,,,,, -1,,Targets,Targets/ecore_hsi_common.h,ecore_hsi_common.h,,,,FW_HSI, -1,,Targets,Targets/ecore_hsi_eth.h,ecore_hsi_eth.h,,,,FW_HSI, -1,,Targets,Targets/ecore_hsi_toe.h,ecore_hsi_toe.h,,,,FW_HSI, -1,,Targets,Targets/ecore_hsi_fcoe.h,ecore_hsi_fcoe.h,,,,FW_HSI, -1,,Targets,Targets/ecore_hsi_iscsi.h,ecore_hsi_iscsi.h,,,,FW_HSI, -1,,Targets,Targets/ecore_hsi_roce.h,ecore_hsi_roce.h,,,,FW_HSI, -1,,Targets,Targets/ecore_hsi_rdma.h,ecore_hsi_rdma.h,,,,FW_HSI, -1,,Targets,Targets/ecore_hsi_iwarp.h,ecore_hsi_iwarp.h,,,,FW_HSI, -1,debug_tools,Targets,Targets/ecore_hsi_debug_tools.h,ecore_hsi_debug_tools.h,,,,FW_HSI, -1,,Targets,Targets/ecore_hsi_init_func.h,ecore_hsi_init_func.h,,,,FW_HSI, -1,,Targets,Targets/ecore_hsi_init_tool.h,ecore_hsi_init_tool.h,,,,FW_HSI, -1,,Targets,Targets/qede_hsi.h,../linux/qede/qede_hsi.h,,,s/common_hsi.h/..\\/qed\\/common_hsi.h/g\\ns/eth_common.h/..\\/qed\\/eth_common.h/g,, -1,,Targets,Targets/qed_hsi_roce.h,../linux/qedr/qedr_hsi.h,,,s/common_hsi.h/..\\/qed\\/common_hsi.h/g\\ns/roce_common.h/..\\/qed\\/roce_common.h/g\\ns/qed_hsi_rdma.h/qedr_hsi_rdma.h/g,, -1,,Targets,Targets/qed_hsi_roce.h,../linux/qedr/usrlib/src/qelr_hsi.h,,,s/qed_hsi_rdma.h/qelr_hsi_rdma.h/g,, -1,,Targets,Targets/qed_hsi_rdma.h,../linux/qedr/qedr_hsi_rdma.h,,,s/rdma_common.h/..\\/qed\\/rdma_common.h/g,, -1,,Targets,Targets/qed_hsi_rdma.h,../linux/qedr/usrlib/src/qelr_hsi_rdma.h,,,,, -1,,Targets,Targets/*.h,hsi_repository/,,,,, -1,,Targets,Targets/common_hsi.h,../common/include/common_hsi.h,,,,FW_HSI, -1,,Targets,Targets/common_hsi.h,../linux/qedr/usrlib/src/common_hsi.h,,,,, -1,,Targets,Targets/eth_common.h,../common/include/eth_common.h,,,,FW_HSI, -1,,Targets,Targets/fcoe_common.h,../common/include/fcoe_common.h,,,,FW_HSI, -1,,Targets,Targets/iscsi_common.h,../common/include/iscsi_common.h,,,,FW_HSI, -1,,Targets,Targets/roce_common.h,../common/include/roce_common.h,,,,FW_HSI, -1,,Targets,Targets/roce_common.h,../linux/qedr/usrlib/src/roce_common.h,,,,, -1,,Targets,Targets/rdma_common.h,../common/include/rdma_common.h,,,,FW_HSI, -1,,Targets,Targets/rdma_common.h,../linux/qedr/usrlib/src/rdma_common.h,,,,, -1,,Targets,Targets/iwarp_common.h,../common/include/iwarp_common.h,,,,FW_HSI -1,,Targets,Targets/iwarp_common.h,../linux/qedr/usrlib/src/iwarp_common.h,,,,, -1,,Targets,Targets/storage_common.h,../common/include/storage_common.h,,,,FW_HSI, -1,,Targets,Targets/tcp_common.h,../common/include/tcp_common.h,,,,FW_HSI, -1,,Func,Func/ecore_init_fw_funcs.h,ecore_init_fw_funcs.h,,,,FW_TOOLS, -1,,Func,Func/ecore_init_fw_funcs.c,ecore_init_fw_funcs.c,,#include "bcm_osal.h"\\n#include "ecore_hw.h"\\n#include "ecore_init_ops.h",,FW_TOOLS, -1,debug_tools,Func,Func/ecore_dbg_fw_funcs.c,ecore_dbg_fw_funcs.c,,#include "bcm_osal.h"\\n#include "ecore.h"\\n#include "ecore_hw.h"\\n#include "ecore_mcp.h"\\n#include "spad_layout.h"\\n#include "nvm_map.h",,FW_TOOLS, -1,debug_tools,Func,Func/ecore_dbg_fw_funcs.h,ecore_dbg_fw_funcs.h,,,,FW_TOOLS, -1,debug_tools,Func,Func/ecore_user_dbg_fw_funcs.c,ecore_user_dbg_fw_funcs.c,,#include "bcm_osal.h"\\n#include "ecore.h"\\n#include "spad_layout.h"\\n#include "nvm_map.h",,FW_TOOLS, -1,debug_tools,Func,Func/ecore_user_dbg_fw_funcs.h,ecore_user_dbg_fw_funcs.h,,,,FW_TOOLS, -1,debug_tools,Func,Func/drv_user_dbg_fw_funcs.c,../common/drv_user_dbg_fw_funcs.c,,,,, -1,debug_tools,Func,Func/drv_user_dbg_fw_funcs.h,../common/include/drv_user_dbg_fw_funcs.h,,,,, -1,debug_tools,Func,Func/drv_dbg_fw_funcs.c,../ediag/drv_dbg_fw_funcs.c,,,,, -1,debug_tools,Func,Func/drv_dbg_fw_funcs.h,../ediag/drv_dbg_fw_funcs.h,,,,, -1,,Func,Func/drv_fcoe_fw_funcs.c,hsi_repository/,,,,, -1,,Func,Func/drv_fcoe_fw_funcs.h,hsi_repository/,,,,, -1,,Func,Func/drv_iscsi_fw_funcs.c,hsi_repository/,,,,, -1,,Func,Func/drv_iscsi_fw_funcs.h,hsi_repository/,,,,, -1,,Func,Func/drv_scsi_fw_funcs.c,hsi_repository/,,,,, -1,,Func,Func/drv_scsi_fw_funcs.h,hsi_repository/,,,,, -1,debug_tools,Func,Func/dbgUtils.tcl,../linux/add-ons/debug/debugfs/internal/dbgUtils.tcl,,,,, -1,debug_tools,Func,Func/dbgUtils.tcl,../ediag/scripts/dbgUtils.tcl,,,,, -1,,Func,Func/profiler.tcl,../ediag/scripts/profiler.tcl,,,,, -1,,Arrays,Init/*_array.cpp,../../common/hw_stub/arrays_orig/,,,,, -1,,Arrays,Init/RfArrayDef.h,../../common/hw_stub/arrays_orig/RfArrayDef.h,,,,, diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/replace_fw.sh b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/replace_fw.sh deleted file mode 100644 index 7925f14f3e..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/replace_fw.sh +++ /dev/null @@ -1,339 +0,0 @@ -#!/bin/bash - -csv_file=`dirname $0`/replace_fw.csv - -files_modified_p4_edit=() -files_modified_no_p4_edit=() - -function usage () { - echo "Usage: replace_fw.sh <source fw> <destination ecore> [-p <p4 client>] [-t <tag filter>]" - echo "" - echo " source fw path of the root folder of the source fw" - echo " destination ecore path of the destination ecore folder" - echo "" - echo " p4 client different p4 client instead of the one that is currently in use" - echo " (a value of AVOID_P4 will avoid p4 processing at all)" - echo "" - echo " tag filter preform operations on files that are specified in the tag filter" - echo " if tag filter is not specified preform opreations on all files" -} - -function get_last_char() { - echo ${1: -1} -} - -function trim_last_char() { - echo ${1%?} -} - -# $1 - string -# $2 - delimiter -function get_last_substr() { - echo ${1##*$2} -} - -function check_p4_exist() { - p4 -V &> /dev/null - ret=$? - return $ret -} - -function check_p4_login() { - p4 login -s &> /dev/null - ret=$? - return $ret -} - -function get_abs_filename() { - echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" -} - -# $1 - array -# $2 - item -function is_item_in_array() { - if [[ `echo $1 | grep $2 | wc -l` > 0 ]]; then true; else false; fi -} - -# $1 - target file -# $2 - modified files array ('0' - "p4_edit" array, '1' - "no_p4_edit" array) -function add_file_to_modified_array() { - local abs_file_path=$(get_abs_filename $1) - - # add the file only if it wasn't already added to the array - if [[ $2 == 0 ]]; then - is_item_in_array "${files_modified_p4_edit[*]}" $abs_file_path || files_modified_p4_edit=(${files_modified_p4_edit[@]} $abs_file_path) - else - is_item_in_array "${files_modified_no_p4_edit[*]}" $abs_file_path || files_modified_no_p4_edit=(${files_modified_no_p4_edit[@]} $abs_file_path) - fi -} - -# -# check usage -# -if [ $# -lt 2 ]; then - usage - exit 1 -fi - -fw_path=$1 -ecore_path=$2 -shift 2 - -# If the user doesn't enter tag filter, then don't filter by tag -tag_filter="none" - -# Parse options received from user -while getopts ":p:t:" option; do - case $option in - p) - p4_client=$OPTARG - ;; - t) - tag_filter=$OPTARG - ;; - \?) - echo "unknown option: -$OPTARG" - usage - exit 1 - ;; - :) - echo "missing option argument for -$OPTARG" - usage - exit 1 - ;; - esac -done - -if [ ! $p4_client ]; then - p4cmd="p4" -else - p4cmd="p4 -c $p4_client" -fi - -# -# remove a possible "/" suffix from the paths for a common handling -# -if [ $(get_last_char $fw_path) = "/" ]; then - fw_path=$(trim_last_char $fw_path) -fi -if [ $(get_last_char $ecore_path) = "/" ]; then - ecore_path=$(trim_last_char $ecore_path) -fi - -# -# avoid p4 processing if an "AVOID_P4" argument was provided. -# if "AVOID_P4" wasn't used - exit in case (1) p4 doesn't exist, or (2) no p4 client is logged in -# -avoid_p4_at_all=0 -if [ "$p4_client" = "AVOID_P4" ]; then - echo " Avoiding any p4 actions" - avoid_p4_at_all=1 -else - check_p4_exist - if [ $? != 0 ]; then - echo " p4 is not installed - can either:" - echo " (1) install p4" - echo " (2) use '-p AVOID_P4' as an argument to avoid p4 processing" - echo " Aborting" - exit 1 - else - check_p4_login - if [ $? != 0 ]; then - echo " No p4 user is logged in - can either:" - echo " (1) log in to p4" - echo " (2) use '-p AVOID_P4' as an argument to avoid p4 processing" - echo " Aborting" - exit 1 - fi - fi -fi - -# -# go over the csv file and verify that all src/dst actually exist -# -abort_file_not_exist=0 -abort_no_destination=0 -found_tag=0 -line_num=0 -while read line -do - line_num=$((line_num+1)) - # skip the titles line - if [ $line_num == 1 ]; then continue; fi - - # extract the csv line inputs - enabled=`echo $line | cut -d ',' -f1` - tag=`echo $line | cut -d ',' -f2` - src=`echo $line | cut -d ',' -f4` - dst=`echo $line | cut -d ',' -f5` - - if [[ "$enabled" == "0" ]]; then continue; fi - if [ "$tag_filter" != "none" ]; then - if [ "$tag" != "$tag_filter" ]; then continue; else found_tag=1; fi - fi - - src_files_num=0 - if [ $src ]; then - src=${fw_path}/${src} - ls $src &> /dev/null - if [ $? != 0 ]; then - echo " $csv_file: line $line_num: error: cannot access $src" - abort_file_not_exist=1 - else - src_files_num=`ls $src | wc -l` - fi - fi - - dst_files_num=0 - if [ $dst ]; then - dst=${ecore_path}/${dst} - ls $dst &> /dev/null - if [ $? != 0 ]; then - echo " $csv_file: line $line_num: error: cannot access $dst" - abort_file_not_exist=1 - else - dst_files_num=`ls $dst | wc -l` - fi - else - echo " $csv_file: line $line_num: error: no destination" - abort_no_destination=1 - fi - - # for a case where the destination is a folder (valid when the source is a regular expression) - if [ $src_files_num != 0 ] && [ $dst_files_num -lt $src_files_num ]; then - echo " $csv_file: line $line_num: error: the number of source files and destination files is not equal ($src_files_num source files, $dst_files_num destination files)" - abort_no_destination=1 - fi -done < $csv_file - -if [[ "$tag_filter" != "none" && $found_tag == 0 ]]; then - echo " tag $tag_filter doesn't exist" - exit 1 -fi - -if [ $abort_file_not_exist == 1 ] || [ $abort_no_destination == 1 ]; then - echo " Aborting" - exit 1 -fi - -# -# go over the csv file and process (copy / add prefix / sed script) where needed -# -echo "Updating the files according to the $csv_file file" -line_num=0 -while read line -do - line_num=$((line_num+1)) - # skip the titles line - if [ $line_num == 1 ]; then continue; fi - - # extract the csv line inputs - enabled=`echo $line | cut -d ',' -f1` - tag=`echo $line | cut -d ',' -f2` - src=`echo $line | cut -d ',' -f4` - dst=`echo $line | cut -d ',' -f5` - skip_p4_this_file=`echo $line | cut -d ',' -f6` - prefix=`echo $line | cut -d ',' -f7` - sed_cmd=`echo $line | cut -d ',' -f8` - binary=`echo $line | cut -d ',' -f10` - - if [[ "$enabled" == "0" ]]; then continue; fi - if [[ "$tag_filter" != "none" && "$tag" != "$tag_filter" ]]; then continue; fi - - if [[ $avoid_p4_at_all == 0 && $skip_p4_this_file != 1 ]]; then modified_array=0; else modified_array=1; fi - - skip_copy=0 - if [ ! $src ]; then skip_copy=1; fi - src=${fw_path}/${src} - dst=${ecore_path}/${dst} - - # detect a case where the destination is a folder (valid when the source is a regular expression) - is_dst_folder=0 - dst_regex=$dst - if [ $(get_last_char $dst) = "/" ]; then - is_dst_folder=1 - # append the source regular expression to the destination folder path - dst_regex=${dst_regex}$(get_last_substr "$src" "/") - fi - - # copy - if [ $skip_copy == 0 ]; then - for src_file in `ls $src 2> /dev/null` - do - dst_file=$dst - if [ $is_dst_folder == 1 ]; then - # append the source file name to the destination folder path - dst_file=${dst_file}$(get_last_substr "$src_file" "/") - fi - - if [ `diff --strip-trailing-cr $src_file $dst_file | wc -l` -gt 0 ]; then - chmod u+w $dst_file - cp -f $src_file $dst_file - if [ "$binary" == "" ]; then - $ecore_path/tools/dos2unix.sh $dst_file - fi - add_file_to_modified_array $dst_file $modified_array - fi - done - fi - - # prefix - if [ "$prefix" != "" ]; then - for dst_file in `ls $dst_regex 2> /dev/null`; do - (echo -e $prefix && cat $dst_file) > $dst_file.new - chmod u+w $dst_file - mv -f $dst_file.new $dst_file - add_file_to_modified_array $dst_file $modified_array - done - fi - - # sed - if [ "$sed_cmd" != "" ]; then - echo -e "$sed_cmd" > sed_cmd.tmp - for dst_file in `ls $dst_regex 2> /dev/null`; do - sed -f sed_cmd.tmp $dst_file > $dst_file.new - chmod u+w $dst_file - mv -f $dst_file.new $dst_file - add_file_to_modified_array $dst_file $modified_array - done - rm -f sed_cmd.tmp - fi -done < $csv_file - -# -# Check out the files which were marked as modified -# -if [[ ${#files_modified_p4_edit[@]} > 0 ]]; then - echo "Checking out the modified files" - $p4cmd edit ${files_modified_p4_edit[@]} > /dev/null - - # undo checking out in case a file is unchanged - $p4cmd revert -a ${files_modified_p4_edit[@]} > revert.tmp - for ((i=0; i<${#files_modified_p4_edit[@]}; i++)); do - partial_file_path=`echo ${files_modified_p4_edit[$i]} | sed -e 's/\(.*\)\/579xx\/\(.*\)/\/579xx\/\2/g'` - if [ `grep $partial_file_path revert.tmp | wc -l` -gt 0 ]; then - files_modified_p4_edit=(${files_modified_p4_edit[@]:0:$i} ${files_modified_p4_edit[@]:$(expr $i + 1)}) - # update the index since the array size was decreased and the elements were shifted - i=$((i-1)) - fi - done - rm -f revert.tmp -fi - -# -# summary -# -for ((i=0; i<${#files_modified_p4_edit[@]}; i++)); do - if [[ $i == 0 ]]; then - echo "The following [ ${#files_modified_p4_edit[@]} ] files were modified and checked out:" - fi - echo " ${files_modified_p4_edit[$i]}" -done -for ((i=0; i<${#files_modified_no_p4_edit[@]}; i++)); do - if [[ $i == 0 ]]; then - echo "The following [ ${#files_modified_no_p4_edit[@]} ] files were modified but were not checked out:" - fi - echo " ${files_modified_no_p4_edit[$i]}" -done - -exit 0 diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/ReplaceFwAndCompile.bat b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/ReplaceFwAndCompile.bat deleted file mode 100644 index 28cd4f338d..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/ReplaceFwAndCompile.bat +++ /dev/null @@ -1,30 +0,0 @@ -@echo off - -rem Description: Replaces the FW version in the ecore environment with the specified FW, and compiles the ecore environment. -rem Usage: ReplaceFwAndCompile <Source FW Folder> [File Type] -rem <FW Dir> should point to a generated FW folder (e.g. nx2\579xx\smc\everest4\Fw\Main\Output\HSI). -rem <File Type> type of files to be replaced (one of the options below). If omitted, all files are replaced. -rem - FW_HSI: FW data types and constants. -rem - FW_TOOLS: FW functions (HSI Func) and Init Tool generated files. - -set srcFolder=%1 -set dstFolder=%cd%\..\..\ -set csvKey=%cd%\..\replace_fw.csv -set type=ALL -if NOT "%2"=="" set type=%2 - -perl -w replace_fw.pl -i %srcFolder% -d %dstFolder% -c %csvKey% -t %type% -IF NOT "%ERRORLEVEL%"=="0" goto replaceError - -compile_ecore.bat -IF NOT "%ERRORLEVEL%"=="0" goto compileError - -echo Compilation was successful! - -goto :EOF -:replaceError -echo Failed replacing FW! -goto :EOF -:compileError -echo Failed in ecore compilation! -goto :EOF
\ No newline at end of file diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/as.exe b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/as.exe Binary files differdeleted file mode 100644 index 6f74395cca..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/as.exe +++ /dev/null diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/cc1.exe b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/cc1.exe Binary files differdeleted file mode 100644 index 0421c21373..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/cc1.exe +++ /dev/null diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/gcc.exe b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/gcc.exe Binary files differdeleted file mode 100644 index 08d97319f2..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/gcc.exe +++ /dev/null diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/libgmp-10.dll b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/libgmp-10.dll Binary files differdeleted file mode 100644 index 32f3973867..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/libgmp-10.dll +++ /dev/null diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/libmpc-2.dll b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/libmpc-2.dll Binary files differdeleted file mode 100644 index 1924b6c8e5..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/libmpc-2.dll +++ /dev/null diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/libmpfr-1.dll b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/libmpfr-1.dll Binary files differdeleted file mode 100644 index 85c2222e2a..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/bin/libmpfr-1.dll +++ /dev/null diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/compile_ecore.bat b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/compile_ecore.bat deleted file mode 100644 index d1fe501c4d..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/compile_ecore.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off - -path=%path%;%cd%\bin -set flags=-DCONFIG_ECORE_L2 -DCONFIG_ECORE_ROCE -DCONFIG_ECORE_FCOE -DCONFIG_ECORE_ISCSI -DCONFIG_ECORE_LL2 -DCONFIG_ECORE_SRIOV -DECORE_PACKAGE -I./include -I./../../hsi/hw/ -I./../../hsi/mcp/ -pushd ..\..\ - -tools\windows\bin\gcc.exe -c *.c %flags% - -popd - -if "%1"=="TESTMACHINE" exit %ERRORLEVEL%
\ No newline at end of file diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/replace_fw.pl b/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/replace_fw.pl deleted file mode 100644 index a3a03cf134..0000000000 --- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/tools/windows/replace_fw.pl +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use English; - - -#======================================================================= -#PROCESS ARGUMENTS -#======================================================================= -my $srcKey = "-i"; -my $destKey = "-d"; -my $csvKey= "-c"; -my $typeKey= "-t"; - -#SET DEFAULT VALUES -my %args = ( $srcKey=>'none', $destKey=>'none', $csvKey => 'none', $typeKey=>'ALL'); - -#PARSE RECIEVED ARGUMENTS -parse_arguments(); -my $srcFolder=$args{$srcKey}; -my $destFolder=$args{$destKey}; -my $csvFile=$args{$csvKey}; -my $type=$args{$typeKey}; - -die "Type can only be ALL, FW_HSI, FW_TOOLS" unless ($type eq 'ALL' || $type eq 'FW_HSI' || $type eq 'FW_TOOLS'); - -my %types = ('FW_HSI' => 0, 'FW_TOOLS' => 0); -if ($type eq 'ALL') -{ - $types{'FW_HSI'} = 1; - $types{'FW_TOOLS'} = 1; -} -else -{ - $types{$type} = 1; -} -#======================================================================= -#MAIN -#======================================================================= -open (CSV,$csvFile) || die "Can't open $csvFile: $!\n"; -my @lines = <CSV>; - -#find columns -my %columns = ('src' => 999, 'dst' => 999, 'type' => 999, 'prefix' => 999); -my @headlines = split(/,/,$lines[0]); -for (my $i=0; $i <= $#headlines; $i++) -{ - chomp($headlines[$i]); - - if ($headlines[$i] eq 'Source') - { - $columns{'src'} = $i; - } - if ($headlines[$i] eq 'Destination') - { - $columns{'dst'} = $i; - } - if ($headlines[$i] eq 'Type') - { - $columns{'type'} = $i; - } - if ($headlines[$i] eq 'Prefix') - { - $columns{'prefix'} = $i; - } -} -die "Couldn't find required columns in csv (Source, Destination, Type)" unless -(!($columns{'src'} == 999 || $columns{'dst'} == 999 || $columns{'type'} == 999 || $columns{'prefix'} == 999)); - -my %modes = ( 0 => 'Read only', 1 => 'Write only', 2 => 'Read / Write' ); -my $totalErrorLevel = 0; - -for (my $i=1; $i <= $#lines; $i++) -{ - my @fields = split(/,/,$lines[$i]); - chomp($fields[$columns{'type'}]); - if ($fields[$columns{'type'}] ne '') - { - chomp($fields[$columns{'type'}]); - if ($types{$fields[$columns{'type'}]} == 1) - { - my $dstFile = $destFolder.'\\'.$fields[$columns{'dst'}]; - my $srcFile = $srcFolder.'\\'.$fields[$columns{'src'}]; - - open (SRC,$srcFile) || die "Can't open $srcFile: $!\n"; - my @srcLines = <SRC>; - close SRC; - - chmod 0600, $dstFile or die "Couldn't chmod $dstFile: $!\n"; - open (DST,">$dstFile") || die "Can't open $dstFile: $!\n"; - if ($fields[$columns{'prefix'}] ne '') - { - $fields[$columns{'prefix'}] =~ s/\\/\//g; #Replace '\' with '/' so that split will be easy - my @includes = split('//n',$fields[$columns{'prefix'}]); - foreach my $include (@includes) {print DST $include."\n";} - } - foreach my $srcLine (@srcLines) {print DST $srcLine;} - close DST; - } - } -} - -exit $totalErrorLevel; - -#======================================================================= -#PARSE_ARGUMENTS -#======================================================================= -#function checks usage, and parses command line arguments. -sub parse_arguments -{ - for (my $i=0;$i<=$#ARGV;$i++) - { - if (defined $args{$ARGV[$i]}) - { - $args{$ARGV[$i]}=$ARGV[$i+1]; - $i++; - } - else - { - die "Unknown Switch: $ARGV[$i]\n"; - } - } - die "\nUSAGE: $PROGRAM_NAME -i <input folder> -d <output_folder> -c <csv file> -t <type of file to replace>\n" - unless (!($args{$srcKey} eq 'none' || $args{$destKey} eq 'none' || $args{$csvKey} eq 'none')); -} - |
