DevPcBios.cpp revision ca9921a4d12fbd97efb97bee5b2f4b9afd3db59e
236b2935f217749893b7034e59da3e3568928acevboxsync * PC BIOS Device.
236b2935f217749893b7034e59da3e3568928acevboxsync * Copyright (C) 2006-2008 Sun Microsystems, Inc.
236b2935f217749893b7034e59da3e3568928acevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
236b2935f217749893b7034e59da3e3568928acevboxsync * available from http://www.virtualbox.org. This file is free software;
236b2935f217749893b7034e59da3e3568928acevboxsync * you can redistribute it and/or modify it under the terms of the GNU
236b2935f217749893b7034e59da3e3568928acevboxsync * General Public License (GPL) as published by the Free Software
236b2935f217749893b7034e59da3e3568928acevboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
236b2935f217749893b7034e59da3e3568928acevboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
236b2935f217749893b7034e59da3e3568928acevboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
236b2935f217749893b7034e59da3e3568928acevboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
236b2935f217749893b7034e59da3e3568928acevboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
236b2935f217749893b7034e59da3e3568928acevboxsync * additional information or have any questions.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync/*******************************************************************************
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync* Header Files *
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync*******************************************************************************/
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync/** @page pg_devbios_cmos_assign CMOS Assignments (BIOS)
157093a77f2752732368338110cb50fa6cd7717fvboxsync * The BIOS uses a CMOS to store configuration data.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * It is currently used as follows:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * @verbatim
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync First CMOS bank (offsets 0x00 to 0x7f):
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Base memory:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Extended memory:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Amount of memory above 16M and below 4GB in 64KB units:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Boot device (BOCHS bios specific):
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Floppy drive type:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Equipment byte:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync 0x1e - 0x25
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Second HDD:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync 0x26 - 0x2d
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync 0x67 - 0x6e
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Fourth HDD:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync 0x70 - 0x77
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync First Sata HDD:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync 0x40 - 0x47
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Second Sata HDD:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync 0x48 - 0x4f
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Third Sata HDD:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync 0x50 - 0x57
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Fourth Sata HDD:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync 0x58 - 0x5f
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Number of CPUs:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync RAM above 4G in 64KB units:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync 0x61 - 0x65
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Second CMOS bank (offsets 0x80 to 0xff):
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Reserved for future use:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync 0x80 - 0x81
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync First net boot device PCI bus/dev/fn:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync 0x82 - 0x83
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Second to third net boot devices:
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync 0x84 - 0x89
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync@endverbatim
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * @todo Mark which bits are compatible with which BIOSes and
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * which are our own definitions.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync/*******************************************************************************
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync* Structures and Typedefs *
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync*******************************************************************************/
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * The boot device.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * PC Bios instance data structure.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsynctypedef struct DEVPCBIOS
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** Pointer back to the device instance. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** Boot devices (ordered). */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** RAM size (in bytes). */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** RAM hole size (in bytes). */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** Bochs shutdown index. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** Floppy device. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** Harddisk device. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** Sata harddisk device. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** LUN of the four harddisks which are emulated as IDE. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** Bios message buffer. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** Bios message buffer index. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** The system BIOS ROM data. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** The size of the system BIOS ROM. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** The name of the BIOS ROM file. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** The LAN boot ROM data. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** The name of the LAN boot ROM file. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** The size of the LAN boot ROM. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** The DMI tables. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** The boot countdown (in seconds). */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** I/O-APIC enabled? */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** PXE debug logging enabled? */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** PXE boot PCI bus/dev/fn list. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /** Number of logical CPUs in guest */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync/* Attempt to guess the LCHS disk geometry from the MS-DOS master boot
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * record (partition table). */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsyncstatic int biosGuessDiskLCHS(PPDMIBLOCK pBlock, PPDMMEDIAGEOMETRY pLCHSGeometry)
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync uint32_t iEndHead, iEndSector, cLCHSCylinders, cLCHSHeads, cLCHSSectors;
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync rc = pBlock->pfnRead(pBlock, 0, aMBR, sizeof(aMBR));
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsync /* Test MBR magic number. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /* Figure out the start of a partition table entry. */
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsync if ((p[12] | p[13] | p[14] | p[15]) && iEndSector & iEndHead)
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsync /* Assumption: partition terminates on a cylinder boundary. */
157093a77f2752732368338110cb50fa6cd7717fvboxsync cLCHSCylinders = RT_MIN(1024, pBlock->pfnGetSize(pBlock) / (512 * cLCHSHeads * cLCHSSectors));
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsync Log(("%s: LCHS=%d %d %d\n", __FUNCTION__, cLCHSCylinders, cLCHSHeads, cLCHSSectors));
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * Write to CMOS memory.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * This is used by the init complete code.
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsyncstatic void pcbiosCmosWrite(PPDMDEVINS pDevIns, int off, uint32_t u32Val)
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsync/* -=-=-=-=-=-=- based on code from pc.c -=-=-=-=-=-=- */
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsync * Initializes the CMOS data for one harddisk.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsyncstatic void pcbiosCmosInitHardDisk(PPDMDEVINS pDevIns, int offType, int offInfo, PCPDMMEDIAGEOMETRY pLCHSGeometry)
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync Log2(("%s: offInfo=%#x: LCHS=%d/%d/%d\n", __FUNCTION__, offInfo, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /* Cylinders low */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync pcbiosCmosWrite(pDevIns, offInfo + 0, RT_MIN(pLCHSGeometry->cCylinders, 1024) & 0xff);
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /* Cylinders high */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync pcbiosCmosWrite(pDevIns, offInfo + 1, RT_MIN(pLCHSGeometry->cCylinders, 1024) >> 8);
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /* Heads */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync pcbiosCmosWrite(pDevIns, offInfo + 2, pLCHSGeometry->cHeads);
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /* Landing zone low */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /* Landing zone high */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /* Write precomp low */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /* Write precomp high */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /* Sectors */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync pcbiosCmosWrite(pDevIns, offInfo + 7, pLCHSGeometry->cSectors);
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * Set logical CHS geometry for a hard disk
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * @returns VBox status code.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * @param pBase Base interface for the device.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * @param pHardDisk The hard disk.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * @param pLCHSGeometry Where to store the geometry settings.
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsyncstatic int setLogicalDiskGeometry(PPDMIBASE pBase, PPDMIBLOCKBIOS pHardDisk, PPDMMEDIAGEOMETRY pLCHSGeometry)
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync rc = pHardDisk->pfnGetLCHSGeometry(pHardDisk, &LCHSGeometry);
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync pBlock = PDMIBASE_QUERY_INTERFACE(pBase, PDMIBLOCK);
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /* No LCHS geometry, autodetect and set. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync /* Try if PCHS geometry works, otherwise fall back. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync rc = pHardDisk->pfnGetPCHSGeometry(pHardDisk, &LCHSGeometry);
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync uint64_t cSectors = pBlock->pfnGetSize(pBlock) / 512;
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsync LCHSGeometry.cCylinders = RT_MAX(cSectors / 16 / 63, 1);
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync LCHSGeometry.cCylinders = RT_MAX(cSectors / 32 / 63, 1);
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync LCHSGeometry.cCylinders = RT_MIN(cSectors / 255 / 63, 1024);
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsync rc = pHardDisk->pfnSetLCHSGeometry(pHardDisk, &LCHSGeometry);
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync LogRel(("DevPcBios: ATA failed to update LCHS geometry, read only\n"));
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync LogRel(("DevPcBios: ATA failed to update LCHS geometry, backend refused\n"));
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * Get BIOS boot code from enmBootDevice in order
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * @todo r=bird: This is a rather silly function since the conversion is 1:1.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsyncstatic uint8_t getBiosBootCode(PDEVPCBIOS pThis, unsigned iOrder)
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsync AssertMsgFailed(("aenmBootDevice[%d]=%d\n", iOrder, pThis->aenmBootDevice[iOrder]));
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsync * Init complete notification.
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsync * This routine will write information needed by the bios to the CMOS.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @returns VBOX status code.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @param pDevIns The device instance.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @see http://www.brl.ntt.co.jp/people/takehiko/interrupt/CMOS.LST.txt for
157093a77f2752732368338110cb50fa6cd7717fvboxsync * a description of standard and non-standard CMOS registers.
157093a77f2752732368338110cb50fa6cd7717fvboxsyncstatic DECLCALLBACK(int) pcbiosInitComplete(PPDMDEVINS pDevIns)
157093a77f2752732368338110cb50fa6cd7717fvboxsync PDEVPCBIOS pThis = PDMINS_2_DATA(pDevIns, PDEVPCBIOS);
157093a77f2752732368338110cb50fa6cd7717fvboxsync unsigned i;
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Memory sizes.
157093a77f2752732368338110cb50fa6cd7717fvboxsync /* base memory. */
157093a77f2752732368338110cb50fa6cd7717fvboxsync u32 = pThis->cbRam > 640 ? 640 : (uint32_t)pThis->cbRam / _1K; /* <-- this test is wrong, but it doesn't matter since we never assign less than 1MB */
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x15, u32 & 0xff); /* 15h - Base Memory in K, Low Byte */
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x16, u32 >> 8); /* 16h - Base Memory in K, High Byte */
157093a77f2752732368338110cb50fa6cd7717fvboxsync /* Extended memory, up to 65MB */
157093a77f2752732368338110cb50fa6cd7717fvboxsync u32 = pThis->cbRam >= 65 * _1M ? 0xffff : ((uint32_t)pThis->cbRam - _1M) / _1K;
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x17, u32 & 0xff); /* 17h - Extended Memory in K, Low Byte */
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x18, u32 >> 8); /* 18h - Extended Memory in K, High Byte */
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x30, u32 & 0xff); /* 30h - Extended Memory in K, Low Byte */
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x31, u32 >> 8); /* 31h - Extended Memory in K, High Byte */
157093a77f2752732368338110cb50fa6cd7717fvboxsync /* Bochs BIOS specific? Anyway, it's the amount of memory above 16MB
157093a77f2752732368338110cb50fa6cd7717fvboxsync and below 4GB (as it can only hold 4GB+16M). We have to chop off the
157093a77f2752732368338110cb50fa6cd7717fvboxsync top 2MB or it conflict with what the ACPI tables return. (Should these
157093a77f2752732368338110cb50fa6cd7717fvboxsync be adjusted, we still have to chop it at 0xfffc0000 or it'll conflict
157093a77f2752732368338110cb50fa6cd7717fvboxsync with the high BIOS mapping.) */
157093a77f2752732368338110cb50fa6cd7717fvboxsync uint64_t const offRamHole = _4G - pThis->cbRamHole;
157093a77f2752732368338110cb50fa6cd7717fvboxsync u32 = (uint32_t)( (RT_MIN(RT_MIN(pThis->cbRam, offRamHole), UINT32_C(0xffe00000)) - 16U * _1M) / _64K );
157093a77f2752732368338110cb50fa6cd7717fvboxsync /* Bochs/VBox BIOS specific way of specifying memory above 4GB in 64KB units.
157093a77f2752732368338110cb50fa6cd7717fvboxsync Bochs got these in a different location which we've already used for SATA,
157093a77f2752732368338110cb50fa6cd7717fvboxsync it also lacks the last two. */
157093a77f2752732368338110cb50fa6cd7717fvboxsync c64KBAbove4GB = (pThis->cbRam - offRamHole) / _64K;
157093a77f2752732368338110cb50fa6cd7717fvboxsync /* Make sure it doesn't hit the limits of the current BIOS code. */
157093a77f2752732368338110cb50fa6cd7717fvboxsync AssertLogRelMsgReturn((c64KBAbove4GB >> (3 * 8)) < 255, ("%#RX64\n", c64KBAbove4GB), VERR_OUT_OF_RANGE);
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x61, c64KBAbove4GB & 0xff);
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x62, (c64KBAbove4GB >> 8) & 0xff);
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x63, (c64KBAbove4GB >> 16) & 0xff);
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x64, (c64KBAbove4GB >> 24) & 0xff);
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x65, (c64KBAbove4GB >> 32) & 0xff);
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Number of CPUs.
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x60, pThis->cCpus & 0xff);
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Bochs BIOS specifics - boot device.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * We do both new and old (ami-style) settings.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * See rombios.c line ~7215 (int19_function).
157093a77f2752732368338110cb50fa6cd7717fvboxsync uint8_t reg3d = getBiosBootCode(pThis, 0) | (getBiosBootCode(pThis, 1) << 4);
157093a77f2752732368338110cb50fa6cd7717fvboxsync uint8_t reg38 = /* pcbiosCmosRead(pDevIns, 0x38) | */ getBiosBootCode(pThis, 2) << 4;
157093a77f2752732368338110cb50fa6cd7717fvboxsync /* This is an extension. Bochs BIOS normally supports only 3 boot devices. */
157093a77f2752732368338110cb50fa6cd7717fvboxsync uint8_t reg3c = getBiosBootCode(pThis, 3) | (pThis->uBootDelay << 4);
157093a77f2752732368338110cb50fa6cd7717fvboxsync * PXE debug option.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Network boot device list.
157093a77f2752732368338110cb50fa6cd7717fvboxsync for (i = 0; i < NET_BOOT_DEVS; ++i)
157093a77f2752732368338110cb50fa6cd7717fvboxsync pcbiosCmosWrite(pDevIns, 0x82 + i * 2, pThis->au16NetBootDev[i] & 0xff);
236b2935f217749893b7034e59da3e3568928acevboxsync pcbiosCmosWrite(pDevIns, 0x83 + i * 2, pThis->au16NetBootDev[i] >> 8);
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Floppy drive type.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync int rc = PDMR3QueryLun(pVM, pThis->pszFDDevice, 0, i, &pBase);
236b2935f217749893b7034e59da3e3568928acevboxsync apFDs[i] = PDMIBASE_QUERY_INTERFACE(pBase, PDMIBLOCKBIOS);
default: AssertFailed(); break;
default: AssertFailed(); break;
switch (u32)
if ( apHDs[i]
if (apHDs[i])
&LCHSGeometry);
LogRel(("DevPcBios: ATA LUN#%d LCHS=%u/%u/%u\n", i, LCHSGeometry.cCylinders, LCHSGeometry.cHeads, LCHSGeometry.cSectors));
if ( apHDs[i]
if (apHDs[i])
int offInfo;
&LCHSGeometry);
LogRel(("DevPcBios: SATA LUN#%d LCHS=%u/%u/%u\n", i, LCHSGeometry.cCylinders, LCHSGeometry.cHeads, LCHSGeometry.cSectors));
return VINF_SUCCESS;
static DECLCALLBACK(int) pcbiosIOPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
return VERR_IOM_IOPORT_UNUSED;
static DECLCALLBACK(int) pcbiosIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
return VERR_INTERNAL_ERROR;
switch (u32)
return VINF_SUCCESS;
return VINF_SUCCESS;
return VINF_SUCCESS;
while (cPages > 0)
int rc;
cPages--;
return VINF_SUCCESS;
static int pcbiosBootFromCfg(PPDMDEVINS pDevIns, PCFGMNODE pCfg, const char *pszParam, DEVPCBIOSBOOT *penmBoot)
char *psz;
pszParam);
return rc;
int rc;
int cb;
#ifdef VBOX_WITH_DMI_OEMSTRINGS
static const char * const s_apszBootDevices[] = { "BootDevice0", "BootDevice1", "BootDevice2", "BootDevice3" };
return rc;
static const char * const s_apszSataDisks[] =
{ "SataPrimaryMasterLUN", "SataPrimarySlaveLUN", "SataSecondaryMasterLUN", "SataSecondarySlaveLUN" };
return rc;
return rc;
/* Convert the UUID to network byte order. Not entirely straightforward as parts are MSB already... */
return rc;
return rc;
for (i = 0; i < NET_BOOT_DEVS; ++i)
Log(("pcbiosConstruct: Failed to open system BIOS ROM file '%s', rc=%Rrc!\n", pThis->pszPcBiosFile, rc));
return rc;
rc = PDMDevHlpROMRegister(pDevIns, (uint32_t)-(int32_t)cbPcBiosBinary, cbPcBiosBinary, pu8PcBiosBinary,
return rc;
#ifdef VBOX_WITH_VMI
return rc;
Log(("pcbiosConstruct: Failed to open LAN boot ROM file '%s', rc=%Rrc!\n", pThis->pszLanBootFile, rc));
if (pu8LanBootBinary)
rc = PDMDevHlpROMProtectShadow(pDevIns, VBOX_LANBOOT_SEG << 4, cbLanBootBinary, PGMROMPROT_READ_RAM_WRITE_RAM);
return rc;
sizeof(DEVPCBIOS),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,