Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / dev / pci / generic-names.fth
CommitLineData
920dae64
AT
1\ ========== Copyright Header Begin ==========================================
2\
3\ Hypervisor Software File: generic-names.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: @(#)generic-names.fth 1.3 00/06/23
43purpose: PCI bus package
44copyright: Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved
45
46\
47\ Pulled from pcibus.fth from firmworks to keep the generic vs standard
48\ name code localised.
49\
50: class-name ( code name$ --- )
51 rot , ( name$ )
52 dup c, ( name$ )
53 bounds do i c@ c, loop 0 c, ( -- )
54 align ( -- )
55;
56
57hex
58align
59create class-names
60
61ffffff , \ Mask
62000100 " display" class-name
630 , \ No more entries for this mask
64
65ff0000 , \ Mask
66030000 " display" class-name
670a0000 " dock" class-name
680b0000 " cpu" class-name
690 , \ No more entries for this mask
70
71ffff00 , \ Mask
72010000 " scsi" class-name
73010100 " ide" class-name
74010200 " fdc" class-name
75010300 " ipi" class-name
76010400 " raid" class-name
77020000 " ethernet" class-name
78020100 " token-ring" class-name
79020200 " fddi" class-name
80020300 " atm" class-name
81040000 " video" class-name
82040100 " sound" class-name
83050000 " memory" class-name
84050100 " flash" class-name
85060000 " host" class-name
86060100 " isa" class-name
87060200 " eisa" class-name
88060300 " mca" class-name
89060400 " pci" class-name
90060500 " pcmcia" class-name
91060600 " nubus" class-name
92060700 " cardbus" class-name
93070000 " serial" class-name
94070100 " parallel" class-name
95080000 " interrupt-controller" class-name
96080100 " dma-controller" class-name
97080200 " timer" class-name
98080300 " rtc" class-name
99090000 " keyboard" class-name
100090100 " pen" class-name
101090200 " mouse" class-name
1020c0000 " firewire" class-name
1030c0100 " access-bus" class-name
1040c0200 " ssa" class-name
1050c0300 " usb" class-name
1060c0400 " fibre-channel" class-name
1070 , \ No more entries for this mask
1080 , \ End of table
109
110: @+ ( adr -- adr' n ) dup na1+ swap @ ;
111
112: unknown-class? ( class-code -- true | class-name$ false )
113 \ The outer loop executes once for each distinct mask value
114 class-names begin @+ dup while ( code adr mask )
115 2 pick and >r ( code adr r: masked-code )
116
117 \ The inner loop searches all entries with that mask value
118 begin @+ dup while ( code adr match )
119
120 r@ = if ( code adr )
121 \ A match under the mask was found; return the string
122 r> drop nip count false exit ( class-name$ false )
123 then ( code adr )
124 \ Skip the string and proceed to the next entry
125 count + 1+ /n round-up
126 repeat ( code adr 0 )
127
128 \ Proceed to the next mask value
129 r> 2drop ( code adr )
130 repeat ( code adr 0 )
131
132 \ No match was found
133 3drop true ( true )
134;