| 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 ============================================ |
| 42 | id: @(#)generic-names.fth 1.3 00/06/23 |
| 43 | purpose: PCI bus package |
| 44 | copyright: 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 | |
| 57 | hex |
| 58 | align |
| 59 | create class-names |
| 60 | |
| 61 | ffffff , \ Mask |
| 62 | 000100 " display" class-name |
| 63 | 0 , \ No more entries for this mask |
| 64 | |
| 65 | ff0000 , \ Mask |
| 66 | 030000 " display" class-name |
| 67 | 0a0000 " dock" class-name |
| 68 | 0b0000 " cpu" class-name |
| 69 | 0 , \ No more entries for this mask |
| 70 | |
| 71 | ffff00 , \ Mask |
| 72 | 010000 " scsi" class-name |
| 73 | 010100 " ide" class-name |
| 74 | 010200 " fdc" class-name |
| 75 | 010300 " ipi" class-name |
| 76 | 010400 " raid" class-name |
| 77 | 020000 " ethernet" class-name |
| 78 | 020100 " token-ring" class-name |
| 79 | 020200 " fddi" class-name |
| 80 | 020300 " atm" class-name |
| 81 | 040000 " video" class-name |
| 82 | 040100 " sound" class-name |
| 83 | 050000 " memory" class-name |
| 84 | 050100 " flash" class-name |
| 85 | 060000 " host" class-name |
| 86 | 060100 " isa" class-name |
| 87 | 060200 " eisa" class-name |
| 88 | 060300 " mca" class-name |
| 89 | 060400 " pci" class-name |
| 90 | 060500 " pcmcia" class-name |
| 91 | 060600 " nubus" class-name |
| 92 | 060700 " cardbus" class-name |
| 93 | 070000 " serial" class-name |
| 94 | 070100 " parallel" class-name |
| 95 | 080000 " interrupt-controller" class-name |
| 96 | 080100 " dma-controller" class-name |
| 97 | 080200 " timer" class-name |
| 98 | 080300 " rtc" class-name |
| 99 | 090000 " keyboard" class-name |
| 100 | 090100 " pen" class-name |
| 101 | 090200 " mouse" class-name |
| 102 | 0c0000 " firewire" class-name |
| 103 | 0c0100 " access-bus" class-name |
| 104 | 0c0200 " ssa" class-name |
| 105 | 0c0300 " usb" class-name |
| 106 | 0c0400 " fibre-channel" class-name |
| 107 | 0 , \ No more entries for this mask |
| 108 | 0 , \ 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 | ; |