ebda.h revision 88c4b361fef237b4b991f435ade57577aa607c0c
/*
* Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
* --------------------------------------------------------------------
*
* This code is based on:
*
*
* Copyright (C) 2002 MandrakeSoft S.A.
*
* MandrakeSoft S.A.
* 43, rue d'Aboukir
* 75002 Paris - France
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <stdint.h>
/* Must be defined here (EBDA structures depend on these). */
#define BX_MAX_ATA_INTERFACES 4
#define BX_USE_ATADRV 1
#define BX_ELTORITO_BOOT 1
#ifdef VBOX_WITH_SCSI
/* Enough for now */
#define BX_MAX_SCSI_DEVICES 4
/* A SCSI device starts always at BX_MAX_ATA_DEVICES. */
#else
#define BX_MAX_SCSI_DEVICES 0
#endif
#ifdef VBOX_WITH_AHCI
/* Four should be enough for now */
#define BX_MAX_AHCI_DEVICES 4
/* An AHCI device starts always at BX_MAX_ATA_DEVICES + BX_MAX_SCSI_DEVICES. */
#else
#define BX_MAX_AHCI_DEVICES 0
#endif
/* Generic storage device types. These depend on the controller type and
* determine which device access routines should be called.
*/
enum dsk_type_enm {
DSK_TYPE_NONE, /* Unknown device. */
DSK_TYPE_UNKNOWN, /* Unknown ATA device. */
DSK_TYPE_ATA, /* ATA disk. */
DSK_TYPE_ATAPI, /* ATAPI device. */
DSK_TYPE_SCSI, /* SCSI disk. */
DSK_TYPE_AHCI, /* SATA disk via AHCI. */
DSKTYP_CNT /* Number of disk types. */
};
/* Disk device types. */
//@todo: Do we really need these?
/* Geometry translation modes. */
enum geo_xlat_enm {
GEO_TRANSLATION_NONE, /* No geometry translation. */
GEO_TRANSLATION_LBA, /* LBA translation. */
GEO_TRANSLATION_LARGE, /* Large CHS translation. */
};
#if 1 //BX_USE_ATADRV
/* Note: The DPTE and FDPT structures are industry standards and
* may not be modified. The other disk-related structures are
* internal to the BIOS.
*/
/* Translated DPT (Device Parameter Table). */
typedef struct {
} dpte_t;
#pragma pack(0)
* that this structure is slightly misaligned.
*/
typedef struct {
} fdpt_t;
#pragma pack()
/* C/H/S geometry information. */
typedef struct {
} chs_t;
typedef struct {
} ata_chan_t;
#ifdef VBOX_WITH_SCSI
/* SCSI specific device information. */
typedef struct {
} scsi_dev_t;
#endif
#ifdef VBOX_WITH_AHCI
/* AHCI specific device information. */
typedef struct {
} ahci_dev_t;
#endif
/* Generic disk information. */
typedef struct {
//@todo: ATA specific - move?
} disk_dev_t;
/* A structure for passing disk request information around. This structure
* is designed for saving stack space. As BIOS requests cannot be overlapped,
* one such structure is sufficient.
*/
typedef struct {
} disk_req_t;
/* All BIOS disk information. Disk-related code in the BIOS should not need
* anything outside of this structure.
*/
typedef struct {
/* Bus-independent disk device information. */
/* ATA bus-specific device information. */
#ifdef VBOX_WITH_SCSI
/* SCSI bus-specific device information. */
#endif
#ifdef VBOX_WITH_AHCI
/* SATA (AHCI) bus-specific device information. */
#endif
} bio_dsk_t;
#if BX_ELTORITO_BOOT
/* El Torito device emulation state. */
typedef struct {
} cdemu_t;
#endif
// for access to EBDA area
// The EBDA structure should conform to
// http://www.frontiernet.net/~fys/rombios.htm document
// I made the ata and cdemu structs begin at 0x121 in the EBDA seg
/* MS-DOS KEYB.COM may overwrite the word at offset 0x117 in the EBDA
* which contains the keyboard ID for PS/2 BIOSes.
*/
typedef struct {
#if BX_ELTORITO_BOOT
#endif
unsigned char uForceBootDrive;
unsigned char uForceBootDevice;
} ebda_data_t;
// the last 16 bytes of the EBDA segment are used for the MPS floating
// pointer structure (though only if an I/O APIC is present)
#define EbdaData ((ebda_data_t *) 0)
/* Note: Using fastcall reduces stack usage a little. */
#endif