Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: atapi.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: @(#)atapi.fth 1.1 07/01/24 | |
43 | purpose: ATAPI interface | |
44 | \ See license at end of file | |
45 | ||
46 | hex | |
47 | ||
48 | headers | |
49 | ||
50 | d# 12 dup constant pkt-len | |
51 | buffer: pkt-buf | |
52 | ||
53 | \ ATAPI devices only accept 12 byte long commands | |
54 | \ Fixup the SCSI commands before sending them out | |
55 | ||
56 | : translate-atapi-command ( cmd-adr,len -- pkt-buf,len ) | |
57 | pkt-buf dup >r pkt-len erase \ Zero pkt-buf | |
58 | r@ swap move \ Copy cmd$ to pkt-buf | |
59 | r@ c@ dup h# 15 = swap h# 1a = or if \ Mode send or mode select command | |
60 | r@ c@ h# 40 or r@ c! \ Fix it | |
61 | r@ 4 + c@ r@ 8 + c! | |
62 | 0 r@ 4 + c! | |
63 | else | |
64 | r@ c@ dup 8 = swap h# a = or if \ Read or write command | |
65 | r@ c@ h# 20 or r@ c! \ Fix it | |
66 | r@ 1+ c@ dup h# e0 and r@ 1+ c! | |
67 | r@ 4 + c@ r@ 8 + c! | |
68 | r@ 3 + c@ r@ 5 + c! | |
69 | r@ 2 + c@ r@ 4 + c! | |
70 | h# 1f and r@ 3 + c! | |
71 | 0 r@ 2 + c! | |
72 | then | |
73 | then | |
74 | r> pkt-len | |
75 | ; | |
76 | ||
77 | : init-atapi-execute-command ( -- ) | |
78 | " is-atapi" get-my-property 0= if | |
79 | 2drop | |
80 | ['] translate-atapi-command to execute-command-hook | |
81 | then | |
82 | ; | |
83 | ' init-atapi-execute-command to init-execute-command | |
84 | ||
85 | \ LICENSE_BEGIN | |
86 | \ Copyright (c) 2006 FirmWorks | |
87 | \ | |
88 | \ Permission is hereby granted, free of charge, to any person obtaining | |
89 | \ a copy of this software and associated documentation files (the | |
90 | \ "Software"), to deal in the Software without restriction, including | |
91 | \ without limitation the rights to use, copy, modify, merge, publish, | |
92 | \ distribute, sublicense, and/or sell copies of the Software, and to | |
93 | \ permit persons to whom the Software is furnished to do so, subject to | |
94 | \ the following conditions: | |
95 | \ | |
96 | \ The above copyright notice and this permission notice shall be | |
97 | \ included in all copies or substantial portions of the Software. | |
98 | \ | |
99 | \ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
100 | \ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
101 | \ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
102 | \ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
103 | \ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
104 | \ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
105 | \ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
106 | \ | |
107 | \ LICENSE_END |