Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / dev / usb2 / device / storage / storage.fth
CommitLineData
920dae64
AT
1\ ========== Copyright Header Begin ==========================================
2\
3\ Hypervisor Software File: storage.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: @(#)storage.fth 1.1 07/01/04
43purpose: USB Mass Storage device driver loader
44copyright: Copyright 2007 Sun Microsystems, Inc. All Rights Reserved
45\ See license at end of file
46
47headers
48hex
49
50" scsi-usb" device-type
510 encode-int " #size-cells" property
522 encode-int " #address-cells" property \ SUN Note - scsi has two address cells
53
54
55external
56
57\ SUN Note - scsi has two address cells.
58: encode-unit ( l h -- adr,len ) swap <# u#s drop ascii , hold u#s u#> ;
59: decode-unit ( addr len -- unit# target# ) parse-2int ;
60
61\ These routines may be called by the children of this device.
62\ This card has no local buffer memory for the ATAPI device, so it
63\ depends on its parent to supply DMA memory. For a device with
64\ local buffer memory, these routines would probably allocate from
65\ that local memory.
66
67h# 800 constant low-speed-max
68h# 2000 constant full-speed-max
69h# 4000 constant high-speed-max
70: my-max ( -- n )
71 " low-speed" get-my-property 0= if 2drop low-speed-max exit then
72 " full-speed" get-my-property 0= if 2drop full-speed-max exit then
73 high-speed-max
74;
75: max-transfer ( -- n )
76 " max-transfer" ['] $call-parent catch if
77 2drop my-max
78 then
79 my-max min
80;
81
82headers
83
84fload ${BP}/dev/usb2/device/common.fth \ USB device driver common routines
85fload ${BP}/dev/usb2/device/storage/scsi.fth \ High level SCSI routines
86fload ${BP}/dev/usb2/device/storage/atapi.fth \ ATAPI interface support
87fload ${BP}/dev/usb2/device/storage/hacom.fth \ Basic SCSI routines
88
89new-device
90 " disk" device-name
91 fload ${BP}/dev/usb2/device/storage/scsidisk.fth
92finish-device
93
94init
95
96
97\ LICENSE_BEGIN
98\ Copyright (c) 2006 FirmWorks
99\
100\ Permission is hereby granted, free of charge, to any person obtaining
101\ a copy of this software and associated documentation files (the
102\ "Software"), to deal in the Software without restriction, including
103\ without limitation the rights to use, copy, modify, merge, publish,
104\ distribute, sublicense, and/or sell copies of the Software, and to
105\ permit persons to whom the Software is furnished to do so, subject to
106\ the following conditions:
107\
108\ The above copyright notice and this permission notice shall be
109\ included in all copies or substantial portions of the Software.
110\
111\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
112\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
113\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
114\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
115\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
116\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
117\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
118\
119\ LICENSE_END