9506 Want support for QLogic QL41000/45000 series devices
[unleashed.git] / usr / src / uts / common / io / qede / 579xx / drivers / ecore / Makefile
blob8aa180ba8aa00a45594ff7e54f267f25bd85cd70
1 # Makefile for building ecore as a module.
2 AT?=@
3 export AT
5 KVER =
6 ifeq ($(KVER),)
7 KVER = $(shell uname -r)
8 endif
10 __ARCH=$(shell uname -m)
12 # PREFIX may be set by the RPM build to set the effective root.
13 PREFIX =
14 ifeq ($(shell ls /lib/modules/$(KVER)/build > /dev/null 2>&1 && echo build),)
15 # SuSE source RPMs
16 _KVER=$(shell echo $(KVER) | cut -d "-" -f1,2)
17 _KFLA=$(shell echo $(KVER) | cut -d "-" -f3)
18 _ARCH=$(shell file -b /lib/modules/$(shell uname -r)/build | cut -d "/" -f5)
19 ifeq ($(_ARCH),)
20 _ARCH=$(__ARCH)
21 endif
22 ifeq ($(shell ls /usr/src/linux-$(_KVER)-obj > /dev/null 2>&1 && echo linux),)
23 ifeq ($(shell ls /usr/src/kernels/$(KVER)-$(__ARCH) > /dev/null 2>&1 && echo linux),)
24 LINUX=
25 else
26 LINUX=/usr/src/kernels/$(KVER)-$(__ARCH)
27 LINUXSRC=$(LINUX)
28 ifeq ($(KERNEL_DIR),)
29 KERNEL_DIR=$(LINUX)
30 endif
31 endif
32 else
33 ifeq ($(KERNEL_DIR),)
34 KERNEL_DIR=/usr/src/linux-$(_KVER)-obj/$(_ARCH)/$(_KFLA)
35 endif
36 LINUXSRC=/usr/src/linux-$(_KVER)
37 endif
38 else
39 BCMPROC := $(__ARCH)
40 BCMCFGS := /lib/modules/$(KVER)/build \
41 /usr/src/kernels/$(KVER)-$(BCMPROC) \
42 /usr/src/linux-$(shell echo $(KVER) | sed "s|\(.*\)-\([a-z]*\)|\1-obj/$(BCMPROC)/\2|") \
43 /usr/src/linux
45 # Delete any entries that do not exist.
46 BCMTSTDIR = $(shell if ls $(DIR) > /dev/null 2>&1; then echo $(DIR); fi)
47 BCMCFGS := $(foreach DIR, $(BCMCFGS), $(BCMTSTDIR))
49 ifeq ($(BCMCFGS),)
50 $(error Linux kernel config directory not found)
51 else
52 ifeq ($(KERNEL_DIR),)
53 KERNEL_DIR := $(firstword $(BCMCFGS))
54 ifeq ($(LINUXSRC),)
55 ifneq ($(shell ls /lib/modules/$(KVER)/source > /dev/null 2>&1 && echo source),)
56 LINUXSRC=/lib/modules/$(KVER)/source
57 endif
58 endif
59 endif
60 endif
61 endif
63 ifeq ($(LINUXSRC),)
64 LINUXSRC=$(KERNEL_DIR)
65 endif
67 # paths
68 ifeq ($(shell ls /lib/modules/$(KVER)/updates > /dev/null 2>&1 && echo 1),1)
69 DRV_DIR = updates
70 else
71 ifeq ($(shell grep -q "search.*[[:space:]]updates" /etc/depmod.conf > /dev/null 2>&1 && echo 1),1)
72 DRV_DIR = updates
73 else
74 ifeq ($(shell grep -q "search.*[[:space:]]updates" /etc/depmod.d/* > /dev/null 2>&1 && echo 1),1)
75 DRV_DIR = updates
76 else
77 DRV_DIR = kernel/drivers/net
78 endif
79 endif
80 endif
82 sles_distro := $(wildcard /etc/SuSE-release)
83 ifneq ($(sles_distro),)
84 SLES_VERSION = $(shell cat /etc/SuSE-release | grep VERSION | grep -o -P [0-9]+)
85 SLES_PATCHLEVEL = $(shell cat /etc/SuSE-release | grep PATCHLEVEL | grep -o -P [0-9]+)
86 PADDED_PATCHLEVEL = $(shell if [ 10 -gt $(SLES_PATCHLEVEL) ]; then echo 0$(SLES_PATCHLEVEL); else echo $(SLES_PATCHLEVEL); fi)
87 SLES_DISTRO_VER = "0x$(SLES_VERSION)$(PADDED_PATCHLEVEL)"
88 EXTRA_CFLAGS += -DSLES_DISTRO=$(SLES_DISTRO_VER)
89 endif
91 SOURCES = ecore_chain.c ecore_cxt.c ecore_dev.c ecore_dbg_fw_funcs.c ecore_user_dbg_fw_funcs.c ecore_hw.c ecore_init_fw_funcs.c ecore_init_ops.c ecore_int.c ecore_mcp.c ecore_sp_commands.c ecore_spq.c ecore_dcbx.c ecore_phy.c ecore_selftest.c ecore_mng_tlv.c
92 HEADERS_LL2 = ecore_ll2_api.h ecore_ll2.h
93 HEADERS_HSI = ecore_hsi_common.h ecore_hsi_iscsi.h ecore_hsi_roce.h ecore_hsi_rdma.h ecore_hsi_iwarp.h ecore_hsi_fcoe.h ecore_hsi_toe.h ecore_hsi_debug_tools.h ecore_hsi_init_func.h ecore_hsi_init_tool.h ../common/include/common_hsi.h ../common/include/eth_common.h ../common/include/fcoe_common.h ../common/include/iscsi_common.h ../common/include/roce_common.h ../common/include/rdma_common.h ../common/include/storage_common.h ../common/include/tcp_common.h ../common/include/iwarp_common.h
94 HEADERS = ecore_chain.h ecore_cxt_api.h ecore_cxt.h ecore_dbg_fw_funcs.h ecore_user_dbg_fw_funcs.h ecore_dbg_values.h ecore_dbg_values_user.h ecore_dev_api.h ecore_gtt_reg_addr.h ecore_gtt_values.h ecore.h ecore_hw_defs.h ecore_hw.h ecore_init_fw_funcs.h ecore_init_ops.h ecore_init_values.h ecore_init_values_zipped.h ecore_int_api.h ecore_int.h ecore_iro.h ecore_iro_values.h ecore_mcp.h ecore_phy_api.h ecore_mcp_api.h ecore_proto_if.h ecore_rt_defs.h ecore_sp_api.h ecore_sp_commands.h ecore_spq.h ecore_status.h ecore_utils.h ecore_dcbx.h ecore_dcbx_api.h ecore_selftest_api.h include/bcm_osal.h ../../hsi/hw/pcics_reg_driver.h ../../hsi/hw/reg_addr.h ../../hsi/mcp/nvm_cfg.h ../../hsi/mcp/mcp_public.h ../../hsi/mcp/spad_layout.h ../../hsi/mfw_hsi.h ../../hsi/mcp/nvm_map.h ecore_tcp_ip.h
95 MODULE_NAME = ecore
96 obj-m += $(MODULE_NAME).o
97 ecore-objs = ecore_cxt.o ecore_dev.o ecore_dbg_fw_funcs.o ecore_user_dbg_fw_funcs.o ecore_hw.o ecore_init_fw_funcs.o ecore_init_ops.o ecore_int.o ecore_mcp.o ecore_phy.o ecore_sp_commands.o ecore_spq.o ecore_dcbx.o ecore_selftest.o ecore_chain.o ecore_mng_tlv.o
99 #TODO - we need all HSI [e.g., ecore_cxt.c needs to know the size of all contexts.
100 #Either need to carefully revise this, or everyone will need all the HSI files.
101 #since both L2 and LL2 require ecore_hsi_eth.h, every flavour needs it
102 HEADERS += $(HEADERS_HSI) ecore_hsi_eth.h
104 # Determine the content of the ecore compilation - on default do everything
105 ifneq ($(L2), 1)
106 ifneq ($(ROCE), 1)
107 ifneq ($(FCOE), 1)
108 ifneq ($(ISCSI), 1)
109 ifneq ($(PTP), 1)
110 ifneq ($(IWARP), 1)
111 L2 = 1
112 ROCE = 1
113 FCOE = 1
114 ISCSI = 1
115 PTP = 1
116 IWARP = 1
117 endif
118 endif
119 endif
120 endif
121 endif
122 endif
124 HEADERS += ecore_l2_api.h ecore_l2.h
125 HEADERS += ecore_roce.h ecore_roce_api.h ecore_hsi_roce.h ecore_hsi_rdma.h
126 HEADERS += ecore_fcoe_api.h ecore_fcoe.h ecore_hsi_fcoe.h
127 HEADERS += ecore_hsi_iscsi.h ecore_iscsi_api.h ecore_iscsi.h ecore_ooo.h
128 HEADERS += $(HEADERS_LL2)
129 HEADERS += ecore_iov_api.h ecore_sriov.h ecore_vf_api.h ecore_vf.h ecore_vfpf_if.h
130 HEADERS += ecore_ptp_api.h
132 ifeq ($(L2), 1)
133 SRIOV ?= 1
134 ecore-objs += ecore_l2.o
135 SOURCES += ecore_l2.c
136 EXTRA_CFLAGS += -DCONFIG_ECORE_L2
137 endif
138 ifeq ($(ROCE), 1)
139 LL2 = 1
140 SOURCES += ecore_roce.c
141 ecore-objs += ecore_roce.o
142 EXTRA_CFLAGS += -DCONFIG_ECORE_ROCE
143 endif
144 ifeq ($(FCOE), 1)
145 LL2 = 1
146 SOURCES += ecore_fcoe.c
147 ecore-objs += ecore_fcoe.o
148 EXTRA_CFLAGS += -DCONFIG_ECORE_FCOE
149 endif
150 ifeq ($(ISCSI), 1)
151 LL2 = 1
152 SOURCES += ecore_iscsi.c ecore_ooo.c
153 ecore-objs += ecore_iscsi.o ecore_ooo.o
154 EXTRA_CFLAGS += -DCONFIG_ECORE_ISCSI
155 endif
156 ifeq ($(IWARP), 1)
157 LL2 = 1
158 EXTRA_CFLAGS += -DCONFIG_ECORE_IWARP
159 endif
162 #Derivatives
163 ifeq ($(LL2), 1)
164 SOURCES += ecore_ll2.c
165 ecore-objs += ecore_ll2.o
166 EXTRA_CFLAGS += -DCONFIG_ECORE_LL2
167 endif
168 ifeq ($(SRIOV), 1)
169 ecore-objs += ecore_sriov.o ecore_vf.o
170 SOURCES += ecore_sriov.c ecore_vf.c
171 EXTRA_CFLAGS += -DCONFIG_ECORE_SRIOV
172 endif
173 ifeq ($(PTP), 1)
174 ecore-objs += ecore_ptp.o
175 SOURCES += ecore_ptp.c
176 EXTRA_CFLAGS += -DCONFIG_ECORE_PTP
177 endif
179 #Add include subdir for both user/module flavours
180 EXTRA_CFLAGS += -DECORE_PACKAGE -I$(src)/include -I./include -I$(src)/../common/include/ -I./../common/include/ -I$(src)/../../hsi/hw/ -I./../../hsi/hw -I$(src)/../../hsi/mcp/ -I./../../hsi/mcp -I$(src)/../../hsi/ -I../../hsi/
182 all default: $(obj-m)
184 clean:
185 rm -rf *.o *.ko .*.cmd *.mod.c Module.symvers modules.order
187 $(obj-m): $(SOURCES)
188 $(MAKE) -C $(KERNEL_DIR) M=`pwd` modules
190 user: $(SOURCES)
191 $(CC) -c $(SOURCES) $(EXTRA_CFLAGS)
193 tar: $(SOURCES) $(HEADERS)
194 rm -rf /tmp/ecore.tar.gz
195 rm -rf /tmp/ecore*
196 mkdir /tmp/ecore
197 cp -r $(SOURCES) $(HEADERS) release.txt /tmp/ecore/
198 echo "L2 = $(L2)" >> /tmp/ecore/Makefile
199 echo "FCOE = $(FCOE)" >> /tmp/ecore/Makefile
200 echo "ISCSI = $(ISCSI)" >> /tmp/ecore/Makefile
201 echo "ROCE = $(ROCE)" >> /tmp/ecore/Makefile
202 echo "SRIOV = $(SRIOV)" >> /tmp/ecore/Makefile
203 cat Makefile >> /tmp/ecore/Makefile
204 tar czvf /tmp/ecore.tar.gz -C /tmp ecore
205 rm -rf /tmp/ecore