xref: /onnv-gate/usr/src/uts/i86pc/sys/biosdisk.h (revision 8135:a8055d14e4de)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*8135SSeth.Goldberg@Sun.COM  * Common Development and Distribution License (the "License").
6*8135SSeth.Goldberg@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*8135SSeth.Goldberg@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_BIOSDISK_H
270Sstevel@tonic-gate #define	_SYS_BIOSDISK_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include <sys/types.h>
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef __cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate typedef union device_path {
360Sstevel@tonic-gate 	struct {			/* ATA or ATAPI or SATA */
370Sstevel@tonic-gate 		unsigned char 	chan;	/* 0 or 1 */
380Sstevel@tonic-gate 		unsigned char 	lun;	/* for ATAPI only */
390Sstevel@tonic-gate 	} ata;
400Sstevel@tonic-gate 	struct {
410Sstevel@tonic-gate 		unsigned short	target;
420Sstevel@tonic-gate 		uint32_t	lun_lo;
430Sstevel@tonic-gate 		uint32_t	lun_hi;
440Sstevel@tonic-gate 	} scsi;
450Sstevel@tonic-gate 	struct {
460Sstevel@tonic-gate 		uint64_t	usb_serial_id;
470Sstevel@tonic-gate 	} usb;
480Sstevel@tonic-gate 	struct {
490Sstevel@tonic-gate 		uint64_t	eui;
500Sstevel@tonic-gate 	} s1394;
510Sstevel@tonic-gate 	struct {
520Sstevel@tonic-gate 		uint64_t	wwid;
530Sstevel@tonic-gate 		uint64_t	lun;
540Sstevel@tonic-gate 	} fibre;
550Sstevel@tonic-gate 	struct {
560Sstevel@tonic-gate 		uint64_t	id_tag;
570Sstevel@tonic-gate 	} i2o;
580Sstevel@tonic-gate 
590Sstevel@tonic-gate 	struct {
600Sstevel@tonic-gate 		uint32_t	raid_array_num;
610Sstevel@tonic-gate 	} raid;
620Sstevel@tonic-gate 	unsigned char pad[16];		/* total length */
630Sstevel@tonic-gate } device_path_t;
640Sstevel@tonic-gate 
650Sstevel@tonic-gate 
660Sstevel@tonic-gate typedef union interface_path {
670Sstevel@tonic-gate 		struct {
680Sstevel@tonic-gate 			unsigned short 	baseport;
690Sstevel@tonic-gate 		} isa;
700Sstevel@tonic-gate 		struct {		/* PCI or PCIX */
710Sstevel@tonic-gate 			unsigned char bus;
720Sstevel@tonic-gate 			unsigned char device;
730Sstevel@tonic-gate 			unsigned char function;
740Sstevel@tonic-gate 			unsigned char channel;
750Sstevel@tonic-gate 		} pci;
760Sstevel@tonic-gate 		char 	pad[8];
770Sstevel@tonic-gate } interface_path_t;
780Sstevel@tonic-gate 
790Sstevel@tonic-gate /*
800Sstevel@tonic-gate  * Structure for Int 13 function 48 (EDD 3.0)
810Sstevel@tonic-gate  *
820Sstevel@tonic-gate  * from T13/1484D Revision 2
830Sstevel@tonic-gate  */
840Sstevel@tonic-gate 
850Sstevel@tonic-gate #pragma pack(1)
860Sstevel@tonic-gate typedef struct int13_fn48_result {
870Sstevel@tonic-gate 	unsigned short		buflen;
880Sstevel@tonic-gate 	unsigned short		flags;
890Sstevel@tonic-gate 	uint32_t		ncyl;
900Sstevel@tonic-gate 	uint32_t		nhead;
910Sstevel@tonic-gate 	uint32_t		spt;
920Sstevel@tonic-gate 	uint32_t 		nsect_lo;
930Sstevel@tonic-gate 	uint32_t		nsect_hi;
940Sstevel@tonic-gate 	unsigned short		bps;
950Sstevel@tonic-gate 	uint32_t		dpte;
960Sstevel@tonic-gate 	unsigned short		magic;		/* BEDD if Path info there */
970Sstevel@tonic-gate 	unsigned char		pathinfo_len;
980Sstevel@tonic-gate 	unsigned char		res1;
990Sstevel@tonic-gate 	unsigned short		res2;
1000Sstevel@tonic-gate 	char			bustype[4];	/* offset 36 */
1010Sstevel@tonic-gate 	char			interface_type[8];
1020Sstevel@tonic-gate 	interface_path_t	interfacepath;
1030Sstevel@tonic-gate 	device_path_t		devicepath;
1040Sstevel@tonic-gate 	unsigned char		res3;
1050Sstevel@tonic-gate 	unsigned char		checksum;	/* offset 73 */
1060Sstevel@tonic-gate } fn48_t;
107*8135SSeth.Goldberg@Sun.COM 
108*8135SSeth.Goldberg@Sun.COM typedef struct int13_fn4b_result {
109*8135SSeth.Goldberg@Sun.COM 	uint8_t		pkt_size;	/* Packet size (== 0x13) */
110*8135SSeth.Goldberg@Sun.COM 
111*8135SSeth.Goldberg@Sun.COM 	uint8_t		boot_mtype;	/* Boot media type: see defines below */
112*8135SSeth.Goldberg@Sun.COM 
113*8135SSeth.Goldberg@Sun.COM 	uint8_t		drivenum;
114*8135SSeth.Goldberg@Sun.COM 	uint8_t		ctlr_idx;
115*8135SSeth.Goldberg@Sun.COM 	uint32_t	lba;
116*8135SSeth.Goldberg@Sun.COM 	uint16_t	dev_spec;
117*8135SSeth.Goldberg@Sun.COM 	uint16_t	buf_seg;
118*8135SSeth.Goldberg@Sun.COM 	uint16_t	load_seg;
119*8135SSeth.Goldberg@Sun.COM 	uint16_t	sect_cnt;
120*8135SSeth.Goldberg@Sun.COM 	uint8_t		cyl_0_7;	/* Bits 0-7 of the 9-bit cylinder cnt */
121*8135SSeth.Goldberg@Sun.COM 	/*
122*8135SSeth.Goldberg@Sun.COM 	 * Bits 0-5: Sector count
123*8135SSeth.Goldberg@Sun.COM 	 *	6-7: High 2 bits of the 9-bit cylinder count
124*8135SSeth.Goldberg@Sun.COM 	 */
125*8135SSeth.Goldberg@Sun.COM 	uint8_t		sec_0_5_and_cyl_8_9;
126*8135SSeth.Goldberg@Sun.COM 	uint8_t		head_cnt;
127*8135SSeth.Goldberg@Sun.COM } fn4b_t;
128*8135SSeth.Goldberg@Sun.COM 
1290Sstevel@tonic-gate #pragma pack()
1300Sstevel@tonic-gate 
1310Sstevel@tonic-gate typedef struct biosdev_data {
1320Sstevel@tonic-gate 	uchar_t			first_block_valid;
1330Sstevel@tonic-gate 	uchar_t			first_block[512];
1340Sstevel@tonic-gate 	uchar_t			edd_valid;
1350Sstevel@tonic-gate 	fn48_t			fn48_dev_params;
1360Sstevel@tonic-gate } biosdev_data_t;
1370Sstevel@tonic-gate 
138*8135SSeth.Goldberg@Sun.COM /*
139*8135SSeth.Goldberg@Sun.COM  * Definitions for boot_mtype in fn4b_t
140*8135SSeth.Goldberg@Sun.COM  */
141*8135SSeth.Goldberg@Sun.COM #define	BOOT_MTYPE_MASK			0xF
142*8135SSeth.Goldberg@Sun.COM #define	BOOT_MTYPE(x)			((x) & BOOT_MTYPE_MASK)
143*8135SSeth.Goldberg@Sun.COM #define	BOOT_MTYPE_NO_EMUL		0
144*8135SSeth.Goldberg@Sun.COM #define	BOOT_MTYPE_1_2M_FLOPPY		1
145*8135SSeth.Goldberg@Sun.COM #define	BOOT_MTYPE_1_44M_FLOPPY		2
146*8135SSeth.Goldberg@Sun.COM #define	BOOT_MTYPE_2_88M_FLOPPY		3
147*8135SSeth.Goldberg@Sun.COM #define	BOOT_MTYPE_HARD_DISK		4
148*8135SSeth.Goldberg@Sun.COM #define	BOOT_MTYPE_INTF_MASK		0xC0
149*8135SSeth.Goldberg@Sun.COM #define	BOOT_MTYPE_INTF_ATAPI		0x40
150*8135SSeth.Goldberg@Sun.COM #define	BOOT_MTYPE_INTF_SCSI		0x80
151*8135SSeth.Goldberg@Sun.COM #define	BOOT_MTYPE_IS_ATAPI(x) \
152*8135SSeth.Goldberg@Sun.COM 	(((x) & BOOT_MTYPE_INTF_MASK) == BOOT_MTYPE_INTF_ATAPI)
153*8135SSeth.Goldberg@Sun.COM #define	BOOT_MTYPE_IS_SCSI(x) \
154*8135SSeth.Goldberg@Sun.COM 	(((x) & BOOT_MTYPE_INTF_MASK) == BOOT_MTYPE_INTF_SCSI)
155*8135SSeth.Goldberg@Sun.COM 
1560Sstevel@tonic-gate #ifdef __cplusplus
1570Sstevel@tonic-gate }
1580Sstevel@tonic-gate #endif
1590Sstevel@tonic-gate 
1600Sstevel@tonic-gate #endif /* _SYS_BIOSDISK_H */
161