biosdisk.c (226746) | biosdisk.c (226748) |
---|---|
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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> | 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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/boot/i386/libi386/biosdisk.c 226746 2011-10-25 19:45:12Z jhb $"); | 28__FBSDID("$FreeBSD: head/sys/boot/i386/libi386/biosdisk.c 226748 2011-10-25 19:54:06Z jhb $"); |
29 30/* 31 * BIOS disk device handling. 32 * 33 * Ideas and algorithms from: 34 * 35 * - NetBSD libi386/biosdisk.c 36 * - FreeBSD biosboot/disk.c --- 7 unchanged lines hidden (view full) --- 44#include <sys/gpt.h> 45#include <machine/bootinfo.h> 46 47#include <stdarg.h> 48#include <uuid.h> 49 50#include <bootstrap.h> 51#include <btxv86.h> | 29 30/* 31 * BIOS disk device handling. 32 * 33 * Ideas and algorithms from: 34 * 35 * - NetBSD libi386/biosdisk.c 36 * - FreeBSD biosboot/disk.c --- 7 unchanged lines hidden (view full) --- 44#include <sys/gpt.h> 45#include <machine/bootinfo.h> 46 47#include <stdarg.h> 48#include <uuid.h> 49 50#include <bootstrap.h> 51#include <btxv86.h> |
52#include <edd.h> |
|
52#include "libi386.h" 53 54#define BIOS_NUMDRIVES 0x475 55#define BIOSDISK_SECSIZE 512 56#define BUFSIZE (1 * BIOSDISK_SECSIZE) 57#define MAXBDDEV MAXDEV 58 59#define DT_ATAPI 0x10 /* disk type for ATAPI floppies */ --- 201 unchanged lines hidden (view full) --- 261 262 /* Determine if we can use EDD with this device. */ 263 v86.eax = 0x4100; 264 v86.edx = bd->bd_unit; 265 v86.ebx = 0x55aa; 266 v86int(); 267 if (!(V86_CY(v86.efl)) && /* carry clear */ 268 ((v86.ebx & 0xffff) == 0xaa55) && /* signature */ | 53#include "libi386.h" 54 55#define BIOS_NUMDRIVES 0x475 56#define BIOSDISK_SECSIZE 512 57#define BUFSIZE (1 * BIOSDISK_SECSIZE) 58#define MAXBDDEV MAXDEV 59 60#define DT_ATAPI 0x10 /* disk type for ATAPI floppies */ --- 201 unchanged lines hidden (view full) --- 262 263 /* Determine if we can use EDD with this device. */ 264 v86.eax = 0x4100; 265 v86.edx = bd->bd_unit; 266 v86.ebx = 0x55aa; 267 v86int(); 268 if (!(V86_CY(v86.efl)) && /* carry clear */ 269 ((v86.ebx & 0xffff) == 0xaa55) && /* signature */ |
269 (v86.ecx & 0x1)) { /* packets mode ok */ | 270 (v86.ecx & EDD_INTERFACE_FIXED_DISK)) { /* packets mode ok */ |
270 bd->bd_flags |= BD_MODEEDD1; 271 if ((v86.eax & 0xff00) >= 0x3000) 272 bd->bd_flags |= BD_MODEEDD3; 273 } 274 return(1); 275 } 276 return(0); 277} --- 851 unchanged lines hidden (view full) --- 1129/* Max number of sectors to bounce-buffer if the request crosses a 64k boundary */ 1130#define FLOPPY_BOUNCEBUF 18 1131 1132static int 1133bd_edd_io(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest, int write) 1134{ 1135 static struct edd_packet packet; 1136 | 271 bd->bd_flags |= BD_MODEEDD1; 272 if ((v86.eax & 0xff00) >= 0x3000) 273 bd->bd_flags |= BD_MODEEDD3; 274 } 275 return(1); 276 } 277 return(0); 278} --- 851 unchanged lines hidden (view full) --- 1130/* Max number of sectors to bounce-buffer if the request crosses a 64k boundary */ 1131#define FLOPPY_BOUNCEBUF 18 1132 1133static int 1134bd_edd_io(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest, int write) 1135{ 1136 static struct edd_packet packet; 1137 |
1137 packet.len = 0x10; | 1138 packet.len = sizeof(struct edd_packet); |
1138 packet.count = blks; | 1139 packet.count = blks; |
1139 packet.offset = VTOPOFF(dest); | 1140 packet.off = VTOPOFF(dest); |
1140 packet.seg = VTOPSEG(dest); 1141 packet.lba = dblk; 1142 v86.ctl = V86_FLAGS; 1143 v86.addr = 0x13; 1144 if (write) 1145 /* Should we Write with verify ?? 0x4302 ? */ 1146 v86.eax = 0x4300; 1147 else --- 274 unchanged lines hidden --- | 1141 packet.seg = VTOPSEG(dest); 1142 packet.lba = dblk; 1143 v86.ctl = V86_FLAGS; 1144 v86.addr = 0x13; 1145 if (write) 1146 /* Should we Write with verify ?? 0x4302 ? */ 1147 v86.eax = 0x4300; 1148 else --- 274 unchanged lines hidden --- |