xref: /titanic_41/usr/src/uts/sun4v/Makefile.sun4v (revision c5389946dfbef9eefd9e2e964618f7f865b59668)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21
22#
23# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25# Copyright (c) 2013 Andrew Stormont.  All rights reserved.
26#
27#	This makefile contains the common definitions for the sun4v unix
28#	and all sun4v implementation architecture dependent modules.
29#
30
31#
32#	Machine type (implementation architecture):
33#
34PLATFORM	 = sun4v
35LINKED_PLATFORMS += SUNW,Sun-Fire-T1000
36LINKED_PLATFORMS += SUNW,SPARC-Enterprise-T5120
37LINKED_PLATFORMS += SUNW,SPARC-Enterprise-T5220
38LINKED_PLATFORMS += SUNW,T5140
39LINKED_PLATFORMS += SUNW,T5240
40LINKED_PLATFORMS += SUNW,T5440
41LINKED_PLATFORMS += SUNW,SPARC-Enterprise-T1000
42LINKED_PLATFORMS += SUNW,Sun-Blade-T6300
43LINKED_PLATFORMS += SUNW,Sun-Blade-T6320
44LINKED_PLATFORMS += SUNW,Netra-CP3260
45LINKED_PLATFORMS += SUNW,Netra-T5220
46LINKED_PLATFORMS += SUNW,USBRDT-5240
47LINKED_PLATFORMS += SUNW,Netra-T5440
48LINKED_PLATFORMS += SUNW,Sun-Blade-T6340
49PROMIF		 = ieee1275
50PSMBASE		 = $(UTSBASE)/../psm
51
52#
53#	uname -m value
54#
55UNAME_M		= $(PLATFORM)
56
57#
58# Definitions for the platform-specific /platform directories.
59#
60# PLATFORMS designates those sun4v machines which have no platform
61# specific code.
62#
63# IMPLEMENTATIONS is used to designate sun4v machines which have
64# platform specific modules.  All code specific to a given implementation
65# resides in the appropriately named subdirectory.   This requires
66# these platforms to have their own Makefiles to define ROOT_PLAT_DIRS,
67# USR_PLAT_DIRS, etc.
68# The number of IMPLEMENTATIONS should not grow!
69#
70# So if we had an implementation named 'foo', we would need the following
71# Makefiles in the foo subdirectory:
72#
73#	sun4v/foo/Makefile
74#	sun4v/foo/Makefile.foo
75#	sun4v/foo/Makefile.targ
76#
77
78#
79# all PLATFORMS that do not belong in the $(IMPLEMENTATIONS) list.
80# This list should be empty.  A platform without platform modules
81# is a plain, generic sun4v platform.
82#
83#IMPLEMENTED_PLATFORM	=
84#PLATFORMS                = $(IMPLEMENTED_PLATFORM)
85
86IMPLEMENTATIONS		= ontario montoya huron maramba
87
88#ROOT_PLAT_DIRS		= $(PLATFORMS:%=$(ROOT_PLAT_DIR)/%)
89#USR_PLAT_DIRS		= $(PLATFORMS:%=$(USR_PLAT_DIR)/%)
90
91#USR_DESKTOP_DIR		= $(USR_PLAT_DIR)/$(IMPLEMENTED_PLATFORM)
92#USR_DESKTOP_INC_DIR	= $(USR_DESKTOP_DIR)/include
93#USR_DESKTOP_SBIN_DIR	= $(USR_DESKTOP_DIR)/sbin
94#USR_DESKTOP_LIB_DIR	= $(USR_DESKTOP_DIR)/lib
95
96#
97#	Define supported builds
98#
99DEF_BUILDS	= $(DEF_BUILDS64)
100ALL_BUILDS	= $(ALL_BUILDS64)
101
102#
103#	Everybody needs to know how to build modstubs.o and to locate unix.o
104#
105UNIX_DIR	 = $(UTSBASE)/$(PLATFORM)/unix
106GENLIB_DIR	 = $(UTSBASE)/$(PLATFORM)/genunix
107MODSTUBS_DIR	 = $(UNIX_DIR)
108DSF_DIR		 = $(UTSBASE)/$(PLATFORM)/genassym
109LINTS_DIR	 = $(OBJS_DIR)
110LINT_LIB_DIR	 = $(UTSBASE)/$(PLATFORM)/lint-libs/$(OBJS_DIR)
111
112DTRACESTUBS_O	 = $(OBJS_DIR)/dtracestubs.o
113DTRACESTUBS	 = $(OBJS_DIR)/libdtracestubs.so
114
115UNIX_O		 = $(UNIX_DIR)/$(OBJS_DIR)/unix.o
116MODSTUBS_O	 = $(MODSTUBS_DIR)/$(OBJS_DIR)/modstubs.o
117GENLIB	 	 = $(GENLIB_DIR)/$(OBJS_DIR)/libgenunix.so
118
119LINT_LIB	 = $(LINT_LIB_DIR)/llib-lunix.ln
120GEN_LINT_LIB	 = $(LINT_LIB_DIR)/llib-lgenunix.ln
121
122LINT64_DIRS	 = $(LINT64_BUILDS:%=$(UTSBASE)/$(PLATFORM)/lint-libs/%)
123LINT64_FILES	 = $(LINT64_DIRS:%=%/llib-l$(MODULE).ln)
124
125#
126#	cpu and platform modules need to know how to build their own symcheck module
127#
128PLATMOD		 = platmod
129PLATLIB		 = $(PLAT_DIR)/$(OBJS_DIR)/libplatmod.so
130
131CPUNAME		 = cpu
132CPULIB		 = $(CPU_DIR)/$(OBJS_DIR)/libcpu.so
133
134SYM_MOD		 = $(OBJS_DIR)/unix.sym
135
136#
137#	Include the makefiles which define build rule templates, the
138#	collection of files per module, and a few specific flags. Note
139#	that order is significant, just as with an include path. The
140#	first build rule template which matches the files name will be
141#	used. By including these in order from most machine dependent
142#	to most machine independent, we allow a machine dependent file
143#	to be used in preference over a machine independent version
144#	(Such as a machine specific optimization, which preserves the
145#	interfaces.)
146#
147include $(UTSBASE)/sun4/Makefile.files
148include $(UTSBASE)/$(PLATFORM)/Makefile.files
149include $(UTSBASE)/sfmmu/Makefile.files
150include $(UTSBASE)/sparc/v9/Makefile.files
151include $(UTSBASE)/sparc/Makefile.files
152include $(UTSBASE)/sun/Makefile.files
153include $(SRC)/psm/promif/$(PROMIF)/common/Makefile.files
154include $(SRC)/psm/promif/$(PROMIF)/$(PLATFORM)/Makefile.files
155include $(UTSBASE)/common/Makefile.files
156
157#
158#	Include machine independent rules. Note that this does not imply
159#	that the resulting module from rules in Makefile.uts is	machine
160#	independent. Only that the build rules are machine independent.
161#
162include $(UTSBASE)/Makefile.uts
163
164CTFMERGE_GUDIR	= sun4v
165
166#
167#	machine specific optimization, override default in Makefile.master
168#
169CC_XARCH	= -m64 -xarch=sparcvis
170AS_XARCH	= -xarch=v9v
171COPTIMIZE	= -xO3
172CCMODE		= -Xa
173
174CFLAGS		= -xchip=ultra $(CCABS32) $(CCREGSYM)
175CFLAGS		+= $(CC_XARCH)
176CFLAGS		+= $(COPTIMIZE)
177CFLAGS		+= $(EXTRA_CFLAGS)
178CFLAGS		+= $(XAOPT)
179CFLAGS		+= $(INLINES) -D_ASM_INLINES
180CFLAGS		+= $(CCMODE)
181CFLAGS		+= $(SPACEFLAG)
182CFLAGS		+= $(CERRWARN)
183CFLAGS		+= $(CTF_FLAGS_$(CLASS))
184CFLAGS		+= $(C99MODE)
185CFLAGS		+= $(CCUNBOUND)
186CFLAGS		+= $(CCNOAUTOINLINE)
187CFLAGS		+= $(CCSTATICSYM)
188CFLAGS		+= $(CC32BITCALLERS)
189CFLAGS		+= $(IROPTFLAG)
190CFLAGS		+= $(CGLOBALSTATIC)
191CFLAGS		+= -xregs=no%float
192CFLAGS		+= -xstrconst
193CFLAGS		+= $(CSOURCEDEBUGFLAGS)
194CFLAGS		+= $(CUSERFLAGS)
195
196CPPFLAGS	+= -DGLREG
197
198ASFLAGS		+= $(AS_XARCH) -DGLREG
199
200AS_INC_PATH	+= -I$(DSF_DIR)/$(OBJS_DIR)
201
202LINT_KMODS	+= $(GENUNIX_KMODS)
203
204LINT_DEFS	= -m64
205
206#
207#	The following must be defined for all implementations:
208#
209#	MAPFILE:		ld mapfile for the build of kernel/unix.
210#	MODSTUBS:		Module stubs source file.
211#	GENCONST_SRC:		genconst.c
212#	OFFSETS:		offsets.in
213#	PLATFORM_OFFSETS:	Platform specific mach_offsets.in
214#	FDOFFSETS:		fd_offsets.in
215#
216MAPFILE		 = $(UTSBASE)/sun4/conf/Mapfile
217MODSTUBS	 = $(UTSBASE)/sparc/ml/modstubs.s
218GENCONST_SRC	 = $(UTSBASE)/sun4/ml/genconst.c
219OFFSETS		 = $(UTSBASE)/sun4/ml/offsets.in
220PLATFORM_OFFSETS = $(UTSBASE)/sun4v/ml/mach_offsets.in
221FDOFFSETS 	 = $(UTSBASE)/sun/io/fd_offsets.in
222
223#
224#	Define the actual specific platforms
225#
226
227MACHINE_DEFS	= -D$(PLATFORM) -D_MACHDEP -DSFMMU
228MACHINE_DEFS	+= -DMAX_MEM_NODES=8
229
230#
231#	Software workarounds for hardware "features"
232#
233
234include $(UTSBASE)/$(PLATFORM)/Makefile.workarounds
235
236#
237#	Debugging level
238#
239#	Special knowledge of which special debugging options effect which
240#	file is used to optimize the build if these flags are changed.
241#
242#	XXX: The above could possibly be done for more flags and files, but
243#	     is left as an experiment to the interested reader. Be forewarned,
244#	     that excessive use could lead to maintenance difficulties.
245#
246#	Note: kslice can be enabled for the sun4v, but is disabled by default
247#	      in all cases.
248#
249
250DEBUG_DEFS_OBJ64	=
251DEBUG_DEFS_DBG64	= -DDEBUG
252DEBUG_DEFS		= $(DEBUG_DEFS_$(BUILD_TYPE))
253
254DEBUG_COND_OBJ64	= $(POUND_SIGN)
255DEBUG_COND_DBG64	=
256IF_DEBUG_OBJ		= $(DEBUG_COND_$(BUILD_TYPE))$(OBJS_DIR)/
257
258$(IF_DEBUG_OBJ)trap.o		:=	DEBUG_DEFS	+= -DTRAPDEBUG
259$(IF_DEBUG_OBJ)mach_trap.o	:=	DEBUG_DEFS	+= -DTRAPDEBUG
260$(IF_DEBUG_OBJ)syscall_trap.o	:=	DEBUG_DEFS	+= -DSYSCALLTRACE
261$(IF_DEBUG_OBJ)clock.o		:=	DEBUG_DEFS	+= -DKSLICE=0
262
263IF_TRAPTRACE_OBJ = $(IF_DEBUG_OBJ)
264# comment this out for a non-debug kernel with TRAPTRACE
265#IF_TRAPTRACE_OBJ = $(OBJS_DIR)/
266
267$(IF_TRAPTRACE_OBJ)mach_locore.o	:=	DEBUG_DEFS	+= -DTRAPTRACE
268$(IF_TRAPTRACE_OBJ)mlsetup.o		:=	DEBUG_DEFS	+= -DTRAPTRACE
269$(IF_TRAPTRACE_OBJ)syscall_trap.o 	:=	DEBUG_DEFS	+= -DTRAPTRACE
270$(IF_TRAPTRACE_OBJ)startup.o		:=	DEBUG_DEFS	+= -DTRAPTRACE
271$(IF_TRAPTRACE_OBJ)mach_startup.o	:=	DEBUG_DEFS	+= -DTRAPTRACE
272$(IF_TRAPTRACE_OBJ)mp_startup.o		:=	DEBUG_DEFS	+= -DTRAPTRACE
273$(IF_TRAPTRACE_OBJ)cpu_states.o		:=	DEBUG_DEFS	+= -DTRAPTRACE
274$(IF_TRAPTRACE_OBJ)mach_cpu_states.o	:=	DEBUG_DEFS	+= -DTRAPTRACE
275$(IF_TRAPTRACE_OBJ)interrupt.o		:=	DEBUG_DEFS	+= -DTRAPTRACE
276$(IF_TRAPTRACE_OBJ)mach_interrupt.o	:=	DEBUG_DEFS	+= -DTRAPTRACE
277$(IF_TRAPTRACE_OBJ)sfmmu_asm.o		:=	DEBUG_DEFS	+= -DTRAPTRACE
278$(IF_TRAPTRACE_OBJ)trap_table.o		:=	DEBUG_DEFS	+= -DTRAPTRACE
279$(IF_TRAPTRACE_OBJ)xc.o			:=	DEBUG_DEFS	+= -DTRAPTRACE
280$(IF_TRAPTRACE_OBJ)mach_xc.o		:=	DEBUG_DEFS	+= -DTRAPTRACE
281$(IF_TRAPTRACE_OBJ)wbuf.o		:=	DEBUG_DEFS	+= -DTRAPTRACE
282$(IF_TRAPTRACE_OBJ)trap.o		:=	DEBUG_DEFS	+= -DTRAPTRACE
283$(IF_TRAPTRACE_OBJ)mach_trap.o		:=	DEBUG_DEFS	+= -DTRAPTRACE
284$(IF_TRAPTRACE_OBJ)x_call.o		:=	DEBUG_DEFS	+= -DTRAPTRACE
285
286# Comment these out if you don't want dispatcher lock statistics.
287
288#$(IF_DEBUG_OBJ)lock_prim.o	:= DEBUG_DEFS	+= -DDISP_LOCK_STATS
289#$(IF_DEBUG_OBJ)disp.o		:= DEBUG_DEFS	+= -DDISP_LOCK_STATS
290
291# Comment these out if you don't want dispatcher debugging
292
293#$(IF_DEBUG_OBJ)lock_prim.o	:= DEBUG_DEFS	+= -DDISP_DEBUG
294
295#
296#	Collect the preprocessor definitions to be associated with *all*
297#	files.
298#
299ALL_DEFS	 = $(MACHINE_DEFS) $(WORKAROUND_DEFS) $(DEBUG_DEFS) \
300		   $(OPTION_DEFS)
301GENCONST_DEFS	 = $(MACHINE_DEFS) $(OPTION_DEFS)
302
303#
304# ----- TRANSITIONAL SECTION --------------------------------------------------
305#
306
307#
308#	Not everything which *should* be a module is a module yet. The
309#	following is a list of such objects which are currently part of
310#	the base kernel but should soon become kmods.
311#
312MACH_NOT_YET_KMODS	 = $(AUTOCONF_OBJS)
313
314#
315# ----- END OF TRANSITIONAL SECTION -------------------------------------------
316#
317
318#
319#	The kernels modules which are "implementation architecture"
320#	specific for this machine are enumerated below. Note that most
321#	of these modules must exist (in one form or another) for each
322#	architecture.
323#
324#	Common Drivers (usually pseudo drivers) (/kernel/drv):
325#
326
327#
328#	Machine Specific Driver Modules (/kernel/drv):
329#
330DRV_KMODS	+= bge
331DRV_KMODS	+= cnex
332DRV_KMODS	+= cpc
333DRV_KMODS	+= drctl
334DRV_KMODS	+= ds_pri
335DRV_KMODS	+= ds_snmp
336DRV_KMODS	+= ebus
337DRV_KMODS	+= fpc
338DRV_KMODS	+= glvc
339DRV_KMODS	+= mdesc
340DRV_KMODS	+= niumx
341DRV_KMODS	+= ntwdt
342DRV_KMODS	+= nxge
343DRV_KMODS	+= n2piupc
344DRV_KMODS	+= iospc
345DRV_KMODS	+= n2rng
346DRV_KMODS	+= px
347DRV_KMODS	+= qcn
348DRV_KMODS	+= rootnex
349DRV_KMODS       += su
350DRV_KMODS	+= tpm
351DRV_KMODS	+= trapstat
352DRV_KMODS	+= vcc
353DRV_KMODS	+= vdc
354DRV_KMODS	+= vds
355DRV_KMODS	+= vldc
356DRV_KMODS	+= vlds
357DRV_KMODS	+= vnet
358DRV_KMODS	+= vnex
359DRV_KMODS	+= vsw
360
361#
362#	Exec Class Modules (/kernel/exec):
363#
364EXEC_KMODS	+=
365
366#
367#	Scheduling Class Modules (/kernel/sched):
368#
369SCHED_KMODS	+=
370
371#
372#	File System Modules (/kernel/fs):
373#
374FS_KMODS	+=
375
376#
377#	Streams Modules (/kernel/strmod):
378#
379# STRMOD_KMODS	+= kb
380
381#
382#	'System' Modules (/kernel/sys):
383#
384SYS_KMODS	+=
385
386#
387#	'User' Modules (/kernel/misc):
388#
389MISC_KMODS	+= bootdev
390MISC_KMODS	+= dr_cpu
391MISC_KMODS	+= dr_io
392MISC_KMODS	+= dr_mem
393MISC_KMODS	+= ds
394MISC_KMODS	+= fault_iso
395MISC_KMODS	+= ldc
396MISC_KMODS	+= obpsym
397MISC_KMODS	+= platmod
398MISC_KMODS	+= platsvc
399MISC_KMODS	+= vis
400MISC_KMODS	+= pcie
401
402#	md5 optimized for Niagara
403#
404MISC_KMODS	+= md5
405
406#
407#	Brand modules
408#
409BRAND_KMODS	+= sn1_brand s10_brand
410
411#
412#	Software Cryptographic Providers (/kernel/crypto):
413#
414CRYPTO_KMODS	+= arcfour
415
416#
417#	generic-unix module (/kernel/genunix):
418#
419GENUNIX_KMODS	+= genunix
420
421#
422#	Modules eXcluded from the product:
423#
424XMODS		+=
425
426#
427#	cpu modules
428#
429CPU_KMODS	+= generic niagara niagara2 vfalls kt
430
431LINT_CPU_KMODS	+= generic
432
433#
434#	Performance Counter BackEnd Modules (/usr/kernel/pcbe):
435#
436PCBE_KMODS	+= niagara_pcbe
437PCBE_KMODS	+= niagara2_pcbe
438PCBE_KMODS	+= vfalls_pcbe
439PCBE_KMODS	+= kt_pcbe
440