1 # Copyright (c) KATO Takenori, 1999, 2000.
3 # All rights reserved. Unpublished rights reserved under the copyright
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer as
12 # the first lines of this file unmodified.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
17 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 # $FreeBSD: src/sys/boot/pc98/boot0.5/disk.s,v 1.4 2000/08/31 10:24:06 kato Exp $
29 # $DragonFly: src/sys/boot/pc98/boot0.5/Attic/disk.s,v 1.3 2003/11/10 06:08:38 dillon Exp $
35 # Check magic number at the end of the sector 0
40 movw secsize(%si), %bx
53 # Copy partition table from buffer to parttable.
60 movw maxpart(%bx), %cx # %cx = max num of partitions
61 movw partoff(%bx), %di
62 movw %di, %bx # %bx = offset to partition table
63 xorw %dx, %dx # %dx = partition number
89 loop setup_partition_loop
93 # Read IPL and partition table in the current device.
98 movw %ax, %si # %si = device number
112 movw defflagoff(%di), %bx
113 movb iplbuf(%bx), %al
114 movb %al, defpartflag
116 movb iplbuf(%bx), %al
131 # Restore IPL from the buffer
140 # Restore default boot partition info.
141 movw defflagoff(%di), %bx
142 movb defpartflag, %al
143 movb %al, iplbuf(%bx)
146 movb %al, iplbuf(%bx)
152 movw secsize(%di), %bx
167 .global scan_sasi, scan_scsi
172 movw $0x0001, %ax # %ah = unit number, %al = for bit operation
177 movw $0x55d, %bx # DISK_EQUIP
182 addb %ah, %dh # %dh = DA/UA
183 movb %dh, daua(%si) # Store DA/UA
185 # Try new sense command
198 movw $0x457, %bx # capacity & sector size of IDE HDD
226 movw %dx, secsize(%di)
237 # destroyed: %ax, %bx, %cx, %dx
240 movw $0x0001, %ax # %ah = ID number, %al = for bit operation
242 # Check whether drive exist.
245 movw $0x482, %bx # DISK_EQUIPS
253 addw $0x460, %bx # SCSI paramter block
258 # SCSI harddrive found.
279 movw %dx, secsize(%di)
288 .global partnum, parttable, defpartflag, defpartnum, npartition
289 partnum: .space 32 # Index of parttable
290 parttable: .space 1024 # Copy of valid partition table
293 npartition: .word 0 # number of partitions