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.
34 # Check magic number at the end of the sector 0
39 movw secsize(%si), %bx
52 # Copy partition table from buffer to parttable.
59 movw maxpart(%bx), %cx # %cx = max num of partitions
60 movw partoff(%bx), %di
61 movw %di, %bx # %bx = offset to partition table
62 xorw %dx, %dx # %dx = partition number
88 loop setup_partition_loop
92 # Read IPL and partition table in the current device.
97 movw %ax, %si # %si = device number
111 movw defflagoff(%di), %bx
112 movb iplbuf(%bx), %al
113 movb %al, defpartflag
115 movb iplbuf(%bx), %al
130 # Restore IPL from the buffer
139 # Restore default boot partition info.
140 movw defflagoff(%di), %bx
141 movb defpartflag, %al
142 movb %al, iplbuf(%bx)
145 movb %al, iplbuf(%bx)
151 movw secsize(%di), %bx
166 .global scan_sasi, scan_scsi
171 movw $0x0001, %ax # %ah = unit number, %al = for bit operation
176 movw $0x55d, %bx # DISK_EQUIP
181 addb %ah, %dh # %dh = DA/UA
182 movb %dh, daua(%si) # Store DA/UA
184 # Try new sense command
197 movw $0x457, %bx # capacity & sector size of IDE HDD
225 movw %dx, secsize(%di)
236 # destroyed: %ax, %bx, %cx, %dx
239 movw $0x0001, %ax # %ah = ID number, %al = for bit operation
241 # Check whether drive exist.
244 movw $0x482, %bx # DISK_EQUIPS
252 addw $0x460, %bx # SCSI paramter block
257 # SCSI harddrive found.
278 movw %dx, secsize(%di)
287 .global defpartflag, defpartnum, npartition
290 npartition: .word 0 # number of partitions
293 .global partnum, parttable
294 iplbuf: .space 0x400 # Read buffer for IPL
295 partnum: .space 32 # Index of parttable
296 parttable: .space 1024 # Copy of valid partition table