Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / dev / usb / finder.fth
CommitLineData
920dae64
AT
1\ ========== Copyright Header Begin ==========================================
2\
3\ Hypervisor Software File: finder.fth
4\
5\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6\
7\ - Do no alter or remove copyright notices
8\
9\ - Redistribution and use of this software in source and binary forms, with
10\ or without modification, are permitted provided that the following
11\ conditions are met:
12\
13\ - Redistribution of source code must retain the above copyright notice,
14\ this list of conditions and the following disclaimer.
15\
16\ - Redistribution in binary form must reproduce the above copyright notice,
17\ this list of conditions and the following disclaimer in the
18\ documentation and/or other materials provided with the distribution.
19\
20\ Neither the name of Sun Microsystems, Inc. or the names of contributors
21\ may be used to endorse or promote products derived from this software
22\ without specific prior written permission.
23\
24\ This software is provided "AS IS," without a warranty of any kind.
25\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
26\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
27\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
28\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
29\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
30\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
31\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
32\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
33\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
34\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
35\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
36\
37\ You acknowledge that this software is not designed, licensed or
38\ intended for use in the design, construction, operation or maintenance of
39\ any nuclear facility.
40\
41\ ========== Copyright Header End ============================================
42id: @(#)finder.fth 1.7 99/06/03
43purpose:
44copyright: Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved
45
46\ XXX for plugin card. map fcode prom. find fcode bits. save in
47\ buffer(s). unmap fcode prom. do at probe time. dump after probing
48\ is complete.
49\ : get-fcode-bits ( -- )
50\ ;
51
52\ for cpu bootprom. look in /packages/SUNW,builtin-drivers.
53\ If found, user must dma-free when done with the image.
54
55\ adr1 len1 is a string that is the name of a bunch of fcode.
56\ adr2 len2 is a location&size for it (max 64K).
57\ return true if it can be found. return false if it is not found.
58
59: find-fcode ( adr1 len1 -- adr2 len2 true | false )
60 my-self >r
61 saved-self to my-self
62 " SUNW,builtin-drivers" find-package drop \ XXX must be present
63 find-method if
64 >r
65 h# 1.0000 dma-alloc
66 h# 1.0000 2dup
67 r> execute if
68 true
69 else dma-free false
70 then
71 else
72 false
73 then
74 r> to my-self
75;
76
77\ make a property for find-fcode so that child nodes can get the fcode
78\ they need.
79: publish-finder ( -- )
80 ['] find-fcode encode-int " sunw,find-fcode" property
81;
82
83\ XXX better be present:
84: find-device-fcode ( -- addr len ) " device" find-fcode drop ;
85
86\ XXX better be present:
87: find-combined-fcode ( -- addr len ) " combined" find-fcode drop ;
88
89