Deleted Added
full compact
biosdisk.c (43205) biosdisk.c (48083)
1/*-
2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: biosdisk.c,v 1.22 1999/01/24 06:03:44 msmith Exp $
26 * $Id: biosdisk.c,v 1.23 1999/01/25 23:07:02 rnordier Exp $
27 */
28
29/*
30 * BIOS disk device handling.
31 *
32 * Ideas and algorithms from:
33 *
34 * - NetBSD libi386/biosdisk.c

--- 707 unchanged lines hidden (view full) ---

742 od->od_hds = ((v86.edx & 0xff00) >> 8) + 1;
743 od->od_sec = v86.ecx & 0x3f;
744
745 DEBUG("unit 0x%x geometry %d/%d/%d", od->od_unit, od->od_cyl, od->od_hds, od->od_sec);
746 return(0);
747}
748
749/*
27 */
28
29/*
30 * BIOS disk device handling.
31 *
32 * Ideas and algorithms from:
33 *
34 * - NetBSD libi386/biosdisk.c

--- 707 unchanged lines hidden (view full) ---

742 od->od_hds = ((v86.edx & 0xff00) >> 8) + 1;
743 od->od_sec = v86.ecx & 0x3f;
744
745 DEBUG("unit 0x%x geometry %d/%d/%d", od->od_unit, od->od_cyl, od->od_hds, od->od_sec);
746 return(0);
747}
748
749/*
750 * Return the BIOS geometry of a given "fixed drive" in a format
751 * suitable for the legacy bootinfo structure. Since the kernel is
752 * expecting raw int 0x13/0x8 values for N_BIOS_GEOM drives, we
753 * prefer to get the information directly, rather than rely on being
754 * able to put it together from information already maintained for
755 * different purposes and for a probably different number of drives.
756 *
757 * For valid drives, the geometry is expected in the format (31..0)
758 * "000000cc cccccccc hhhhhhhh 00ssssss"; and invalid drives are
759 * indicated by returning the geometry of a "1.2M" PC-format floppy
760 * disk. And, incidentally, what is returned is not the geometry as
761 * such but the highest valid cylinder, head, and sector numbers.
762 */
763u_int32_t
764bd_getbigeom(int bunit)
765{
766
767 v86.ctl = V86_FLAGS;
768 v86.addr = 0x13;
769 v86.eax = 0x800;
770 v86.edx = 0x80 + bunit;
771 v86int();
772 if (v86.efl & 0x1)
773 return 0x4f010f;
774 return ((v86.ecx & 0xc0) << 18) | ((v86.ecx & 0xff00) << 8) |
775 (v86.edx & 0xff00) | (v86.ecx & 0x3f);
776}
777
778/*
750 * Return a suitable dev_t value for (dev).
751 *
752 * In the case where it looks like (dev) is a SCSI disk, we allow the number of
753 * IDE disks to be specified in $num_ide_disks. There should be a Better Way.
754 */
755int
756bd_getdev(struct i386_devdesc *dev)
757{

--- 75 unchanged lines hidden ---
779 * Return a suitable dev_t value for (dev).
780 *
781 * In the case where it looks like (dev) is a SCSI disk, we allow the number of
782 * IDE disks to be specified in $num_ide_disks. There should be a Better Way.
783 */
784int
785bd_getdev(struct i386_devdesc *dev)
786{

--- 75 unchanged lines hidden ---