Branch
Hash :
1a08f436
Author :
Date :
2010-08-25T09:23:17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393
# ========== Copyright Header Begin ==========================================
#
# Hypervisor Software File: dropins.src
#
# Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
#
# - Do no alter or remove copyright notices
#
# - Redistribution and use of this software in source and binary forms, with
# or without modification, are permitted provided that the following
# conditions are met:
#
# - Redistribution of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# - Redistribution in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# Neither the name of Sun Microsystems, Inc. or the names of contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# This software is provided "AS IS," without a warranty of any kind.
# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
# MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
# ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
# DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
# OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
# FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
# DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
# ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
# SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# You acknowledge that this software is not designed, licensed or
# intended for use in the design, construction, operation or maintenance of
# any nuclear facility.
#
# ========== Copyright Header End ============================================
# id: @(#)dropins.src 1.3 06/06/28
# purpose:
# copyright: Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
# copyright: Use is subject to license terms.
#
#
# Format: key <data>
# build <command to run>
# depend <file>
# target <dropin-src> <dropin-name>
# source{ [code] terminated by }source
# include <file>
#
version2
# create the code to execute fcode dropins
source{
" /packages/SUNW,builtin-drivers" find-device
headerless
: load-driver ( str$ -- )
find-drop-in if ( adr,len )
>r dup >r 1 byte-load ( )
r> r> free-drop-in ( )
then ( )
;
headers
: interrupt-property ( n -- ) " interrupts" integer-property ;
: get-fcode ( adr1 len1 adr2 len2 -- true | false )
find-drop-in if
2dup >r >r
rot min rot swap move
r> r> free-drop-in
true
else 2drop false
then
;
\ the proper value here is dependent on the particular OBP
\ implementation, especially the depth of the return stack.
\ the value is internal to the two external words. they
\ are used by the onboard usb host adapter code and the
\ onboard usb fcode modules
\ 6 value onboard-usb-depth-remaining \ full usb tree
3 value onboard-usb-depth-remaining
external
: onboard-usb-max-depth ( n -- )
to onboard-usb-depth-remaining
;
: onboard-usb-recurse? ( -- current-level )
onboard-usb-depth-remaining dup if
dup 1- to onboard-usb-depth-remaining
then
;
headers
}source
build ${MAKEDI}
target bootprom.bin bootprom
depend ${BP}/dev/southbridge/ontario/isa/depend.mk
target isa.fc SUNW,isa
source{
0 value local-bus-number
: en+ ( xdr,len int -- xdr',len' ) encode-int encode+ ;
: <firesb> ( xdr,len unit intr -- xdr,len )
>r 0 0 rot ( pa.lo pa.mid unit )
dup h# f and h# 100 * ( pa.lo pa.mid unit pa.hi' )
swap 4 >> h# f and h# 800 * + ( pa.lo pa.mid pa.hi' )
local-bus-number + ( pa.lo pa.mid pa.hi' )
rot >r swap >r ( pa.hi )
en+ r> en+ r> en+ r> en+ ( xdr,len )
" /pci@7c0" find-package drop en+ ( xdr,len )
;
\ Load the ISA bridge driver
: class060100 ( -- )
" SUNW,isa" load-driver
" /pci@7c0/pci@0/pci@2/pci@0,2/sound@1" find-package if delete-device drop then
" /pci@7c0/pci@0/pci@1/pci@0/sound@1" find-package if delete-device drop then
my-space h# f0000 and to local-bus-number
my-self my-parent to my-self >r
1 encode-int " #interrupt-cells" property
h# fff800 encode-int
0 en+
0 en+
7 en+ " interrupt-map-mask" property
0 0 encode-bytes
5.0 1 <firesb> 1 en+ \ USB IRQ6
6.0 1 <firesb> 3 en+ \ USB2 IRQ7
8.0 1 <firesb> 4 en+ \ IDE IRQ10
" interrupt-map" property
r> to my-self
;
}source
depend ${BP}/dev/sun4v-devices/vnexus/depend.mk
target vnexus.fc SUNW,vnexus
source{
: onboard-devices ( -- )
diagnostic-mode? if
." Loading onboard drivers: "
then
0 0 " 100" " /" begin-package
" SUNW,vnexus" load-driver
end-package
;
}source
# Fonts
depend ${BP}/pkg/termemu/fonts.mk
external font.di
# Sunlogo
depend ${BP}/pkg/sunlogo/logo.mk
external sun-logo.di
# Keyboard Translator Package
depend ${BP}/pkg/keyboard/translator/kbdtrans.mk
external kbdtrans.di
# Sun USB Keyboard Tables
depend ${BP}/pkg/keyboard/tables/usb/keyboard.mk
external usbkbds.di
# Network boot support package
depend ${BP}/pkg/netinet/obptftp.mk
external obptftp.di
# ASR attach point
source{
fload ${BP}/pkg/sun4v-asr/attach.fth
}source
# ASR Package
depend ${BP}/pkg/sun4v-asr/asr.mk
external asr.di
# Fire (JBus to PCI-Express bridge)
depend ${BP}/dev/sun4v-devices/vpci/depend.mk
depend ${BP}/dev/sun4v-devices/fire/master-pcia/depend.mk
depend ${BP}/dev/sun4v-devices/fire/master-pcib/depend.mk
target vpci.fc sun4v-vpci
buildoptions vpci.fc:= FTHFLAGS += [define] VPCI
buildoptions vpci.fc:= FTHFLAGS += [define] FIRE?
buildoptions vpci.fc:= FTHFLAGS += [define] 64BIT-ASSIGNED?
target master-pcia.fc jbus-1e
target master-pcib.fc jbus-1f
source{
: pciex-7c0 ( -- )
" jbus-1f" load-driver " sun4v-vpci" load-driver
;
: pciex-780 ( -- )
" jbus-1e" load-driver " sun4v-vpci" load-driver
;
}source
# Intel Gigabit Ethernet
# message XXX Ophir device pathnames are hard coded
depend ${BP}/dev/network/ophir/depend.mk
target ophir.fc ophir
source{
: $= ( adr1 len1 adr2 len2 -- same? )
rot tuck = if comp 0= else 3drop false then
;
\ Use the subsystem vendor id 0x108e for Sun so we ensure that
\ we don't attach the Ophir driver to PCI-E cards. If we do,
\ it's possible that the Ophir driver could blow away the EEPROM
\ MAC, and the system wouldn't be able to recover the MAC.
: pciex8086,105e.108e.105e ( -- )
\ Create local-mac-address property. Copy from system mac addr.
system-mac-address ( mac-addr len )
here 2dup >r >r swap allot r@ ( mac-addr vaddr len r: vaddr len )
move r> r> ( len vaddr )
0 over 6 3 do ( len vaddr 0 vaddr )
dup i + c@ swap \ Fetch low-order three bytes of MAC
loop drop bljoin lbflip ( len vaddr low-order-mac )
dup h# FFFFFF = if
." Invalid system MAC address." cr
else ( len vaddr low-order-mac )
\ phandle>devname requires a 'reg' property and a 'name' for the
\ results to be deterministic, but we don't load the driver until
\ later so we check the parent.
my-parent ihandle>phandle phandle>devname ( len vaddr low-order-mac dev$ )
2dup " /pci@780/pci@0/pci@1" $= if ( len vaddr low-order-mac dev$ )
2drop my-space h# ff00 and 0<> if 1+ then ( len vaddr low-order-mac )
else ( len vaddr low-order-mac dev$ )
" /pci@7c0/pci@0/pci@2" $= if ( len vaddr low-order-mac )
my-space h# ff00 and 0= if 2 else 3 then + ( len vaddr low-order-mac )
else
abort
then
then
then ( len vaddr low-order-mac' )
over >r lbsplit drop r> ( len vaddr m5 m4 m3 vaddr )
6 3 do
tuck i + c!
loop drop ( len vaddr )
\ Create the property
swap encode-bytes " local-mac-address" property
\ Bring the driver in
" ophir" load-driver
;
}source
# virtual flashprom support
depend ${BP}/dev/sun4v-devices/flashprom/depend.mk
target flashprom.fc sun4v-flashprom
source{
: flashprom-virtual-device ( -- ) " sun4v-flashprom" load-driver ;
}source
# virtual console support
depend ${BP}/dev/sun4v-devices/console/depend.mk
target console.fc sun4v-console
source{
: console-virtual-device ( -- ) " sun4v-console" load-driver ;
}source
# legion disk
depend ${BP}/dev/sun4v-devices/legion-disk/depend.mk
target sim-disk.fc legion-disk
source{
: disk-virtual-device ( -- ) " legion-disk" load-driver ;
}source
# legion NVRAM
depend ${BP}/dev/sun4v-devices/legion-nvram/depend.mk
target sim-nvram.fc legion-nvram
source{
: nvram-virtual-device ( -- ) " legion-nvram" load-driver ;
}source
# NVRAM SVC
depend ${BP}/dev/sun4v-devices/nvram/depend.mk
target nvram.fc sun4v-nvram
source{
: nvram-svc-virtual-device ( -- ) " sun4v-nvram" load-driver ;
}source
# hypervisor TOD
depend ${BP}/dev/sun4v-devices/tod/depend.mk
target tod.fc sun4v-tod
source{
: tod-virtual-device ( -- ) " sun4v-tod" load-driver ;
}source
# Niagara Crypto Provider
depend ${BP}/dev/sun4v-devices/ncp/depend.mk
target ncp.fc sun4v-ncp
source{
: ncp-virtual-device ( -- ) " sun4v-ncp" load-driver ;
}source
# Service channel
depend ${BP}/dev/sun4v-devices/svc-channel/depend.mk
target svc-channel.fc svc-channel
source{
: svc-virtual-device ( -- ) " svc-channel" load-driver ;
}source
# Dec bridge
depend ${BP}/dev/pci-bridge/dec21152/depend.mk
target dec21152.fc class060400
source{
: class060400 ( -- )
" class060400" load-driver
;
}source
# Legacy Southbridge Support below
# Serial line A
depend ${BP}/dev/southbridge/isa-devices/serial/depend.mk
target serial.fc SUNW,tty
source{
: isa-0,3f8 ( -- )
" ttya" encode-string " console" property
" SUNW,tty" load-driver
" console" delete-property
;
}source
# an IDE controller
depend ${BP}/dev/ide/pci/depend.mk
target ide.fc class010100
source{
: class010100 ( -- ) " class010100" load-driver ;
alias class01018a class010100
alias class01018f class010100
alias class0101ff class010100
}source
# onboard USB driver
depend ${BP}/dev/southbridge/usb/depend.mk
target southusb.fc usb
source{
: pci10b9,5237 ( -- )
1 interrupt-property
" usb" load-driver
;
}source
depend ${BP}/dev/usb-devices/device/depend.mk
target device.fc device
source{
: device ( -- adr len true | false ) " device" get-fcode ;
}source
depend ${BP}/dev/usb-devices/combined/depend.mk
target combined.fc combined
source{
: combined ( -- adr len true | false ) " combined" get-fcode ;
}source
depend ${BP}/dev/usb-devices/interface/depend.mk
target interface.fc interface
source{
: interface ( -- adr len true | false ) " interface" get-fcode ;
}source
depend ${BP}/dev/usb-devices/hub/depend.mk
target hub.fc hub
source{
: hub ( -- adr len true | false ) " hub" get-fcode ;
}source
depend ${BP}/dev/usb-devices/kbd/depend.mk
target usbkbd.fc kbd
source{
: kbd ( -- adr len true | false ) " kbd" get-fcode ;
}source
# finish the dropins
source{
device-end
}source