VirtualBox

Ignore:
Timestamp:
Oct 28, 2015 8:17:18 PM (9 years ago)
Author:
vboxsync
Message:

EFI/Firmware: 'svn merge /vendor/edk2/UDK2010.SR1 /vendor/edk2/current .', reverting and removing files+dirs listed in ReadMe.vbox, resolving conflicts with help from ../UDK2014.SP1/. This is a raw untested merge.

Location:
trunk/src/VBox/Devices/EFI/Firmware
Files:
50 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware

  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/AcpiTables/AcpiTables.inf

    r48674 r58459  
    3434  Facs.aslc
    3535  Dsdt.asl
     36  Ssdt.asl
    3637
    3738[Packages]
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/AcpiTables/Dsdt.asl

    r48674 r58459  
    11/** @file
    22  Contains root level name space objects for the platform
    3  
     3
    44  Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
    55  This program and the accompanying materials are
     
    77  which accompanies this distribution.  The full text of the license may be found at
    88  http://opensource.org/licenses/bsd-license.php
    9  
     9
    1010  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212
    13 **/ 
    14 
    15 DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {
     13**/
     14
     15DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 4) {
    1616  //
    1717  // System Sleep States
    1818  //
    19   Name (\_S0, Package () {5, 0, 0, 0})
    20   Name (\_S4, Package () {1, 0, 0, 0})
    21   Name (\_S5, Package () {0, 0, 0, 0})
     19  // We build S3 and S4 with GetSuspendStates() in
     20  // "OvmfPkg/AcpiPlatformDxe/Qemu.c".
     21  //
     22  Name (\_S0, Package () {5, 0, 0, 0}) // Working
     23  Name (\_S5, Package () {0, 0, 0, 0}) // Soft Off
    2224
    2325  //
     
    3739      // BUS, I/O, and MMIO resources
    3840      //
    39       Name (_CRS, ResourceTemplate () {
     41      Name (CRES, ResourceTemplate () {
    4042        WORDBusNumber (          // Bus number resource (0); the bridge produces bus numbers for its subsequent buses
    4143          ResourceProducer,      // bit 0 of general flags is 1
     
    5658          MinFixed,              // Range is fixed
    5759          MaxFixed,              // Range is fixed
    58           PosDecode,             
     60          PosDecode,
    5961          EntireRange,
    6062          0x0000,                // Granularity
     
    6971          MinFixed,              // Range is fixed
    7072          MaxFixed,              // Range is fixed
    71           PosDecode,             
     73          PosDecode,
    7274          EntireRange,
    7375          0x0000,                // Granularity
     
    9294          )
    9395
    94         DWORDMEMORY (            // Descriptor for linear frame buffer video RAM
     96        DWORDMEMORY (            // Descriptor for 32-bit MMIO
    9597          ResourceProducer,      // bit 0 of general flags is 0
    9698          PosDecode,
    9799          MinFixed,              // Range is fixed
    98100          MaxFixed,              // Range is Fixed
    99           Cacheable,
     101          NonCacheable,
    100102          ReadWrite,
    101103          0x00000000,            // Granularity
     
    103105          0xFFFBFFFF,            // Max
    104106          0x00000000,            // Translation
    105           0x07FC0000             // Range Length
     107          0x07FC0000,            // Range Length
     108          ,                      // ResourceSourceIndex
     109          ,                      // ResourceSource
     110          PW32                   // DescriptorName
    106111          )
    107112      })
     113
     114      Name (CR64, ResourceTemplate () {
     115        QWordMemory (            // Descriptor for 64-bit MMIO
     116            ResourceProducer,    // bit 0 of general flags is 0
     117            PosDecode,
     118            MinFixed,            // Range is fixed
     119            MaxFixed,            // Range is Fixed
     120            Cacheable,
     121            ReadWrite,
     122            0x00000000,          // Granularity
     123            0x8000000000,        // Min
     124            0xFFFFFFFFFF,        // Max
     125            0x00000000,          // Translation
     126            0x8000000000,        // Range Length
     127            ,                    // ResourceSourceIndex
     128            ,                    // ResourceSource
     129            PW64                 // DescriptorName
     130            )
     131      })
     132
     133      Method (_CRS, 0) {
     134        //
     135        // see the FIRMWARE_DATA structure in "OvmfPkg/AcpiPlatformDxe/Qemu.c"
     136        //
     137        External (FWDT, OpRegionObj)
     138        Field(FWDT, QWordAcc, NoLock, Preserve) {
     139          P0S, 64,               // PciWindow32.Base
     140          P0E, 64,               // PciWindow32.End
     141          P0L, 64,               // PciWindow32.Length
     142          P1S, 64,               // PciWindow64.Base
     143          P1E, 64,               // PciWindow64.End
     144          P1L, 64                // PciWindow64.Length
     145        }
     146        Field(FWDT, DWordAcc, NoLock, Preserve) {
     147          P0SL, 32,              // PciWindow32.Base,   low  32 bits
     148          P0SH, 32,              // PciWindow32.Base,   high 32 bits
     149          P0EL, 32,              // PciWindow32.End,    low  32 bits
     150          P0EH, 32,              // PciWindow32.End,    high 32 bits
     151          P0LL, 32,              // PciWindow32.Length, low  32 bits
     152          P0LH, 32,              // PciWindow32.Length, high 32 bits
     153          P1SL, 32,              // PciWindow64.Base,   low  32 bits
     154          P1SH, 32,              // PciWindow64.Base,   high 32 bits
     155          P1EL, 32,              // PciWindow64.End,    low  32 bits
     156          P1EH, 32,              // PciWindow64.End,    high 32 bits
     157          P1LL, 32,              // PciWindow64.Length, low  32 bits
     158          P1LH, 32               // PciWindow64.Length, high 32 bits
     159        }
     160
     161        //
     162        // fixup 32-bit PCI IO window
     163        //
     164        CreateDWordField (CRES, \_SB.PCI0.PW32._MIN, PS32)
     165        CreateDWordField (CRES, \_SB.PCI0.PW32._MAX, PE32)
     166        CreateDWordField (CRES, \_SB.PCI0.PW32._LEN, PL32)
     167        Store (P0SL, PS32)
     168        Store (P0EL, PE32)
     169        Store (P0LL, PL32)
     170
     171        If (LAnd (LEqual (P1SL, 0x00), LEqual (P1SH, 0x00))) {
     172          Return (CRES)
     173        } Else {
     174          //
     175          // fixup 64-bit PCI IO window
     176          //
     177          CreateQWordField (CR64, \_SB.PCI0.PW64._MIN, PS64)
     178          CreateQWordField (CR64, \_SB.PCI0.PW64._MAX, PE64)
     179          CreateQWordField (CR64, \_SB.PCI0.PW64._LEN, PL64)
     180          Store (P1S, PS64)
     181          Store (P1E, PE64)
     182          Store (P1L, PL64)
     183
     184          //
     185          // add window and return result
     186          //
     187          ConcatenateResTemplate (CRES, CR64, Local0)
     188          Return (Local0)
     189        }
     190      }
    108191
    109192      //
     
    114197          Package () {
    115198            //
    116             // Bus 0, Device 1
    117             //
    118             Package () {0x0001FFFF, 0x00, \_SB.PCI0.LPC.LNKA, 0x00},
     199            // Bus 0; Devices 0 to 15
     200            //
     201            Package () {0x0000FFFF, 0x00, \_SB.PCI0.LPC.LNKD, 0x00},
     202            Package () {0x0000FFFF, 0x01, \_SB.PCI0.LPC.LNKA, 0x00},
     203            Package () {0x0000FFFF, 0x02, \_SB.PCI0.LPC.LNKB, 0x00},
     204            Package () {0x0000FFFF, 0x03, \_SB.PCI0.LPC.LNKC, 0x00},
     205
     206            //
     207            // Bus 0, Device 1, Pin 0 (INTA) is special; it corresponds to the
     208            // internally generated SCI (System Control Interrupt), which is
     209            // always routed to GSI 9. By setting the third (= Source) field to
     210            // zero, we could use the fourth (= Source Index) field to hardwire
     211            // the pin to GSI 9 directly.
     212            //
     213            // That way however, in accordance with the ACPI spec's description
     214            // of SCI, the interrupt would be treated as "active low,
     215            // shareable, level", and that doesn't match qemu.
     216            //
     217            // In QemuInstallAcpiMadtTable() [OvmfPkg/AcpiPlatformDxe/Qemu.c]
     218            // we install an Interrupt Override Structure for the identity
     219            // mapped IRQ#9 / GSI 9 (the corresponding bit being set in
     220            // Pcd8259LegacyModeEdgeLevel), which describes the correct
     221            // polarity (active high). As a consequence, some OS'en (eg. Linux)
     222            // override the default (active low) polarity originating from the
     223            // _PRT; others (eg. FreeBSD) don't. Therefore we need a separate
     224            // link device just to specify a polarity that matches the MADT.
     225            //
     226            Package () {0x0001FFFF, 0x00, \_SB.PCI0.LPC.LNKS, 0x00},
     227
    119228            Package () {0x0001FFFF, 0x01, \_SB.PCI0.LPC.LNKB, 0x00},
    120229            Package () {0x0001FFFF, 0x02, \_SB.PCI0.LPC.LNKC, 0x00},
    121230            Package () {0x0001FFFF, 0x03, \_SB.PCI0.LPC.LNKD, 0x00},
    122             //
    123             // Bus 0, Device 3
    124             //
    125             Package () {0x0003FFFF, 0x00, \_SB.PCI0.LPC.LNKA, 0x00},
    126             Package () {0x0003FFFF, 0x01, \_SB.PCI0.LPC.LNKB, 0x00},
    127             Package () {0x0003FFFF, 0x02, \_SB.PCI0.LPC.LNKC, 0x00},
    128             Package () {0x0003FFFF, 0x03, \_SB.PCI0.LPC.LNKD, 0x00},
     231
     232            Package () {0x0002FFFF, 0x00, \_SB.PCI0.LPC.LNKB, 0x00},
     233            Package () {0x0002FFFF, 0x01, \_SB.PCI0.LPC.LNKC, 0x00},
     234            Package () {0x0002FFFF, 0x02, \_SB.PCI0.LPC.LNKD, 0x00},
     235            Package () {0x0002FFFF, 0x03, \_SB.PCI0.LPC.LNKA, 0x00},
     236
     237            Package () {0x0003FFFF, 0x00, \_SB.PCI0.LPC.LNKC, 0x00},
     238            Package () {0x0003FFFF, 0x01, \_SB.PCI0.LPC.LNKD, 0x00},
     239            Package () {0x0003FFFF, 0x02, \_SB.PCI0.LPC.LNKA, 0x00},
     240            Package () {0x0003FFFF, 0x03, \_SB.PCI0.LPC.LNKB, 0x00},
     241
     242            Package () {0x0004FFFF, 0x00, \_SB.PCI0.LPC.LNKD, 0x00},
     243            Package () {0x0004FFFF, 0x01, \_SB.PCI0.LPC.LNKA, 0x00},
     244            Package () {0x0004FFFF, 0x02, \_SB.PCI0.LPC.LNKB, 0x00},
     245            Package () {0x0004FFFF, 0x03, \_SB.PCI0.LPC.LNKC, 0x00},
     246
     247            Package () {0x0005FFFF, 0x00, \_SB.PCI0.LPC.LNKA, 0x00},
     248            Package () {0x0005FFFF, 0x01, \_SB.PCI0.LPC.LNKB, 0x00},
     249            Package () {0x0005FFFF, 0x02, \_SB.PCI0.LPC.LNKC, 0x00},
     250            Package () {0x0005FFFF, 0x03, \_SB.PCI0.LPC.LNKD, 0x00},
     251
     252            Package () {0x0006FFFF, 0x00, \_SB.PCI0.LPC.LNKB, 0x00},
     253            Package () {0x0006FFFF, 0x01, \_SB.PCI0.LPC.LNKC, 0x00},
     254            Package () {0x0006FFFF, 0x02, \_SB.PCI0.LPC.LNKD, 0x00},
     255            Package () {0x0006FFFF, 0x03, \_SB.PCI0.LPC.LNKA, 0x00},
     256
     257            Package () {0x0007FFFF, 0x00, \_SB.PCI0.LPC.LNKC, 0x00},
     258            Package () {0x0007FFFF, 0x01, \_SB.PCI0.LPC.LNKD, 0x00},
     259            Package () {0x0007FFFF, 0x02, \_SB.PCI0.LPC.LNKA, 0x00},
     260            Package () {0x0007FFFF, 0x03, \_SB.PCI0.LPC.LNKB, 0x00},
     261
     262            Package () {0x0008FFFF, 0x00, \_SB.PCI0.LPC.LNKD, 0x00},
     263            Package () {0x0008FFFF, 0x01, \_SB.PCI0.LPC.LNKA, 0x00},
     264            Package () {0x0008FFFF, 0x02, \_SB.PCI0.LPC.LNKB, 0x00},
     265            Package () {0x0008FFFF, 0x03, \_SB.PCI0.LPC.LNKC, 0x00},
     266
     267            Package () {0x0009FFFF, 0x00, \_SB.PCI0.LPC.LNKA, 0x00},
     268            Package () {0x0009FFFF, 0x01, \_SB.PCI0.LPC.LNKB, 0x00},
     269            Package () {0x0009FFFF, 0x02, \_SB.PCI0.LPC.LNKC, 0x00},
     270            Package () {0x0009FFFF, 0x03, \_SB.PCI0.LPC.LNKD, 0x00},
     271
     272            Package () {0x000AFFFF, 0x00, \_SB.PCI0.LPC.LNKB, 0x00},
     273            Package () {0x000AFFFF, 0x01, \_SB.PCI0.LPC.LNKC, 0x00},
     274            Package () {0x000AFFFF, 0x02, \_SB.PCI0.LPC.LNKD, 0x00},
     275            Package () {0x000AFFFF, 0x03, \_SB.PCI0.LPC.LNKA, 0x00},
     276
     277            Package () {0x000BFFFF, 0x00, \_SB.PCI0.LPC.LNKC, 0x00},
     278            Package () {0x000BFFFF, 0x01, \_SB.PCI0.LPC.LNKD, 0x00},
     279            Package () {0x000BFFFF, 0x02, \_SB.PCI0.LPC.LNKA, 0x00},
     280            Package () {0x000BFFFF, 0x03, \_SB.PCI0.LPC.LNKB, 0x00},
     281
     282            Package () {0x000CFFFF, 0x00, \_SB.PCI0.LPC.LNKD, 0x00},
     283            Package () {0x000CFFFF, 0x01, \_SB.PCI0.LPC.LNKA, 0x00},
     284            Package () {0x000CFFFF, 0x02, \_SB.PCI0.LPC.LNKB, 0x00},
     285            Package () {0x000CFFFF, 0x03, \_SB.PCI0.LPC.LNKC, 0x00},
     286
     287            Package () {0x000DFFFF, 0x00, \_SB.PCI0.LPC.LNKA, 0x00},
     288            Package () {0x000DFFFF, 0x01, \_SB.PCI0.LPC.LNKB, 0x00},
     289            Package () {0x000DFFFF, 0x02, \_SB.PCI0.LPC.LNKC, 0x00},
     290            Package () {0x000DFFFF, 0x03, \_SB.PCI0.LPC.LNKD, 0x00},
     291
     292            Package () {0x000EFFFF, 0x00, \_SB.PCI0.LPC.LNKB, 0x00},
     293            Package () {0x000EFFFF, 0x01, \_SB.PCI0.LPC.LNKC, 0x00},
     294            Package () {0x000EFFFF, 0x02, \_SB.PCI0.LPC.LNKD, 0x00},
     295            Package () {0x000EFFFF, 0x03, \_SB.PCI0.LPC.LNKA, 0x00},
     296
     297            Package () {0x000FFFFF, 0x00, \_SB.PCI0.LPC.LNKC, 0x00},
     298            Package () {0x000FFFFF, 0x01, \_SB.PCI0.LPC.LNKD, 0x00},
     299            Package () {0x000FFFFF, 0x02, \_SB.PCI0.LPC.LNKA, 0x00},
     300            Package () {0x000FFFFF, 0x03, \_SB.PCI0.LPC.LNKB, 0x00}
    129301          }
    130302        )
     
    133305      //
    134306      // PCI to ISA Bridge (Bus 0, Device 1, Function 0)
     307      // "Low Pin Count"
    135308      //
    136309      Device (LPC) {
     
    138311
    139312        //
    140         // PCI Interrupt Routing Configuration Registers
     313        // The SCI cannot be rerouted or disabled with PIRQRC[A:D]; we only
     314        // need this link device in order to specify the polarity.
     315        //
     316        Device (LNKS) {
     317          Name (_HID, EISAID("PNP0C0F"))
     318          Name (_UID, 0)
     319
     320          Name (_STA, 0xB) // 0x1: device present
     321                           // 0x2: enabled and decoding resources
     322                           // 0x8: functioning properly
     323
     324          Method (_SRS, 1, NotSerialized) { /* no-op */ }
     325          Method (_DIS, 0, NotSerialized) { /* no-op */ }
     326
     327          Name (_PRS, ResourceTemplate () {
     328            Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 9 }
     329            //
     330            // list of IRQs occupied thus far: 9
     331            //
     332          })
     333          Method (_CRS, 0, NotSerialized) { Return (_PRS) }
     334        }
     335
     336        //
     337        // PCI Interrupt Routing Configuration Registers, PIRQRC[A:D]
    141338        //
    142339        OperationRegion (PRR0, PCI_Config, 0x60, 0x04)
     
    150347        //
    151348        // _STA method for LNKA, LNKB, LNKC, LNKD
     349        // Arg0[in]: value of PIRA / PIRB / PIRC / PIRD
    152350        //
    153351        Method (PSTA, 1, NotSerialized) {
    154           If (And (Arg0, 0x80)) {
    155             Return (0x9)
     352          If (And (Arg0, 0x80)) { // disable-bit set?
     353            Return (0x9)          // "device present" | "functioning properly"
    156354          } Else {
    157             Return (0xB)
    158           }
    159         }
    160 
    161         //
    162         // _DIS method for LNKA, LNKB, LNKC, LNKD
    163         //
    164         Method (PDIS, 1, NotSerialized) {
    165           Or (Arg0, 0x80, Arg0)
     355            Return (0xB)          // same | "enabled and decoding resources"
     356          }
    166357        }
    167358
    168359        //
    169360        // _CRS method for LNKA, LNKB, LNKC, LNKD
     361        // Arg0[in]: value of PIRA / PIRB / PIRC / PIRD
    170362        //
    171363        Method (PCRS, 1, NotSerialized) {
    172           Name (BUF0, ResourceTemplate () {IRQ (Level, ActiveLow, Shared){0}})
    173           //
    174           // Define references to buffer elements
    175           //
    176           CreateWordField (BUF0, 0x01, IRQW)  // IRQ low
    177           //
    178           // Write current settings into IRQ descriptor
    179           //
    180           If (And (Arg0, 0x80)) {
    181             Store (Zero, Local0)
    182           } Else {
    183             Store (One, Local0)
    184           }
    185           //
    186           // Shift 1 by value in register 70
    187           //
    188           ShiftLeft (Local0, And (Arg0, 0x0F), IRQW)   // Save in buffer
    189           Return (BUF0)                                // Return Buf0
     364          //
     365          // create temporary buffer with an Extended Interrupt Descriptor
     366          // whose single vector defaults to zero
     367          //
     368          Name (BUF0, ResourceTemplate () {
     369              Interrupt (ResourceConsumer, Level, ActiveHigh, Shared){0}
     370            }
     371          )
     372
     373          //
     374          // define reference to first interrupt vector in buffer
     375          //
     376          CreateDWordField (BUF0, 0x05, IRQW)
     377
     378          //
     379          // If the disable-bit is clear, overwrite the default zero vector
     380          // with the value in Arg0 (ie. PIRQRC[A:D]). Reserved bits are read
     381          // as 0.
     382          //
     383          If (LNot (And (Arg0, 0x80))) {
     384            Store (Arg0, IRQW)
     385          }
     386          Return (BUF0)
    190387        }
    191388
     
    194391        //
    195392        Name (PPRS, ResourceTemplate () {
    196           IRQ (Level, ActiveLow, Shared) {3, 4, 5, 7, 9, 10, 11, 12, 14, 15}
     393          Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) {5, 10, 11}
     394          //
     395          // list of IRQs occupied thus far: 9, 5, 10, 11
     396          //
    197397        })
    198 
    199         //
    200         // _SRS method for LNKA, LNKB, LNKC, LNKD
    201         //
    202         Method (PSRS, 2, NotSerialized) {
    203           CreateWordField (Arg1, 0x01, IRQW)      // IRQ low
    204           FindSetRightBit (IRQW, Local0)          // Set IRQ
    205           If (LNotEqual (IRQW, Zero)) {
    206             And (Local0, 0x7F, Local0)
    207             Decrement (Local0)
    208           } Else {
    209             Or (Local0, 0x80, Local0)
    210           }
    211           Store (Local0, Arg0)
    212         }
    213398
    214399        //
     
    220405
    221406          Method (_STA, 0, NotSerialized) { Return (PSTA (PIRA)) }
    222           Method (_DIS, 0, NotSerialized) { PDIS (PIRA)  }
     407          Method (_DIS, 0, NotSerialized) {
     408            Or (PIRA, 0x80, PIRA) // set disable-bit
     409          }
    223410          Method (_CRS, 0, NotSerialized) { Return (PCRS (PIRA)) }
    224411          Method (_PRS, 0, NotSerialized) { Return (PPRS) }
    225           Method (_SRS, 1, NotSerialized) { PSRS (PIRA, Arg0) }
     412          Method (_SRS, 1, NotSerialized) {
     413            CreateDWordField (Arg0, 0x05, IRQW)
     414            Store (IRQW, PIRA)
     415          }
    226416        }
    227417
     
    234424
    235425          Method (_STA, 0, NotSerialized) { Return (PSTA (PIRB)) }
    236           Method (_DIS, 0, NotSerialized) { PDIS (PIRB) }
     426          Method (_DIS, 0, NotSerialized) {
     427            Or (PIRB, 0x80, PIRB) // set disable-bit
     428          }
    237429          Method (_CRS, 0, NotSerialized) { Return (PCRS (PIRB)) }
    238430          Method (_PRS, 0, NotSerialized) { Return (PPRS) }
    239           Method (_SRS, 1, NotSerialized) { PSRS (PIRB, Arg0) }
     431          Method (_SRS, 1, NotSerialized) {
     432            CreateDWordField (Arg0, 0x05, IRQW)
     433            Store (IRQW, PIRB)
     434          }
    240435        }
    241436
     
    248443
    249444          Method (_STA, 0, NotSerialized) { Return (PSTA (PIRC)) }
    250           Method (_DIS, 0, NotSerialized) { PDIS (PIRC) }
     445          Method (_DIS, 0, NotSerialized) {
     446            Or (PIRC, 0x80, PIRC) // set disable-bit
     447          }
    251448          Method (_CRS, 0, NotSerialized) { Return (PCRS (PIRC)) }
    252449          Method (_PRS, 0, NotSerialized) { Return (PPRS) }
    253           Method (_SRS, 1, NotSerialized) { PSRS (PIRC, Arg0) }
     450          Method (_SRS, 1, NotSerialized) {
     451            CreateDWordField (Arg0, 0x05, IRQW)
     452            Store (IRQW, PIRC)
     453          }
    254454        }
    255455
     
    259459        Device (LNKD) {
    260460          Name (_HID, EISAID("PNP0C0F"))
    261           Name (_UID, 1)
     461          Name (_UID, 4)
    262462
    263463          Method (_STA, 0, NotSerialized) { Return (PSTA (PIRD)) }
    264           Method (_DIS, 0, NotSerialized) { PDIS (PIRD) }
     464          Method (_DIS, 0, NotSerialized) {
     465            Or (PIRD, 0x80, PIRD) // set disable-bit
     466          }
    265467          Method (_CRS, 0, NotSerialized) { Return (PCRS (PIRD)) }
    266468          Method (_PRS, 0, NotSerialized) { Return (PPRS) }
    267           Method (_SRS, 1, NotSerialized) { PSRS (PIRD, Arg0) }
    268         }
    269        
     469          Method (_SRS, 1, NotSerialized) {
     470            CreateDWordField (Arg0, 0x05, IRQW)
     471            Store (IRQW, PIRD)
     472          }
     473        }
     474
    270475        //
    271476        // Programmable Interrupt Controller (PIC)
     
    278483            IO (Decode16, 0x4D0, 0x4D0, 0x00, 0x02)
    279484            IRQNoFlags () {2}
    280           })
    281         }
    282 
    283         //
    284         // ISA DMA
     485            //
     486            // list of IRQs occupied thus far: 9, 5, 10, 11, 2
     487            //
     488          })
     489        }
     490
     491        //
     492        // ISA DMA
    285493        //
    286494        Device (DMAC) {
    287           Name (_HID, EISAID ("PNP0200")) 
     495          Name (_HID, EISAID ("PNP0200"))
    288496          Name (_CRS, ResourceTemplate () {
    289497            IO (Decode16, 0x00, 0x00, 0, 0x10)
     
    305513            IO (Decode16, 0x40, 0x40, 0x00, 0x04)
    306514            IRQNoFlags () {0}
     515            //
     516            // list of IRQs occupied thus far: 9, 5, 10, 11, 2, 0
     517            //
    307518          })
    308519        }
     
    316527            IO (Decode16, 0x70, 0x70, 0x00, 0x02)
    317528            IRQNoFlags () {8}
     529            //
     530            // list of IRQs occupied thus far: 9, 5, 10, 11, 2, 0, 8
     531            //
    318532          })
    319533        }
     
    337551            IO (Decode16, 0xF0, 0xF0, 0x00, 0x10)
    338552            IRQNoFlags () {13}
     553            //
     554            // list of IRQs occupied thus far: 9, 5, 10, 11, 2, 0, 8, 13
     555            //
    339556          })
    340557        }
     
    365582            IO (Decode16, 0x370, 0x370, 0x00, 0x02)
    366583            IO (Decode16, 0x378, 0x378, 0x00, 0x08)
    367             IO (Decode16, 0x400, 0x400, 0x00, 0x40)       // PMBLK1
     584            IO (Decode16, 0x402, 0x402, 0x00, 0x01)        // QEMU debug console, should use FixedPcdGet16 (PcdDebugIoPort)
    368585            IO (Decode16, 0x440, 0x440, 0x00, 0x10)
    369586            IO (Decode16, 0x678, 0x678, 0x00, 0x08)
    370587            IO (Decode16, 0x778, 0x778, 0x00, 0x08)
    371             Memory32Fixed (ReadOnly, 0xFEC00000, 0x1000)  // IO APIC
    372             Memory32Fixed (ReadOnly, 0xFEE00000, 0x1000)
     588            IO (Decode16, 0xafe0, 0xafe0, 0x00, 0x04)      // QEMU GPE0 BLK
     589            IO (Decode16, 0xb000, 0xb000, 0x00, 0x40)      // PMBLK1
     590            Memory32Fixed (ReadOnly, 0xFEC00000, 0x1000)   // IO APIC
     591            Memory32Fixed (ReadOnly, 0xFEE00000, 0x100000) // LAPIC
    373592          })
    374593        }
     
    377596        // PS/2 Keyboard and PC/AT Enhanced Keyboard 101/102
    378597        //
    379         Device (PS2K) { 
     598        Device (PS2K) {
    380599          Name (_HID, EISAID ("PNP0303"))
    381600          Name (_CID, EISAID ("PNP030B"))
     
    384603            IO (Decode16, 0x64, 0x64, 0x00, 0x01)
    385604            IRQNoFlags () {1}
     605            //
     606            // list of IRQs occupied thus far: 9, 5, 10, 11, 2, 0, 8, 13, 1
     607            //
    386608          })
    387609        }
     
    395617          Name (_CRS, ResourceTemplate() {
    396618            IRQNoFlags () {12}
     619            //
     620            // list of IRQs occupied thus far:
     621            // 9, 5, 10, 11, 2, 0, 8, 13, 1, 12
     622            //
    397623          })
    398624        }
     
    408634            IO (Decode16, 0x3F8, 0x3F8, 0x01, 0x08)
    409635            IRQ (Edge, ActiveHigh, Exclusive, ) {4}
     636            //
     637            // list of IRQs occupied thus far:
     638            // 9, 5, 10, 11, 2, 0, 8, 13, 1, 12, 4
     639            //
    410640          })
    411641        }
     
    421651            IO (Decode16, 0x2F8, 0x2F8, 0x01, 0x08)
    422652            IRQ (Edge, ActiveHigh, Exclusive, ) {3}
     653            //
     654            // list of IRQs occupied thus far:
     655            // 9, 5, 10, 11, 2, 0, 8, 13, 1, 12, 4, 3
     656            //
    423657          })
    424658        }
     
    433667            IO (Decode16, 0x3F7, 0x3F7, 0x01, 0x01)
    434668            IRQNoFlags () {6}
     669            //
     670            // list of IRQs occupied thus far:
     671            // 9, 5, 10, 11, 2, 0, 8, 13, 1, 12, 4, 3, 6
     672            //
    435673            DMA (Compatibility, NotBusMaster, Transfer8) {2}
     674          })
     675        }
     676
     677        //
     678        // parallel port -- no DMA for now
     679        //
     680        Device (PAR1) {
     681          Name (_HID, EISAID ("PNP0400"))
     682          Name (_DDN, "LPT1")
     683          Name (_UID, 0x01)
     684          Name(_CRS, ResourceTemplate() {
     685            IO (Decode16, 0x0378, 0x0378, 0x00, 0x08)
     686            IRQNoFlags () {7}
     687            //
     688            // list of IRQs occupied thus far:
     689            // 9, 5, 10, 11, 2, 0, 8, 13, 1, 12, 4, 3, 6, 7
     690            // in order:
     691            // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
     692            //
    436693          })
    437694        }
     
    440697  }
    441698}
    442 
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/AcpiTables/Facp.aslc

    r48674 r58459  
    11/** @file
    22  FACP Table
    3  
    4   Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR>
     3
     4  Copyright (c) 2013, Red Hat, Inc.
     5  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
    56  This program and the accompanying materials are
    67  licensed and made available under the terms and conditions of the BSD License
    78  which accompanies this distribution.  The full text of the license may be found at
    89  http://opensource.org/licenses/bsd-license.php
    9  
     10
    1011  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1112  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1213
    13 **/ 
    14  
     14**/
     15
    1516#include "Platform.h"
    1617
    17 EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE FACP = {
    18   EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
    19   sizeof (EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE),
    20   EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
    21   0,                // to make sum of entire table == 0
    22   EFI_ACPI_OEM_ID,         // OEMID is a 6 bytes long field
    23   EFI_ACPI_OEM_TABLE_ID,      // OEM table identification(8 bytes long)
    24   EFI_ACPI_OEM_REVISION,      // OEM revision number
    25   EFI_ACPI_CREATOR_ID,        // ASL compiler vendor ID
    26   EFI_ACPI_CREATOR_REVISION,  // ASL compiler revision number
     18EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE FACP = {
     19  {
     20    EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
     21    sizeof (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE),
     22    EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
     23    0,                          // to make sum of entire table == 0
     24    {EFI_ACPI_OEM_ID},          // OEMID is a 6 bytes long field
     25    EFI_ACPI_OEM_TABLE_ID,      // OEM table identification(8 bytes long)
     26    EFI_ACPI_OEM_REVISION,      // OEM revision number
     27    EFI_ACPI_CREATOR_ID,        // ASL compiler vendor ID
     28    EFI_ACPI_CREATOR_REVISION   // ASL compiler revision number
     29  },
    2730  0,                // Physical addesss of FACS
    2831  0,                // Physical address of DSDT
    29   INT_MODEL,        // System Interrupt Model
    30   RESERVED,         // reserved
     32  RESERVED,         // System Interrupt Model in ACPI 1.0, eliminated in 2.0
     33  EFI_ACPI_2_0_PM_PROFILE_UNSPECIFIED, // Preferred PM profile
    3134  SCI_INT_VECTOR,   // System vector of SCI interrupt
    3235  SMI_CMD_IO_PORT,  // Port address of SMI command port
     
    3437  ACPI_DISABLE,     // value to write to port smi_cmd to disable ACPI
    3538  S4BIOS_REQ,       // Value to write to SMI CMD port to enter the S4BIOS state
    36   0xE2,             // PState control
     39  0,                // PState control
    3740  PM1a_EVT_BLK,     // Port address of Power Mgt 1a Event Reg Blk
    38   PM1b_EVT_BLK,     // Port address of Power Mgt 1b Event Reg Blk
     41  0,                // Power Mgt 1b Event Reg Blk unsupported
    3942  PM1a_CNT_BLK,     // Port address of Power Mgt 1a Ctrl Reg Blk
    40   PM1b_CNT_BLK,     // Port address of Power Mgt 1b Ctrl Reg Blk
    41   PM2_CNT_BLK,      // Port address of Power Mgt 2  Ctrl Reg Blk
     43  0,                // Power Mgt 1b Ctrl Reg Blk unsupported
     44  0,                // Power Mgt 2  Ctrl Reg Blk unsupported
    4245  PM_TMR_BLK,       // Port address of Power Mgt Timer Ctrl Reg Blk
    4346  GPE0_BLK,         // Port addr of General Purpose Event 0 Reg Blk
    44   GPE1_BLK,         // Port addr of General Purpose Event 1 Reg Blk
     47  0,                // General Purpose Event 1 Reg Blk unsupported
    4548  PM1_EVT_LEN,      // Byte Length of ports at pm1X_evt_blk
    4649  PM1_CNT_LEN,      // Byte Length of ports at pm1X_cnt_blk
    47   PM2_CNT_LEN,      // Byte Length of ports at pm2_cnt_blk
     50  0,                // Power Mgt 2 Ctrl Reg Blk unsupported
    4851  PM_TM_LEN,        // Byte Length of ports at pm_tm_blk
    4952  GPE0_BLK_LEN,     // Byte Length of ports at gpe0_blk
    50   GPE1_BLK_LEN,     // Byte Length of ports at gpe1_blk
    51   GPE1_BASE,        // offset in gpe model where gpe1 events start
    52   0xE3,             // _CST support
     53  0,                // General Purpose Event 1 Reg Blk unsupported
     54  0,                // General Purpose Event 1 Reg Blk unsupported
     55  0,                // _CST support
    5356  P_LVL2_LAT,       // worst case HW latency to enter/exit C2 state
    5457  P_LVL3_LAT,       // worst case HW latency to enter/exit C3 state
     
    6063  MON_ALRM,         // index to month-of-year alarm in RTC CMOS RAM
    6164  CENTURY,          // index to century in RTC CMOS RAM
    62   0x03,             // Boot architecture flag
    63   0x00,             // Boot architecture flag
    64   RESERVED,         // reserved
    65   FLAG
     65  0x0000,           // Boot architecture flag (16-bit)
     66  RESERVED,         // reserved
     67  FLAG,             // Fixed feature flags
     68  GAS2_IO(RESET_REG, 1), // Extended address of the Reset Register
     69  RESET_VALUE,           // Value for the Reset Register to reset the system
     70  { RESERVED },     // reserved[3]
     71  0,                // 64-bit physical addesss of FACS, set at installation
     72  0,                // 64-bit physical addesss of DSDT, set at installation
     73
     74  GAS2_IO(PM1a_EVT_BLK, PM1_EVT_LEN), // Ext. addr. of PM 1a Event Reg Blk
     75  { 0 },                              // PM 1b Event Reg Blk unsupported
     76  GAS2_IO(PM1a_CNT_BLK, PM1_CNT_LEN), // Ext. addr. of PM 1a Ctrl Reg Blk
     77  { 0 },                              // PM 1b Ctrl Reg Blk unsupported
     78  { 0 },                              // PM 2  Ctrl Reg Blk unsupported
     79  GAS2_IO(PM_TMR_BLK, PM_TM_LEN),     // Ext. addr. of PM Timer Ctrl Reg Blk
     80  GAS2_IO(GPE0_BLK, GPE0_BLK_LEN),    // Ext. addr. of GPE 0 Reg Blk
     81  { 0 }                               // GPE 1 Reg Blk unsupported
    6682};
    6783
     
    7389{
    7490  //
    75   // Reference the table being generated to prevent the optimizer from removing the 
     91  // Reference the table being generated to prevent the optimizer from removing the
    7692  // data structure from the exeutable
    7793  //
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/AcpiTables/Facs.aslc

    r48674 r58459  
    22  FACS Table
    33 
    4   Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
    55  This program and the accompanying materials are
    66  licensed and made available under the terms and conditions of the BSD License
     
    2626  0x00,
    2727  0x00,
    28   EFI_ACPI_RESERVED_BYTE,
    29   EFI_ACPI_RESERVED_BYTE,
    30   EFI_ACPI_RESERVED_BYTE,
    31   EFI_ACPI_RESERVED_BYTE,
    32   EFI_ACPI_RESERVED_BYTE,
    33   EFI_ACPI_RESERVED_BYTE,
    34   EFI_ACPI_RESERVED_BYTE,
    35   EFI_ACPI_RESERVED_BYTE,
    36   EFI_ACPI_RESERVED_BYTE,
    37   EFI_ACPI_RESERVED_BYTE,
    38   EFI_ACPI_RESERVED_BYTE,
    39   EFI_ACPI_RESERVED_BYTE,
    40   EFI_ACPI_RESERVED_BYTE,
    41   EFI_ACPI_RESERVED_BYTE,
    42   EFI_ACPI_RESERVED_BYTE,
    43   EFI_ACPI_RESERVED_BYTE,
    44   EFI_ACPI_RESERVED_BYTE,
    45   EFI_ACPI_RESERVED_BYTE,
    46   EFI_ACPI_RESERVED_BYTE,
    47   EFI_ACPI_RESERVED_BYTE,
    48   EFI_ACPI_RESERVED_BYTE,
    49   EFI_ACPI_RESERVED_BYTE,
    50   EFI_ACPI_RESERVED_BYTE,
    51   EFI_ACPI_RESERVED_BYTE,
    52   EFI_ACPI_RESERVED_BYTE,
    53   EFI_ACPI_RESERVED_BYTE,
    54   EFI_ACPI_RESERVED_BYTE,
    55   EFI_ACPI_RESERVED_BYTE,
    56   EFI_ACPI_RESERVED_BYTE,
    57   EFI_ACPI_RESERVED_BYTE,
    58   EFI_ACPI_RESERVED_BYTE,
    59   EFI_ACPI_RESERVED_BYTE,
    60   EFI_ACPI_RESERVED_BYTE,
    61   EFI_ACPI_RESERVED_BYTE,
    62   EFI_ACPI_RESERVED_BYTE,
    63   EFI_ACPI_RESERVED_BYTE,
    64   EFI_ACPI_RESERVED_BYTE,
    65   EFI_ACPI_RESERVED_BYTE,
    66   EFI_ACPI_RESERVED_BYTE,
    67   EFI_ACPI_RESERVED_BYTE
     28  {
     29    EFI_ACPI_RESERVED_BYTE,
     30    EFI_ACPI_RESERVED_BYTE,
     31    EFI_ACPI_RESERVED_BYTE,
     32    EFI_ACPI_RESERVED_BYTE,
     33    EFI_ACPI_RESERVED_BYTE,
     34    EFI_ACPI_RESERVED_BYTE,
     35    EFI_ACPI_RESERVED_BYTE,
     36    EFI_ACPI_RESERVED_BYTE,
     37    EFI_ACPI_RESERVED_BYTE,
     38    EFI_ACPI_RESERVED_BYTE,
     39    EFI_ACPI_RESERVED_BYTE,
     40    EFI_ACPI_RESERVED_BYTE,
     41    EFI_ACPI_RESERVED_BYTE,
     42    EFI_ACPI_RESERVED_BYTE,
     43    EFI_ACPI_RESERVED_BYTE,
     44    EFI_ACPI_RESERVED_BYTE,
     45    EFI_ACPI_RESERVED_BYTE,
     46    EFI_ACPI_RESERVED_BYTE,
     47    EFI_ACPI_RESERVED_BYTE,
     48    EFI_ACPI_RESERVED_BYTE,
     49    EFI_ACPI_RESERVED_BYTE,
     50    EFI_ACPI_RESERVED_BYTE,
     51    EFI_ACPI_RESERVED_BYTE,
     52    EFI_ACPI_RESERVED_BYTE,
     53    EFI_ACPI_RESERVED_BYTE,
     54    EFI_ACPI_RESERVED_BYTE,
     55    EFI_ACPI_RESERVED_BYTE,
     56    EFI_ACPI_RESERVED_BYTE,
     57    EFI_ACPI_RESERVED_BYTE,
     58    EFI_ACPI_RESERVED_BYTE,
     59    EFI_ACPI_RESERVED_BYTE,
     60    EFI_ACPI_RESERVED_BYTE,
     61    EFI_ACPI_RESERVED_BYTE,
     62    EFI_ACPI_RESERVED_BYTE,
     63    EFI_ACPI_RESERVED_BYTE,
     64    EFI_ACPI_RESERVED_BYTE,
     65    EFI_ACPI_RESERVED_BYTE,
     66    EFI_ACPI_RESERVED_BYTE,
     67    EFI_ACPI_RESERVED_BYTE,
     68    EFI_ACPI_RESERVED_BYTE
     69  }
    6870};
    6971
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/AcpiTables/Madt.aslc

    r48674 r58459  
    22  MADT Table
    33
    4   This file contains a structure definition for the ACPI 1.0 Multiple APIC 
    5   Description Table (MADT). 
    6  
    7   Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR>
     4  This file contains a structure definition for the ACPI 1.0 Multiple APIC
     5  Description Table (MADT).
     6
     7  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
    88  This program and the accompanying materials are
    99  licensed and made available under the terms and conditions of the BSD License
    1010  which accompanies this distribution.  The full text of the license may be found at
    1111  http://opensource.org/licenses/bsd-license.php
    12  
     12
    1313  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1414  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1515
    16 **/ 
     16**/
    1717
    1818#include <IndustryStandard/Acpi.h>
    19 
    20 //
    21 // MADT Definitions
    22 //
    23 #define EFI_ACPI_OEM_MADT_REVISION 0x00000000 // TBD
     19#include <Platform.h>
    2420
    2521//
     
    7268//
    7369EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
    74   EFI_ACPI_1_0_APIC_SIGNATURE,
    75   sizeof (EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE),
    76   EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
     70  {
     71    {
     72      EFI_ACPI_1_0_APIC_SIGNATURE,
     73      sizeof (EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE),
     74      EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
     75      0x00,                                                     // Checksum will be updated at runtime
     76      {EFI_ACPI_OEM_ID},
     77      EFI_ACPI_OEM_TABLE_ID,
     78      EFI_ACPI_OEM_REVISION,
     79      EFI_ACPI_CREATOR_ID,
     80      EFI_ACPI_CREATOR_REVISION
     81    },
    7782
    78   //
    79   // Checksum will be updated at runtime
    80   //
    81   0x00,
    82  
    83   //
    84   // It is expected that these values will be programmed at runtime
    85   //
    86   ' ', ' ', ' ', ' ', ' ', ' ',
    87  
    88   0,
    89   EFI_ACPI_OEM_MADT_REVISION,
    90   0,
    91   0,
     83    //
     84    // MADT specific fields
     85    //
     86    EFI_ACPI_LOCAL_APIC_ADDRESS,
     87    EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS,
     88  },
    9289
    93   //
    94   // MADT specific fields
    95   //
    96   EFI_ACPI_LOCAL_APIC_ADDRESS,
    97   EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS,
    98  
    9990  //
    10091  // Processor Local APIC Structure
    10192  //
    102 
    103   EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC,                        // Type
    104   sizeof (EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE),     // Length
    105   0x01,                                                     // Processor ID
    106   0x00,                                                     // Local APIC ID
    107   0x00000001,                                               // Flags - Enabled by default
     93  {
     94    {
     95      EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC,                        // Type
     96      sizeof (EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE),     // Length
     97      0x00,                                                     // Processor ID
     98      0x00,                                                     // Local APIC ID
     99      0x00000001                                                // Flags - Enabled by default
     100    }
     101  },
    108102
    109103  //
     
    111105  //
    112106
    113   //
    114   // IRQ0=>IRQ2 Interrupt Source Override Structure
    115   //
    116   EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE,                   // Type
    117   sizeof (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length
    118   0x00,                                                     // Bus - ISA
    119   0x00,                                                     // Source - IRQ0
    120   0x00000002,                                               // Global System Interrupt - IRQ2
    121   0x0000,                                                   // Flags - Conforms to specifications of the bus
     107  {
     108    {
     109      //
     110      // IRQ0=>IRQ2 Interrupt Source Override Structure
     111      //
     112      EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE,                   // Type
     113      sizeof (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length
     114      0x00,                                                     // Bus - ISA
     115      0x00,                                                     // Source - IRQ0
     116      0x00000002,                                               // Global System Interrupt - IRQ2
     117      0x0000                                                    // Flags - Conforms to specifications of the bus
     118    },
    122119
    123   //
    124   // ISO (SCI Active High) Interrupt Source Override Structure
    125   //
    126   EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE,                   // Type
    127   sizeof (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length
    128   0x00,                                                     // Bus - ISA
    129   0x09,                                                     // Source - IRQ0
    130   0x00000009,                                               // Global System Interrupt - IRQ2
    131   0x000D,                                                   // Flags - Level-tiggered, Active High
     120    {
     121      //
     122      // ISO (SCI Active High) Interrupt Source Override Structure
     123      //
     124      EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE,                   // Type
     125      sizeof (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length
     126      0x00,                                                     // Bus - ISA
     127      0x09,                                                     // Source - IRQ0
     128      0x00000009,                                               // Global System Interrupt - IRQ2
     129      0x000D                                                    // Flags - Level-tiggered, Active High
     130    }
     131  },
    132132
    133133  //
    134134  // IO APIC Structure
    135135  //
    136   EFI_ACPI_1_0_IO_APIC,                                     // Type
    137   sizeof (EFI_ACPI_1_0_IO_APIC_STRUCTURE),                  // Length
    138   0x02,                                                     // IO APIC ID
    139   EFI_ACPI_RESERVED_BYTE,                                   // Reserved
    140   0xFEC00000,                                               // IO APIC Address (physical)
    141   0x00000000                                                // Global System Interrupt Base
     136  {
     137    {
     138      EFI_ACPI_1_0_IO_APIC,                                     // Type
     139      sizeof (EFI_ACPI_1_0_IO_APIC_STRUCTURE),                  // Length
     140      0x02,                                                     // IO APIC ID
     141      EFI_ACPI_RESERVED_BYTE,                                   // Reserved
     142      0xFEC00000,                                               // IO APIC Address (physical)
     143      0x00000000                                                // Global System Interrupt Base
     144    }
     145  },
    142146};
    143147
     
    149153{
    150154  //
    151   // Reference the table being generated to prevent the optimizer from removing the 
     155  // Reference the table being generated to prevent the optimizer from removing the
    152156  // data structure from the exeutable
    153157  //
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/AcpiTables/Platform.h

    r48674 r58459  
    22  Platform specific defines for constructing ACPI tables
    33
     4  Copyright (c) 2012, 2013, Red Hat, Inc.
    45  Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
    56  This program and the accompanying materials are
     
    78  which accompanies this distribution.  The full text of the license may be found at
    89  http://opensource.org/licenses/bsd-license.php
    9  
     10
    1011  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1112  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1213
    13 **/ 
     14**/
    1415
    1516#ifndef _Platform_h_INCLUDED_
    1617#define _Platform_h_INCLUDED_
    1718
    18 #include <PiDxe.h> 
     19#include <PiDxe.h>
    1920#include <IndustryStandard/Acpi.h>
    2021
     
    2425#define EFI_ACPI_OEM_ID           'O','V','M','F',' ',' '   // OEMID 6 bytes long
    2526#define EFI_ACPI_OEM_TABLE_ID     SIGNATURE_64('O','V','M','F','E','D','K','2') // OEM table id 8 bytes long
    26 #define EFI_ACPI_OEM_REVISION     0x02000820
     27#define EFI_ACPI_OEM_REVISION     0x20130221
    2728#define EFI_ACPI_CREATOR_ID       SIGNATURE_32('O','V','M','F')
    28 #define EFI_ACPI_CREATOR_REVISION 0x00000097
     29#define EFI_ACPI_CREATOR_REVISION 0x00000099
    2930
    30 #define INT_MODEL       0x01
    31 #define SCI_INT_VECTOR  0x0009
    32 #define SMI_CMD_IO_PORT 0 // If SMM was supported, then this would be 0xB2
    33 #define ACPI_ENABLE     0x0E1
    34 #define ACPI_DISABLE    0x01E
     31#define SCI_INT_VECTOR  0x0009
     32#define SMI_CMD_IO_PORT 0xB2
     33#define ACPI_ENABLE     0xF1
     34#define ACPI_DISABLE    0xF0
    3535#define S4BIOS_REQ      0x00
    36 #define PM1a_EVT_BLK    0x00000400
    37 #define PM1b_EVT_BLK    0x00000000
    38 #define PM1a_CNT_BLK    0x00000404
    39 #define PM1b_CNT_BLK    0x00000000
    40 #define PM2_CNT_BLK     0x00000022
    41 #define PM_TMR_BLK      0x00000408
    42 #define GPE0_BLK        0x0000040C
    43 #define GPE1_BLK        0x00000000
     36#define PM1a_EVT_BLK    0x0000b000
     37#define PM1a_CNT_BLK    0x0000b004
     38#define PM_TMR_BLK      0x0000b008
     39#define GPE0_BLK        0x0000afe0
    4440#define PM1_EVT_LEN     0x04
    4541#define PM1_CNT_LEN     0x02
    46 #define PM2_CNT_LEN     0x01
    4742#define PM_TM_LEN       0x04
    4843#define GPE0_BLK_LEN    0x04
    49 #define GPE1_BLK_LEN    0x00
    50 #define GPE1_BASE       0x00
    5144#define RESERVED        0x00
    5245#define P_LVL2_LAT      0x0065
    5346#define P_LVL3_LAT      0x03E9
    54 #define FLUSH_SIZE      0x0400
    55 #define FLUSH_STRIDE    0x0010
     47#define FLUSH_SIZE      0x0000
     48#define FLUSH_STRIDE    0x0000
    5649#define DUTY_OFFSET     0x00
    5750#define DUTY_WIDTH      0x00
    58 #define DAY_ALRM        0x0D
     51#define DAY_ALRM        0x00
    5952#define MON_ALRM        0x00
    6053#define CENTURY         0x00
    61 #define FLAG            EFI_ACPI_1_0_WBINVD | EFI_ACPI_1_0_PROC_C1 | EFI_ACPI_1_0_SLP_BUTTON | EFI_ACPI_1_0_RTC_S4 | EFI_ACPI_1_0_TMR_VAL_EXT
     54#define FLAG            (EFI_ACPI_2_0_WBINVD | \
     55                         EFI_ACPI_2_0_PROC_C1 | \
     56                         EFI_ACPI_2_0_SLP_BUTTON | \
     57                         EFI_ACPI_2_0_RTC_S4 | \
     58                         EFI_ACPI_2_0_RESET_REG_SUP)
     59#define RESET_REG       0xCF9
     60#define RESET_VALUE     (BIT2 | BIT1) // PIIX3 Reset CPU + System Reset
     61
     62//
     63// Byte-aligned IO port register block initializer for
     64// EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE
     65//
     66#define GAS2_IO(Base, Size) {                             \
     67          EFI_ACPI_2_0_SYSTEM_IO, /* AddressSpaceId    */ \
     68          (Size) * 8,             /* RegisterBitWidth  */ \
     69          0,                      /* RegisterBitOffset */ \
     70          0,                      /* Reserved          */ \
     71          (Base)                  /* Address           */ \
     72          }
    6273
    6374#endif
    64 
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.c

    r48674 r58459  
    33  Block I/O Protocol instances.
    44
    5   Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
     5  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
    66  This program and the accompanying materials
    77  are licensed and made available under the terms and conditions of the BSD License
     
    288288  BLOCK_MMIO_PROTOCOL            *BlockMmio;
    289289
    290   Private = (BLOCK_MMIO_TO_BLOCK_IO_DEVICE*) AllocateZeroPool (sizeof (Private));
     290  Private = (BLOCK_MMIO_TO_BLOCK_IO_DEVICE*) AllocateZeroPool (sizeof (*Private));
    291291  ASSERT (Private != NULL);
    292292
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c

    r48674 r58459  
    3131//
    3232#define SYSTEM_ROM_FILE_GUID \
    33 { 0x1547B4F3, 0x3E8A, 0x4FEF, 0x81, 0xC8, 0x32, 0x8E, 0xD6, 0x47, 0xAB, 0x1A }
     33{ 0x1547B4F3, 0x3E8A, 0x4FEF, { 0x81, 0xC8, 0x32, 0x8E, 0xD6, 0x47, 0xAB, 0x1A } }
    3434
    3535#define NULL_ROM_FILE_GUID \
    36 { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
     36{ 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
    3737
    3838SYSTEM_ROM_TABLE mSystemRomTable[] = {
     
    8080  },
    8181  {
    82     //          -- Pin 1 -- -- Pin 2 -- -- Pin 3 -- -- Pin 4 --
    83     // Bus  Dev  Reg   Map   Reg   Map   Reg   Map   Reg   Map
    84 
    85     0x00,0x08,0x60,0xDEB8,0x61,0xDEB8,0x62,0xDEB8,0x63,0xDEB8,0x00,0x00,
    86     0x00,0x10,0x61,0xDEB8,0x62,0xDEB8,0x63,0xDEB8,0x60,0xDEB8,0x01,0x00,
    87     0x00,0x18,0x62,0xDEB8,0x63,0xDEB8,0x60,0xDEB8,0x61,0xDEB8,0x02,0x00,
    88     0x00,0x20,0x63,0xDEB8,0x60,0xDEB8,0x61,0xDEB8,0x62,0xDEB8,0x03,0x00,
    89     0x00,0x28,0x60,0xDEB8,0x61,0xDEB8,0x62,0xDEB8,0x63,0xDEB8,0x04,0x00,
    90     0x00,0x30,0x61,0xDEB8,0x62,0xDEB8,0x63,0xDEB8,0x60,0xDEB8,0x05,0x00,
     82    //           -- Pin 1 --   -- Pin 2 --   -- Pin 3 --  -- Pin 4 --
     83    // Bus  Dev   Reg   Map     Reg   Map     Reg   Map     Reg   Map
     84    //
     85    {0x00,0x08,{{0x60,0xDEB8},{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8}},0x00,0x00},
     86    {0x00,0x10,{{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8},{0x60,0xDEB8}},0x01,0x00},
     87    {0x00,0x18,{{0x62,0xDEB8},{0x63,0xDEB8},{0x60,0xDEB8},{0x61,0xDEB8}},0x02,0x00},
     88    {0x00,0x20,{{0x63,0xDEB8},{0x60,0xDEB8},{0x61,0xDEB8},{0x62,0xDEB8}},0x03,0x00},
     89    {0x00,0x28,{{0x60,0xDEB8},{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8}},0x04,0x00},
     90    {0x00,0x30,{{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8},{0x60,0xDEB8}},0x05,0x00},
    9191  }
    9292};
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c

    r48674 r58459  
    33  by pretending that a memory buffer is storage for the NV variables.
    44
    5   Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
     5  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    66  This program and the accompanying materials
    77  are licensed and made available under the terms and conditions of the BSD License
     
    3434#include <Library/PlatformFvbLib.h>
    3535#include "Fvb.h"
     36
     37#define EFI_AUTHENTICATED_VARIABLE_GUID \
     38{ 0xaaf32c78, 0x947b, 0x439a, { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 } }
    3639
    3740//
     
    623626  )
    624627{
     628  //
     629  // Templates for standard (non-authenticated) variable FV header
     630  //
    625631  STATIC FVB_FV_HDR_AND_VARS_TEMPLATE FvAndVarTemplate = {
    626632    { // EFI_FIRMWARE_VOLUME_HEADER FvHdr;
     
    650656
    651657      // UINT8                     Reserved[1];
    652       0,
     658      {0},
    653659
    654660      // UINT8                     Revision;
     
    656662
    657663      // EFI_FV_BLOCK_MAP_ENTRY    BlockMap[1];
    658       { 2, // UINT32 NumBlocks;
    659         EMU_FVB_BLOCK_SIZE  // UINT32 Length;
     664      {
     665        {
     666          2, // UINT32 NumBlocks;
     667          EMU_FVB_BLOCK_SIZE  // UINT32 Length;
     668        }
    660669      }
    661670    },
     
    685694    }
    686695  };
     696
     697  //
     698  // Templates for authenticated variable FV header
     699  //
     700  STATIC FVB_FV_HDR_AND_VARS_TEMPLATE FvAndAuthenticatedVarTemplate = {
     701    { // EFI_FIRMWARE_VOLUME_HEADER FvHdr;
     702      // UINT8                     ZeroVector[16];
     703      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
     704
     705      // EFI_GUID                  FileSystemGuid;
     706      EFI_SYSTEM_NV_DATA_FV_GUID,
     707
     708      // UINT64                    FvLength;
     709      EMU_FVB_SIZE,
     710
     711      // UINT32                    Signature;
     712      EFI_FVH_SIGNATURE,
     713
     714      // EFI_FVB_ATTRIBUTES_2      Attributes;
     715      0x4feff,
     716
     717      // UINT16                    HeaderLength;
     718      EMU_FV_HEADER_LENGTH,
     719
     720      // UINT16                    Checksum;
     721      0,
     722
     723      // UINT16                    ExtHeaderOffset;
     724      0,
     725
     726      // UINT8                     Reserved[1];
     727      {0},
     728
     729      // UINT8                     Revision;
     730      EFI_FVH_REVISION,
     731
     732      // EFI_FV_BLOCK_MAP_ENTRY    BlockMap[1];
     733      {
     734        {
     735          2, // UINT32 NumBlocks;
     736          EMU_FVB_BLOCK_SIZE  // UINT32 Length;
     737        }
     738      }
     739    },
     740    // EFI_FV_BLOCK_MAP_ENTRY     EndBlockMap;
     741    { 0, 0 }, // End of block map
     742    { // VARIABLE_STORE_HEADER      VarHdr;
     743        // EFI_GUID  Signature;     // need authenticated variables for secure boot
     744        EFI_AUTHENTICATED_VARIABLE_GUID,
     745
     746      // UINT32  Size;
     747      (
     748        FixedPcdGet32 (PcdVariableStoreSize) -
     749        OFFSET_OF (FVB_FV_HDR_AND_VARS_TEMPLATE, VarHdr)
     750      ),
     751
     752      // UINT8   Format;
     753      VARIABLE_STORE_FORMATTED,
     754
     755      // UINT8   State;
     756      VARIABLE_STORE_HEALTHY,
     757
     758      // UINT16  Reserved;
     759      0,
     760
     761      // UINT32  Reserved1;
     762      0
     763    }
     764  };
     765
    687766  EFI_FIRMWARE_VOLUME_HEADER  *Fv;
    688767
     
    690769  // Copy the template structure into the location
    691770  //
    692   CopyMem (Ptr, (VOID*)&FvAndVarTemplate, sizeof (FvAndVarTemplate));
     771  if (FeaturePcdGet (PcdSecureBootEnable) == FALSE) {
     772    CopyMem (Ptr, (VOID*)&FvAndVarTemplate, sizeof (FvAndVarTemplate));
     773  } else {
     774    CopyMem (Ptr, (VOID*)&FvAndAuthenticatedVarTemplate, sizeof (FvAndAuthenticatedVarTemplate));
     775  }
    693776
    694777  //
     
    698781  Fv->Checksum = CalculateCheckSum16 (Ptr, Fv->HeaderLength);
    699782}
    700 
    701 
    702 /**
    703   Initializes the Fault Tolerant Write data structure
    704 
    705   This data structure is used by the Fault Tolerant Write driver.
    706 
    707   @param[in]  Buffer - Location for the FTW data structure
    708 
    709 **/
    710 VOID
    711 InitializeFtwState (
    712   IN  VOID   *Buffer
    713   )
    714 {
    715   EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *Hdr;
    716   UINT32                                  TempCrc;
    717   STATIC EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER DefaultFtw = {
    718     EFI_SYSTEM_NV_DATA_FV_GUID, // EFI_GUID  Signature;
    719     ERASED_UINT32,              // UINT32    Crc;
    720     ERASED_BIT,                 // UINT8     WorkingBlockValid : 1;
    721     ERASED_BIT,                 // UINT8     WorkingBlockInvalid : 1;
    722     0,                          // UINT8     Reserved : 6;
    723     { 0, 0, 0 },                // UINT8     Reserved3[3];
    724     FTW_WRITE_QUEUE_SIZE        // UINT64    WriteQueueSize;
    725   };
    726 
    727   CopyMem (Buffer, (VOID*) &DefaultFtw, sizeof (DefaultFtw));
    728 
    729   Hdr = (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER*) Buffer;
    730 
    731   //
    732   // Calculate checksum.
    733   //
    734   // The Crc, WorkingBlockValid and WorkingBlockInvalid bits should
    735   // be set to the erased state before computing the checksum.
    736   //
    737   gBS->CalculateCrc32 (Buffer, sizeof (DefaultFtw), &TempCrc);
    738   Hdr->Crc = TempCrc;
    739 
    740   //
    741   // Mark as valid.
    742   //
    743   Hdr->WorkingBlockValid = NOT_ERASED_BIT;
    744 }
    745 
    746783
    747784/**
     
    781818    DEBUG ((EFI_D_ERROR, "EMU Variable invalid PCD sizes\n"));
    782819    return EFI_INVALID_PARAMETER;
     820  }
     821
     822  if (PcdGet64 (PcdFlashNvStorageVariableBase64) != 0) {
     823    DEBUG ((EFI_D_INFO, "Disabling EMU Variable FVB since "
     824                        "flash variables appear to be supported.\n"));
     825    return EFI_ABORTED;
    783826  }
    784827
     
    826869  //
    827870  SubPtr = (VOID*) ((UINT8*) Ptr + PcdGet32 (PcdVariableStoreSize));
    828   if (Initialize) {
    829     InitializeFtwState (SubPtr);
    830   }
    831871  PcdSet32 (PcdFlashNvStorageFtwWorkingBase, (UINT32)(UINTN) SubPtr);
    832872
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf

    r48674 r58459  
    6969  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
    7070
     71[FeaturePcd]
     72  gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootEnable
     73
    7174[Depex]
    7275  TRUE
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.c

    r58172 r58459  
    22  ACPI Timer implements one instance of Timer Library.
    33
    4   Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
    55  Copyright (c) 2011, Andrei Warkentin <[email protected]>
    66
     
    99  which accompanies this distribution.  The full text of the license may be found at
    1010  http://opensource.org/licenses/bsd-license.php
    11  
     11
    1212  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1313  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1414
    15 **/ 
     15**/
    1616
    1717#include <Base.h>
     
    2121#include <Library/PciLib.h>
    2222#include <Library/DebugLib.h>
    23 
    24 //
    25 // PIIX4 Power Management Base Address
    26 //
    27 #ifndef VBOX
    28 UINT32 mPmba = 0x400;
    29 #else
     23#include <Library/PcdLib.h>
     24#include <IndustryStandard/Pci22.h>
     25#include <IndustryStandard/Acpi.h>
     26
     27//
     28// PCI Location of PIIX4 Power Management PCI Configuration Registers
     29//
     30#define PIIX4_POWER_MANAGEMENT_BUS       0x00
     31#define PIIX4_POWER_MANAGEMENT_DEVICE    0x01
     32#define PIIX4_POWER_MANAGEMENT_FUNCTION  0x03
     33
     34//
     35// Macro to access PIIX4 Power Management PCI Configuration Registers
     36//
     37#define PIIX4_PCI_POWER_MANAGEMENT_REGISTER(Register) \
     38  PCI_LIB_ADDRESS (                                   \
     39    PIIX4_POWER_MANAGEMENT_BUS,                       \
     40    PIIX4_POWER_MANAGEMENT_DEVICE,                    \
     41    PIIX4_POWER_MANAGEMENT_FUNCTION,                  \
     42    Register                                          \
     43    )
     44
     45//
     46// PCI Location of Q35 Power Management PCI Configuration Registers
     47//
     48#define Q35_POWER_MANAGEMENT_BUS       0x00
     49#define Q35_POWER_MANAGEMENT_DEVICE    0x1f
     50#define Q35_POWER_MANAGEMENT_FUNCTION  0x00
     51
     52//
     53// Macro to access Q35 Power Management PCI Configuration Registers
     54//
     55#define Q35_PCI_POWER_MANAGEMENT_REGISTER(Register) \
     56  PCI_LIB_ADDRESS (                                 \
     57    Q35_POWER_MANAGEMENT_BUS,                       \
     58    Q35_POWER_MANAGEMENT_DEVICE,                    \
     59    Q35_POWER_MANAGEMENT_FUNCTION,                  \
     60    Register                                        \
     61    )
     62
     63//
     64// PCI Location of Host Bridge PCI Configuration Registers
     65//
     66#define HOST_BRIDGE_BUS       0x00
     67#define HOST_BRIDGE_DEVICE    0x00
     68#define HOST_BRIDGE_FUNCTION  0x00
     69
     70//
     71// Macro to access Host Bridge Configuration Registers
     72//
     73#define HOST_BRIDGE_REGISTER(Register) \
     74  PCI_LIB_ADDRESS (                    \
     75    HOST_BRIDGE_BUS,                   \
     76    HOST_BRIDGE_DEVICE,                \
     77    HOST_BRIDGE_FUNCTION,              \
     78    Register                           \
     79    )
     80
     81//
     82// Host Bridge Device ID (DID) Register
     83//
     84#define HOST_BRIDGE_DID  HOST_BRIDGE_REGISTER (0x02)
     85
     86//
     87// Host Bridge DID Register values
     88//
     89#define PCI_DEVICE_ID_INTEL_82441    0x1237  // DID value for PIIX4
     90#define PCI_DEVICE_ID_INTEL_Q35_MCH  0x29C0  // DID value for Q35
     91
     92//
     93// Access Power Management PCI Config Regs based on Host Bridge type
     94//
     95#define PCI_POWER_MANAGEMENT_REGISTER(Register)                   \
     96  ((PciRead16 (HOST_BRIDGE_DID) == PCI_DEVICE_ID_INTEL_Q35_MCH) ? \
     97    Q35_PCI_POWER_MANAGEMENT_REGISTER (Register) :                \
     98    PIIX4_PCI_POWER_MANAGEMENT_REGISTER (Register))
     99
     100//
     101// Power Management PCI Configuration Registers
     102//
     103#define PMBA                PCI_POWER_MANAGEMENT_REGISTER (0x40)
     104#define   PMBA_RTE          BIT0
     105#define PMREGMISC           PCI_POWER_MANAGEMENT_REGISTER (0x80)
     106#define   PMIOSE            BIT0
     107
     108//
     109// The ACPI Time is a 24-bit counter
     110//
     111#define ACPI_TIMER_COUNT_SIZE  BIT24
     112
     113//
     114// Offset in the Power Management Base Address to the ACPI Timer
     115//
     116#define ACPI_TIMER_OFFSET      0x8
     117
     118#ifdef VBOX
    30119UINT32 mPmba = 0x4000;
     120
     121#define PCI_BAR_IO             0x1
    31122#endif
    32 
    33 #define PCI_BAR_IO             0x1
    34 #define ACPI_TIMER_FREQUENCY   3579545
    35 #define ACPI_TIMER_COUNT_SIZE  0x01000000
    36 #define ACPI_TIMER_OFFSET      0x8
    37123
    38124/**
     
    52138  )
    53139{
    54   UINT8 Device;
    55 
    56   Device = 1;
    57   // Device = 7;
    58 
    59   if (PciRead8 (PCI_LIB_ADDRESS (0,Device,3,0x80)) & 1) {
    60     mPmba = PciRead32 (PCI_LIB_ADDRESS (0,Device,3,0x40));
    61     ASSERT (mPmba & PCI_BAR_IO);
    62     mPmba &= ~PCI_BAR_IO;
    63   } else {
    64     PciAndThenOr32 (PCI_LIB_ADDRESS (0,Device,3,0x40),
    65                     (UINT32) ~0xfc0, mPmba);
    66     PciOr8         (PCI_LIB_ADDRESS (0,Device,3,0x04), 0x01);
     140  //
     141  // Check to see if the Power Management Base Address is already enabled
     142  //
     143  if ((PciRead8 (PMREGMISC) & PMIOSE) == 0) {
     144    //
     145    // If the Power Management Base Address is not programmed,
     146    // then program the Power Management Base Address from a PCD.
     147    //
     148    PciAndThenOr32 (PMBA, (UINT32)(~0x0000FFC0), PcdGet16 (PcdAcpiPmBaseAddress));
     149
     150    //
     151    // Enable PMBA I/O port decodes in PMREGMISC
     152    //
     153    PciOr8 (PMREGMISC, PMIOSE);
    67154  }
    68 
    69   //
    70   // ACPI Timer enable is in Bus 0, Device ?, Function 3
    71   //
    72   PciOr8         (PCI_LIB_ADDRESS (0,Device,3,0x80), 0x01);
     155 
    73156  return RETURN_SUCCESS;
    74157}
     
    118201
    119202**/
    120 STATIC
    121203UINT32
    122204InternalAcpiGetTimerTick (
     
    124206  )
    125207{
     208  //
     209  //   Read PMBA to read and return the current ACPI timer value.
     210  //
     211#ifndef VBOX
     212  return IoRead32 ((PciRead32 (PMBA) & ~PMBA_RTE) + ACPI_TIMER_OFFSET);
     213#else
    126214  return IoRead32 (mPmba + ACPI_TIMER_OFFSET);
     215#endif
    127216}
    128217
     
    136225
    137226**/
    138 STATIC
    139227VOID
    140228InternalAcpiDelay (
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf

    r48674 r58459  
    77#  which accompanies this distribution.  The full text of the license may be found at
    88#  http://opensource.org/licenses/bsd-license.php
    9 # 
     9#
    1010#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1111#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    12 # 
     12#
    1313##
    1414
     
    3434[Packages]
    3535  MdePkg/MdePkg.dec
     36  OvmfPkg/OvmfPkg.dec
     37
     38[Pcd]
     39  gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress
    3640
    3741[LibraryClasses]
     
    3943  PciLib
    4044  IoLib
    41 
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/NvVarsFileLib/FsAccess.c

    r48674 r58459  
    22  File System Access for NvVarsFileLib
    33
    4   Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    277277
    278278/**
     279  Writes a variable to indicate that the NV variables
     280  have been loaded from the file system.
     281
     282**/
     283STATIC
     284VOID
     285SetNvVarsVariable (
     286  VOID
     287  )
     288{
     289  BOOLEAN                        VarData;
     290  UINTN                          Size;
     291
     292  //
     293  // Write a variable to indicate we've already loaded the
     294  // variable data.  If it is found, we skip the loading on
     295  // subsequent attempts.
     296  //
     297  Size = sizeof (VarData);
     298  VarData = TRUE;
     299  gRT->SetVariable (
     300         L"NvVars",
     301         &gEfiSimpleFileSystemProtocolGuid,
     302         EFI_VARIABLE_NON_VOLATILE |
     303           EFI_VARIABLE_BOOTSERVICE_ACCESS |
     304           EFI_VARIABLE_RUNTIME_ACCESS,
     305         Size,
     306         (VOID*) &VarData
     307         );
     308}
     309
     310
     311/**
    279312  Loads the non-volatile variables from the NvVars file on the
    280313  given file system.
     
    333366  // subsequent attempts.
    334367  //
    335   Size = sizeof (VarData);
    336   VarData = TRUE;
    337   gRT->SetVariable (
    338          L"NvVars",
    339          &gEfiSimpleFileSystemProtocolGuid,
    340          EFI_VARIABLE_NON_VOLATILE |
    341            EFI_VARIABLE_BOOTSERVICE_ACCESS |
    342            EFI_VARIABLE_RUNTIME_ACCESS,
    343          Size,
    344          (VOID*) &VarData
    345          );
     368  SetNvVarsVariable();
    346369
    347370  DEBUG ((
     
    409432  VOID                        *VariableData;
    410433  EFI_HANDLE                  SerializedVariables;
     434
     435  SerializedVariables = NULL;
    411436
    412437  Status = SerializeVariablesNewInstance (&SerializedVariables);
     
    476501
    477502  if (!EFI_ERROR (Status)) {
     503    //
     504    // Write a variable to indicate we've already loaded the
     505    // variable data.  If it is found, we skip the loading on
     506    // subsequent attempts.
     507    //
     508    SetNvVarsVariable();
     509
    478510    DEBUG ((EFI_D_INFO, "Saved NV Variables to NvVars file\n"));
    479511  }
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c

    r52193 r58459  
    22  Platform BDS customizations.
    33
    4   Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    1414
    1515#include "BdsPlatform.h"
     16#include "QemuBootOrder.h"
    1617#ifdef VBOX
    1718#include "VBoxPkg.h"
     
    7071    EFI_TPL               OldTpl;
    7172    OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
     73
     74    gBS->LocateProtocol(&gEfiSimpleTextOutProtocolGuid, NULL, (VOID **)&TextOutputProtocol);
     75    gBS->LocateProtocol(&gEfiUgaDrawProtocolGuid, NULL, (VOID **)&Uga);
     76    gBS->LocateProtocol(&gEfiGraphicsOutputProtocolGuid, NULL, (VOID **)&Gop);
    7277    if (Gop)
    7378    {
     
    101106{
    102107    EFI_EVENT event;
    103 
    104     gBS->LocateProtocol(&gEfiSimpleTextOutProtocolGuid, NULL, (VOID **)&TextOutputProtocol);
    105     gBS->LocateProtocol(&gEfiUgaDrawProtocolGuid, NULL, (VOID **)&Uga);
    106     gBS->LocateProtocol(&gEfiGraphicsOutputProtocolGuid, NULL, (VOID **)&Gop);
    107108    gBS->CreateEventEx(EVT_NOTIFY_SIGNAL, TPL_NOTIFY, VBoxConsoleSwitchMode, NULL, &gEfiEventReadyToBootGuid, &event);
    108109    return EFI_SUCCESS;
     
    158159  );
    159160
    160 #ifndef VBOX
    161 STATIC
    162 VOID
    163 LoadVideoRom (
    164   VOID
    165   );
    166 
    167 
    168 STATIC
    169 EFI_STATUS
    170 PciRomLoadEfiDriversFromRomImage (
    171   IN EFI_PHYSICAL_ADDRESS    Rom,
    172   IN UINTN                   RomSize
    173   );
    174 #endif
    175161//
    176162// BDS Platform Functions
     
    198184  DEBUG ((EFI_D_INFO, "PlatformBdsInit\n"));
    199185  InstallDevicePathCallback ();
    200 #ifndef VBOX
    201   LoadVideoRom ();
    202 #endif
    203186}
    204187
     
    311294  //
    312295  DevPathStr = DevicePathToStr(DevicePath);
    313   DEBUG((
    314     EFI_D_INFO,
    315     "BdsPlatform.c+%d: COM%d DevPath: %s\n",
    316     __LINE__,
    317     gPnp16550ComPortDeviceNode.UID + 1,
    318     DevPathStr
    319     ));
    320   FreePool(DevPathStr);
     296  if (DevPathStr != NULL) {
     297    DEBUG((
     298      EFI_D_INFO,
     299      "BdsPlatform.c+%d: COM%d DevPath: %s\n",
     300      __LINE__,
     301      gPnp16550ComPortDeviceNode.UID + 1,
     302      DevPathStr
     303      ));
     304    FreePool(DevPathStr);
     305  }
    321306
    322307  BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
     
    338323  //
    339324  DevPathStr = DevicePathToStr(DevicePath);
    340   DEBUG((
    341     EFI_D_INFO,
    342     "BdsPlatform.c+%d: COM%d DevPath: %s\n",
    343     __LINE__,
    344     gPnp16550ComPortDeviceNode.UID + 1,
    345     DevPathStr
    346     ));
    347   FreePool(DevPathStr);
     325  if (DevPathStr != NULL) {
     326    DEBUG((
     327      EFI_D_INFO,
     328      "BdsPlatform.c+%d: COM%d DevPath: %s\n",
     329      __LINE__,
     330      gPnp16550ComPortDeviceNode.UID + 1,
     331      DevPathStr
     332      ));
     333    FreePool(DevPathStr);
     334  }
    348335
    349336  BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
     
    465452  EFI_DEVICE_PATH_PROTOCOL  *GopDevicePath;
    466453
    467   DevicePath = NULL;
     454  DevicePath    = NULL;
     455  GopDevicePath = NULL;
    468456  Status = gBS->HandleProtocol (
    469457                  DeviceHandle,
     
    826814  //
    827815  PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x3c), 0x00);
    828   PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x60), 0x0b);
    829   PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x61), 0x09);
    830   PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x62), 0x0b);
    831   PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x63), 0x09);
     816  PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x60), 0x0b); // LNKA routing target
     817  PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x61), 0x0b); // LNKB routing target
     818  PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x62), 0x0a); // LNKC routing target
     819  PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x63), 0x0a); // LNKD routing target
    832820
    833821  //
     
    840828  // Bus 0, Device 1, Function 3 - Power Managment Controller
    841829  //
    842   PciWrite8 (PCI_LIB_ADDRESS (0, 1, 3, 0x3c), 0x0b);
    843   PciWrite8 (PCI_LIB_ADDRESS (0, 1, 3, 0x3d), 0x01);
     830  PciWrite8 (PCI_LIB_ADDRESS (0, 1, 3, 0x3c), 0x09);
     831  PciWrite8 (PCI_LIB_ADDRESS (0, 1, 3, 0x3d), 0x01); // INTA
    844832
    845833  //
     
    851839  // Bus 0, Device 3, Function 0 - Network Controller
    852840  //
    853   PciWrite8 (PCI_LIB_ADDRESS (0, 3, 0, 0x3c), 0x0b);
    854   PciWrite8 (PCI_LIB_ADDRESS (0, 3, 0, 0x3d), 0x01);
    855 
    856   //
    857   // Bus 0, Device 4, Function 0 - RAM Memory
    858   //
    859   PciWrite8 (PCI_LIB_ADDRESS (0, 4, 0, 0x3c), 0x09);
    860   PciWrite8 (PCI_LIB_ADDRESS (0, 4, 0, 0x3d), 0x01);
     841  PciWrite8 (PCI_LIB_ADDRESS (0, 3, 0, 0x3c), 0x0a);
     842  PciWrite8 (PCI_LIB_ADDRESS (0, 3, 0, 0x3d), 0x01); // INTA (-> LNKC)
     843
     844  //
     845  // Bus 0, Device 5, Function 0 - RAM Memory
     846  //
     847  PciWrite8 (PCI_LIB_ADDRESS (0, 5, 0, 0x3c), 0x0b);
     848  PciWrite8 (PCI_LIB_ADDRESS (0, 5, 0, 0x3d), 0x01); // INTA (-> LNKA)
     849}
     850
     851
     852VOID
     853AcpiInitialization (
     854  VOID
     855  )
     856{
     857  //
     858  // Set ACPI SCI_EN bit in PMCNTRL
     859  //
     860  IoOr16 ((PciRead32 (PCI_LIB_ADDRESS (0, 1, 3, 0x40)) & ~BIT0) + 4, BIT0);
    861861}
    862862
     
    889889    //
    890890    DevPathStr = DevicePathToStr (DevicePath);
    891     DEBUG((
    892       EFI_D_INFO,
    893       "Found Mass Storage device: %s\n",
    894       DevPathStr
    895       ));
    896     FreePool(DevPathStr);
     891    if (DevPathStr != NULL) {
     892      DEBUG((
     893        EFI_D_INFO,
     894        "Found Mass Storage device: %s\n",
     895        DevPathStr
     896        ));
     897      FreePool(DevPathStr);
     898    }
    897899
    898900    Status = gBS->ConnectController (Handle, NULL, NULL, TRUE);
     
    10411043
    10421044  PciInitialization ();
     1045  AcpiInitialization ();
    10431046
    10441047  //
     
    11751178  ConnectRootBridge ();
    11761179
    1177   //
    1178   // Try to restore variables from the hard disk early so
    1179   // they can be used for the other BDS connect operations.
    1180   //
    1181   PlatformBdsRestoreNvVarsFromHardDisk ();
     1180  if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {
     1181    DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "
     1182      "from disk since flash variables appear to be supported.\n"));
     1183  } else {
     1184    //
     1185    // Try to restore variables from the hard disk early so
     1186    // they can be used for the other BDS connect operations.
     1187    //
     1188    PlatformBdsRestoreNvVarsFromHardDisk ();
     1189  }
    11821190
    11831191  //
     
    12341242  //
    12351243  PlatformBdsConnectSequence ();
     1244
     1245  //
     1246  // Process QEMU's -kernel command line option
     1247  //
     1248  TryRunningQemuKernel ();
    12361249
    12371250  //
     
    13411354  BdsLibEnumerateAllBootOption (BootOptionList);
    13421355
    1343 
    1344   //
    1345   // Please uncomment above ConnectAll and EnumerateAll code and remove following first boot
    1346   // checking code in real production tip.
    1347   //
    1348   // In BOOT_WITH_FULL_CONFIGURATION boot mode, should always connect every device
    1349   // and do enumerate all the default boot options. But in development system board, the boot mode
    1350   // cannot be BOOT_ASSUMING_NO_CONFIGURATION_CHANGES because the machine box
    1351   // is always open. So the following code only do the ConnectAll and EnumerateAll at first boot.
    1352   //
    1353   Status = BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder");
    1354   VBoxLogFlowFuncMarkRC(Status);
    1355   if (EFI_ERROR(Status)) {
    1356     //
    1357     // If cannot find "BootOrder" variable,  it may be first boot.
    1358     // Try to connect all devices and enumerate all boot options here.
    1359     //
    1360     BdsLibConnectAll ();
    1361     BdsLibEnumerateAllBootOption (BootOptionList);
    1362   }
     1356  SetBootOrderFromQemu (BootOptionList);
     1357  //
     1358  // The BootOrder variable may have changed, reload the in-memory list with
     1359  // it.
     1360  //
     1361  BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder");
    13631362
    13641363  //
     
    16511650
    16521651
    1653 #ifndef VBOX
    1654 STATIC
    1655 VOID
    1656 LoadVideoRom (
    1657   VOID
    1658   )
    1659 {
    1660   PCI_DATA_STRUCTURE            *Pcir;
    1661   UINTN                         RomSize;
    1662 
    1663   //
    1664   // The virtual machines sometimes load the video rom image
    1665   // directly at the legacy video BIOS location of C000:0000,
    1666   // and do not implement the PCI expansion ROM feature.
    1667   //
    1668   Pcir = (PCI_DATA_STRUCTURE *) (UINTN) 0xc0000;
    1669   RomSize = Pcir->ImageLength * 512;
    1670   PciRomLoadEfiDriversFromRomImage (0xc0000, RomSize);
    1671 }
    1672 
    1673 
    1674 STATIC
    1675 EFI_STATUS
    1676 PciRomLoadEfiDriversFromRomImage (
    1677   IN EFI_PHYSICAL_ADDRESS    Rom,
    1678   IN UINTN                   RomSize
    1679   )
    1680 {
    1681   CHAR16                        *FileName;
    1682   EFI_PCI_EXPANSION_ROM_HEADER  *EfiRomHeader;
    1683   PCI_DATA_STRUCTURE            *Pcir;
    1684   UINTN                         ImageIndex;
    1685   UINTN                         RomOffset;
    1686   UINT32                        ImageSize;
    1687   UINT16                        ImageOffset;
    1688   EFI_HANDLE                    ImageHandle;
    1689   EFI_STATUS                    Status;
    1690   EFI_STATUS                    retStatus;
    1691   EFI_DEVICE_PATH_PROTOCOL      *FilePath;
    1692   BOOLEAN                       SkipImage;
    1693   UINT32                        DestinationSize;
    1694   UINT32                        ScratchSize;
    1695   UINT8                         *Scratch;
    1696   VOID                          *ImageBuffer;
    1697   VOID                          *DecompressedImageBuffer;
    1698   UINT32                        ImageLength;
    1699   EFI_DECOMPRESS_PROTOCOL       *Decompress;
    1700   UINT32                        InitializationSize;
    1701 
    1702   VBoxLogFlowFuncEnter();
    1703   FileName = L"PciRomInMemory";
    1704 
    1705   //FileName = L"PciRom Addr=0000000000000000";
    1706   //HexToString (&FileName[12], Rom, 16);
    1707 
    1708   ImageIndex    = 0;
    1709   retStatus     = EFI_NOT_FOUND;
    1710   RomOffset  = (UINTN) Rom;
    1711 
    1712   do {
    1713 
    1714     EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *) (UINTN) RomOffset;
    1715 
    1716     if (EfiRomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
    1717       return retStatus;
    1718     }
    1719 
    1720     //
    1721     // If the pointer to the PCI Data Structure is invalid, no further images can be located.
    1722     // The PCI Data Structure must be DWORD aligned.
    1723     //
    1724     if (EfiRomHeader->PcirOffset == 0 ||
    1725         (EfiRomHeader->PcirOffset & 3) != 0 ||
    1726         RomOffset - (UINTN)Rom + EfiRomHeader->PcirOffset + sizeof (PCI_DATA_STRUCTURE) > RomSize) {
    1727       break;
    1728     }
    1729     Pcir      = (PCI_DATA_STRUCTURE *) (UINTN) (RomOffset + EfiRomHeader->PcirOffset);
    1730     //
    1731     // If a valid signature is not present in the PCI Data Structure, no further images can be located.
    1732     //
    1733     if (Pcir->Signature != PCI_DATA_STRUCTURE_SIGNATURE) {
    1734       break;
    1735     }
    1736     ImageSize = Pcir->ImageLength * 512;
    1737     if (RomOffset - (UINTN)Rom + ImageSize > RomSize) {
    1738       break;
    1739     }
    1740 
    1741     if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
    1742         (EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE) &&
    1743         ((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||
    1744          (EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER))) {
    1745 
    1746       ImageOffset             = EfiRomHeader->EfiImageHeaderOffset;
    1747       InitializationSize      = EfiRomHeader->InitializationSize * 512;
    1748 
    1749       if (InitializationSize <= ImageSize && ImageOffset < InitializationSize) {
    1750 
    1751         ImageBuffer             = (VOID *) (UINTN) (RomOffset + ImageOffset);
    1752         ImageLength             = InitializationSize - ImageOffset;
    1753         DecompressedImageBuffer = NULL;
    1754 
    1755         //
    1756         // decompress here if needed
    1757         //
    1758         SkipImage = FALSE;
    1759         if (EfiRomHeader->CompressionType > EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
    1760           SkipImage = TRUE;
    1761         }
    1762 
    1763         if (EfiRomHeader->CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
    1764           Status = gBS->LocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **) &Decompress);
    1765           if (EFI_ERROR (Status)) {
    1766             SkipImage = TRUE;
    1767           } else {
    1768             SkipImage = TRUE;
    1769             Status = Decompress->GetInfo (
    1770                                   Decompress,
    1771                                   ImageBuffer,
    1772                                   ImageLength,
    1773                                   &DestinationSize,
    1774                                   &ScratchSize
    1775                                   );
    1776             if (!EFI_ERROR (Status)) {
    1777               DecompressedImageBuffer = NULL;
    1778               DecompressedImageBuffer = AllocatePool (DestinationSize);
    1779               if (DecompressedImageBuffer != NULL) {
    1780                 Scratch = AllocatePool (ScratchSize);
    1781                 if (Scratch != NULL) {
    1782                   Status = Decompress->Decompress (
    1783                                         Decompress,
    1784                                         ImageBuffer,
    1785                                         ImageLength,
    1786                                         DecompressedImageBuffer,
    1787                                         DestinationSize,
    1788                                         Scratch,
    1789                                         ScratchSize
    1790                                         );
    1791                   if (!EFI_ERROR (Status)) {
    1792                     ImageBuffer = DecompressedImageBuffer;
    1793                     ImageLength = DestinationSize;
    1794                     SkipImage   = FALSE;
    1795                   }
    1796 
    1797                   gBS->FreePool (Scratch);
    1798                 }
    1799               }
    1800             }
    1801           }
    1802         }
    1803 
    1804         if (!SkipImage) {
    1805 
    1806           //
    1807           // load image and start image
    1808           //
    1809 
    1810           FilePath = FileDevicePath (NULL, FileName);
    1811 
    1812           Status = gBS->LoadImage (
    1813                           FALSE,
    1814                           gImageHandle,
    1815                           FilePath,
    1816                           ImageBuffer,
    1817                           ImageLength,
    1818                           &ImageHandle
    1819                           );
    1820           if (!EFI_ERROR (Status)) {
    1821             Status = gBS->StartImage (ImageHandle, NULL, NULL);
    1822             if (!EFI_ERROR (Status)) {
    1823               retStatus = Status;
    1824             }
    1825           }
    1826           if (FilePath != NULL) {
    1827             gBS->FreePool (FilePath);
    1828           }
    1829         }
    1830 
    1831         if (DecompressedImageBuffer != NULL) {
    1832           gBS->FreePool (DecompressedImageBuffer);
    1833         }
    1834 
    1835       }
    1836     }
    1837 
    1838     RomOffset = RomOffset + ImageSize;
    1839     ImageIndex++;
    1840   } while (((Pcir->Indicator & 0x80) == 0x00) && ((RomOffset - (UINTN) Rom) < RomSize));
    1841 
    1842 
    1843   VBoxLogFlowFuncLeaveRC(retStatus);
    1844   return retStatus;
    1845 }
    1846 #endif /* !VBOX */
    1847 
    1848 
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h

    r48674 r58459  
    296296  );
    297297
     298/**
     299  Loads and boots UEFI Linux via the FwCfg interface.
     300
     301  @retval    EFI_NOT_FOUND - The Linux kernel was not found
     302
     303**/
     304EFI_STATUS
     305TryRunningQemuKernel (
     306  VOID
     307  );
     308
    298309#endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf

    r48674 r58459  
    1919  MODULE_TYPE                    = DXE_DRIVER
    2020  VERSION_STRING                 = 1.0
    21   LIBRARY_CLASS                  = PlatformBdsLib|DXE_DRIVER   
     21  LIBRARY_CLASS                  = PlatformBdsLib|DXE_DRIVER
    2222
    2323#
     
    3030  BdsPlatform.c
    3131  PlatformData.c
     32  QemuBootOrder.c
     33  QemuKernel.c
    3234  BdsPlatform.h
     35  QemuBootOrder.h
    3336
    3437[Packages]
     
    4952  PciLib
    5053  NvVarsFileLib
     54  QemuFwCfgLib
     55  LoadLinuxLib
    5156
    5257[Pcd]
     
    5459  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
    5560  gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent
     61  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable
    5662
    5763[Pcd.IA32, Pcd.X64]
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c

    r48674 r58459  
    22  Reset System Library functions for OVMF
    33
    4   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    1818#include <Library/DebugLib.h>
    1919#include <Library/IoLib.h>
     20#include <Library/PcdLib.h>
     21#include <Library/TimerLib.h>
    2022
    2123VOID
     
    2628  ASSERT (SuspendType < 6);
    2729
    28   IoAndThenOr16 (0x404, (UINT16) ~0x3c00, (UINT16) (SuspendType << 10));
    29   IoOr16 (0x404, BIT13);
     30  IoBitFieldWrite16  (PcdGet16 (PcdAcpiPmBaseAddress) + 4, 10, 13, (UINT16) SuspendType);
     31  IoOr16 (PcdGet16 (PcdAcpiPmBaseAddress) + 4, BIT13);
    3032  CpuDeadLoop ();
    3133}
     
    4648  )
    4749{
    48   IoWrite8 (0x64, 0xfe);
     50  IoWrite8 (0xCF9, BIT2 | BIT1); // 1st choice: PIIX3 RCR, RCPU|SRST
     51  MicroSecondDelay (50);
     52
     53  IoWrite8 (0x64, 0xfe);         // 2nd choice: keyboard controller
     54  CpuDeadLoop ();
    4955}
    5056
     
    6369{
    6470  IoWrite8 (0x64, 0xfe);
     71  CpuDeadLoop ();
    6572}
    6673
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf

    r48674 r58459  
    22#  Library instance for ResetSystem library class for OVMF
    33#
    4 #  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4#  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    55#  This program and the accompanying materials
    66#  are licensed and made available under the terms and conditions of the BSD License
     
    3232[Packages]
    3333  MdePkg/MdePkg.dec
     34  OvmfPkg/OvmfPkg.dec
    3435
    3536[LibraryClasses]
    3637  DebugLib
    3738  IoLib
     39  TimerLib
    3840
     41[Pcd]
     42  gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c

    r48674 r58459  
    285285  )
    286286{
    287   return gRT->SetVariable (
    288            VariableName,
    289            VendorGuid,
    290            Attributes,
    291            DataSize,
    292            Data
    293            );
     287  EFI_STATUS          Status;
     288  STATIC CONST UINT32 AuthMask =
     289                        EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS |
     290                        EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
     291
     292  Status = gRT->SetVariable (
     293             VariableName,
     294             VendorGuid,
     295             Attributes,
     296             DataSize,
     297             Data
     298             );
     299
     300  if (Status == EFI_SECURITY_VIOLATION && (Attributes & AuthMask) != 0) {
     301    DEBUG ((DEBUG_WARN, "%a: setting authenticated variable \"%s\" "
     302            "failed with EFI_SECURITY_VIOLATION, ignoring\n", __FUNCTION__,
     303            VariableName));
     304    Status = EFI_SUCCESS;
     305  }
     306  return Status;
    294307}
    295308
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkg.dec

    r48674 r58459  
    22#  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
    33#
    4 #  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4#  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    55#
    66#  This program and the accompanying materials
     
    88#  which accompanies this distribution. The full text of the license may be found at
    99#  http://opensource.org/licenses/bsd-license.php
    10 # 
     10#
    1111#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    1212#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     
    2424
    2525[LibraryClasses]
     26  ##  @libraryclass  Loads and boots a Linux kernel image
     27  #
     28  LoadLinuxLib|Include/Library/LoadLinuxLib.h
     29
    2630  ##  @libraryclass  Save and restore variables using a file
    2731  #
    2832  NvVarsFileLib|Include/Library/NvVarsFileLib.h
     33
     34  ##  @libraryclass  Access QEMU's firmware configuration interface
     35  #
     36  QemuFwCfgLib|Include/Library/QemuFwCfgLib.h
    2937
    3038  ##  @libraryclass  Serialize (and deserialize) variables
     
    3543  gUefiOvmfPkgTokenSpaceGuid      = {0x93bb96af, 0xb9f2, 0x4eb8, {0x94, 0x62, 0xe0, 0xba, 0x74, 0x56, 0x42, 0x36}}
    3644  gEfiXenInfoGuid                 = {0xd3b46f3b, 0xd441, 0x1244, {0x9a, 0x12, 0x0, 0x12, 0x27, 0x3f, 0xc1, 0x4d}}
     45  gOvmfPlatformConfigGuid         = {0x7235c51c, 0x0c80, 0x4cab, {0x87, 0xac, 0x3b, 0x08, 0x4a, 0x63, 0x04, 0xb1}}
    3746
    3847[Protocols]
     48  gVirtioDeviceProtocolGuid       = {0xfa920010, 0x6785, 0x4941, {0xb6, 0xec, 0x49, 0x8c, 0x57, 0x9f, 0x16, 0x0a}}
    3949  gBlockMmioProtocolGuid          = {0x6b558ce3, 0x69e5, 0x4c67, {0xa6, 0x34, 0xf7, 0xfe, 0x72, 0xad, 0xbe, 0x84}}
    4050
    4151[PcdsFixedAtBuild]
    42   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase|0x0|UINT32|0
    43   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize|0x0|UINT32|1
     52  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|0x0|UINT32|0
     53  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize|0x0|UINT32|1
     54  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|0x0|UINT32|0x15
     55  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize|0x0|UINT32|0x16
     56
     57  ## This flag is used to control the destination port for PlatformDebugLibIoPort
     58  gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort|0x402|UINT16|4
     59
     60  ## This flag determines the Power Management Base Address of choice, written
     61  #  to PIIX4 function 3 offset 0x40-0x43 bits [15:6].
     62  gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress|0xB000|UINT16|5
     63
     64  ## When VirtioScsiDxe is instantiated for a HBA, the numbers of targets and
     65  #  LUNs are retrieved from the host during virtio-scsi setup.
     66  #  MdeModulePkg/Bus/Scsi/ScsiBusDxe then scans all MaxTarget * MaxLun
     67  #  possible devices. This can take extremely long, for example with
     68  #  MaxTarget=255 and MaxLun=16383. The *inclusive* constants below limit
     69  #  MaxTarget and MaxLun, independently, should the host report higher values,
     70  #  so that scanning the number of devices given by their product is still
     71  #  acceptably fast.
     72  gUefiOvmfPkgTokenSpaceGuid.PcdVirtioScsiMaxTargetLimit|31|UINT16|6
     73  gUefiOvmfPkgTokenSpaceGuid.PcdVirtioScsiMaxLunLimit|7|UINT32|7
     74
     75[PcdsFixedAtBuild]
     76  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase|0x0|UINT32|0x8
     77  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize|0x0|UINT32|0x9
     78  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize|0x0|UINT32|0xa
     79  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize|0|UINT32|0xb
     80  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase|0x0|UINT32|0xc
     81  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwSpareBase|0x0|UINT32|0xd
     82  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase|0x0|UINT32|0xe
     83  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress|0x0|UINT32|0xf
     84  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|0x0|UINT32|0x11
     85  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize|0x0|UINT32|0x12
     86  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|0x0|UINT32|0x13
     87  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize|0x0|UINT32|0x14
     88  gUefiOvmfPkgTokenSpaceGuid.PcdS3AcpiReservedMemoryBase|0x0|UINT32|0x17
     89  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|0x0|UINT32|0x18
     90  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageSize|0x0|UINT32|0x19
     91  gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize|0x0|UINT32|0x1a
    4492
    4593[PcdsDynamic, PcdsDynamicEx]
    4694  gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2
     95  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable|FALSE|BOOLEAN|0x10
    4796
     97[PcdsFeatureFlag]
     98  gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootEnable|FALSE|BOOLEAN|3
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgIa32.dsc

    r58189 r58459  
    22#  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
    33#
    4 #  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    55#
    66#  This program and the accompanying materials
     
    3434  FLASH_DEFINITION               = OvmfPkg/OvmfPkgIa32.fdf
    3535
     36  #
     37  # Defines for default states.  These can be changed on the command line.
     38  # -D FLAG=VALUE
     39  #
     40  DEFINE SECURE_BOOT_ENABLE      = FALSE
     41
    3642[BuildOptions]
     43  GCC:*_UNIXGCC_*_CC_FLAGS             = -DMDEPKG_NDEBUG
    3744  GCC:RELEASE_*_*_CC_FLAGS             = -DMDEPKG_NDEBUG
    3845  INTEL:RELEASE_*_*_CC_FLAGS           = /D MDEPKG_NDEBUG
     
    8693  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
    8794  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
     95  DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
    8896  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
    8997  PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
     
    98106  UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
    99107  UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
    100   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
     108  DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
    101109  NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
    102110  FileHandleLib|ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
     
    109117  UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
    110118  SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
     119  QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
     120  VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
     121  LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf
     122  LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
     123  CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
    111124
    112125!ifdef $(VBOX)
     
    125138  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
    126139  LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
    127   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf 
     140  DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
     141
     142!if $(SECURE_BOOT_ENABLE) == TRUE
     143  PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
     144  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
     145  OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
     146  TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
     147!endif
     148
     149  S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
     150  SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
     151
     152[LibraryClasses.common]
     153!if $(SECURE_BOOT_ENABLE) == TRUE
     154  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
     155!endif
    128156
    129157[LibraryClasses.common.SEC]
    130158!ifndef $(VBOX)
    131   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     159  QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf
     160!ifdef $(DEBUG_ON_SERIAL_PORT)
     161  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     162!else
     163  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     164!endif
    132165!else
    133166  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     
    144177  PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
    145178  MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
     179  CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
    146180
    147181[LibraryClasses.common.PEI_CORE]
     
    155189  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
    156190!ifndef $(VBOX)
    157   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     191!ifdef $(DEBUG_ON_SERIAL_PORT)
     192  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     193!else
     194  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     195!endif
    158196  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
    159197!else
     
    192230  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
    193231!ifndef $(VBOX)
    194   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     232!ifdef $(DEBUG_ON_SERIAL_PORT)
     233  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     234!else
     235  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     236!endif
    195237!else
    196238  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     
    198240  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
    199241  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
    200 !ifdef $(VBOX)
    201242!ifdef $(SOURCE_DEBUG_ENABLE)
    202243  DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
    203244!endif
    204 !endif
     245  CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
    205246
    206247[LibraryClasses.common.DXE_RUNTIME_DRIVER]
     
    210251  ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf
    211252!ifndef $(VBOX)
    212   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     253!ifdef $(DEBUG_ON_SERIAL_PORT)
     254  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     255!else
     256  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     257!endif
    213258!else
    214259  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     
    216261  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
    217262  UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
    218   DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
     263!if $(SECURE_BOOT_ENABLE) == TRUE
     264  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
     265!endif
    219266
    220267[LibraryClasses.common.UEFI_DRIVER]
     
    224271  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
    225272!ifndef $(VBOX)
    226   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     273!ifdef $(DEBUG_ON_SERIAL_PORT)
     274  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     275!else
     276  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     277!endif
    227278!else
    228279  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     
    236287  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
    237288  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
    238   DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
    239289  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
    240290!ifndef $(VBOX)
    241   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     291!ifdef $(DEBUG_ON_SERIAL_PORT)
     292  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     293!else
     294  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     295!endif
    242296!else
    243297  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     
    248302  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
    249303  PlatformBdsLib|OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf
     304  CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
     305  LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf
     306!ifdef $(SOURCE_DEBUG_ENABLE)
     307  DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
     308!endif
    250309
    251310[LibraryClasses.common.UEFI_APPLICATION]
     
    253312  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
    254313!ifndef $(VBOX)
    255   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     314!ifdef $(DEBUG_ON_SERIAL_PORT)
     315  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     316!else
     317  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     318!endif
    256319!else
    257320  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     
    270333  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
    271334  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
     335!if $(SECURE_BOOT_ENABLE) == TRUE
     336  gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootEnable|TRUE
     337!endif
    272338!ifdef $(VBOX)
    273339  gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeReplayIn|FALSE
     
    281347  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
    282348  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
    283   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400
     349  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
    284350  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000
    285   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xc000
    286   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0xc000
    287   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x2000
    288   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x10000
     351  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
    289352
    290353  gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
    291354
    292   gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0xff
     355  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
    293356  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000004F
    294357!ifdef $(SOURCE_DEBUG_ENABLE)
     
    302365!endif
    303366
    304 !if $(BUILD_NEW_SHELL)
     367!ifndef $(USE_OLD_SHELL)
    305368  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
    306 !else
    307 !if $(USE_NEW_SHELL)
    308   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
    309 !endif
    310 !endif
     369!endif
     370
     371!if $(SECURE_BOOT_ENABLE) == TRUE
     372  # override the default values from SecurityPkg to ensure images from all sources are verified in secure boot
     373  gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
     374  gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04
     375  gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
     376!endif
     377
     378  # IRQs 5, 9, 10, 11 are level-triggered
     379  gPcAtChipsetPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20
    311380
    312381################################################################################
     
    321390  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
    322391  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
     392  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE
     393!ifndef $(VBOX)
     394  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800
     395  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
     396!else
     397  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1024
     398  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|768
     399!endif
    323400
    324401################################################################################
     
    328405################################################################################
    329406[Components]
     407  OvmfPkg/ResetVector/ResetVector.inf
     408
    330409  #
    331410  # SEC Phase modules
     
    351430      PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
    352431  }
     432  UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf {
     433    <LibraryClasses>
     434      PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
     435  }
    353436
    354437  #
     
    358441    <LibraryClasses>
    359442      NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
     443      DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
    360444  }
    361445
     
    367451
    368452  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
     453
     454!if $(SECURE_BOOT_ENABLE) == TRUE
     455  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
     456    <LibraryClasses>
     457      NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
     458        }
     459!else
    369460  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
     461!endif
     462
    370463  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
    371464  PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
     
    374467  PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
    375468  PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
    376   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
     469  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
     470    <LibraryClasses>
     471      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
     472  }
    377473  PcAtChipsetPkg/KbcResetDxe/Reset.inf
    378474  MdeModulePkg/Universal/Metronome/Metronome.inf {
     
    395491
    396492  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
     493!ifndef $(VBOX)
     494  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
     495  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
     496  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
     497  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
     498!endif
    397499  OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf {
    398500    <LibraryClasses>
     
    410512  MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
    411513  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
    412   MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
     514  MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf {
     515    <LibraryClasses>
     516      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
     517  }
    413518  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
    414   MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
     519  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
     520    <LibraryClasses>
     521      DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
     522      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
     523  }
    415524  MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
    416525  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
     
    423532  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
    424533  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
     534  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
    425535  MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
    426536
     
    465575  #
    466576  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
     577!ifndef $(VBOX)
     578  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
     579  OvmfPkg/AcpiTables/AcpiTables.inf
     580  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
     581  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
     582  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
     583!else
    467584  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
    468 !ifndef $(VBOX)
    469   OvmfPkg/AcpiTables/AcpiTables.inf
    470585!endif
    471586
     
    473588  # Network Support
    474589  #
    475 !if $(NETWORK_ENABLE)
     590!ifndef $(VBOX)
    476591  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
    477592  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
     
    487602  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
    488603  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
     604  OvmfPkg/VirtioNetDxe/VirtioNet.inf
    489605!endif
    490606
     
    501617
    502618!ifdef $(CSM_ENABLE)
    503   IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf
     619  IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf {
     620    <LibraryClasses>
     621      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
     622  }
    504623  IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
    505624  OvmfPkg/Csm/Csm16/Csm16.inf
    506625!endif
    507626
    508 !if $(BUILD_NEW_SHELL)
     627!ifndef $(USE_OLD_SHELL)
    509628  ShellPkg/Application/Shell/Shell.inf {
    510629    <LibraryClasses>
     
    525644#      SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
    526645#      SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf
     646      BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
    527647
    528648    <PcdsFixedAtBuild>
     
    533653!endif
    534654
     655!if $(SECURE_BOOT_ENABLE) == TRUE
     656  SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableRuntimeDxe.inf {
     657    <LibraryClasses>
     658      BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
     659      OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
     660  }
     661  OvmfPkg/SecureBootConfigDxe/SecureBootConfigDxe.inf
     662!endif
     663
     664  OvmfPkg/PlatformDxe/Platform.inf
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgIa32.fdf

    r58189 r58459  
    22#  Open Virtual Machine Firmware: FDF
    33#
    4 #  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    55#
    66#  This program and the accompanying materials
     
    1515
    1616################################################################################
     17
     18#
     19# Default flash size for DEBUG build is 2MB. For RELEASE it is 1MB.
     20#
     21# Defining FD_SIZE_1MB or FD_SIZE_2MB on the build command line can
     22# override this.
     23#
     24[Defines]
     25!if $(TARGET) == RELEASE
     26!ifndef $(FD_SIZE_2MB)
     27DEFINE FD_SIZE_1MB=
     28!endif
     29!endif
     30
     31!include OvmfPkg.fdf.inc
     32
     33#
     34# Build the variable store and the firmware code as one unified flash device
     35# image.
     36#
    1737[FD.OVMF]
    18 BaseAddress   = 0xFFF00000
    19 Size          = 0x00100000
     38BaseAddress   = $(FW_BASE_ADDRESS)
     39Size          = $(FW_SIZE)
    2040ErasePolarity = 1
    21 BlockSize     = 0x1000
    22 NumBlocks     = 0x100
    23 
    24 #VBox: Debug needs more space, original: 0x00000000|0x000EC000
    25 0x00000000|0x000F4000
     41BlockSize     = $(BLOCK_SIZE)
     42NumBlocks     = $(FW_BLOCKS)
     43
     44!include VarStore.fdf.inc
     45
     46$(VARS_SIZE)|$(FVMAIN_SIZE)
    2647FV = FVMAIN_COMPACT
    2748
    28 #VBox: Debug needs more space, original: 0x000EC000|0x14000
    29 0x000F4000|0x0000C000
     49$(SECFV_OFFSET)|$(SECFV_SIZE)
    3050FV = SECFV
    3151
     52#
     53# Build the variable store and the firmware code as separate flash device
     54# images.
     55#
     56[FD.OVMF_VARS]
     57BaseAddress   = $(FW_BASE_ADDRESS)
     58Size          = $(VARS_SIZE)
     59ErasePolarity = 1
     60BlockSize     = $(BLOCK_SIZE)
     61NumBlocks     = $(VARS_BLOCKS)
     62
     63!include VarStore.fdf.inc
     64
     65[FD.OVMF_CODE]
     66BaseAddress   = $(CODE_BASE_ADDRESS)
     67Size          = $(CODE_SIZE)
     68ErasePolarity = 1
     69BlockSize     = $(BLOCK_SIZE)
     70NumBlocks     = $(CODE_BLOCKS)
     71
     720x00000000|$(FVMAIN_SIZE)
     73FV = FVMAIN_COMPACT
     74
     75$(FVMAIN_SIZE)|$(SECFV_SIZE)
     76FV = SECFV
     77
    3278################################################################################
    3379
    3480[FD.MEMFD]
    35 BaseAddress   = 0x2000000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase
    36 Size          = 0x600000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
     81BaseAddress   = 0x800000
     82Size          = 0x900000
    3783ErasePolarity = 1
    3884BlockSize     = 0x10000
    39 NumBlocks     = 0x60
    40 
    41 0x0|0x600000
    42 FV = MAINFV
     85NumBlocks     = 0x90
     86
     870x000000|0x006000
     88gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize
     89
     900x006000|0x001000
     91gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageSize
     92
     930x007000|0x001000
     94gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize
     95
     960x010000|0x008000
     97gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize
     98
     990x018000|0x008000
     100gUefiOvmfPkgTokenSpaceGuid.PcdS3AcpiReservedMemoryBase|gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize
     101
     1020x020000|0x0E0000
     103gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize
     104FV = PEIFV
     105
     1060x100000|0x800000
     107gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
     108FV = DXEFV
    43109
    44110################################################################################
     
    67133#
    68134# The code in this FV handles the initial firmware startup, and
    69 # decompresses the MAINFV which handles the majority of the boot sequence.
     135# decompresses the PEI and DXE FVs which handles the rest of the boot sequence.
    70136#
    71137INF  OvmfPkg/Sec/SecMain.inf
    72138
    73 INF  RuleOverride=RESET_VECTOR UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf
    74 
    75 ################################################################################
    76 [FV.MAINFV]
     139INF  RuleOverride=RESET_VECTOR OvmfPkg/ResetVector/ResetVector.inf
     140
     141################################################################################
     142[FV.PEIFV]
    77143BlockSize          = 0x10000
    78144FvAlignment        = 16
     
    93159READ_LOCK_STATUS   = TRUE
    94160
    95 #
    96 # Files to be placed in MAIN FV
    97 #
    98 # This firmware volume will have files placed in it uncompressed,
    99 # and then then entire firmware volume will be compressed in a
    100 # single compression operation in order to achieve better
    101 # overall compression.
    102 #
    103 
    104161APRIORI PEI {
    105162  INF  MdeModulePkg/Universal/PCD/Pei/Pcd.inf
     
    114171INF  OvmfPkg/PlatformPei/PlatformPei.inf
    115172INF  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
    116 
    117 FILE FV_IMAGE = A4EF5A93-3F1B-4232-A1C4-F0910E6D1D9C {
    118   SECTION COMPRESS PI_NONE {
    119     SECTION FV_IMAGE = DXEFV
    120   }
    121 }
     173INF  UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
    122174
    123175################################################################################
     
    143195
    144196APRIORI DXE {
     197  INF  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
    145198  INF  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
     199!ifndef $(VBOX)
     200  INF  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
     201!endif
    146202}
    147203
     
    168224
    169225INF  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
     226!ifndef $(VBOX)
     227INF  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
     228INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
     229INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
     230INF  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
     231!endif
    170232INF  OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf
     233!ifndef $(VBOX)
    171234INF  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
    172 !ifndef $(VBOX)
    173 INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
     235!if $(SECURE_BOOT_ENABLE) == TRUE
     236  INF  SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableRuntimeDxe.inf
     237  INF  OvmfPkg/SecureBootConfigDxe/SecureBootConfigDxe.inf
     238!else
     239  INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
     240!endif
    174241!else
    175242INF  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
     
    196263INF  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
    197264INF  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
     265INF  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
    198266INF  MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
    199267
     
    227295INF  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
    228296
     297!ifndef $(VBOX)
     298INF  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
     299INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
     300INF  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
     301INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
     302INF  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
     303!else
    229304INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
    230305INF  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
    231 !ifndef $(VBOX)
    232 INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
    233306!endif
    234307
    235308INF  RuleOverride = BINARY FatBinPkg/EnhancedFatDxe/Fat.inf
    236309
    237 !if $(BUILD_NEW_SHELL)
     310!ifndef $(USE_OLD_SHELL)
    238311INF  ShellPkg/Application/Shell/Shell.inf
    239312!else
    240 !if $(USE_NEW_SHELL)
    241 INF  RuleOverride = BINARY ShellBinPkg/UefiShell/UefiShell.inf
    242 !else
    243313INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
    244 !endif
    245314!endif
    246315
     
    260329# Network modules
    261330#
    262 !if $(NETWORK_ENABLE)
     331!ifndef $(VBOX)
     332!if $(E1000_ENABLE)
    263333  FILE DRIVER = 5D695E11-9B3F-4b83-B25F-4A8D5D69BE07 {
    264334    SECTION PE32 = Intel3.5/EFI32/E3507E2.EFI
    265335  }
     336!endif
    266337  INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
    267338  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
     
    277348  INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
    278349  INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
     350  INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
    279351!endif
    280352
     
    295367INF  RuleOverride=CSM OvmfPkg/Csm/Csm16/Csm16.inf
    296368!endif
     369
     370!ifndef $(VBOX)
     371INF  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
     372!endif
     373INF  OvmfPkg/PlatformDxe/Platform.inf
    297374
    298375################################################################################
     
    318395FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
    319396   SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
    320      SECTION FV_IMAGE = MAINFV
     397     #
     398     # These firmware volumes will have files placed in them uncompressed,
     399     # and then both firmware volumes will be compressed in a single
     400     # compression operation in order to achieve better overall compression.
     401     #
     402     SECTION FV_IMAGE = PEIFV
     403     SECTION FV_IMAGE = DXEFV
    321404   }
    322405 }
     
    384467    VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
    385468  }
    386  
     469
    387470[Rule.Common.UEFI_APPLICATION]
    388471  FILE APPLICATION = $(NAMED_GUID) {
     
    398481    VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
    399482  }
    400  
     483
    401484[Rule.Common.USER_DEFINED.ACPITABLE]
    402485  FILE FREEFORM = $(NAMED_GUID) {
     
    412495[Rule.Common.SEC.RESET_VECTOR]
    413496  FILE RAW = $(NAMED_GUID) {
    414     RAW RAW                |.raw
    415   }
    416 
    417 !ifndef $(VBOX)
    418 [OptionRom.OvmfVideo]
    419 INF  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf {
    420     PCI_DEVICE_ID  = 0x00B8
    421   }
    422 !endif
     497    RAW BIN   Align = 16   |.bin
     498  }
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgIa32X64.dsc

    r48674 r58459  
    22#  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
    33#
    4 #  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    55#
    66#  This program and the accompanying materials
     
    3030  FLASH_DEFINITION               = OvmfPkg/OvmfPkgIa32X64.fdf
    3131
     32  #
     33  # Defines for default states.  These can be changed on the command line.
     34  # -D FLAG=VALUE
     35  #
     36  DEFINE SECURE_BOOT_ENABLE      = FALSE
     37
    3238[BuildOptions]
     39  GCC:*_UNIXGCC_*_CC_FLAGS             = -DMDEPKG_NDEBUG
    3340  GCC:RELEASE_*_*_CC_FLAGS             = -DMDEPKG_NDEBUG
    3441  INTEL:RELEASE_*_*_CC_FLAGS           = /D MDEPKG_NDEBUG
    3542  MSFT:RELEASE_*_*_CC_FLAGS            = /D MDEPKG_NDEBUG
    3643  GCC:*_*_*_CC_FLAGS                   = -mno-mmx -mno-sse
    37 
     44!ifdef $(SOURCE_DEBUG_ENABLE)
     45  MSFT:*_*_X64_GENFW_FLAGS  = --keepexceptiontable
     46  GCC:*_*_X64_GENFW_FLAGS   = --keepexceptiontable
     47  INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable
     48!endif
     49 
    3850################################################################################
    3951#
     
    6678  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
    6779  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
     80  DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
    6881  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
    6982  PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
     
    7891  UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
    7992  UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
    80   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
     93  DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
    8194  NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
    8295  FileHandleLib|ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
     
    89102  UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
    90103  SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
    91   LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
     104  QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
     105  VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
     106  LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf
     107  LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
     108  CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
    92109
    93110!ifdef $(SOURCE_DEBUG_ENABLE)
     
    101118  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
    102119  LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
    103   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf 
     120  DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
     121
     122!if $(SECURE_BOOT_ENABLE) == TRUE
     123  PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
     124  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
     125  OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
     126  TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
     127!endif
     128
     129  S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
     130  SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
     131
     132[LibraryClasses.common]
     133!if $(SECURE_BOOT_ENABLE) == TRUE
     134  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
     135!endif
    104136
    105137[LibraryClasses.common.SEC]
    106   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     138  QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf
     139!ifdef $(DEBUG_ON_SERIAL_PORT)
     140  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     141!else
     142  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     143!endif
    107144  ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
    108145  ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
     
    114151  PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
    115152  MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
     153  CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
    116154
    117155[LibraryClasses.common.PEI_CORE]
     
    124162  OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
    125163  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
    126   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     164!ifdef $(DEBUG_ON_SERIAL_PORT)
     165  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     166!else
     167  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     168!endif
    127169  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
    128170
     
    136178  OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
    137179  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
    138   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     180!ifdef $(DEBUG_ON_SERIAL_PORT)
     181  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     182!else
     183  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     184!endif
    139185  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
    140186  PeiResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
     
    149195  MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
    150196  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
    151   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     197!ifdef $(DEBUG_ON_SERIAL_PORT)
     198  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     199!else
     200  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     201!endif
    152202  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
    153203  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
     
    155205  DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
    156206!endif
     207  CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
    157208
    158209[LibraryClasses.common.DXE_RUNTIME_DRIVER]
     
    161212  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
    162213  ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf
    163   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     214!ifdef $(DEBUG_ON_SERIAL_PORT)
     215  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     216!else
     217  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     218!endif
    164219  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
    165220  UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
    166   DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
     221!if $(SECURE_BOOT_ENABLE) == TRUE
     222  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
     223!endif
    167224
    168225[LibraryClasses.common.UEFI_DRIVER]
     
    171228  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
    172229  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
    173   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     230!ifdef $(DEBUG_ON_SERIAL_PORT)
     231  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     232!else
     233  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     234!endif
    174235  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
    175236  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
     
    180241  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
    181242  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
    182   DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
    183243  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
    184   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     244!ifdef $(DEBUG_ON_SERIAL_PORT)
     245  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     246!else
     247  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     248!endif
    185249  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
    186250  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
     
    188252  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
    189253  PlatformBdsLib|OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf
     254  CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
     255  LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf
     256!ifdef $(SOURCE_DEBUG_ENABLE)
     257  DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
     258!endif
    190259
    191260[LibraryClasses.common.UEFI_APPLICATION]
    192261  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
    193262  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
    194   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     263!ifdef $(DEBUG_ON_SERIAL_PORT)
     264  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     265!else
     266  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     267!endif
    195268
    196269################################################################################
     
    206279  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
    207280  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
     281!if $(SECURE_BOOT_ENABLE) == TRUE
     282  gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootEnable|TRUE
     283!endif
    208284
    209285[PcdsFixedAtBuild]
     
    213289  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
    214290  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
    215   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400
     291  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
    216292  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000
    217   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xc000
    218   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0xc000
    219   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x2000
    220   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x10000
     293  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
    221294
    222295  gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
     
    234307!endif
    235308
    236 !if $(BUILD_NEW_SHELL)
     309!ifndef $(USE_OLD_SHELL)
    237310  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
    238 !else
    239 !if $(USE_NEW_SHELL)
    240   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
    241 !endif
    242 !endif
     311!endif
     312
     313[PcdsFixedAtBuild.X64]
     314!if $(SECURE_BOOT_ENABLE) == TRUE
     315  # override the default values from SecurityPkg to ensure images from all sources are verified in secure boot
     316  gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
     317  gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04
     318  gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
     319!endif
     320
     321  # IRQs 5, 9, 10, 11 are level-triggered
     322  gPcAtChipsetPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20
    243323
    244324################################################################################
     
    253333  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
    254334  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
     335  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE
     336  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800
     337  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
    255338
    256339
     
    261344################################################################################
    262345[Components.IA32]
     346  OvmfPkg/ResetVector/ResetVector.inf
     347
    263348  #
    264349  # SEC Phase modules
     
    284369      PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
    285370  }
     371  UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf {
     372    <LibraryClasses>
     373      PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
     374  }
    286375
    287376[Components.X64]
     
    292381    <LibraryClasses>
    293382      NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
     383      DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
    294384  }
    295385
     
    301391
    302392  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
     393
     394!if $(SECURE_BOOT_ENABLE) == TRUE
     395  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
     396    <LibraryClasses>
     397      NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
     398        }
     399!else
    303400  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
     401!endif
     402
    304403  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
    305404  PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
     
    308407  PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
    309408  PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
    310   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
     409  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
     410    <LibraryClasses>
     411      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
     412  }
    311413  PcAtChipsetPkg/KbcResetDxe/Reset.inf
    312414  MdeModulePkg/Universal/Metronome/Metronome.inf {
     
    329431
    330432  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
     433  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
     434  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
     435  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
     436  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
    331437  OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf {
    332438    <LibraryClasses>
     
    340446  MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
    341447  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
    342   MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
     448  MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf {
     449    <LibraryClasses>
     450      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
     451  }
    343452  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
    344   MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
     453  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
     454    <LibraryClasses>
     455      DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
     456      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
     457  }
    345458  MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
    346459  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
     
    353466  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
    354467  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
     468  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
    355469  MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
    356470
     
    379493  #
    380494  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
    381   MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
     495  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
    382496  OvmfPkg/AcpiTables/AcpiTables.inf
     497  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
     498  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
     499  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
    383500
    384501  #
    385502  # Network Support
    386503  #
    387 !if $(NETWORK_ENABLE)
    388504  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
    389505  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
     
    399515  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
    400516  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
    401 !endif
     517  OvmfPkg/VirtioNetDxe/VirtioNet.inf
    402518
    403519  #
     
    411527
    412528!ifdef $(CSM_ENABLE)
    413   IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf
     529  IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf {
     530    <LibraryClasses>
     531      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
     532  }
    414533  IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
    415534  OvmfPkg/Csm/Csm16/Csm16.inf
    416535!endif
    417536
    418 !if $(BUILD_NEW_SHELL)
     537!ifndef $(USE_OLD_SHELL)
    419538  ShellPkg/Application/Shell/Shell.inf {
    420539    <LibraryClasses>
     
    435554#      SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
    436555#      SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf
     556      BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
    437557
    438558    <PcdsFixedAtBuild>
     
    443563!endif
    444564
     565!if $(SECURE_BOOT_ENABLE) == TRUE
     566  SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableRuntimeDxe.inf {
     567    <LibraryClasses>
     568      BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
     569      OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
     570  }
     571  OvmfPkg/SecureBootConfigDxe/SecureBootConfigDxe.inf
     572!endif
     573
     574  OvmfPkg/PlatformDxe/Platform.inf
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgIa32X64.fdf

    r48674 r58459  
    22#  Open Virtual Machine Firmware: FDF
    33#
    4 #  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    55#
    66#  This program and the accompanying materials
     
    1515
    1616################################################################################
     17
     18#
     19# Default flash size for DEBUG build is 2MB. For RELEASE it is 1MB.
     20#
     21# Defining FD_SIZE_1MB or FD_SIZE_2MB on the build command line can
     22# override this.
     23#
     24[Defines]
     25!if $(TARGET) == RELEASE
     26!ifndef $(FD_SIZE_2MB)
     27DEFINE FD_SIZE_1MB=
     28!endif
     29!endif
     30
     31!include OvmfPkg.fdf.inc
     32
     33#
     34# Build the variable store and the firmware code as one unified flash device
     35# image.
     36#
    1737[FD.OVMF]
    18 BaseAddress   = 0xFFF00000
    19 Size          = 0x00100000
     38BaseAddress   = $(FW_BASE_ADDRESS)
     39Size          = $(FW_SIZE)
    2040ErasePolarity = 1
    21 BlockSize     = 0x1000
    22 NumBlocks     = 0x100
    23 
    24 0x00000000|0x000EC000
     41BlockSize     = $(BLOCK_SIZE)
     42NumBlocks     = $(FW_BLOCKS)
     43
     44!include VarStore.fdf.inc
     45
     46$(VARS_SIZE)|$(FVMAIN_SIZE)
    2547FV = FVMAIN_COMPACT
    2648
    27 0x000EC000|0x14000
     49$(SECFV_OFFSET)|$(SECFV_SIZE)
    2850FV = SECFV
    2951
     52#
     53# Build the variable store and the firmware code as separate flash device
     54# images.
     55#
     56[FD.OVMF_VARS]
     57BaseAddress   = $(FW_BASE_ADDRESS)
     58Size          = $(VARS_SIZE)
     59ErasePolarity = 1
     60BlockSize     = $(BLOCK_SIZE)
     61NumBlocks     = $(VARS_BLOCKS)
     62
     63!include VarStore.fdf.inc
     64
     65[FD.OVMF_CODE]
     66BaseAddress   = $(CODE_BASE_ADDRESS)
     67Size          = $(CODE_SIZE)
     68ErasePolarity = 1
     69BlockSize     = $(BLOCK_SIZE)
     70NumBlocks     = $(CODE_BLOCKS)
     71
     720x00000000|$(FVMAIN_SIZE)
     73FV = FVMAIN_COMPACT
     74
     75$(FVMAIN_SIZE)|$(SECFV_SIZE)
     76FV = SECFV
     77
    3078################################################################################
    3179
    3280[FD.MEMFD]
    33 BaseAddress   = 0x800000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase
    34 Size          = 0x500000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
     81BaseAddress   = 0x800000
     82Size          = 0x900000
    3583ErasePolarity = 1
    3684BlockSize     = 0x10000
    37 NumBlocks     = 0x50
    38 
    39 0x0|0x500000
    40 FV = MAINFV
     85NumBlocks     = 0x90
     86
     870x000000|0x006000
     88gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize
     89
     900x006000|0x001000
     91gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageSize
     92
     930x007000|0x001000
     94gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize
     95
     960x010000|0x008000
     97gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize
     98
     990x018000|0x008000
     100gUefiOvmfPkgTokenSpaceGuid.PcdS3AcpiReservedMemoryBase|gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize
     101
     1020x020000|0x0E0000
     103gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize
     104FV = PEIFV
     105
     1060x100000|0x800000
     107gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
     108FV = DXEFV
    41109
    42110################################################################################
     
    65133#
    66134# The code in this FV handles the initial firmware startup, and
    67 # decompresses the MAINFV which handles the majority of the boot sequence.
     135# decompresses the PEI and DXE FVs which handles the rest of the boot sequence.
    68136#
    69137INF  OvmfPkg/Sec/SecMain.inf
    70138
    71 INF  RuleOverride=RESET_VECTOR USE = IA32 UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf
    72 
    73 ################################################################################
    74 [FV.MAINFV]
     139INF  RuleOverride=RESET_VECTOR OvmfPkg/ResetVector/ResetVector.inf
     140
     141################################################################################
     142[FV.PEIFV]
    75143BlockSize          = 0x10000
    76144FvAlignment        = 16
     
    91159READ_LOCK_STATUS   = TRUE
    92160
    93 #
    94 # Files to be placed in MAIN FV
    95 #
    96 # This firmware volume will have files placed in it uncompressed,
    97 # and then then entire firmware volume will be compressed in a
    98 # single compression operation in order to achieve better
    99 # overall compression.
    100 #
    101 
    102161APRIORI PEI {
    103162  INF  MdeModulePkg/Universal/PCD/Pei/Pcd.inf
     
    112171INF  OvmfPkg/PlatformPei/PlatformPei.inf
    113172INF  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
    114 
    115 FILE FV_IMAGE = A4EF5A93-3F1B-4232-A1C4-F0910E6D1D9C {
    116   SECTION COMPRESS PI_NONE {
    117     SECTION FV_IMAGE = DXEFV
    118   }
    119 }
     173INF  UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
    120174
    121175################################################################################
     
    141195
    142196APRIORI DXE {
     197  INF  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
    143198  INF  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
     199  INF  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
    144200}
    145201
     
    166222
    167223INF  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
     224INF  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
     225INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
     226INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
     227INF  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
    168228INF  OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf
    169229INF  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
    170 INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
     230
     231!if $(SECURE_BOOT_ENABLE) == TRUE
     232  INF  SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableRuntimeDxe.inf
     233  INF  OvmfPkg/SecureBootConfigDxe/SecureBootConfigDxe.inf
     234!else
     235  INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
     236!endif
     237
    171238INF  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
    172239INF  MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
     
    188255INF  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
    189256INF  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
     257INF  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
    190258INF  MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
    191259
     
    204272
    205273INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
    206 INF  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
     274INF  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
    207275INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
     276INF  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
     277INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
     278INF  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
    208279
    209280INF  RuleOverride = BINARY USE = X64 FatBinPkg/EnhancedFatDxe/Fat.inf
    210281
    211 !if $(BUILD_NEW_SHELL)
     282!ifndef $(USE_OLD_SHELL)
    212283INF  ShellPkg/Application/Shell/Shell.inf
    213284!else
    214 !if $(USE_NEW_SHELL)
    215 INF  RuleOverride = BINARY USE = X64 ShellBinPkg/UefiShell/UefiShell.inf
    216 !else
    217285INF  RuleOverride = BINARY USE = X64 EdkShellBinPkg/FullShell/FullShell.inf
    218 !endif
    219286!endif
    220287
     
    226293# Network modules
    227294#
    228 !if $(NETWORK_ENABLE)
     295!if $(E1000_ENABLE)
    229296  FILE DRIVER = 5D695E11-9B3F-4b83-B25F-4A8D5D69BE07 {
    230297    SECTION PE32 = Intel3.5/EFIX64/E3507X2.EFI
    231298  }
     299!endif
    232300  INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
    233301  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
     
    243311  INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
    244312  INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
    245 !endif
     313  INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
    246314
    247315#
     
    259327INF  RuleOverride=CSM OvmfPkg/Csm/Csm16/Csm16.inf
    260328!endif
     329
     330INF  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
     331INF  OvmfPkg/PlatformDxe/Platform.inf
    261332
    262333################################################################################
     
    282353FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
    283354   SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
    284      SECTION FV_IMAGE = MAINFV
     355     #
     356     # These firmware volumes will have files placed in them uncompressed,
     357     # and then both firmware volumes will be compressed in a single
     358     # compression operation in order to achieve better overall compression.
     359     #
     360     SECTION FV_IMAGE = PEIFV
     361     SECTION FV_IMAGE = DXEFV
    285362   }
    286363 }
     
    348425    VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
    349426  }
    350  
     427
    351428[Rule.Common.UEFI_APPLICATION]
    352429  FILE APPLICATION = $(NAMED_GUID) {
     
    362439    VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
    363440  }
    364  
     441
    365442[Rule.Common.USER_DEFINED.ACPITABLE]
    366443  FILE FREEFORM = $(NAMED_GUID) {
     
    376453[Rule.Common.SEC.RESET_VECTOR]
    377454  FILE RAW = $(NAMED_GUID) {
    378     RAW RAW                |.raw
    379   }
    380 
    381 [OptionRom.OvmfVideo]
    382 INF  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf {
    383     PCI_DEVICE_ID  = 0x00B8
    384   }
     455    RAW BIN   Align = 16   |.bin
     456  }
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgX64.dsc

    r58189 r58459  
    22#  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
    33#
    4 #  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    55#
    66#  This program and the accompanying materials
     
    3434  FLASH_DEFINITION               = OvmfPkg/OvmfPkgX64.fdf
    3535
     36  #
     37  # Defines for default states.  These can be changed on the command line.
     38  # -D FLAG=VALUE
     39  #
     40  DEFINE SECURE_BOOT_ENABLE      = FALSE
     41
    3642[BuildOptions]
     43  GCC:*_UNIXGCC_*_CC_FLAGS             = -DMDEPKG_NDEBUG
    3744  GCC:RELEASE_*_*_CC_FLAGS             = -DMDEPKG_NDEBUG
    3845  INTEL:RELEASE_*_*_CC_FLAGS           = /D MDEPKG_NDEBUG
    3946  MSFT:RELEASE_*_*_CC_FLAGS            = /D MDEPKG_NDEBUG
    4047  GCC:*_*_*_CC_FLAGS                   = -mno-mmx -mno-sse
     48!ifdef $(SOURCE_DEBUG_ENABLE)
     49  MSFT:*_*_X64_GENFW_FLAGS  = --keepexceptiontable
     50  GCC:*_*_X64_GENFW_FLAGS   = --keepexceptiontable
     51  INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable
     52!endif
    4153
    4254!ifdef $(VBOX)
     
    8597  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
    8698  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
     99  DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
    87100  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
    88101  PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
     
    97110  UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
    98111  UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
    99   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
     112  DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
    100113  NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
    101114  FileHandleLib|ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
     
    108121  UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
    109122  SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
    110   LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
     123  QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
     124  VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
     125  LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf
     126  LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
     127  CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
    111128
    112129!ifdef $(VBOX)
     
    125142  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
    126143  LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
    127   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf 
     144  DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
     145
     146!if $(SECURE_BOOT_ENABLE) == TRUE
     147  PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
     148  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
     149  OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
     150  TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
     151!endif
     152
     153  S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
     154  SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
     155
     156[LibraryClasses.common]
     157!if $(SECURE_BOOT_ENABLE) == TRUE
     158  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
     159!endif
    128160
    129161[LibraryClasses.common.SEC]
    130162!ifndef $(VBOX)
    131   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     163  QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf
     164!ifdef $(DEBUG_ON_SERIAL_PORT)
     165  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     166!else
     167  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     168!endif
    132169!else
    133170  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     
    144181  PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
    145182  MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
     183  CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
    146184
    147185[LibraryClasses.common.PEI_CORE]
     
    172210  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
    173211!ifndef $(VBOX)
    174   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     212!ifdef $(DEBUG_ON_SERIAL_PORT)
     213  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     214!else
     215  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     216!endif
    175217  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
    176218!else
     
    192234  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
    193235!ifndef $(VBOX)
    194   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     236!ifdef $(DEBUG_ON_SERIAL_PORT)
     237  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     238!else
     239  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     240!endif
    195241!else
    196242  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     
    198244  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
    199245  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
    200 !ifdef $(VBOX)
    201246!ifdef $(SOURCE_DEBUG_ENABLE)
    202247  DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
    203248!endif
    204 !endif
     249  CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
    205250
    206251[LibraryClasses.common.DXE_RUNTIME_DRIVER]
     
    210255  ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf
    211256!ifndef $(VBOX)
    212   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     257!ifdef $(DEBUG_ON_SERIAL_PORT)
     258  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     259!else
     260  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     261!endif
    213262!else
    214263  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     
    216265  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
    217266  UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
    218   DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
     267!if $(SECURE_BOOT_ENABLE) == TRUE
     268  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
     269!endif
    219270
    220271[LibraryClasses.common.UEFI_DRIVER]
     
    224275  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
    225276!ifndef $(VBOX)
    226   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     277!ifdef $(DEBUG_ON_SERIAL_PORT)
     278  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     279!else
     280  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     281!endif
    227282!else
    228283  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     
    236291  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
    237292  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
    238   DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
    239293  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
    240294!ifndef $(VBOX)
    241   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     295!ifdef $(DEBUG_ON_SERIAL_PORT)
     296  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     297!else
     298  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     299!endif
    242300!else
    243301  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     
    248306  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
    249307  PlatformBdsLib|OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf
     308  CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
     309  LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf
     310!ifdef $(SOURCE_DEBUG_ENABLE)
     311  DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
     312!endif
    250313
    251314[LibraryClasses.common.UEFI_APPLICATION]
     
    253316  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
    254317!ifndef $(VBOX)
    255   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     318!ifdef $(DEBUG_ON_SERIAL_PORT)
     319  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     320!else
     321  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
     322!endif
    256323!else
    257324  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     
    270337  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
    271338  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
     339!if $(SECURE_BOOT_ENABLE) == TRUE
     340  gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootEnable|TRUE
     341!endif
    272342!ifdef $(VBOX)
    273343  gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeReplayIn|FALSE
     
    281351  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
    282352  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
    283   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400
     353  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
    284354  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000
    285   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xc000
    286   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0xc000
    287   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x2000
    288   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x10000
     355  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000
    289356
    290357  gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
    291358
    292   gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0xff
     359  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
    293360  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000004F
    294361!ifdef $(SOURCE_DEBUG_ENABLE)
     
    302369!endif
    303370
    304 !if $(BUILD_NEW_SHELL)
     371!ifndef $(USE_OLD_SHELL)
    305372  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
    306 !else
    307 !if $(USE_NEW_SHELL)
    308   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
    309 !endif
    310 !endif
     373!endif
     374
     375!if $(SECURE_BOOT_ENABLE) == TRUE
     376  # override the default values from SecurityPkg to ensure images from all sources are verified in secure boot
     377  gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
     378  gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04
     379  gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
     380!endif
     381
     382  # IRQs 5, 9, 10, 11 are level-triggered
     383  gPcAtChipsetPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20
    311384
    312385################################################################################
     
    321394  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
    322395  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
     396  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE
     397!ifndef $(VBOX)
     398  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800
     399  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
     400!else
     401  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1024
     402  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|768
     403!endif
    323404
    324405################################################################################
     
    328409################################################################################
    329410[Components]
     411  OvmfPkg/ResetVector/ResetVector.inf
     412
    330413  #
    331414  # SEC Phase modules
     
    351434      PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
    352435  }
     436  UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf {
     437    <LibraryClasses>
     438      PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
     439  }
    353440
    354441  #
     
    358445    <LibraryClasses>
    359446      NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
     447      DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
    360448  }
    361449
     
    367455
    368456  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
     457
     458!if $(SECURE_BOOT_ENABLE) == TRUE
     459  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
     460    <LibraryClasses>
     461      NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
     462        }
     463!else
    369464  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
     465!endif
     466
    370467  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
    371468  PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
     
    374471  PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
    375472  PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
    376   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
     473  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
     474    <LibraryClasses>
     475      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
     476  }
    377477  PcAtChipsetPkg/KbcResetDxe/Reset.inf
    378478  MdeModulePkg/Universal/Metronome/Metronome.inf {
     
    395495
    396496  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
     497!ifndef $(VBOX)
     498  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
     499  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
     500  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
     501  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
     502!endif
    397503  OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf {
    398504    <LibraryClasses>
     
    410516  MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
    411517  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
    412   MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
     518  MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf {
     519    <LibraryClasses>
     520      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
     521  }
    413522  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
    414   MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
     523  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
     524    <LibraryClasses>
     525      DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
     526      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
     527  }
    415528  MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
    416529  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
     
    423536  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
    424537  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
     538  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
    425539  MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
    426540
     
    465579  #
    466580  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
     581!ifndef $(VBOX)
     582  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
     583  OvmfPkg/AcpiTables/AcpiTables.inf
     584  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
     585  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
     586  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
     587!else
    467588  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
    468 !ifndef $(VBOX)
    469   OvmfPkg/AcpiTables/AcpiTables.inf
    470589!endif
    471590
     
    473592  # Network Support
    474593  #
    475 !if $(NETWORK_ENABLE)
     594!ifndef $(VBOX)
    476595  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
    477596  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
     
    487606  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
    488607  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
     608  OvmfPkg/VirtioNetDxe/VirtioNet.inf
    489609!endif
    490610
     
    501621
    502622!ifdef $(CSM_ENABLE)
    503   IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf
     623  IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf {
     624    <LibraryClasses>
     625      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
     626  }
    504627  IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
    505628  OvmfPkg/Csm/Csm16/Csm16.inf
    506629!endif
    507630
    508 !if $(BUILD_NEW_SHELL)
     631!ifndef $(USE_OLD_SHELL)
    509632  ShellPkg/Application/Shell/Shell.inf {
    510633    <LibraryClasses>
     
    525648#      SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
    526649#      SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf
     650      BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
    527651
    528652    <PcdsFixedAtBuild>
     
    533657!endif
    534658
     659!if $(SECURE_BOOT_ENABLE) == TRUE
     660  SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableRuntimeDxe.inf {
     661    <LibraryClasses>
     662      BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
     663      OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
     664  }
     665  OvmfPkg/SecureBootConfigDxe/SecureBootConfigDxe.inf
     666!endif
     667
     668  OvmfPkg/PlatformDxe/Platform.inf
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgX64.fdf

    r58189 r58459  
    22#  Open Virtual Machine Firmware: FDF
    33#
    4 #  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    55#
    66#  This program and the accompanying materials
     
    1515
    1616################################################################################
     17
     18#
     19# Default flash size for DEBUG build is 2MB. For RELEASE it is 1MB.
     20#
     21# Defining FD_SIZE_1MB or FD_SIZE_2MB on the build command line can
     22# override this.
     23#
     24[Defines]
     25!if $(TARGET) == RELEASE
     26!ifndef $(FD_SIZE_2MB)
     27DEFINE FD_SIZE_1MB=
     28!endif
     29!endif
     30
     31!include OvmfPkg.fdf.inc
     32
     33#
     34# Build the variable store and the firmware code as one unified flash device
     35# image.
     36#
    1737[FD.OVMF]
    18 BaseAddress   = 0xFFF00000
    19 Size          = 0x00100000
     38BaseAddress   = $(FW_BASE_ADDRESS)
     39Size          = $(FW_SIZE)
    2040ErasePolarity = 1
    21 BlockSize     = 0x1000
    22 NumBlocks     = 0x100
    23 
    24 0x00000000|0x000EC000
     41BlockSize     = $(BLOCK_SIZE)
     42NumBlocks     = $(FW_BLOCKS)
     43
     44!include VarStore.fdf.inc
     45
     46$(VARS_SIZE)|$(FVMAIN_SIZE)
    2547FV = FVMAIN_COMPACT
    2648
    27 0x000EC000|0x14000
     49$(SECFV_OFFSET)|$(SECFV_SIZE)
    2850FV = SECFV
    2951
     52#
     53# Build the variable store and the firmware code as separate flash device
     54# images.
     55#
     56[FD.OVMF_VARS]
     57BaseAddress   = $(FW_BASE_ADDRESS)
     58Size          = $(VARS_SIZE)
     59ErasePolarity = 1
     60BlockSize     = $(BLOCK_SIZE)
     61NumBlocks     = $(VARS_BLOCKS)
     62
     63!include VarStore.fdf.inc
     64
     65[FD.OVMF_CODE]
     66BaseAddress   = $(CODE_BASE_ADDRESS)
     67Size          = $(CODE_SIZE)
     68ErasePolarity = 1
     69BlockSize     = $(BLOCK_SIZE)
     70NumBlocks     = $(CODE_BLOCKS)
     71
     720x00000000|$(FVMAIN_SIZE)
     73FV = FVMAIN_COMPACT
     74
     75$(FVMAIN_SIZE)|$(SECFV_SIZE)
     76FV = SECFV
     77
    3078################################################################################
    3179
    3280[FD.MEMFD]
    33 BaseAddress   = 0x2000000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase
    34 Size          = 0x600000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
     81BaseAddress   = 0x800000
     82Size          = 0x900000
    3583ErasePolarity = 1
    3684BlockSize     = 0x10000
    37 NumBlocks     = 0x60
    38 
    39 0x0|0x600000
    40 FV = MAINFV
     85NumBlocks     = 0x90
     86
     870x000000|0x006000
     88gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize
     89
     900x006000|0x001000
     91gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageSize
     92
     930x007000|0x001000
     94gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize
     95
     960x010000|0x008000
     97gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize
     98
     990x018000|0x008000
     100gUefiOvmfPkgTokenSpaceGuid.PcdS3AcpiReservedMemoryBase|gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize
     101
     1020x020000|0x0E0000
     103gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize
     104FV = PEIFV
     105
     1060x100000|0x800000
     107gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
     108FV = DXEFV
    41109
    42110################################################################################
     
    65133#
    66134# The code in this FV handles the initial firmware startup, and
    67 # decompresses the MAINFV which handles the majority of the boot sequence.
     135# decompresses the PEI and DXE FVs which handles the rest of the boot sequence.
    68136#
    69137INF  OvmfPkg/Sec/SecMain.inf
    70138
    71 INF  RuleOverride=RESET_VECTOR UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf
    72 
    73 ################################################################################
    74 [FV.MAINFV]
     139INF  RuleOverride=RESET_VECTOR OvmfPkg/ResetVector/ResetVector.inf
     140
     141################################################################################
     142[FV.PEIFV]
    75143BlockSize          = 0x10000
    76144FvAlignment        = 16
     
    91159READ_LOCK_STATUS   = TRUE
    92160
    93 #
    94 # Files to be placed in MAIN FV
    95 #
    96 # This firmware volume will have files placed in it uncompressed,
    97 # and then then entire firmware volume will be compressed in a
    98 # single compression operation in order to achieve better
    99 # overall compression.
    100 #
    101 
    102161APRIORI PEI {
    103162  INF  MdeModulePkg/Universal/PCD/Pei/Pcd.inf
     
    112171INF  OvmfPkg/PlatformPei/PlatformPei.inf
    113172INF  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
    114 
    115 FILE FV_IMAGE = A4EF5A93-3F1B-4232-A1C4-F0910E6D1D9C {
    116   SECTION COMPRESS PI_NONE {
    117     SECTION FV_IMAGE = DXEFV
    118   }
    119 }
     173INF  UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
    120174
    121175################################################################################
     
    141195
    142196APRIORI DXE {
     197  INF  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
    143198  INF  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
     199  INF  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
    144200}
    145201
     
    166222
    167223INF  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
     224!ifndef $(VBOX)
     225INF  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
     226INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
     227INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
     228INF  OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
     229!endif
    168230INF  OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf
     231!ifndef $(VBOX)
    169232INF  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
    170 !ifndef $(VBOX)
    171 INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
     233!if $(SECURE_BOOT_ENABLE) == TRUE
     234  INF  SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableRuntimeDxe.inf
     235  INF  OvmfPkg/SecureBootConfigDxe/SecureBootConfigDxe.inf
     236!else
     237  INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
     238!endif
    172239!else
    173240INF  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
     
    194261INF  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
    195262INF  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
     263INF  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
    196264INF  MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
    197265
     
    225293INF  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
    226294
     295!ifndef $(VBOX)
     296INF  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
     297INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
     298INF  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
     299INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
     300INF  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
     301!else
    227302INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
    228303INF  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
    229 !ifndef $(VBOX)
    230 INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
    231304!endif
    232305
    233306INF  RuleOverride = BINARY FatBinPkg/EnhancedFatDxe/Fat.inf
    234307
    235 !if $(BUILD_NEW_SHELL)
     308!ifndef $(USE_OLD_SHELL)
    236309INF  ShellPkg/Application/Shell/Shell.inf
    237310!else
    238 !if $(USE_NEW_SHELL)
    239 INF  RuleOverride = BINARY ShellBinPkg/UefiShell/UefiShell.inf
    240 !else
    241311INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
    242 !endif
    243312!endif
    244313
     
    258327# Network modules
    259328#
    260 !if $(NETWORK_ENABLE)
     329!ifndef $(VBOX)
     330!if $(E1000_ENABLE)
    261331  FILE DRIVER = 5D695E11-9B3F-4b83-B25F-4A8D5D69BE07 {
    262332    SECTION PE32 = Intel3.5/EFIX64/E3507X2.EFI
    263333  }
     334!endif
    264335  INF  MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
    265336  INF  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
     
    275346  INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
    276347  INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
     348  INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
    277349!endif
    278350
     
    293365INF  RuleOverride=CSM OvmfPkg/Csm/Csm16/Csm16.inf
    294366!endif
     367
     368!ifndef $(VBOX)
     369INF  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
     370!endif
     371INF  OvmfPkg/PlatformDxe/Platform.inf
    295372
    296373################################################################################
     
    316393FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
    317394   SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
    318      SECTION FV_IMAGE = MAINFV
     395     #
     396     # These firmware volumes will have files placed in them uncompressed,
     397     # and then both firmware volumes will be compressed in a single
     398     # compression operation in order to achieve better overall compression.
     399     #
     400     SECTION FV_IMAGE = PEIFV
     401     SECTION FV_IMAGE = DXEFV
    319402   }
    320403 }
     
    382465    VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
    383466  }
    384  
     467
    385468[Rule.Common.UEFI_APPLICATION]
    386469  FILE APPLICATION = $(NAMED_GUID) {
     
    396479    VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
    397480  }
    398  
     481
    399482[Rule.Common.USER_DEFINED.ACPITABLE]
    400483  FILE FREEFORM = $(NAMED_GUID) {
     
    410493[Rule.Common.SEC.RESET_VECTOR]
    411494  FILE RAW = $(NAMED_GUID) {
    412     RAW RAW                |.raw
    413   }
    414 
    415 !ifndef $(VBOX)
    416 [OptionRom.OvmfVideo]
    417 INF  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf {
    418     PCI_DEVICE_ID  = 0x00B8
    419   }
    420 !endif
     495    RAW BIN   Align = 16   |.bin
     496  }
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/PlatformPei/Fv.c

    r48674 r58459  
    22  Build FV related hobs for platform.
    33
    4   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    1414
    1515#include "PiPei.h"
     16#include "Platform.h"
    1617#include <Library/DebugLib.h>
    1718#include <Library/HobLib.h>
     
    2122
    2223/**
    23   Perform a call-back into the SEC simulator to get address of the Firmware Hub
    24 
    25   @param  FfsHeader     Ffs Header availible to every PEIM
    26   @param  PeiServices   General purpose services available to every PEIM.
     24  Publish PEI & DXE (Decompressed) Memory based FVs to let PEI
     25  and DXE know about them.
    2726
    2827  @retval EFI_SUCCESS   Platform PEI FVs were initialized successfully.
     
    3433  )
    3534{
    36   DEBUG ((EFI_D_ERROR, "Platform PEI Firmware Volume Initialization\n"));
     35  DEBUG ((EFI_D_INFO, "Platform PEI Firmware Volume Initialization\n"));
    3736
    38   DEBUG (
    39     (EFI_D_ERROR, "Firmware Volume HOB: 0x%x 0x%x\n",
    40       PcdGet32 (PcdOvmfMemFvBase),
    41       PcdGet32 (PcdOvmfMemFvSize)
    42       )
     37  //
     38  // Create a memory allocation HOB for the PEI FV.
     39  //
     40  // Allocate as ACPI NVS is S3 is supported
     41  //
     42  BuildMemoryAllocationHob (
     43    PcdGet32 (PcdOvmfPeiMemFvBase),
     44    PcdGet32 (PcdOvmfPeiMemFvSize),
     45    mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData
    4346    );
    4447
    45   BuildFvHob (PcdGet32 (PcdOvmfMemFvBase), PcdGet32 (PcdOvmfMemFvSize));
     48  //
     49  // Let DXE know about the DXE FV
     50  //
     51  BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase), PcdGet32 (PcdOvmfDxeMemFvSize));
    4652
    4753  //
    48   // Create a memory allocation HOB.
     54  // Create a memory allocation HOB for the DXE FV.
    4955  //
    5056  BuildMemoryAllocationHob (
    51     PcdGet32 (PcdOvmfMemFvBase),
    52     PcdGet32 (PcdOvmfMemFvSize),
     57    PcdGet32 (PcdOvmfDxeMemFvBase),
     58    PcdGet32 (PcdOvmfDxeMemFvSize),
    5359    EfiBootServicesData
     60    );
     61
     62  //
     63  // Let PEI know about the DXE FV so it can find the DXE Core
     64  //
     65  PeiServicesInstallFvInfoPpi (
     66    NULL,
     67    (VOID *)(UINTN) PcdGet32 (PcdOvmfDxeMemFvBase),
     68    PcdGet32 (PcdOvmfDxeMemFvSize),
     69    NULL,
     70    NULL
    5471    );
    5572
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/PlatformPei/MemDetect.c

    r58173 r58459  
    22  Memory Detection for Virtual Machines.
    33
    4   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    2525// The Library classes this module consumes
    2626//
     27#include <Library/BaseMemoryLib.h>
    2728#include <Library/DebugLib.h>
    2829#include <Library/HobLib.h>
     
    3637#include "Cmos.h"
    3738
    38 STATIC
    39 UINTN
     39UINT32
    4040GetSystemMemorySizeBelow4gb (
     41  VOID
    4142  )
    4243{
     
    8485}
    8586
    86 
    8787/**
    88   Peform Memory Detection
     88  Publish PEI core memory
    8989
    9090  @return EFI_SUCCESS     The PEIM initialized successfully.
    9191
    9292**/
    93 EFI_PHYSICAL_ADDRESS
    94 MemDetect (
     93EFI_STATUS
     94PublishPeiMemory (
     95  VOID
    9596  )
    9697{
     
    99100  UINT64                      MemorySize;
    100101  UINT64                      LowerMemorySize;
    101   UINT64                      UpperMemorySize;
    102 
    103   DEBUG ((EFI_D_ERROR, "MemDetect called\n"));
    104 
    105   //
    106   // Determine total memory size available
    107   //
    108   LowerMemorySize = GetSystemMemorySizeBelow4gb ();
    109   UpperMemorySize = GetSystemMemorySizeAbove4gb ();
    110 
    111   //
    112   // Determine the range of memory to use during PEI
    113   //
    114   MemoryBase = PcdGet32 (PcdOvmfMemFvBase) + PcdGet32 (PcdOvmfMemFvSize);
    115   MemorySize = LowerMemorySize - MemoryBase;
    116   if (MemorySize > SIZE_64MB) {
    117     MemoryBase = LowerMemorySize - SIZE_64MB;
    118     MemorySize = SIZE_64MB;
     102
     103  if (mBootMode == BOOT_ON_S3_RESUME) {
     104    MemoryBase = PcdGet32 (PcdS3AcpiReservedMemoryBase);
     105    MemorySize = PcdGet32 (PcdS3AcpiReservedMemorySize);
     106  } else {
     107    LowerMemorySize = GetSystemMemorySizeBelow4gb ();
     108
     109    //
     110    // Determine the range of memory to use during PEI
     111    //
     112    MemoryBase = PcdGet32 (PcdOvmfDxeMemFvBase) + PcdGet32 (PcdOvmfDxeMemFvSize);
     113    MemorySize = LowerMemorySize - MemoryBase;
     114    if (MemorySize > SIZE_64MB) {
     115      MemoryBase = LowerMemorySize - SIZE_64MB;
     116      MemorySize = SIZE_64MB;
     117    }
    119118  }
    120119#ifdef VBOX
     
    128127  ASSERT_EFI_ERROR (Status);
    129128
     129  return Status;
     130}
     131
     132
     133#ifndef VBOX
     134/**
     135  Peform Memory Detection for QEMU / KVM
     136
     137**/
     138STATIC
     139VOID
     140QemuInitializeRam (
     141  VOID
     142  )
     143{
     144  UINT64                      LowerMemorySize;
     145  UINT64                      UpperMemorySize;
     146
     147  DEBUG ((EFI_D_INFO, "%a called\n", __FUNCTION__));
     148
     149  //
     150  // Determine total memory size available
     151  //
     152  LowerMemorySize = GetSystemMemorySizeBelow4gb ();
     153  UpperMemorySize = GetSystemMemorySizeAbove4gb ();
     154
     155  if (mBootMode != BOOT_ON_S3_RESUME) {
     156    //
     157    // Create memory HOBs
     158    //
     159    AddMemoryRangeHob (BASE_1MB, LowerMemorySize);
     160    AddMemoryRangeHob (0, BASE_512KB + BASE_128KB);
     161  }
     162
     163  MtrrSetMemoryAttribute (BASE_1MB, LowerMemorySize - BASE_1MB, CacheWriteBack);
     164
     165  MtrrSetMemoryAttribute (0, BASE_512KB + BASE_128KB, CacheWriteBack);
     166
     167  if (UpperMemorySize != 0) {
     168    if (mBootMode != BOOT_ON_S3_RESUME) {
     169      AddUntestedMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
     170    }
     171
     172    MtrrSetMemoryAttribute (BASE_4GB, UpperMemorySize, CacheWriteBack);
     173  }
     174}
     175#else
     176VOID
     177VBoxInitializeRam (
     178  VOID
     179  )
     180{
     181  UINT64                      LowerMemorySize;
     182  UINT64                      UpperMemorySize;
     183  EFI_PHYSICAL_ADDRESS        MemoryBase;
     184  UINT64                      MemorySize;
     185
     186  DEBUG ((EFI_D_INFO, "%a called\n", __FUNCTION__));
     187
     188  //
     189  // Determine total memory size available
     190  //
     191  LowerMemorySize = GetSystemMemorySizeBelow4gb ();
     192  UpperMemorySize = GetSystemMemorySizeAbove4gb ();
     193
     194  if (mBootMode == BOOT_ON_S3_RESUME) {
     195    MemoryBase = PcdGet32 (PcdS3AcpiReservedMemoryBase);
     196    MemorySize = PcdGet32 (PcdS3AcpiReservedMemorySize);
     197  } else {
     198    LowerMemorySize = GetSystemMemorySizeBelow4gb ();
     199
     200    //
     201    // Determine the range of memory to use during PEI
     202    //
     203    MemoryBase = PcdGet32 (PcdOvmfDxeMemFvBase) + PcdGet32 (PcdOvmfDxeMemFvSize);
     204    MemorySize = LowerMemorySize - MemoryBase;
     205    if (MemorySize > SIZE_64MB) {
     206      MemoryBase = LowerMemorySize - SIZE_64MB;
     207      MemorySize = SIZE_64MB;
     208    }
     209  }
     210  MemorySize -= BASE_64KB; /* Reserves 64KB for ACPI tables. */
     211
    130212  //
    131213  // Create memory HOBs
     
    133215  AddMemoryBaseSizeHob (MemoryBase, MemorySize);
    134216  AddMemoryRangeHob (BASE_1MB, MemoryBase);
     217  MtrrSetMemoryAttribute (BASE_1MB, MemoryBase + MemorySize - BASE_1MB, CacheWriteBack);
     218  AddMemoryRangeHob (0, BASE_512KB + BASE_128KB);
     219  MtrrSetMemoryAttribute (0, BASE_512KB + BASE_128KB, CacheWriteBack);
     220
     221  if (UpperMemorySize != 0) {
     222      AddUntestedMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
     223
     224    MtrrSetMemoryAttribute (BASE_4GB, UpperMemorySize, CacheWriteBack);
     225  }
     226}
     227#endif
     228
     229/**
     230  Publish system RAM and reserve memory regions
     231
     232**/
     233VOID
     234InitializeRamRegions (
     235  VOID
     236  )
     237{
    135238#ifndef VBOX
    136   AddMemoryRangeHob (0, BASE_512KB + BASE_128KB);
     239  if (!mXen) {
     240    QemuInitializeRam ();
     241  } else {
     242    XenPublishRamRegions ();
     243  }
     244#else
     245  VBoxInitializeRam();
    137246#endif
    138247
    139   MtrrSetMemoryAttribute (BASE_1MB, MemoryBase + MemorySize - BASE_1MB, CacheWriteBack);
    140 
    141 #ifdef VBOX
    142   AddMemoryRangeHob (0, BASE_512KB + BASE_128KB);
     248  if (mS3Supported && mBootMode != BOOT_ON_S3_RESUME) {
     249    //
     250    // This is the memory range that will be used for PEI on S3 resume
     251    //
     252    BuildMemoryAllocationHob (
     253      (EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdS3AcpiReservedMemoryBase),
     254      (UINT64)(UINTN) PcdGet32 (PcdS3AcpiReservedMemorySize),
     255      EfiACPIMemoryNVS
     256      );
     257
     258    //
     259    // Cover the initial RAM area used as stack and temporary PEI heap.
     260    //
     261    // This is reserved as ACPI NVS so it can be used on S3 resume.
     262    //
     263    BuildMemoryAllocationHob (
     264      PcdGet32 (PcdOvmfSecPeiTempRamBase),
     265      PcdGet32 (PcdOvmfSecPeiTempRamSize),
     266      EfiACPIMemoryNVS
     267      );
     268
     269    //
     270    // SEC stores its table of GUIDed section handlers here.
     271    //
     272    BuildMemoryAllocationHob (
     273      PcdGet64 (PcdGuidedExtractHandlerTableAddress),
     274      PcdGet32 (PcdGuidedExtractHandlerTableSize),
     275      EfiACPIMemoryNVS
     276      );
     277
     278#ifdef MDE_CPU_X64
     279    //
     280    // Reserve the initial page tables built by the reset vector code.
     281    //
     282    // Since this memory range will be used by the Reset Vector on S3
     283    // resume, it must be reserved as ACPI NVS.
     284    //
     285    BuildMemoryAllocationHob (
     286      (EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdOvmfSecPageTablesBase),
     287      (UINT64)(UINTN) PcdGet32 (PcdOvmfSecPageTablesSize),
     288      EfiACPIMemoryNVS
     289      );
    143290#endif
    144   MtrrSetMemoryAttribute (0, BASE_512KB + BASE_128KB, CacheWriteBack);
    145 
    146   if (UpperMemorySize != 0) {
    147     AddUntestedMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
    148 
    149     MtrrSetMemoryAttribute (BASE_4GB, UpperMemorySize, CacheWriteBack);
    150   }
    151 
    152   return MemoryBase + MemorySize;
    153 }
    154 
     291  }
     292
     293  if (mBootMode != BOOT_ON_S3_RESUME) {
     294    //
     295    // Reserve the lock box storage area
     296    //
     297    // Since this memory range will be used on S3 resume, it must be
     298    // reserved as ACPI NVS.
     299    //
     300    // If S3 is unsupported, then various drivers might still write to the
     301    // LockBox area. We ought to prevent DXE from serving allocation requests
     302    // such that they would overlap the LockBox storage.
     303    //
     304    ZeroMem (
     305      (VOID*)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),
     306      (UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize)
     307      );
     308    BuildMemoryAllocationHob (
     309      (EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),
     310      (UINT64)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize),
     311      mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData
     312      );
     313  }
     314}
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/PlatformPei/Platform.c

    r58174 r58459  
    22  Platform PEI driver
    33
    4   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    55  Copyright (c) 2011, Andrei Warkentin <[email protected]>
    66
     
    3131#include <Library/PeimEntryPoint.h>
    3232#include <Library/PeiServicesLib.h>
     33#include <Library/QemuFwCfgLib.h>
    3334#include <Library/ResourcePublicationLib.h>
    3435#include <Guid/MemoryTypeInformation.h>
    3536#include <Ppi/MasterBootMode.h>
     37#include <IndustryStandard/Pci22.h>
    3638
    3739#include "Platform.h"
     
    5961
    6062
     63EFI_BOOT_MODE mBootMode = BOOT_WITH_FULL_CONFIGURATION;
     64
     65BOOLEAN mS3Supported = FALSE;
     66
     67
    6168VOID
    6269AddIoMemoryBaseSizeHob (
     
    210217}
    211218
    212 
    213219VOID
    214220MemMapInitialization (
    215   EFI_PHYSICAL_ADDRESS  TopOfMemory
     221  VOID
    216222  )
    217223{
     
    241247
    242248  //
    243   // Add PCI MMIO space available to PCI resource allocations
    244   //
    245   if (TopOfMemory < BASE_2GB) {
    246     AddIoMemoryBaseSizeHob (BASE_2GB, 0xFC000000 - BASE_2GB);
    247   } else {
    248     AddIoMemoryBaseSizeHob (TopOfMemory, 0xFC000000 - TopOfMemory);
    249   }
    250 
    251   //
    252   // Local APIC range
    253   //
    254   AddIoMemoryBaseSizeHob (0xFEC80000, SIZE_512KB);
    255 
    256   //
    257   // I/O APIC range
    258   //
    259   AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_512KB);
    260 
    261   //
    262249  // Video memory + Legacy BIOS region
    263250#ifdef VBOX
     
    267254  AddIoMemoryRangeHob (0x0A0000, BASE_1MB);
    268255
     256  if (!mXen) {
     257    UINT32  TopOfLowRam;
     258    TopOfLowRam = GetSystemMemorySizeBelow4gb ();
     259
     260    //
     261    // address       purpose   size
     262    // ------------  --------  -------------------------
     263    // max(top, 2g)  PCI MMIO  0xFC000000 - max(top, 2g)
     264    // 0xFC000000    gap                           44 MB
     265    // 0xFEC00000    IO-APIC                        4 KB
     266    // 0xFEC01000    gap                         1020 KB
     267    // 0xFED00000    HPET                           1 KB
     268    // 0xFED00400    gap                         1023 KB
     269    // 0xFEE00000    LAPIC                          1 MB
     270    //
     271    AddIoMemoryRangeHob (TopOfLowRam < BASE_2GB ?
     272                         BASE_2GB : TopOfLowRam, 0xFC000000);
     273    AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB);
     274    AddIoMemoryBaseSizeHob (0xFED00000, SIZE_1KB);
     275    AddIoMemoryBaseSizeHob (PcdGet32(PcdCpuLocalApicBaseAddress), SIZE_1MB);
     276  }
     277
    269278#ifdef VBOX
    270279  //
     
    284293VOID
    285294MiscInitialization (
    286   BOOLEAN Xen
     295  VOID
    287296  )
    288297{
     
    297306  BuildCpuHob (36, 16);
    298307
    299   if (!Xen) {
    300     //
    301     // Set the PM I/O base address to 0x400
    302     //
    303     PciAndThenOr32 (PCI_LIB_ADDRESS (0, 1, 3, 0x40), (UINT32) ~0xfc0, 0x400);
     308  //
     309  // If PMREGMISC/PMIOSE is set, assume the ACPI PMBA has been configured (for
     310  // example by Xen) and skip the setup here. This matches the logic in
     311  // AcpiTimerLibConstructor ().
     312  //
     313  if ((PciRead8 (PCI_LIB_ADDRESS (0, 1, 3, 0x80)) & 0x01) == 0) {
     314    //
     315    // The PEI phase should be exited with fully accessibe PIIX4 IO space:
     316    // 1. set PMBA
     317    //
     318    PciAndThenOr32 (
     319      PCI_LIB_ADDRESS (0, 1, 3, 0x40),
     320      (UINT32) ~0xFFC0,
     321      PcdGet16 (PcdAcpiPmBaseAddress)
     322      );
     323
     324    //
     325    // 2. set PCICMD/IOSE
     326    //
     327    PciOr8 (
     328      PCI_LIB_ADDRESS (0, 1, 3, PCI_COMMAND_OFFSET),
     329      EFI_PCI_COMMAND_IO_SPACE
     330      );
     331
     332    //
     333    // 3. set PMREGMISC/PMIOSE
     334    //
     335    PciOr8 (PCI_LIB_ADDRESS (0, 1, 3, 0x80), 0x01);
    304336  }
    305337}
     
    308340VOID
    309341BootModeInitialization (
    310   )
    311 {
    312   EFI_STATUS Status;
    313 
    314   Status = PeiServicesSetBootMode (BOOT_WITH_FULL_CONFIGURATION);
     342  VOID
     343  )
     344{
     345  EFI_STATUS    Status;
     346
     347  if (CmosRead8 (0xF) == 0xFE) {
     348    mBootMode = BOOT_ON_S3_RESUME;
     349  }
     350
     351  Status = PeiServicesSetBootMode (mBootMode);
    315352  ASSERT_EFI_ERROR (Status);
    316353
     
    334371  VariableStore =
    335372    (EFI_PHYSICAL_ADDRESS)(UINTN)
    336       AllocateRuntimePool (
    337         2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)
     373      AllocateAlignedRuntimePages (
     374        EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)),
     375        PcdGet32 (PcdFlashNvStorageFtwSpareSize)
    338376        );
    339377  DEBUG ((EFI_D_INFO,
     
    383421  )
    384422{
    385 #ifndef VBOX
    386   EFI_STATUS            Status;
    387 #endif
    388   EFI_PHYSICAL_ADDRESS  TopOfMemory;
    389   BOOLEAN               Xen;
    390 
    391423  DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));
    392424
    393425  DebugDumpCmos ();
    394426
    395   TopOfMemory = MemDetect ();
    396 
    397 #ifndef VBOX
    398   Status = InitializeXen ();
    399   Xen = EFI_ERROR (Status) ? FALSE : TRUE;
    400 #else
    401   Xen = FALSE;
    402 #endif
    403 
    404   ReserveEmuVariableNvStore ();
    405 
    406   PeiFvInitialization ();
    407 
    408   MemMapInitialization (TopOfMemory);
    409 
    410   MiscInitialization (Xen);
     427  XenDetect ();
     428
     429  if (QemuFwCfgS3Enabled ()) {
     430    DEBUG ((EFI_D_INFO, "S3 support was detected on QEMU\n"));
     431    mS3Supported = TRUE;
     432  }
    411433
    412434  BootModeInitialization ();
    413435
     436  PublishPeiMemory ();
     437
     438  InitializeRamRegions ();
     439
     440  if (mXen) {
     441    DEBUG ((EFI_D_INFO, "Xen was detected\n"));
     442    InitializeXen ();
     443  }
     444
     445  if (mBootMode != BOOT_ON_S3_RESUME) {
     446    ReserveEmuVariableNvStore ();
     447
     448    PeiFvInitialization ();
     449
     450    MemMapInitialization ();
     451  }
     452
     453  MiscInitialization ();
     454
    414455  return EFI_SUCCESS;
    415456}
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/PlatformPei/Platform.h

    r48674 r58459  
    22  Platform PEI module include file.
    33
    4   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    1515#ifndef _PLATFORM_PEI_H_INCLUDED_
    1616#define _PLATFORM_PEI_H_INCLUDED_
     17
     18#include <IndustryStandard/E820.h>
    1719
    1820VOID
     
    5860  );
    5961
    60 EFI_PHYSICAL_ADDRESS
    61 MemDetect (
     62EFI_STATUS
     63PublishPeiMemory (
     64  VOID
     65  );
     66
     67UINT32
     68GetSystemMemorySizeBelow4gb (
     69  VOID
     70  );
     71
     72VOID
     73InitializeRamRegions (
    6274  VOID
    6375  );
     
    7385  );
    7486
     87BOOLEAN
     88XenDetect (
     89  VOID
     90  );
     91
     92extern BOOLEAN mXen;
     93
     94VOID
     95XenPublishRamRegions (
     96  VOID
     97  );
     98
     99extern EFI_BOOT_MODE mBootMode;
     100
     101extern BOOLEAN mS3Supported;
     102
    75103#endif // _PLATFORM_PEI_H_INCLUDED_
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/PlatformPei/PlatformPei.inf

    r48674 r58459  
    33#
    44#  This module provides platform specific function to detect boot mode.
    5 #  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     5#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    66#
    77#  This program and the accompanying materials
     
    3737
    3838[Packages]
     39  IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
    3940  MdePkg/MdePkg.dec
    4041  MdeModulePkg/MdeModulePkg.dec
     
    5556  PeiServicesTablePointerLib
    5657  PeimEntryPoint
     58  QemuFwCfgLib
    5759  MtrrLib
     60  PcdLib
    5861
    5962[Pcd]
    60   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase
    61   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
     63  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase
     64  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize
     65  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase
     66  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
     67  gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress
     68  gUefiOvmfPkgTokenSpaceGuid.PcdS3AcpiReservedMemoryBase
     69  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase
     70  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize
     71  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase
     72  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize
     73  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase
     74  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageSize
     75  gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize
     76  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize
     77  gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress
    6278  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize
    6379  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
    6480  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
    6581  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
     82  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
     83  gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress
    6684
    6785[Ppis]
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/PlatformPei/Xen.c

    r48674 r58459  
    22  Xen Platform PEI support
    33
    4   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    55  Copyright (c) 2011, Andrei Warkentin <[email protected]>
    66
     
    2828#include <Library/PcdLib.h>
    2929#include <Guid/XenInfo.h>
     30#include <IndustryStandard/E820.h>
     31#include <Library/ResourcePublicationLib.h>
     32#include <Library/MtrrLib.h>
    3033
    3134#include "Platform.h"
     35#include "Xen.h"
     36
     37BOOLEAN mXen = FALSE;
     38
     39STATIC UINT32 mXenLeaf = 0;
    3240
    3341EFI_XEN_INFO mXenInfo;
    3442
     43/**
     44  Returns E820 map provided by Xen
     45
     46  @param Entries      Pointer to E820 map
     47  @param Count        Number of entries
     48
     49  @return EFI_STATUS
     50**/
     51EFI_STATUS
     52XenGetE820Map (
     53  EFI_E820_ENTRY64 **Entries,
     54  UINT32 *Count
     55  )
     56{
     57  EFI_XEN_OVMF_INFO *Info =
     58    (EFI_XEN_OVMF_INFO *)(UINTN) OVMF_INFO_PHYSICAL_ADDRESS;
     59
     60  if (AsciiStrCmp ((CHAR8 *) Info->Signature, "XenHVMOVMF")) {
     61    return EFI_NOT_FOUND;
     62  }
     63
     64  ASSERT (Info->E820 < MAX_ADDRESS);
     65  *Entries = (EFI_E820_ENTRY64 *)(UINTN) Info->E820;
     66  *Count = Info->E820EntriesCount;
     67
     68  return EFI_SUCCESS;
     69}
    3570
    3671/**
     
    85120  Figures out if we are running inside Xen HVM.
    86121
    87   @return UINT32     CPUID index used to connect to HV.
    88 
    89 **/
    90 UINT32
     122  @retval TRUE   Xen was detected
     123  @retval FALSE  Xen was not detected
     124
     125**/
     126BOOLEAN
    91127XenDetect (
    92128  VOID
    93129  )
    94130{
    95 
    96   UINT32 XenLeaf;
    97131  UINT8 Signature[13];
    98132
    99   for (XenLeaf = 0x40000000; XenLeaf < 0x40010000; XenLeaf += 0x100) {
    100     AsmCpuid (XenLeaf, NULL, (UINT32 *) &Signature[0],
     133  if (mXenLeaf != 0) {
     134    return TRUE;
     135  }
     136
     137  Signature[12] = '\0';
     138  for (mXenLeaf = 0x40000000; mXenLeaf < 0x40010000; mXenLeaf += 0x100) {
     139    AsmCpuid (mXenLeaf,
     140              NULL,
     141              (UINT32 *) &Signature[0],
    101142              (UINT32 *) &Signature[4],
    102143              (UINT32 *) &Signature[8]);
    103     Signature[12] = '\0';
    104144
    105145    if (!AsciiStrCmp ((CHAR8 *) Signature, "XenVMMXenVMM")) {
    106       return XenLeaf;
     146      mXen = TRUE;
     147      return TRUE;
    107148    }
    108149  }
    109150
    110   return 0;
    111 }
     151  mXenLeaf = 0;
     152  return FALSE;
     153}
     154
     155
     156VOID
     157XenPublishRamRegions (
     158  VOID
     159  )
     160{
     161  EFI_E820_ENTRY64  *E820Map;
     162  UINT32            E820EntriesCount;
     163  EFI_STATUS        Status;
     164
     165  if (!mXen) {
     166    return;
     167  }
     168
     169  DEBUG ((EFI_D_INFO, "Using memory map provided by Xen\n"));
     170
     171  //
     172  // Parse RAM in E820 map
     173  //
     174  Status = XenGetE820Map (&E820Map, &E820EntriesCount);
     175
     176  ASSERT_EFI_ERROR (Status);
     177
     178  if (E820EntriesCount > 0) {
     179    EFI_E820_ENTRY64 *Entry;
     180    UINT32 Loop;
     181
     182    for (Loop = 0; Loop < E820EntriesCount; Loop++) {
     183      Entry = E820Map + Loop;
     184
     185      //
     186      // Only care about RAM
     187      //
     188      if (Entry->Type != EfiAcpiAddressRangeMemory) {
     189        continue;
     190      }
     191
     192      if (Entry->BaseAddr >= BASE_4GB) {
     193        AddUntestedMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length);
     194      } else {
     195        AddMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length);
     196      }
     197
     198      MtrrSetMemoryAttribute (Entry->BaseAddr, Entry->Length, CacheWriteBack);
     199    }
     200  }
     201}
     202
    112203
    113204/**
     
    123214  )
    124215{
    125   UINT32 XenLeaf;
    126 
    127   XenLeaf = XenDetect ();
    128 
    129   if (XenLeaf == 0) {
     216  if (mXenLeaf == 0) {
    130217    return EFI_NOT_FOUND;
    131218  }
    132219
    133   DEBUG ((EFI_D_INFO, "Xen was detected\n"));
    134 
    135   XenConnect (XenLeaf);
     220  XenConnect (mXenLeaf);
    136221
    137222  //
     
    141226  AddReservedMemoryBaseSizeHob (0xFC000000, 0x1000000);
    142227
     228  PcdSetBool (PcdPciDisableBusEnumeration, TRUE);
     229
    143230  return EFI_SUCCESS;
    144231}
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/QemuVideoDxe/Driver.c

    r48674 r58459  
    1616
    1717#include "Qemu.h"
     18#include <IndustryStandard/Acpi.h>
    1819
    1920EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding = {
     
    2627};
    2728
     29QEMU_VIDEO_CARD gQemuVideoCardList[] = {
     30    {
     31        CIRRUS_LOGIC_VENDOR_ID,
     32        CIRRUS_LOGIC_5430_DEVICE_ID,
     33        QEMU_VIDEO_CIRRUS_5430,
     34        L"Cirrus 5430"
     35    },{
     36        CIRRUS_LOGIC_VENDOR_ID,
     37        CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID,
     38        QEMU_VIDEO_CIRRUS_5430,
     39        L"Cirrus 5430"
     40    },{
     41        CIRRUS_LOGIC_VENDOR_ID,
     42        CIRRUS_LOGIC_5446_DEVICE_ID,
     43        QEMU_VIDEO_CIRRUS_5446,
     44        L"Cirrus 5446"
     45    },{
     46        0x1234,
     47        0x1111,
     48        QEMU_VIDEO_BOCHS_MMIO,
     49        L"QEMU Standard VGA"
     50    },{
     51        0x1b36,
     52        0x0100,
     53        QEMU_VIDEO_BOCHS,
     54        L"QEMU QXL VGA"
     55    },{
     56        0 /* end of list */
     57    }
     58};
     59
     60static QEMU_VIDEO_CARD*
     61QemuVideoDetect(
     62  IN UINT16 VendorId,
     63  IN UINT16 DeviceId
     64  )
     65{
     66  UINTN Index = 0;
     67
     68  while (gQemuVideoCardList[Index].VendorId != 0) {
     69    if (gQemuVideoCardList[Index].VendorId == VendorId &&
     70        gQemuVideoCardList[Index].DeviceId == DeviceId) {
     71      return gQemuVideoCardList + Index;
     72    }
     73    Index++;
     74  }
     75  return NULL;
     76}
     77
    2878/**
    2979  Check if this device is supported.
     
    4898  EFI_PCI_IO_PROTOCOL *PciIo;
    4999  PCI_TYPE00          Pci;
    50   EFI_DEV_PATH        *Node;
     100  QEMU_VIDEO_CARD     *Card;
    51101
    52102  //
     
    80130
    81131  Status = EFI_UNSUPPORTED;
    82   //
    83   // See if the I/O enable is on.  Most systems only allow one VGA device to be turned on
    84   // at a time, so see if this is one that is turned on.
    85   //
    86   //  if (((Pci.Hdr.Command & 0x01) == 0x01)) {
    87   //
    88   // See if this is a Cirrus Logic PCI controller
    89   //
    90   if (Pci.Hdr.VendorId == CIRRUS_LOGIC_VENDOR_ID) {
    91     //
    92     // See if this is a 5430 or a 5446 PCI controller
    93     //
    94     if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_DEVICE_ID ||
    95         Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID ||
    96         Pci.Hdr.DeviceId == CIRRUS_LOGIC_5446_DEVICE_ID) {
    97        
    98       Status = EFI_SUCCESS;
    99       //
    100       // If this is an Intel 945 graphics controller,
    101       // go further check RemainingDevicePath validation
    102       //
    103       if (RemainingDevicePath != NULL) {
    104         Node = (EFI_DEV_PATH *) RemainingDevicePath;
    105         //
    106         // Check if RemainingDevicePath is the End of Device Path Node,
    107         // if yes, return EFI_SUCCESS
    108         //
    109         if (!IsDevicePathEnd (Node)) {
    110           //
    111           // If RemainingDevicePath isn't the End of Device Path Node,
    112           // check its validation
    113           //
    114           if (Node->DevPath.Type != ACPI_DEVICE_PATH ||
    115               Node->DevPath.SubType != ACPI_ADR_DP ||
    116               DevicePathNodeLength(&Node->DevPath) != sizeof(ACPI_ADR_DEVICE_PATH)) {
    117             Status = EFI_UNSUPPORTED;
    118           }
    119         }
    120       }
    121     }
     132  Card = QemuVideoDetect(Pci.Hdr.VendorId, Pci.Hdr.DeviceId);
     133  if (Card != NULL) {
     134    DEBUG ((EFI_D_INFO, "QemuVideo: %s detected\n", Card->Name));
     135    Status = EFI_SUCCESS;
    122136  }
    123137
     
    157171  )
    158172{
    159   EFI_STATUS                      Status;
    160   QEMU_VIDEO_PRIVATE_DATA  *Private;
    161   BOOLEAN                         PciAttributesSaved;
    162   EFI_DEVICE_PATH_PROTOCOL        *ParentDevicePath;
    163   ACPI_ADR_DEVICE_PATH            AcpiDeviceNode;
    164 
    165   PciAttributesSaved = FALSE;
     173  EFI_TPL                           OldTpl;
     174  EFI_STATUS                        Status;
     175  QEMU_VIDEO_PRIVATE_DATA           *Private;
     176  BOOLEAN                           IsQxl;
     177  EFI_DEVICE_PATH_PROTOCOL          *ParentDevicePath;
     178  ACPI_ADR_DEVICE_PATH              AcpiDeviceNode;
     179  PCI_TYPE00                        Pci;
     180  QEMU_VIDEO_CARD                   *Card;
     181  EFI_PCI_IO_PROTOCOL               *ChildPciIo;
     182
     183  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
     184
    166185  //
    167186  // Allocate Private context data for GOP inteface.
     
    170189  if (Private == NULL) {
    171190    Status = EFI_OUT_OF_RESOURCES;
    172     goto Error;
     191    goto RestoreTpl;
    173192  }
    174193
     
    177196  //
    178197  Private->Signature  = QEMU_VIDEO_PRIVATE_DATA_SIGNATURE;
    179   Private->Handle     = NULL;
    180198
    181199  //
     
    191209                  );
    192210  if (EFI_ERROR (Status)) {
    193     goto Error;
    194   }
     211    goto FreePrivate;
     212  }
     213
     214  //
     215  // Read the PCI Configuration Header from the PCI Device
     216  //
     217  Status = Private->PciIo->Pci.Read (
     218                        Private->PciIo,
     219                        EfiPciIoWidthUint32,
     220                        0,
     221                        sizeof (Pci) / sizeof (UINT32),
     222                        &Pci
     223                        );
     224  if (EFI_ERROR (Status)) {
     225    goto ClosePciIo;
     226  }
     227
     228  //
     229  // Determine card variant.
     230  //
     231  Card = QemuVideoDetect(Pci.Hdr.VendorId, Pci.Hdr.DeviceId);
     232  if (Card == NULL) {
     233    Status = EFI_DEVICE_ERROR;
     234    goto ClosePciIo;
     235  }
     236  Private->Variant = Card->Variant;
     237
     238  //
     239  // IsQxl is based on the detected Card->Variant, which at a later point might
     240  // not match Private->Variant.
     241  //
     242  IsQxl = (BOOLEAN)(Card->Variant == QEMU_VIDEO_BOCHS);
    195243
    196244  //
     
    205253
    206254  if (EFI_ERROR (Status)) {
    207     goto Error;
    208   }
    209   PciAttributesSaved = TRUE;
    210 
     255    goto ClosePciIo;
     256  }
     257
     258  //
     259  // Set new PCI attributes
     260  //
    211261  Status = Private->PciIo->Attributes (
    212262                            Private->PciIo,
     
    216266                            );
    217267  if (EFI_ERROR (Status)) {
    218     goto Error;
     268    goto ClosePciIo;
     269  }
     270
     271  //
     272  // Check whenever the qemu stdvga mmio bar is present (qemu 1.3+).
     273  //
     274  if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO) {
     275    EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *MmioDesc;
     276
     277    Status = Private->PciIo->GetBarAttributes (
     278                        Private->PciIo,
     279                        PCI_BAR_IDX2,
     280                        NULL,
     281                        (VOID**) &MmioDesc
     282                        );
     283    if (EFI_ERROR (Status) ||
     284        MmioDesc->ResType != ACPI_ADDRESS_SPACE_TYPE_MEM) {
     285      DEBUG ((EFI_D_INFO, "QemuVideo: No mmio bar, fallback to port io\n"));
     286      Private->Variant = QEMU_VIDEO_BOCHS;
     287    } else {
     288      DEBUG ((EFI_D_INFO, "QemuVideo: Using mmio bar @ 0x%lx\n",
     289              MmioDesc->AddrRangeMin));
     290    }
     291
     292    if (!EFI_ERROR (Status)) {
     293      FreePool (MmioDesc);
     294    }
     295  }
     296
     297  //
     298  // Check if accessing the bochs interface works.
     299  //
     300  if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO ||
     301      Private->Variant == QEMU_VIDEO_BOCHS) {
     302    UINT16 BochsId;
     303    BochsId = BochsRead(Private, VBE_DISPI_INDEX_ID);
     304    if ((BochsId & 0xFFF0) != VBE_DISPI_ID0) {
     305      DEBUG ((EFI_D_INFO, "QemuVideo: BochsID mismatch (got 0x%x)\n", BochsId));
     306      Status = EFI_DEVICE_ERROR;
     307      goto RestoreAttributes;
     308    }
    219309  }
    220310
     
    228318                  );
    229319  if (EFI_ERROR (Status)) {
    230     goto Error;
     320    goto RestoreAttributes;
    231321  }
    232322
     
    234324  // Set Gop Device Path
    235325  //
    236   if (RemainingDevicePath == NULL) {
    237     ZeroMem (&AcpiDeviceNode, sizeof (ACPI_ADR_DEVICE_PATH));
    238     AcpiDeviceNode.Header.Type = ACPI_DEVICE_PATH;
    239     AcpiDeviceNode.Header.SubType = ACPI_ADR_DP;
    240     AcpiDeviceNode.ADR = ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, ACPI_ADR_DISPLAY_TYPE_VGA, 0, 0);
    241     SetDevicePathNodeLength (&AcpiDeviceNode.Header, sizeof (ACPI_ADR_DEVICE_PATH));
    242 
    243     Private->GopDevicePath = AppendDevicePathNode (
    244                                         ParentDevicePath,
    245                                         (EFI_DEVICE_PATH_PROTOCOL *) &AcpiDeviceNode
    246                                         );
    247   } else if (!IsDevicePathEnd (RemainingDevicePath)) {
    248     //
    249     // If RemainingDevicePath isn't the End of Device Path Node,
    250     // only scan the specified device by RemainingDevicePath
    251     //
    252     Private->GopDevicePath = AppendDevicePathNode (ParentDevicePath, RemainingDevicePath);
    253   } else {
    254     //
    255     // If RemainingDevicePath is the End of Device Path Node,
    256     // don't create child device and return EFI_SUCCESS
    257     //
    258     Private->GopDevicePath = NULL;
    259   }
    260    
    261   if (Private->GopDevicePath != NULL) {
    262     //
    263     // Creat child handle and device path protocol firstly
    264     //
    265     Private->Handle = NULL;
    266     Status = gBS->InstallMultipleProtocolInterfaces (
    267                     &Private->Handle,
    268                     &gEfiDevicePathProtocolGuid,
    269                     Private->GopDevicePath,
    270                     NULL
    271                     );
     326  ZeroMem (&AcpiDeviceNode, sizeof (ACPI_ADR_DEVICE_PATH));
     327  AcpiDeviceNode.Header.Type = ACPI_DEVICE_PATH;
     328  AcpiDeviceNode.Header.SubType = ACPI_ADR_DP;
     329  AcpiDeviceNode.ADR = ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, ACPI_ADR_DISPLAY_TYPE_VGA, 0, 0);
     330  SetDevicePathNodeLength (&AcpiDeviceNode.Header, sizeof (ACPI_ADR_DEVICE_PATH));
     331
     332  Private->GopDevicePath = AppendDevicePathNode (
     333                                      ParentDevicePath,
     334                                      (EFI_DEVICE_PATH_PROTOCOL *) &AcpiDeviceNode
     335                                      );
     336  if (Private->GopDevicePath == NULL) {
     337    Status = EFI_OUT_OF_RESOURCES;
     338    goto RestoreAttributes;
     339  }
     340
     341  //
     342  // Create new child handle and install the device path protocol on it.
     343  //
     344  Status = gBS->InstallMultipleProtocolInterfaces (
     345                  &Private->Handle,
     346                  &gEfiDevicePathProtocolGuid,
     347                  Private->GopDevicePath,
     348                  NULL
     349                  );
     350  if (EFI_ERROR (Status)) {
     351    goto FreeGopDevicePath;
    272352  }
    273353
     
    275355  // Construct video mode buffer
    276356  //
    277   Status = QemuVideoVideoModeSetup (Private);
    278   if (EFI_ERROR (Status)) {
    279     goto Error;
    280   }
    281 
    282   if (Private->GopDevicePath == NULL) {
    283     //
    284     // If RemainingDevicePath is the End of Device Path Node,
    285     // don't create child device and return EFI_SUCCESS
    286     //
    287     Status = EFI_SUCCESS;
    288   } else {
    289 
    290     //
    291     // Start the GOP software stack.
    292     //
    293     Status = QemuVideoGraphicsOutputConstructor (Private);
    294     ASSERT_EFI_ERROR (Status);
    295 
    296     Status = gBS->InstallMultipleProtocolInterfaces (
    297                     &Private->Handle,
    298                     &gEfiGraphicsOutputProtocolGuid,
    299                     &Private->GraphicsOutput,
    300                     NULL
    301                     );
    302   }
    303 
    304 Error:
    305   if (EFI_ERROR (Status)) {
    306     if (Private) {
    307       if (Private->PciIo) {
    308         if (PciAttributesSaved == TRUE) {
    309           //
    310           // Restore original PCI attributes
    311           //
    312           Private->PciIo->Attributes (
    313                           Private->PciIo,
    314                           EfiPciIoAttributeOperationSet,
    315                           Private->OriginalPciAttributes,
    316                           NULL
    317                           );
    318         }
    319         //
    320         // Close the PCI I/O Protocol
    321         //
    322         gBS->CloseProtocol (
    323               Private->Handle,
    324               &gEfiPciIoProtocolGuid,
    325               This->DriverBindingHandle,
    326               Private->Handle
    327               );
    328       }
    329 
    330       gBS->FreePool (Private);
    331     }
    332   }
     357  switch (Private->Variant) {
     358  case QEMU_VIDEO_CIRRUS_5430:
     359  case QEMU_VIDEO_CIRRUS_5446:
     360    Status = QemuVideoCirrusModeSetup (Private);
     361    break;
     362  case QEMU_VIDEO_BOCHS_MMIO:
     363  case QEMU_VIDEO_BOCHS:
     364    Status = QemuVideoBochsModeSetup (Private, IsQxl);
     365    break;
     366  default:
     367    ASSERT (FALSE);
     368    Status = EFI_DEVICE_ERROR;
     369    break;
     370  }
     371  if (EFI_ERROR (Status)) {
     372    goto UninstallGopDevicePath;
     373  }
     374
     375  //
     376  // Start the GOP software stack.
     377  //
     378  Status = QemuVideoGraphicsOutputConstructor (Private);
     379  if (EFI_ERROR (Status)) {
     380    goto FreeModeData;
     381  }
     382
     383  Status = gBS->InstallMultipleProtocolInterfaces (
     384                  &Private->Handle,
     385                  &gEfiGraphicsOutputProtocolGuid,
     386                  &Private->GraphicsOutput,
     387                  NULL
     388                  );
     389  if (EFI_ERROR (Status)) {
     390    goto DestructQemuVideoGraphics;
     391  }
     392
     393  //
     394  // Reference parent handle from child handle.
     395  //
     396  Status = gBS->OpenProtocol (
     397                Controller,
     398                &gEfiPciIoProtocolGuid,
     399                (VOID **) &ChildPciIo,
     400                This->DriverBindingHandle,
     401                Private->Handle,
     402                EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
     403                );
     404  if (EFI_ERROR (Status)) {
     405    goto UninstallGop;
     406  }
     407
     408  if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO ||
     409      Private->Variant == QEMU_VIDEO_BOCHS) {
     410    InstallVbeShim (Card->Name, Private->GraphicsOutput.Mode->FrameBufferBase);
     411  }
     412
     413  gBS->RestoreTPL (OldTpl);
     414  return EFI_SUCCESS;
     415
     416UninstallGop:
     417  gBS->UninstallProtocolInterface (Private->Handle,
     418         &gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput);
     419
     420DestructQemuVideoGraphics:
     421  QemuVideoGraphicsOutputDestructor (Private);
     422
     423FreeModeData:
     424  FreePool (Private->ModeData);
     425
     426UninstallGopDevicePath:
     427  gBS->UninstallProtocolInterface (Private->Handle,
     428         &gEfiDevicePathProtocolGuid, Private->GopDevicePath);
     429
     430FreeGopDevicePath:
     431  FreePool (Private->GopDevicePath);
     432
     433RestoreAttributes:
     434  Private->PciIo->Attributes (Private->PciIo, EfiPciIoAttributeOperationSet,
     435                    Private->OriginalPciAttributes, NULL);
     436
     437ClosePciIo:
     438  gBS->CloseProtocol (Controller, &gEfiPciIoProtocolGuid,
     439         This->DriverBindingHandle, Controller);
     440
     441FreePrivate:
     442  FreePool (Private);
     443
     444RestoreTpl:
     445  gBS->RestoreTPL (OldTpl);
    333446
    334447  return Status;
     
    362475  QEMU_VIDEO_PRIVATE_DATA  *Private;
    363476
     477  if (NumberOfChildren == 0) {
     478    //
     479    // Close the PCI I/O Protocol
     480    //
     481    gBS->CloseProtocol (
     482          Controller,
     483          &gEfiPciIoProtocolGuid,
     484          This->DriverBindingHandle,
     485          Controller
     486          );
     487    return EFI_SUCCESS;
     488  }
     489
     490  //
     491  // free all resources for whose access we need the child handle, because the
     492  // child handle is going away
     493  //
     494  ASSERT (NumberOfChildren == 1);
    364495  Status = gBS->OpenProtocol (
    365                   Controller,
     496                  ChildHandleBuffer[0],
    366497                  &gEfiGraphicsOutputProtocolGuid,
    367498                  (VOID **) &GraphicsOutput,
     
    378509  //
    379510  Private = QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (GraphicsOutput);
     511  ASSERT (Private->Handle == ChildHandleBuffer[0]);
    380512
    381513  QemuVideoGraphicsOutputDestructor (Private);
     
    404536                  );
    405537
    406   //
    407   // Close the PCI I/O Protocol
    408   //
    409538  gBS->CloseProtocol (
    410539        Controller,
    411540        &gEfiPciIoProtocolGuid,
    412541        This->DriverBindingHandle,
    413         Controller
     542        Private->Handle
    414543        );
     544
     545  FreePool (Private->ModeData);
     546  gBS->UninstallProtocolInterface (Private->Handle,
     547         &gEfiDevicePathProtocolGuid, Private->GopDevicePath);
     548  FreePool (Private->GopDevicePath);
    415549
    416550  //
     
    553687  )
    554688{
    555   outb (Private, PALETTE_INDEX_REGISTER, (UINT8) Index);
    556   outb (Private, PALETTE_DATA_REGISTER, (UINT8) (Red >> 2));
    557   outb (Private, PALETTE_DATA_REGISTER, (UINT8) (Green >> 2));
    558   outb (Private, PALETTE_DATA_REGISTER, (UINT8) (Blue >> 2));
     689  VgaOutb (Private, PALETTE_INDEX_REGISTER, (UINT8) Index);
     690  VgaOutb (Private, PALETTE_DATA_REGISTER, (UINT8) (Red >> 2));
     691  VgaOutb (Private, PALETTE_DATA_REGISTER, (UINT8) (Green >> 2));
     692  VgaOutb (Private, PALETTE_DATA_REGISTER, (UINT8) (Blue >> 2));
    559693}
    560694
     
    641775**/
    642776VOID
    643 InitializeGraphicsMode (
    644   QEMU_VIDEO_PRIVATE_DATA  *Private,
    645   QEMU_VIDEO_VIDEO_MODES   *ModeData
     777InitializeCirrusGraphicsMode (
     778  QEMU_VIDEO_PRIVATE_DATA  *Private,
     779  QEMU_VIDEO_CIRRUS_MODES  *ModeData
    646780  )
    647781{
    648782  UINT8 Byte;
    649783  UINTN Index;
    650   UINT16 DeviceId;
    651   EFI_STATUS Status;
    652 
    653   Status = Private->PciIo->Pci.Read (
    654              Private->PciIo,
    655              EfiPciIoWidthUint16,
    656              PCI_DEVICE_ID_OFFSET,
    657              1,
    658              &DeviceId
    659              );
    660   //
    661   // Read the PCI Configuration Header from the PCI Device
    662   //
    663   ASSERT_EFI_ERROR (Status);
    664784
    665785  outw (Private, SEQ_ADDRESS_REGISTER, 0x1206);
     
    670790  }
    671791
    672   if (DeviceId != CIRRUS_LOGIC_5446_DEVICE_ID) {
     792  if (Private->Variant == QEMU_VIDEO_CIRRUS_5430) {
    673793    outb (Private, SEQ_ADDRESS_REGISTER, 0x0f);
    674794    Byte = (UINT8) ((inb (Private, SEQ_DATA_REGISTER) & 0xc7) ^ 0x30);
     
    702822  outw (Private, GRAPH_ADDRESS_REGISTER, 0x000b);
    703823  outb (Private, DAC_PIXEL_MASK_REGISTER, 0xff);
     824
     825  SetDefaultPalette (Private);
     826  ClearScreen (Private);
     827}
     828
     829VOID
     830BochsWrite (
     831  QEMU_VIDEO_PRIVATE_DATA  *Private,
     832  UINT16                   Reg,
     833  UINT16                   Data
     834  )
     835{
     836  EFI_STATUS   Status;
     837
     838  if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO) {
     839    Status = Private->PciIo->Mem.Write (
     840        Private->PciIo,
     841        EfiPciIoWidthUint16,
     842        PCI_BAR_IDX2,
     843        0x500 + (Reg << 1),
     844        1,
     845        &Data
     846        );
     847    ASSERT_EFI_ERROR (Status);
     848  } else {
     849    outw (Private, VBE_DISPI_IOPORT_INDEX, Reg);
     850    outw (Private, VBE_DISPI_IOPORT_DATA,  Data);
     851  }
     852}
     853
     854UINT16
     855BochsRead (
     856  QEMU_VIDEO_PRIVATE_DATA  *Private,
     857  UINT16                   Reg
     858  )
     859{
     860  EFI_STATUS   Status;
     861  UINT16       Data;
     862
     863  if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO) {
     864    Status = Private->PciIo->Mem.Read (
     865        Private->PciIo,
     866        EfiPciIoWidthUint16,
     867        PCI_BAR_IDX2,
     868        0x500 + (Reg << 1),
     869        1,
     870        &Data
     871        );
     872    ASSERT_EFI_ERROR (Status);
     873  } else {
     874    outw (Private, VBE_DISPI_IOPORT_INDEX, Reg);
     875    Data = inw (Private, VBE_DISPI_IOPORT_DATA);
     876  }
     877  return Data;
     878}
     879
     880VOID
     881VgaOutb (
     882  QEMU_VIDEO_PRIVATE_DATA  *Private,
     883  UINTN                    Reg,
     884  UINT8                    Data
     885  )
     886{
     887  EFI_STATUS   Status;
     888
     889  if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO) {
     890    Status = Private->PciIo->Mem.Write (
     891        Private->PciIo,
     892        EfiPciIoWidthUint8,
     893        PCI_BAR_IDX2,
     894        0x400 - 0x3c0 + Reg,
     895        1,
     896        &Data
     897        );
     898    ASSERT_EFI_ERROR (Status);
     899  } else {
     900    outb (Private, Reg, Data);
     901  }
     902}
     903
     904VOID
     905InitializeBochsGraphicsMode (
     906  QEMU_VIDEO_PRIVATE_DATA  *Private,
     907  QEMU_VIDEO_BOCHS_MODES  *ModeData
     908  )
     909{
     910  DEBUG ((EFI_D_INFO, "InitializeBochsGraphicsMode: %dx%d @ %d\n",
     911          ModeData->Width, ModeData->Height, ModeData->ColorDepth));
     912
     913  /* unblank */
     914  VgaOutb (Private, ATT_ADDRESS_REGISTER, 0x20);
     915
     916  BochsWrite (Private, VBE_DISPI_INDEX_ENABLE,      0);
     917  BochsWrite (Private, VBE_DISPI_INDEX_BANK,        0);
     918  BochsWrite (Private, VBE_DISPI_INDEX_X_OFFSET,    0);
     919  BochsWrite (Private, VBE_DISPI_INDEX_Y_OFFSET,    0);
     920
     921  BochsWrite (Private, VBE_DISPI_INDEX_BPP,         (UINT16) ModeData->ColorDepth);
     922  BochsWrite (Private, VBE_DISPI_INDEX_XRES,        (UINT16) ModeData->Width);
     923  BochsWrite (Private, VBE_DISPI_INDEX_VIRT_WIDTH,  (UINT16) ModeData->Width);
     924  BochsWrite (Private, VBE_DISPI_INDEX_YRES,        (UINT16) ModeData->Height);
     925  BochsWrite (Private, VBE_DISPI_INDEX_VIRT_HEIGHT, (UINT16) ModeData->Height);
     926
     927  BochsWrite (Private, VBE_DISPI_INDEX_ENABLE,
     928              VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED);
    704929
    705930  SetDefaultPalette (Private);
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/QemuVideoDxe/Gop.c

    r48674 r58459  
    7373  DEBUG ((EFI_D_INFO, "FrameBufferBase: 0x%x, FrameBufferSize: 0x%x\n", Mode->FrameBufferBase, Mode->FrameBufferSize));
    7474
     75  FreePool (FrameBufDesc);
    7576  return EFI_SUCCESS;
    7677}
     
    114115  Private = QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This);
    115116
    116   if (Private->HardwareNeedsStarting) {
    117     return EFI_NOT_STARTED;
    118   }
    119 
    120117  if (Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) {
    121118    return EFI_INVALID_PARAMETER;
     
    176173  }
    177174
    178   Private->LineBuffer = NULL;
    179175  Private->LineBuffer = AllocatePool (4 * ModeData->HorizontalResolution);
    180176  if (Private->LineBuffer == NULL) {
     
    182178  }
    183179
    184   InitializeGraphicsMode (Private, &QemuVideoVideoModes[ModeData->ModeNumber]);
     180  switch (Private->Variant) {
     181  case QEMU_VIDEO_CIRRUS_5430:
     182  case QEMU_VIDEO_CIRRUS_5446:
     183    InitializeCirrusGraphicsMode (Private, &QemuVideoCirrusModes[ModeData->InternalModeIndex]);
     184    break;
     185  case QEMU_VIDEO_BOCHS_MMIO:
     186  case QEMU_VIDEO_BOCHS:
     187    InitializeBochsGraphicsMode (Private, &QemuVideoBochsModes[ModeData->InternalModeIndex]);
     188    break;
     189  default:
     190    ASSERT (FALSE);
     191    gBS->FreePool (Private->LineBuffer);
     192    Private->LineBuffer = NULL;
     193    return EFI_DEVICE_ERROR;
     194  }
    185195
    186196  This->Mode->Mode = ModeNumber;
     
    195205    This->Mode->Info
    196206    );
    197 
    198   Private->HardwareNeedsStarting  = FALSE;
    199207
    200208  return EFI_SUCCESS;
     
    307315    return Status;
    308316  }
     317
    309318  Status = gBS->AllocatePool (
    310319                  EfiBootServicesData,
     
    313322                  );
    314323  if (EFI_ERROR (Status)) {
    315     return Status;
     324    goto FreeMode;
    316325  }
    317326  Private->GraphicsOutput.Mode->MaxMode = (UINT32) Private->MaxMode;
    318327  Private->GraphicsOutput.Mode->Mode    = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER;
    319   Private->HardwareNeedsStarting        = TRUE;
    320328  Private->LineBuffer                   = NULL;
    321329
     
    323331  // Initialize the hardware
    324332  //
    325   GraphicsOutput->SetMode (GraphicsOutput, 0);
     333  Status = GraphicsOutput->SetMode (GraphicsOutput, 0);
     334  if (EFI_ERROR (Status)) {
     335    goto FreeInfo;
     336  }
     337
    326338  DrawLogo (
    327339    Private,
     
    331343
    332344  return EFI_SUCCESS;
     345
     346FreeInfo:
     347  FreePool (Private->GraphicsOutput.Mode->Info);
     348
     349FreeMode:
     350  FreePool (Private->GraphicsOutput.Mode);
     351  Private->GraphicsOutput.Mode = NULL;
     352
     353  return Status;
    333354}
    334355
     
    349370--*/
    350371{
     372  if (Private->LineBuffer != NULL) {
     373    FreePool (Private->LineBuffer);
     374  }
     375
    351376  if (Private->GraphicsOutput.Mode != NULL) {
    352377    if (Private->GraphicsOutput.Mode->Info != NULL) {
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/QemuVideoDxe/Initialize.c

    r48674 r58459  
    144144/// Table of supported video modes
    145145///
    146 QEMU_VIDEO_VIDEO_MODES  QemuVideoVideoModes[] = {
     146QEMU_VIDEO_CIRRUS_MODES  QemuVideoCirrusModes[] = {
    147147//  {  640, 480, 8, 60, Crtc_640_480_256_60,  Seq_640_480_256_60,  0xe3 },
    148148//  {  800, 600, 8, 60, Crtc_800_600_256_60,  Seq_800_600_256_60,  0xef },
     
    155155};
    156156
    157 #define QEMU_VIDEO_MODE_COUNT \
    158   (sizeof (QemuVideoVideoModes) / sizeof (QemuVideoVideoModes[0]))
     157#define QEMU_VIDEO_CIRRUS_MODE_COUNT \
     158  (sizeof (QemuVideoCirrusModes) / sizeof (QemuVideoCirrusModes[0]))
    159159
    160160/**
     
    163163**/
    164164EFI_STATUS
    165 QemuVideoVideoModeSetup (
     165QemuVideoCirrusModeSetup (
    166166  QEMU_VIDEO_PRIVATE_DATA  *Private
    167167  )
     
    169169  UINT32                                 Index;
    170170  QEMU_VIDEO_MODE_DATA                   *ModeData;
    171   QEMU_VIDEO_VIDEO_MODES                 *VideoMode;
     171  QEMU_VIDEO_CIRRUS_MODES                *VideoMode;
    172172
    173173  //
     
    175175  //
    176176  Private->ModeData = AllocatePool (
    177                         sizeof (Private->ModeData[0]) * QEMU_VIDEO_MODE_COUNT
     177                        sizeof (Private->ModeData[0]) * QEMU_VIDEO_CIRRUS_MODE_COUNT
    178178                        );
     179  if (Private->ModeData == NULL) {
     180    return EFI_OUT_OF_RESOURCES;
     181  }
    179182  ModeData = Private->ModeData;
    180   VideoMode = &QemuVideoVideoModes[0];
    181   for (Index = 0; Index < QEMU_VIDEO_MODE_COUNT; Index ++) {
    182     ModeData->ModeNumber = Index;
     183  VideoMode = &QemuVideoCirrusModes[0];
     184  for (Index = 0; Index < QEMU_VIDEO_CIRRUS_MODE_COUNT; Index ++) {
     185    ModeData->InternalModeIndex = Index;
    183186    ModeData->HorizontalResolution          = VideoMode->Width;
    184187    ModeData->VerticalResolution            = VideoMode->Height;
     
    186189    ModeData->RefreshRate                   = VideoMode->RefreshRate;
    187190    DEBUG ((EFI_D_INFO,
    188       "Adding Video Mode %d: %dx%d, %d-bit, %d Hz\n",
    189       ModeData->ModeNumber,
     191      "Adding Mode %d as Cirrus Internal Mode %d: %dx%d, %d-bit, %d Hz\n",
     192      (INT32) (ModeData - Private->ModeData),
     193      ModeData->InternalModeIndex,
    190194      ModeData->HorizontalResolution,
    191195      ModeData->VerticalResolution,
     
    197201    VideoMode ++;
    198202  }
    199   Private->MaxMode = QEMU_VIDEO_MODE_COUNT;
     203  Private->MaxMode = ModeData - Private->ModeData;
    200204
    201205  return EFI_SUCCESS;
    202206}
    203207
     208///
     209/// Table of supported video modes
     210///
     211QEMU_VIDEO_BOCHS_MODES  QemuVideoBochsModes[] = {
     212  {  640,  480, 32 },
     213  {  800,  480, 32 },
     214  {  800,  600, 32 },
     215  {  832,  624, 32 },
     216  {  960,  640, 32 },
     217  { 1024,  600, 32 },
     218  { 1024,  768, 32 },
     219  { 1152,  864, 32 },
     220  { 1152,  870, 32 },
     221  { 1280,  720, 32 },
     222  { 1280,  760, 32 },
     223  { 1280,  768, 32 },
     224  { 1280,  800, 32 },
     225  { 1280,  960, 32 },
     226  { 1280, 1024, 32 },
     227  { 1360,  768, 32 },
     228  { 1366,  768, 32 },
     229  { 1400, 1050, 32 },
     230  { 1440,  900, 32 },
     231  { 1600,  900, 32 },
     232  { 1600, 1200, 32 },
     233  { 1680, 1050, 32 },
     234  { 1920, 1080, 32 },
     235  { 1920, 1200, 32 },
     236  { 1920, 1440, 32 },
     237  { 2000, 2000, 32 },
     238  { 2048, 1536, 32 },
     239  { 2048, 2048, 32 },
     240  { 2560, 1440, 32 },
     241  { 2560, 1600, 32 },
     242  { 2560, 2048, 32 },
     243  { 2800, 2100, 32 },
     244  { 3200, 2400, 32 },
     245  { 3840, 2160, 32 },
     246  { 4096, 2160, 32 },
     247  { 7680, 4320, 32 },
     248  { 8192, 4320, 32 }
     249};
     250
     251#define QEMU_VIDEO_BOCHS_MODE_COUNT \
     252  (sizeof (QemuVideoBochsModes) / sizeof (QemuVideoBochsModes[0]))
     253
     254EFI_STATUS
     255QemuVideoBochsModeSetup (
     256  QEMU_VIDEO_PRIVATE_DATA  *Private,
     257  BOOLEAN                  IsQxl
     258  )
     259{
     260  UINT32                                 AvailableFbSize;
     261  UINT32                                 Index;
     262  QEMU_VIDEO_MODE_DATA                   *ModeData;
     263  QEMU_VIDEO_BOCHS_MODES                 *VideoMode;
     264
     265  //
     266  // Fetch the available framebuffer size.
     267  //
     268  // VBE_DISPI_INDEX_VIDEO_MEMORY_64K is expected to return the size of the
     269  // drawable framebuffer. Up to and including qemu-2.1 however it used to
     270  // return the size of PCI BAR 0 (ie. the full video RAM size).
     271  //
     272  // On stdvga the two concepts coincide with each other; the full memory size
     273  // is usable for drawing.
     274  //
     275  // On QXL however, only a leading segment, "surface 0", can be used for
     276  // drawing; the rest of the video memory is used for the QXL guest-host
     277  // protocol. VBE_DISPI_INDEX_VIDEO_MEMORY_64K should report the size of
     278  // "surface 0", but since it doesn't (up to and including qemu-2.1), we
     279  // retrieve the size of the drawable portion from a field in the QXL ROM BAR,
     280  // where it is also available.
     281  //
     282  if (IsQxl) {
     283    UINT32 Signature;
     284    UINT32 DrawStart;
     285
     286    Signature = 0;
     287    DrawStart = 0xFFFFFFFF;
     288    AvailableFbSize = 0;
     289    if (EFI_ERROR (
     290          Private->PciIo->Mem.Read (Private->PciIo, EfiPciIoWidthUint32,
     291                                PCI_BAR_IDX2, 0, 1, &Signature)) ||
     292        Signature != SIGNATURE_32 ('Q', 'X', 'R', 'O') ||
     293        EFI_ERROR (
     294          Private->PciIo->Mem.Read (Private->PciIo, EfiPciIoWidthUint32,
     295                                PCI_BAR_IDX2, 36, 1, &DrawStart)) ||
     296        DrawStart != 0 ||
     297        EFI_ERROR (
     298          Private->PciIo->Mem.Read (Private->PciIo, EfiPciIoWidthUint32,
     299                                PCI_BAR_IDX2, 40, 1, &AvailableFbSize))) {
     300      DEBUG ((EFI_D_ERROR, "%a: can't read size of drawable buffer from QXL "
     301        "ROM\n", __FUNCTION__));
     302      return EFI_NOT_FOUND;
     303    }
     304  } else {
     305    AvailableFbSize  = BochsRead (Private, VBE_DISPI_INDEX_VIDEO_MEMORY_64K);
     306    AvailableFbSize *= SIZE_64KB;
     307  }
     308  DEBUG ((EFI_D_VERBOSE, "%a: AvailableFbSize=0x%x\n", __FUNCTION__,
     309    AvailableFbSize));
     310
     311  //
     312  // Setup Video Modes
     313  //
     314  Private->ModeData = AllocatePool (
     315                        sizeof (Private->ModeData[0]) * QEMU_VIDEO_BOCHS_MODE_COUNT
     316                        );
     317  if (Private->ModeData == NULL) {
     318    return EFI_OUT_OF_RESOURCES;
     319  }
     320  ModeData = Private->ModeData;
     321  VideoMode = &QemuVideoBochsModes[0];
     322  for (Index = 0; Index < QEMU_VIDEO_BOCHS_MODE_COUNT; Index ++) {
     323    UINTN RequiredFbSize;
     324
     325    ASSERT (VideoMode->ColorDepth % 8 == 0);
     326    RequiredFbSize = (UINTN) VideoMode->Width * VideoMode->Height *
     327                     (VideoMode->ColorDepth / 8);
     328    if (RequiredFbSize <= AvailableFbSize) {
     329      ModeData->InternalModeIndex    = Index;
     330      ModeData->HorizontalResolution = VideoMode->Width;
     331      ModeData->VerticalResolution   = VideoMode->Height;
     332      ModeData->ColorDepth           = VideoMode->ColorDepth;
     333      ModeData->RefreshRate          = 60;
     334      DEBUG ((EFI_D_INFO,
     335        "Adding Mode %d as Bochs Internal Mode %d: %dx%d, %d-bit, %d Hz\n",
     336        (INT32) (ModeData - Private->ModeData),
     337        ModeData->InternalModeIndex,
     338        ModeData->HorizontalResolution,
     339        ModeData->VerticalResolution,
     340        ModeData->ColorDepth,
     341        ModeData->RefreshRate
     342        ));
     343
     344      ModeData ++ ;
     345    }
     346    VideoMode ++;
     347  }
     348  Private->MaxMode = ModeData - Private->ModeData;
     349
     350  return EFI_SUCCESS;
     351}
     352
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/QemuVideoDxe/Qemu.h

    r48674 r58459  
    5151//
    5252typedef struct {
    53   UINT32  ModeNumber;
     53  UINT32  InternalModeIndex; // points into card-specific mode table
    5454  UINT32  HorizontalResolution;
    5555  UINT32  VerticalResolution;
     
    8686//
    8787#define QEMU_VIDEO_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('Q', 'V', 'I', 'D')
     88
     89typedef enum {
     90  QEMU_VIDEO_CIRRUS_5430 = 1,
     91  QEMU_VIDEO_CIRRUS_5446,
     92  QEMU_VIDEO_BOCHS,
     93  QEMU_VIDEO_BOCHS_MMIO,
     94} QEMU_VIDEO_VARIANT;
     95
     96typedef struct {
     97  UINT16                                VendorId;
     98  UINT16                                DeviceId;
     99  QEMU_VIDEO_VARIANT                    Variant;
     100  CHAR16                                *Name;
     101} QEMU_VIDEO_CARD;
    88102
    89103typedef struct {
     
    94108  EFI_GRAPHICS_OUTPUT_PROTOCOL          GraphicsOutput;
    95109  EFI_DEVICE_PATH_PROTOCOL              *GopDevicePath;
     110
     111  //
     112  // The next three fields match the client-visible
     113  // EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE.Mode and
     114  // EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE.MaxMode fields.
     115  //
    96116  UINTN                                 CurrentMode;
    97117  UINTN                                 MaxMode;
    98118  QEMU_VIDEO_MODE_DATA                  *ModeData;
     119
    99120  UINT8                                 *LineBuffer;
    100   BOOLEAN                               HardwareNeedsStarting;
     121  QEMU_VIDEO_VARIANT                    Variant;
    101122} QEMU_VIDEO_PRIVATE_DATA;
    102123
    103124///
    104 /// Video Mode structure
     125/// Card-specific Video Mode structures
    105126///
    106127typedef struct {
     
    112133  UINT16  *SeqSettings;
    113134  UINT8   MiscSetting;
    114 } QEMU_VIDEO_VIDEO_MODES;
     135} QEMU_VIDEO_CIRRUS_MODES;
     136
     137typedef struct {
     138  UINT32  Width;
     139  UINT32  Height;
     140  UINT32  ColorDepth;
     141} QEMU_VIDEO_BOCHS_MODES;
    115142
    116143#define QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS(a) \
     
    129156extern UINT8                                      Crtc_1024_768_256_60[];
    130157extern UINT16                                     Seq_1024_768_256_60[];
    131 extern QEMU_VIDEO_VIDEO_MODES              QemuVideoVideoModes[];
     158extern QEMU_VIDEO_CIRRUS_MODES                    QemuVideoCirrusModes[];
     159extern QEMU_VIDEO_BOCHS_MODES                     QemuVideoBochsModes[];
    132160extern EFI_DRIVER_BINDING_PROTOCOL                gQemuVideoDriverBinding;
    133161extern EFI_COMPONENT_NAME_PROTOCOL                gQemuVideoComponentName;
     
    151179#define PALETTE_DATA_REGISTER   0x3c9
    152180
     181#define VBE_DISPI_IOPORT_INDEX           0x01CE
     182#define VBE_DISPI_IOPORT_DATA            0x01D0
     183
     184#define VBE_DISPI_INDEX_ID               0x0
     185#define VBE_DISPI_INDEX_XRES             0x1
     186#define VBE_DISPI_INDEX_YRES             0x2
     187#define VBE_DISPI_INDEX_BPP              0x3
     188#define VBE_DISPI_INDEX_ENABLE           0x4
     189#define VBE_DISPI_INDEX_BANK             0x5
     190#define VBE_DISPI_INDEX_VIRT_WIDTH       0x6
     191#define VBE_DISPI_INDEX_VIRT_HEIGHT      0x7
     192#define VBE_DISPI_INDEX_X_OFFSET         0x8
     193#define VBE_DISPI_INDEX_Y_OFFSET         0x9
     194#define VBE_DISPI_INDEX_VIDEO_MEMORY_64K 0xa
     195
     196#define VBE_DISPI_ID0                    0xB0C0
     197#define VBE_DISPI_ID1                    0xB0C1
     198#define VBE_DISPI_ID2                    0xB0C2
     199#define VBE_DISPI_ID3                    0xB0C3
     200#define VBE_DISPI_ID4                    0xB0C4
     201#define VBE_DISPI_ID5                    0xB0C5
     202
     203#define VBE_DISPI_DISABLED               0x00
     204#define VBE_DISPI_ENABLED                0x01
     205#define VBE_DISPI_GETCAPS                0x02
     206#define VBE_DISPI_8BIT_DAC               0x20
     207#define VBE_DISPI_LFB_ENABLED            0x40
     208#define VBE_DISPI_NOCLEARMEM             0x80
    153209
    154210//
     
    359415//
    360416VOID
    361 InitializeGraphicsMode (
    362   QEMU_VIDEO_PRIVATE_DATA  *Private,
    363   QEMU_VIDEO_VIDEO_MODES   *ModeData
     417InitializeCirrusGraphicsMode (
     418  QEMU_VIDEO_PRIVATE_DATA  *Private,
     419  QEMU_VIDEO_CIRRUS_MODES  *ModeData
     420  );
     421
     422VOID
     423InitializeBochsGraphicsMode (
     424  QEMU_VIDEO_PRIVATE_DATA  *Private,
     425  QEMU_VIDEO_BOCHS_MODES   *ModeData
    364426  );
    365427
     
    411473  );
    412474
    413 EFI_STATUS
    414 QemuVideoVideoModeSetup (
     475VOID
     476BochsWrite (
     477  QEMU_VIDEO_PRIVATE_DATA  *Private,
     478  UINT16                   Reg,
     479  UINT16                   Data
     480  );
     481
     482UINT16
     483BochsRead (
     484  QEMU_VIDEO_PRIVATE_DATA  *Private,
     485  UINT16                   Reg
     486  );
     487
     488VOID
     489VgaOutb (
     490  QEMU_VIDEO_PRIVATE_DATA  *Private,
     491  UINTN                    Reg,
     492  UINT8                    Data
     493  );
     494
     495EFI_STATUS
     496QemuVideoCirrusModeSetup (
    415497  QEMU_VIDEO_PRIVATE_DATA  *Private
    416498  );
    417499
     500EFI_STATUS
     501QemuVideoBochsModeSetup (
     502  QEMU_VIDEO_PRIVATE_DATA  *Private,
     503  BOOLEAN                  IsQxl
     504  );
     505
     506VOID
     507InstallVbeShim (
     508  IN CONST CHAR16         *CardName,
     509  IN EFI_PHYSICAL_ADDRESS FrameBufferBase
     510  );
    418511#endif
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf

    r48674 r58459  
    2424  ENTRY_POINT                    = InitializeQemuVideo
    2525
    26   PCI_VENDOR_ID  = 0x1013
    27   PCI_DEVICE_ID  = 0x00A8
    28   PCI_CLASS_CODE = 0x030000
    29   PCI_REVISION   = 0x00
    30   PCI_COMPRESS   = TRUE
    31 
    3226#
    3327# The following information is for reference only and not required by the build tools.
     
    4539  Gop.c
    4640  Initialize.c
     41  VbeShim.c
    4742
    4843[Packages]
    4944  MdePkg/MdePkg.dec
    5045  OptionRomPkg/OptionRomPkg.dec
     46  OvmfPkg/OvmfPkg.dec
    5147
    5248[LibraryClasses]
     
    5652  DevicePathLib
    5753  MemoryAllocationLib
     54  PciLib
     55  PrintLib
    5856  TimerLib
    5957  UefiBootServicesTableLib
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/README

    r48674 r58459  
    1010=== STATUS ===
    1111
    12 Current status: Alpha
    13 
    1412Current capabilities:
    1513* IA32 and X64 architectures
    16 * QEMU (0.9.1 or later)
     14* QEMU (0.10.0 or later)
    1715  - Video, keyboard, IDE, CD-ROM, serial
    1816  - Runs UEFI shell
    1917  - Optional NIC support.  Requires QEMU (0.12.2 or later)
    20 * UEFI Linux has booted (but is not stable)
     18* UEFI Linux boots
     19* UEFI Windows 8 boots
     20* UEFI Windows 7 & Windows 2008 Server boot (see important notes below!)
    2121
    2222=== FUTURE PLANS ===
    2323
    24 * Stabilize UEFI Linux boot
    2524* Test/Stabilize UEFI Self-Certification Tests (SCT) results
    2625
     
    3231  - Intel ASL compiler: Available from http://www.acpica.org
    3332  - Microsoft ASL compiler: Available from http://www.acpi.info
     33* NASM: http://www.nasm.us/
    3434
    3535Update Conf/target.txt ACTIVE_PLATFORM for OVMF:
     
    5151* OVMF.FD
    5252  - Please note!  This filename has changed.  Older releases used OVMF.Fv.
    53 * CirrusLogic5446.rom
     53* OvmfVideo.rom
     54  - This file is not built separately any longer, starting with svn r13520.
    5455
    5556More information on building OVMF can be found at:
     
    5960=== RUNNING OVMF on QEMU ===
    6061
    61 * QEMU 0.9.1 or later is required.
    62 * Either copy, rename or symlink OVMF.FD => bios.bin
    63 * Either copy, rename or symlink CirrusLogic5446.rom => vgabios-cirrus.bin
     62* QEMU 0.12.2 or later is required.
    6463* Be sure to use qemu-system-x86_64, if you are using and X64 firmware.
    6564  (qemu-system-x86_64 works for the IA32 firmware as well, of course.)
    66 * Use the QEMU -L parameter to specify the directory where the bios.bin
    67   and vgabios-cirrus.bin files are located.
    68 * Optionally you can use the QEMU -serial command to capture the
    69   OVMF debug messages.  For example: -serial file:serial.log
     65* Use OVMF for QEMU firmware (3 options available)
     66  - Option 1: QEMU 1.6 or newer; Use QEMU -pflash parameter
     67    * QEMU/OVMF will use emulated flash, and fully support UEFI variables
     68    * Run qemu with: -pflash path/to/OVMF.fd
     69  - Option 2: Use QEMU -bios parameter
     70    * Note that UEFI variables will be partially emulated, and non-volatile
     71      variables may lose their contents after a reboot
     72    * Run qemu with: -bios path/to/OVMF.fd
     73  - Option 3: Use QEMU -L parameter
     74    * Note that UEFI variables will be partially emulated, and non-volatile
     75      variables may lose their contents after a reboot
     76    * Either copy, rename or symlink OVMF.fd => bios.bin
     77    * Use the QEMU -L parameter to specify the directory where the bios.bin
     78      file is located.
    7079* The EFI shell is built into OVMF builds at this time, so it should
    7180  run automatically if a UEFI boot application is not found on the
     
    7382* On Linux, newer version of QEMU may enable KVM feature, and this might
    7483  cause OVMF to fail to boot.  The QEMU '-no-kvm' may allow OVMF to boot.
     84* Capturing OVMF debug messages on qemu:
     85  - The default OVMF build writes debug messages to IO port 0x402.  The
     86    following qemu command line options save them in the file called
     87    debug.log: '-debugcon file:debug.log -global isa-debugcon.iobase=0x402'.
     88  - It is possible to revert to the original behavior, when debug messages were
     89    written to the emulated serial port (potentially intermixing OVMF debug
     90    output with UEFI serial console output).  For this the
     91    '-D DEBUG_ON_SERIAL_PORT' option has to be passed to the build command (see
     92    the next section), and in order to capture the serial output qemu needs to
     93    be started with eg. '-serial file:serial.log'.
     94  - Debug messages fall into several categories.  Logged vs. suppressed
     95    categories are controlled at OVMF build time by the
     96    'gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel' bitmask (an UINT32
     97    value) in the selected .dsc file.  Individual bits of this bitmask are
     98    defined in <MdePkg/Include/Library/DebugLib.h>.  One non-default bit (with
     99    some performance impact) that is frequently set for debugging is 0x00400000
     100    (DEBUG_VERBOSE).
     101  - The RELEASE build target ('-b RELEASE' build option, see below) disables
     102    all debug messages.  The default build target is DEBUG.
    75103
    76104=== Build Scripts ===
     
    86114$ OvmfPkg/build.sh -a X64 qemu -cdrom /path/to/disk-image.iso
    87115
    88 To build a 32-bit OVMF without debug serial messages using GCC 4.5:
     116To build a 32-bit OVMF without debug messages using GCC 4.5:
    89117$ OvmfPkg/build.sh -a IA32 -b RELEASE -t GCC45
    90118
    91119=== Network Support ===
    92120
    93 To add network drivers to OVMF:
    94 
    95 * Download UEFI drivers for the e1000 NIC
    96   - http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=17515&lang=eng
    97   - Install the drivers into a directory called Intel3.5 in your WORKSPACE
    98 
    99 * Include the drivers in OVMF during the build:
    100   - Add '-D NETWORK_ENABLE' to your build command
    101   - For example: build -D NETWORK_ENABLE
    102 
    103 * Use the QEMU -net parameter to enable NIC support.
    104   - QEMU does not support UEFI DHCP or UEFI PXE Boot, so long timeouts will
    105     occur when NICs are enabled.  The long timeouts can be avoided by
    106     interrupts the boot sequence by pressing a key when the logo appears.
    107   - Example: Enable e1000 NIC with a DHCP server and restrict packet
    108     forwarding:
    109     -net nic,model=e1000 -net user,restrict=yes -net user,dhcpstart=10.0.2.10
    110   - Example: Enable e1000 NIC with a DHCP server, restrict packet forwarding,
    111     and generate PCAP file:
    112     -net nic,model=e1000 -net user,restrict=yes -net user,dhcpstart=10.0.2.10
    113     -net dump,file=a.pcap
    114   - Example: Enable 2 e1000 NICs with a DHCP server and restrict
    115     packet forwarding:
    116     -net nic,model=e1000,addr=3 -net nic,model=e1000,addr=4
    117     -net user,restrict=yes -net user,dhcpstart=10.0.2.10
    118 
     121OVMF provides a UEFI network stack by default. Its lowest level driver is the
     122NIC driver, higher levels are generic. In order to make DHCP, PXE Boot, and eg.
     123socket test utilities from the StdLib edk2 package work, (1) qemu has to be
     124configured to emulate a NIC, (2) a matching UEFI NIC driver must be available
     125when OVMF boots.
     126
     127(If a NIC is configured for the virtual machine, and -- dependent on boot order
     128-- PXE booting is attempted, but no DHCP server responds to OVMF's DHCP
     129DISCOVER message at startup, the boot process may take approx. 3 seconds
     130longer.)
     131
     132* For each NIC emulated by qemu, a GPLv2 licensed UEFI driver is available from
     133  the iPXE project. The qemu source distribution, starting with version 1.5,
     134  contains prebuilt binaries of these drivers (and of course allows one to
     135  rebuild them from source as well). This is the recommended set of drivers.
     136
     137* Use the qemu -netdev and -device options, or the legacy -net option, to
     138  enable NIC support: <http://wiki.qemu.org/Documentation/Networking>.
     139
     140* For a qemu >= 1.5 binary running *without* any "-M machine" option where
     141  "machine" would identify a < qemu-1.5 configuration (for example: "-M
     142  pc-i440fx-1.4" or "-M pc-0.13"), the iPXE drivers are automatically available
     143  to and configured for OVMF in the default qemu installation.
     144
     145* For a qemu binary in [0.13, 1.5), or a qemu >= 1.5 binary with an "-M
     146  machine" option where "machine" selects a < qemu-1.5 configuration:
     147
     148  - download a >= 1.5.0-rc1 source tarball from <http://wiki.qemu.org/Download>,
     149
     150  - extract the following iPXE driver files from the tarball and install them
     151    in a location that is accessible to qemu processes (this may depend on your
     152    SELinux configuration, for example):
     153
     154    qemu-VERSION/pc-bios/efi-e1000.rom
     155    qemu-VERSION/pc-bios/efi-ne2k_pci.rom
     156    qemu-VERSION/pc-bios/efi-pcnet.rom
     157    qemu-VERSION/pc-bios/efi-rtl8139.rom
     158    qemu-VERSION/pc-bios/efi-virtio.rom
     159
     160  - extend the NIC's -device option on the qemu command line with a matching
     161    "romfile=" optarg:
     162
     163    -device e1000,...,romfile=/full/path/to/efi-e1000.rom
     164    -device ne2k_pci,...,romfile=/full/path/to/efi-ne2k_pci.rom
     165    -device pcnet,...,romfile=/full/path/to/efi-pcnet.rom
     166    -device rtl8139,...,romfile=/full/path/to/efi-rtl8139.rom
     167    -device virtio-net-pci,...,romfile=/full/path/to/efi-virtio.rom
     168
     169* Independently of the iPXE NIC drivers, the default OVMF build provides a
     170  basic virtio-net driver, located in OvmfPkg/VirtioNetDxe.
     171
     172* Also independently of the iPXE NIC drivers, Intel's proprietary E1000 NIC
     173  driver (PROEFI) can be embedded in the OVMF image at build time:
     174
     175  - Download UEFI drivers for the e1000 NIC
     176    - http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=17515&lang=eng
     177    - Install the drivers into a directory called Intel3.5 in your WORKSPACE.
     178
     179  - Include the driver in OVMF during the build:
     180    - Add "-D E1000_ENABLE -D FD_SIZE_2MB" to your build command,
     181    - For example: "build -D E1000_ENABLE -D FD_SIZE_2MB".
     182
     183* When a matching iPXE driver is configured for a NIC as described above, it
     184  takes priority over other drivers that could possibly drive the card too:
     185
     186                 | e1000  ne2k_pci  pcnet  rtl8139  virtio-net-pci
     187    -------------+------------------------------------------------
     188    iPXE         |   x       x        x       x           x
     189    VirtioNetDxe |                                        x
     190    Intel PROEFI |   x
     191
     192=== OVMF Flash Layout ===
     193
     194Like all current IA32/X64 system designs, OVMF's firmware
     195device (rom/flash) appears in QEMU's physical address space
     196just below 4GB (0x100000000).
     197
     198The layout of the firmware device in memory looks like:
     199
     200+--------------------------------------- 4GB (0x100000000)
     201| VTF0 (16-bit reset code) and OVMF SEC
     202| (SECFV)
     203+--------------------------------------- varies based on flash size
     204|
     205| Compressed main firmware image
     206| (FVMAIN_COMPACT)
     207|
     208+--------------------------------------- base + 0x20000
     209| Fault-tolerant write (FTW)
     210| Spare blocks (64KB/0x10000)
     211+--------------------------------------- base + 0x10000
     212| FTW Work block (4KB/0x1000)
     213+--------------------------------------- base + 0x0f000
     214| Event log area (4KB/0x1000)
     215+--------------------------------------- base + 0x0e000
     216| Non-volatile variable storage
     217| area (56KB/0xe000)
     218+--------------------------------------- base address
     219
     220OVMF supports building a 1MB or a 2MB flash image. The base address for
     221a 1MB image in QEMU physical memory is 0xfff00000. The base address for
     222a 2MB image is 0xffe00000.
     223
     224The code in SECFV locates FVMAIN_COMPACT, and decompresses the
     225main firmware (MAINFV) into RAM memory at address 0x800000. The
     226remaining OVMF firmware then uses this decompressed firmware
     227volume image.
     228
     229=== UNIXGCC Debug ===
     230
     231If you build with the UNIXGCC toolchain, then debugging will be disabled
     232due to larger image sizes being produced by the UNIXGCC toolchain. The
     233first choice recommendation is to use GCC44 or newer instead.
     234
     235If you must use UNIXGCC, then you can override the build options for
     236particular libraries and modules in the .dsc to re-enable debugging
     237selectively. For example:
     238  [Components]
     239  OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf {
     240    <BuildOptions>
     241      GCC:*_*_*_CC_FLAGS             = -UMDEPKG_NDEBUG
     242  }
     243  IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf {
     244    <BuildOptions>
     245      GCC:*_*_*_CC_FLAGS             = -UMDEPKG_NDEBUG
     246  }
     247
     248=== UEFI Windows 7 & Windows 2008 Server ===
     249
     250* One of the '-vga std' and '-vga qxl' QEMU options should be used.
     251* Only one video mode, 1024x768x32, is supported at OS runtime.
     252* The '-vga qxl' QEMU option is recommended. After booting the installed
     253  guest OS, select the video card in Device Manager, and upgrade its driver
     254  to the QXL XDDM one. Download location:
     255  <http://www.spice-space.org/download.html>, Guest | Windows binaries.
     256  This enables further resolutions at OS runtime, and provides S3
     257  (suspend/resume) capability.
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Sec/Ia32/SecEntry.S

    r48674 r58459  
    22#------------------------------------------------------------------------------
    33#*
    4 #*   Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
     4#*   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    55#*   This program and the accompanying materials
    66#*   are licensed and made available under the terms and conditions of the BSD License
     
    3737
    3838    #
    39     # Load temporary stack top at very low memory.  The C code
    40     # can reload to a better address.
     39    # Load temporary RAM stack based on PCDs
    4140    #
    42     movl    $BASE_512KB, %eax
     41    .set    SEC_TOP_OF_STACK, FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \
     42                              FixedPcdGet32 (PcdOvmfSecPeiTempRamSize)
     43    movl    $SEC_TOP_OF_STACK, %eax
    4344    movl    %eax, %esp
    4445    nop
    4546
    4647    #
    47     # Call into C code
     48    # Setup parameters and call SecCoreStartupWithStack
     49    #   [esp]   return address for call
     50    #   [esp+4] BootFirmwareVolumePtr
     51    #   [esp+8] TopOfCurrentStack
    4852    #
    4953    pushl   %eax
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Sec/Ia32/SecEntry.asm

    r48674 r58459  
    22;------------------------------------------------------------------------------
    33;*
    4 ;*   Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
     4;*   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    55;*   This program and the accompanying materials
    66;*   are licensed and made available under the terms and conditions of the BSD License
     
    3939
    4040    ;
    41     ; Load temporary stack top at very low memory.  The C code
    42     ; can reload to a better address.
     41    ; Load temporary RAM stack based on PCDs
    4342    ;
    44     mov     eax, BASE_512KB
     43    SEC_TOP_OF_STACK EQU (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \
     44                          FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))
     45    mov     eax, SEC_TOP_OF_STACK
    4546    mov     esp, eax
    4647    nop
    4748
    4849    ;
    49     ; Call into C code
     50    ; Setup parameters and call SecCoreStartupWithStack
     51    ;   [esp]   return address for call
     52    ;   [esp+4] BootFirmwareVolumePtr
     53    ;   [esp+8] TopOfCurrentStack
    5054    ;
    5155    push    eax
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Sec/SecMain.c

    r48674 r58459  
    22  Main SEC phase code.  Transitions to PEI.
    33
    4   Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.<BR>
    55
    66  This program and the accompanying materials
     
    129129  with the specified section type.
    130130
     131  The Instance parameter indicates which instance of the section
     132  type to return. (0 is first instance, 1 is second...)
     133
     134  @param[in]   Sections        The sections to search
     135  @param[in]   SizeOfSections  Total size of all sections
     136  @param[in]   SectionType     The section type to locate
     137  @param[in]   Instance        The section instance number
     138  @param[out]  FoundSection    The FFS section if found
     139
     140  @retval EFI_SUCCESS           The file and section was found
     141  @retval EFI_NOT_FOUND         The file and section was not found
     142  @retval EFI_VOLUME_CORRUPTED  The firmware volume was corrupted
     143
     144**/
     145EFI_STATUS
     146FindFfsSectionInstance (
     147  IN  VOID                             *Sections,
     148  IN  UINTN                            SizeOfSections,
     149  IN  EFI_SECTION_TYPE                 SectionType,
     150  IN  UINTN                            Instance,
     151  OUT EFI_COMMON_SECTION_HEADER        **FoundSection
     152  )
     153{
     154  EFI_PHYSICAL_ADDRESS        CurrentAddress;
     155  UINT32                      Size;
     156  EFI_PHYSICAL_ADDRESS        EndOfSections;
     157  EFI_COMMON_SECTION_HEADER   *Section;
     158  EFI_PHYSICAL_ADDRESS        EndOfSection;
     159
     160  //
     161  // Loop through the FFS file sections within the PEI Core FFS file
     162  //
     163  EndOfSection = (EFI_PHYSICAL_ADDRESS)(UINTN) Sections;
     164  EndOfSections = EndOfSection + SizeOfSections;
     165  for (;;) {
     166    if (EndOfSection == EndOfSections) {
     167      break;
     168    }
     169    CurrentAddress = (EndOfSection + 3) & ~(3ULL);
     170    if (CurrentAddress >= EndOfSections) {
     171      return EFI_VOLUME_CORRUPTED;
     172    }
     173
     174    Section = (EFI_COMMON_SECTION_HEADER*)(UINTN) CurrentAddress;
     175
     176    Size = SECTION_SIZE (Section);
     177    if (Size < sizeof (*Section)) {
     178      return EFI_VOLUME_CORRUPTED;
     179    }
     180
     181    EndOfSection = CurrentAddress + Size;
     182    if (EndOfSection > EndOfSections) {
     183      return EFI_VOLUME_CORRUPTED;
     184    }
     185
     186    //
     187    // Look for the requested section type
     188    //
     189    if (Section->Type == SectionType) {
     190      if (Instance == 0) {
     191        *FoundSection = Section;
     192        return EFI_SUCCESS;
     193      } else {
     194        Instance--;
     195      }
     196    }
     197  }
     198
     199  return EFI_NOT_FOUND;
     200}
     201
     202/**
     203  Locates a section within a series of sections
     204  with the specified section type.
     205
    131206  @param[in]   Sections        The sections to search
    132207  @param[in]   SizeOfSections  Total size of all sections
     
    147222  )
    148223{
    149   EFI_PHYSICAL_ADDRESS        CurrentAddress;
    150   UINT32                      Size;
    151   EFI_PHYSICAL_ADDRESS        EndOfSections;
    152   EFI_COMMON_SECTION_HEADER   *Section;
    153   EFI_PHYSICAL_ADDRESS        EndOfSection;
    154 
    155   //
    156   // Loop through the FFS file sections within the PEI Core FFS file
    157   //
    158   EndOfSection = (EFI_PHYSICAL_ADDRESS)(UINTN) Sections;
    159   EndOfSections = EndOfSection + SizeOfSections;
    160   for (;;) {
    161     if (EndOfSection == EndOfSections) {
    162       break;
    163     }
    164     CurrentAddress = (EndOfSection + 3) & ~(3ULL);
    165     if (CurrentAddress >= EndOfSections) {
    166       return EFI_VOLUME_CORRUPTED;
    167     }
    168 
    169     Section = (EFI_COMMON_SECTION_HEADER*)(UINTN) CurrentAddress;
    170     DEBUG ((EFI_D_INFO, "Section->Type: 0x%x\n", Section->Type));
    171 
    172     Size = SECTION_SIZE (Section);
    173     if (Size < sizeof (*Section)) {
    174       return EFI_VOLUME_CORRUPTED;
    175     }
    176 
    177     EndOfSection = CurrentAddress + Size;
    178     if (EndOfSection > EndOfSections) {
    179       return EFI_VOLUME_CORRUPTED;
    180     }
    181 
    182     //
    183     // Look for the requested section type
    184     //
    185     if (Section->Type == SectionType) {
    186       *FoundSection = Section;
    187       return EFI_SUCCESS;
    188     }
    189     DEBUG ((EFI_D_INFO, "Section->Type (0x%x) != SectionType (0x%x)\n", Section->Type, SectionType));
    190   }
    191 
    192   return EFI_NOT_FOUND;
     224  return FindFfsSectionInstance (
     225           Sections,
     226           SizeOfSections,
     227           SectionType,
     228           0,
     229           FoundSection
     230           );
    193231}
    194232
     
    208246**/
    209247EFI_STATUS
    210 EFIAPI
    211248FindFfsFileAndSection (
    212249  IN  EFI_FIRMWARE_VOLUME_HEADER       *Fv,
     
    224261
    225262  if (Fv->Signature != EFI_FVH_SIGNATURE) {
    226     DEBUG ((EFI_D_INFO, "FV at %p does not have FV header signature\n", Fv));
     263    DEBUG ((EFI_D_ERROR, "FV at %p does not have FV header signature\n", Fv));
    227264    return EFI_VOLUME_CORRUPTED;
    228265  }
     
    246283      return EFI_VOLUME_CORRUPTED;
    247284    }
    248     DEBUG ((EFI_D_INFO, "File->Type: 0x%x\n", File->Type));
    249285
    250286    EndOfFile = CurrentAddress + Size;
     
    257293    //
    258294    if (File->Type != FileType) {
    259       DEBUG ((EFI_D_INFO, "File->Type (0x%x) != FileType (0x%x)\n", File->Type, FileType));
    260295      continue;
    261296    }
     
    277312
    278313  @param[in,out]  Fv            On input, the firmware volume to search
    279                                 On output, the decompressed main FV
     314                                On output, the decompressed BOOT/PEI FV
    280315
    281316  @retval EFI_SUCCESS           The file and section was found
     
    285320**/
    286321EFI_STATUS
    287 EFIAPI
    288 DecompressGuidedFv (
     322DecompressMemFvs (
    289323  IN OUT EFI_FIRMWARE_VOLUME_HEADER       **Fv
    290324  )
     
    298332  VOID                              *OutputBuffer;
    299333  VOID                              *ScratchBuffer;
    300   EFI_FIRMWARE_VOLUME_IMAGE_SECTION *NewFvSection;
    301   EFI_FIRMWARE_VOLUME_HEADER        *NewFv;
    302 
    303   NewFvSection = (EFI_FIRMWARE_VOLUME_IMAGE_SECTION*) NULL;
     334  EFI_FIRMWARE_VOLUME_IMAGE_SECTION *FvSection;
     335  EFI_FIRMWARE_VOLUME_HEADER        *PeiMemFv;
     336  EFI_FIRMWARE_VOLUME_HEADER        *DxeMemFv;
     337
     338  FvSection = (EFI_FIRMWARE_VOLUME_IMAGE_SECTION*) NULL;
    304339
    305340  Status = FindFfsFileAndSection (
     
    325360  }
    326361
    327   //PcdGet32 (PcdOvmfMemFvBase), PcdGet32 (PcdOvmfMemFvSize)
    328   OutputBuffer = (VOID*) ((UINT8*)(UINTN) PcdGet32 (PcdOvmfMemFvBase) + SIZE_1MB);
     362  OutputBuffer = (VOID*) ((UINT8*)(UINTN) PcdGet32 (PcdOvmfDxeMemFvBase) + SIZE_1MB);
    329363  ScratchBuffer = ALIGN_POINTER ((UINT8*) OutputBuffer + OutputBufferSize, SIZE_1MB);
    330364  Status = ExtractGuidedSectionDecode (
     
    339373  }
    340374
    341   Status = FindFfsSectionInSections (
     375  Status = FindFfsSectionInstance (
    342376             OutputBuffer,
    343377             OutputBufferSize,
    344378             EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
    345              (EFI_COMMON_SECTION_HEADER**) &NewFvSection
     379             0,
     380             (EFI_COMMON_SECTION_HEADER**) &FvSection
    346381             );
    347382  if (EFI_ERROR (Status)) {
    348     DEBUG ((EFI_D_ERROR, "Unable to find FV image in extracted data\n"));
     383    DEBUG ((EFI_D_ERROR, "Unable to find PEI FV section\n"));
    349384    return Status;
    350385  }
    351386
    352   NewFv = (EFI_FIRMWARE_VOLUME_HEADER*)(UINTN) PcdGet32 (PcdOvmfMemFvBase);
    353   CopyMem (NewFv, (VOID*) (NewFvSection + 1), PcdGet32 (PcdOvmfMemFvSize));
    354 
    355   if (NewFv->Signature != EFI_FVH_SIGNATURE) {
    356     DEBUG ((EFI_D_ERROR, "Extracted FV at %p does not have FV header signature\n", NewFv));
     387  ASSERT (SECTION_SIZE (FvSection) ==
     388          (PcdGet32 (PcdOvmfPeiMemFvSize) + sizeof (*FvSection)));
     389  ASSERT (FvSection->Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE);
     390
     391  PeiMemFv = (EFI_FIRMWARE_VOLUME_HEADER*)(UINTN) PcdGet32 (PcdOvmfPeiMemFvBase);
     392  CopyMem (PeiMemFv, (VOID*) (FvSection + 1), PcdGet32 (PcdOvmfPeiMemFvSize));
     393
     394  if (PeiMemFv->Signature != EFI_FVH_SIGNATURE) {
     395    DEBUG ((EFI_D_ERROR, "Extracted FV at %p does not have FV header signature\n", PeiMemFv));
    357396    CpuDeadLoop ();
    358397    return EFI_VOLUME_CORRUPTED;
    359398  }
    360399
    361   *Fv = NewFv;
     400  Status = FindFfsSectionInstance (
     401             OutputBuffer,
     402             OutputBufferSize,
     403             EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
     404             1,
     405             (EFI_COMMON_SECTION_HEADER**) &FvSection
     406             );
     407  if (EFI_ERROR (Status)) {
     408    DEBUG ((EFI_D_ERROR, "Unable to find DXE FV section\n"));
     409    return Status;
     410  }
     411
     412  ASSERT (FvSection->Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE);
     413  ASSERT (SECTION_SIZE (FvSection) ==
     414          (PcdGet32 (PcdOvmfDxeMemFvSize) + sizeof (*FvSection)));
     415
     416  DxeMemFv = (EFI_FIRMWARE_VOLUME_HEADER*)(UINTN) PcdGet32 (PcdOvmfDxeMemFvBase);
     417  CopyMem (DxeMemFv, (VOID*) (FvSection + 1), PcdGet32 (PcdOvmfDxeMemFvSize));
     418
     419  if (DxeMemFv->Signature != EFI_FVH_SIGNATURE) {
     420    DEBUG ((EFI_D_ERROR, "Extracted FV at %p does not have FV header signature\n", DxeMemFv));
     421    CpuDeadLoop ();
     422    return EFI_VOLUME_CORRUPTED;
     423  }
     424
     425  *Fv = PeiMemFv;
    362426  return EFI_SUCCESS;
    363427}
     
    375439**/
    376440EFI_STATUS
    377 EFIAPI
    378441FindPeiCoreImageBaseInFv (
    379442  IN  EFI_FIRMWARE_VOLUME_HEADER       *Fv,
     
    407470}
    408471
     472
     473/**
     474  Reads 8-bits of CMOS data.
     475
     476  Reads the 8-bits of CMOS data at the location specified by Index.
     477  The 8-bit read value is returned.
     478
     479  @param  Index  The CMOS location to read.
     480
     481  @return The value read.
     482
     483**/
     484STATIC
     485UINT8
     486CmosRead8 (
     487  IN      UINTN                     Index
     488  )
     489{
     490  IoWrite8 (0x70, (UINT8) Index);
     491  return IoRead8 (0x71);
     492}
     493
     494
     495STATIC
     496BOOLEAN
     497IsS3Resume (
     498  VOID
     499  )
     500{
     501  return (CmosRead8 (0xF) == 0xFE);
     502}
     503
     504
     505STATIC
     506EFI_STATUS
     507GetS3ResumePeiFv (
     508  IN OUT EFI_FIRMWARE_VOLUME_HEADER       **PeiFv
     509  )
     510{
     511  *PeiFv = (EFI_FIRMWARE_VOLUME_HEADER*)(UINTN) PcdGet32 (PcdOvmfPeiMemFvBase);
     512  return EFI_SUCCESS;
     513}
     514
     515
    409516/**
    410517  Locates the PEI Core entry point address
     
    419526**/
    420527VOID
    421 EFIAPI
    422528FindPeiCoreImageBase (
    423529  IN OUT  EFI_FIRMWARE_VOLUME_HEADER       **BootFv,
     
    427533  *PeiCoreImageBase = 0;
    428534
    429   FindMainFv (BootFv);
    430 
    431   DecompressGuidedFv (BootFv);
     535  if (IsS3Resume ()) {
     536    DEBUG ((EFI_D_VERBOSE, "SEC: S3 resume\n"));
     537    GetS3ResumePeiFv (BootFv);
     538  } else {
     539    DEBUG ((EFI_D_VERBOSE, "SEC: Normal boot\n"));
     540    FindMainFv (BootFv);
     541
     542    DecompressMemFvs (BootFv);
     543  }
    432544
    433545  FindPeiCoreImageBaseInFv (*BootFv, PeiCoreImageBase);
     
    439551**/
    440552EFI_STATUS
    441 EFIAPI
    442553FindImageBase (
    443554  IN  EFI_FIRMWARE_VOLUME_HEADER       *BootFirmwareVolumePtr,
     
    532643**/
    533644VOID
    534 EFIAPI
    535645FindAndReportEntryPoints (
    536646  IN  EFI_FIRMWARE_VOLUME_HEADER       **BootFirmwareVolumePtr,
     
    591701  ProcessLibraryConstructorList (NULL, NULL);
    592702
    593   DEBUG ((EFI_D_ERROR,
     703  DEBUG ((EFI_D_INFO,
    594704    "SecCoreStartupWithStack(0x%x, 0x%x)\n",
    595705    (UINT32)(UINTN)BootFv,
     
    616726  AsmWriteIdtr (&IdtDescriptor);
    617727
     728#if defined (MDE_CPU_X64)
     729  //
     730  // ASSERT that the Page Tables were set by the reset vector code to
     731  // the address we expect.
     732  //
     733  ASSERT (AsmReadCr3 () == (UINTN) PcdGet32 (PcdOvmfSecPageTablesBase));
     734#endif
     735
    618736  //
    619737  // |-------------|       <-- TopOfCurrentStack
     
    624742  //
    625743
     744  ASSERT ((UINTN) (PcdGet32 (PcdOvmfSecPeiTempRamBase) +
     745                   PcdGet32 (PcdOvmfSecPeiTempRamSize)) ==
     746          (UINTN) TopOfCurrentStack);
     747
    626748  //
    627749  // Initialize SEC hand-off state
     
    629751  SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF);
    630752
    631   SecCoreData.TemporaryRamSize       = SIZE_64KB;
     753  SecCoreData.TemporaryRamSize       = (UINTN) PcdGet32 (PcdOvmfSecPeiTempRamSize);
    632754  SecCoreData.TemporaryRamBase       = (VOID*)((UINT8 *)TopOfCurrentStack - SecCoreData.TemporaryRamSize);
    633755
     
    714836  BASE_LIBRARY_JUMP_BUFFER         JumpBuffer;
    715837 
    716   DEBUG ((EFI_D_ERROR, "TemporaryRamMigration(0x%x, 0x%x, 0x%x)\n", (UINTN)TemporaryMemoryBase, (UINTN)PermanentMemoryBase, CopySize));
     838  DEBUG ((EFI_D_INFO,
     839    "TemporaryRamMigration(0x%x, 0x%x, 0x%x)\n",
     840    (UINTN) TemporaryMemoryBase,
     841    (UINTN) PermanentMemoryBase,
     842    CopySize
     843    ));
    717844 
    718845  OldHeap = (VOID*)(UINTN)TemporaryMemoryBase;
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Sec/SecMain.inf

    r48674 r58459  
    22#  SEC Driver
    33#
    4 #  Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
     4#  Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.<BR>
    55#
    66#  This program and the accompanying materials
     
    6565
    6666[Pcd]
    67   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase
    68   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
     67  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase
     68  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize
     69  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase
     70  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
     71  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase
     72  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase
     73  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Sec/X64/SecEntry.S

    r48674 r58459  
    22#------------------------------------------------------------------------------
    33#*
    4 #*   Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
     4#*   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    55#*   This program and the accompanying materials
    66#*   are licensed and made available under the terms and conditions of the BSD License
     
    4040    # can reload to a better address.
    4141    #
    42     movq    $BASE_512KB, %rsp
     42    .set    SEC_TOP_OF_STACK, FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \
     43                              FixedPcdGet32 (PcdOvmfSecPeiTempRamSize)
     44    movq    $SEC_TOP_OF_STACK, %rsp
    4345    nop
    4446
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Sec/X64/SecEntry.asm

    r48674 r58459  
    22;------------------------------------------------------------------------------
    33;*
    4 ;*   Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
     4;*   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    55;*   This program and the accompanying materials
    66;*   are licensed and made available under the terms and conditions of the BSD License
     
    3737
    3838    ;
    39     ; Load temporary stack top at very low memory.  The C code
    40     ; can reload to a better address.
     39    ; Load temporary RAM stack based on PCDs
    4140    ;
    42     mov     rsp, BASE_512KB
     41    SEC_TOP_OF_STACK EQU (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \
     42                          FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))
     43    mov     rsp, SEC_TOP_OF_STACK
    4344    nop
    4445
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c

    r48674 r58459  
    8585
    8686  @param  Smbios               SMBIOS protocol
    87   @param  EntryPointStructure  SMBIOS entry point structures block
     87  @param  TableAddress         SMBIOS tables starting address
    8888
    8989**/
     
    9191InstallAllStructures (
    9292  IN EFI_SMBIOS_PROTOCOL       *Smbios,
    93   IN SMBIOS_TABLE_ENTRY_POINT  *EntryPointStructure
     93  IN UINT8                     *TableAddress
    9494  )
    9595{
     
    9898  EFI_SMBIOS_HANDLE         SmbiosHandle;
    9999
    100   SmbiosTable.Raw = (UINT8*)(UINTN) EntryPointStructure->TableAddress;
     100  SmbiosTable.Raw = TableAddress;
    101101  if (SmbiosTable.Raw == NULL) {
    102102    return EFI_INVALID_PARAMETER;
     
    107107    // Log the SMBIOS data for this structure
    108108    //
    109     SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
     109    SmbiosHandle = SmbiosTable.Hdr->Handle;
    110110    Status = Smbios->Add (
    111111                       Smbios,
     
    146146  EFI_SMBIOS_PROTOCOL       *Smbios;
    147147  SMBIOS_TABLE_ENTRY_POINT  *EntryPointStructure;
     148  UINT8                     *SmbiosTables;
    148149
    149150  //
     
    160161
    161162  //
    162   // Add Xen SMBIOS data if found
     163  // Add Xen or QEMU SMBIOS data if found
    163164  //
    164165  EntryPointStructure = GetXenSmbiosTables ();
    165166  if (EntryPointStructure != NULL) {
    166     Status = InstallAllStructures (Smbios, EntryPointStructure);
     167    SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
     168  } else {
     169    SmbiosTables = GetQemuSmbiosTables ();
     170  }
     171
     172  if (SmbiosTables != NULL) {
     173    Status = InstallAllStructures (Smbios, SmbiosTables);
     174
     175    //
     176    // Free SmbiosTables if allocated by Qemu (i.e., NOT by Xen):
     177    //
     178    if (EntryPointStructure == NULL) {
     179      FreePool (SmbiosTables);
     180    }
    167181  }
    168182
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h

    r48674 r58459  
    2626#include <Library/BaseMemoryLib.h>
    2727#include <Library/UefiBootServicesTableLib.h>
     28#include <Library/MemoryAllocationLib.h>
    2829
    2930
     
    3637SMBIOS_TABLE_ENTRY_POINT *
    3738GetXenSmbiosTables (
     39  VOID
     40  );
     41
     42
     43/**
     44  Locates and extracts the QEMU SMBIOS table data if present in fw_cfg
     45
     46  @return             Address of extracted QEMU SMBIOS data
     47
     48**/
     49UINT8 *
     50GetQemuSmbiosTables (
    3851  VOID
    3952  );
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf

    r48674 r58459  
    3333  SmbiosPlatformDxe.c
    3434  Xen.c
     35  Qemu.c
    3536
    3637[Packages]
     
    4647  DebugLib
    4748  HobLib
     49  QemuFwCfgLib
     50  MemoryAllocationLib
    4851
    4952[Protocols]
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/build.sh

    r48674 r58459  
    1 #!/bin/bash
     1#!/usr/bin/env bash
    22#
    33# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
    4 # Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
     4# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
    55#
    66# This program and the accompanying materials
     
    4242#
    4343
    44 PROCESSOR=X64
     44ARCH_IA32=no
     45ARCH_X64=no
    4546BUILDTARGET=DEBUG
    4647BUILD_OPTIONS=
    4748PLATFORMFILE=
     49THREADNUMBER=1
    4850LAST_ARG=
    4951RUN_QEMU=no
     52ENABLE_FLASH=no
    5053
    5154#
     
    5861    ;;
    5962  Darwin*)
    60       Major=$(uname -r | cut -f 1 -d '.')
    61       if [[ $Major == 9 ]]
    62       then
     63    Major=$(uname -r | cut -f 1 -d '.')
     64    case $Major in
     65      10)
     66        TARGET_TOOLS=XCODE32
     67        ;;
     68      1[12])
     69        TARGET_TOOLS=XCLANG
     70        ;;
     71       *)
    6372        echo OvmfPkg requires Snow Leopard or later OS
    6473        exit 1
    65       else
    66         TARGET_TOOLS=XCODE32
    67       fi
    68       ;;
     74        ;;
     75    esac
     76    ;;
    6977  Linux*)
    7078    gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
     
    7684        TARGET_TOOLS=GCC46
    7785        ;;
     86      4.7.*)
     87        TARGET_TOOLS=GCC47
     88        ;;
     89      4.8.*)
     90        TARGET_TOOLS=GCC48
     91        ;;
     92      4.9.*|4.1[0-9].*)
     93        TARGET_TOOLS=GCC49
     94        ;;
    7895      *)
    7996        TARGET_TOOLS=GCC44
     
    90107  if [ -z "$LAST_ARG" ]; then
    91108    case $arg in
    92       -a|-b|-t|-p)
     109      -a|-b|-t|-p|-n)
    93110        LAST_ARG=$arg
    94111        ;;
     
    98115        break
    99116        ;;
     117      --enable-flash)
     118        ENABLE_FLASH=yes
     119        ;;
    100120      *)
    101121        BUILD_OPTIONS="$BUILD_OPTIONS $arg"
     
    105125    case $LAST_ARG in
    106126      -a)
    107         PROCESSOR=$arg
     127        if [[ x"$arg" != x"IA32" && x"$arg" != x"X64" ]]; then
     128          echo Unsupported processor architecture: $arg
     129          echo Only IA32 or X64 is supported
     130          exit 1
     131        fi
     132        eval ARCH_$arg=yes
    108133        ;;
    109134      -b)
     
    116141        TARGET_TOOLS=$arg
    117142        ;;
     143      -n)
     144        THREADNUMBER=$arg
     145        ;;
    118146      *)
    119147        BUILD_OPTIONS="$BUILD_OPTIONS $arg"
     
    125153done
    126154
     155if [[ "$ARCH_IA32" == "yes" && "$ARCH_X64" == "yes" ]]; then
     156  PROCESSOR=IA32X64
     157  Processor=Ia32X64
     158  BUILD_OPTIONS="$BUILD_OPTIONS -a IA32 -a X64"
     159  PLATFORM_BUILD_DIR=Ovmf3264
     160  BUILD_ROOT_ARCH=X64
     161elif [[ "$ARCH_IA32" == "yes" && "$ARCH_X64" == "no" ]]; then
     162  PROCESSOR=IA32
     163  Processor=Ia32
     164  BUILD_OPTIONS="$BUILD_OPTIONS -a IA32"
     165  PLATFORM_BUILD_DIR=Ovmf$Processor
     166  BUILD_ROOT_ARCH=$PROCESSOR
     167else
     168  PROCESSOR=X64
     169  Processor=X64
     170  BUILD_OPTIONS="$BUILD_OPTIONS -a X64"
     171  PLATFORM_BUILD_DIR=Ovmf$Processor
     172  BUILD_ROOT_ARCH=X64
     173fi
     174
    127175case $PROCESSOR in
    128176  IA32)
    129     Processor=Ia32
    130     QEMU_COMMAND=qemu
    131     ;;
    132   X64)
    133     Processor=X64
    134     QEMU_COMMAND=qemu-system-x86_64
     177    if [ -n "$QEMU_COMMAND" ]; then
     178      #
     179      # The user set the QEMU_COMMAND variable. We'll use it to run QEMU.
     180      #
     181      :
     182    elif  [ -x `which qemu-system-i386` ]; then
     183      QEMU_COMMAND=qemu-system-i386
     184    elif  [ -x `which qemu-system-x86_64` ]; then
     185      QEMU_COMMAND=qemu-system-x86_64
     186    elif  [ -x `which qemu` ]; then
     187      QEMU_COMMAND=qemu
     188    else
     189      echo Unable to find QEMU for IA32 architecture!
     190      exit 1
     191    fi
     192    ;;
     193  X64|IA32X64)
     194    if [ -z "$QEMU_COMMAND" ]; then
     195      #
     196      # The user didn't set the QEMU_COMMAND variable.
     197      #
     198      QEMU_COMMAND=qemu-system-x86_64
     199    fi
    135200    ;;
    136201  *)
     
    145210fi
    146211
    147 ADD_QEMU_HDA=yes
    148 for arg in "$@"
    149 do
    150   case $arg in
    151     -hd[a-d]|-fd[ab]|-cdrom)
    152       ADD_QEMU_HDA=no
    153       break
     212if [[ "$RUN_QEMU" == "yes" ]]; then
     213  qemu_version=$($QEMU_COMMAND -version 2>&1 | tail -1 | awk '{print $4}')
     214  case $qemu_version in
     215    1.[6-9].*|1.[1-9][0-9].*|2.*.*)
     216      ENABLE_FLASH=yes
    154217      ;;
    155218  esac
    156 done
     219
     220  ADD_QEMU_HDA=yes
     221  for arg in "$@"
     222  do
     223    case $arg in
     224      -hd[a-d]|-fd[ab]|-cdrom)
     225        ADD_QEMU_HDA=no
     226        break
     227        ;;
     228    esac
     229  done
     230fi
    157231
    158232#
     
    167241#exit 1
    168242
    169 BUILD_ROOT=$WORKSPACE/Build/Ovmf$Processor/"$BUILDTARGET"_"$TARGET_TOOLS"
     243BUILD_ROOT=$WORKSPACE/Build/$PLATFORM_BUILD_DIR/"$BUILDTARGET"_"$TARGET_TOOLS"
    170244FV_DIR=$BUILD_ROOT/FV
    171 BUILD_ROOT_ARCH=$BUILD_ROOT/$PROCESSOR
     245BUILD_ROOT_ARCH=$BUILD_ROOT/$BUILD_ROOT_ARCH
    172246QEMU_FIRMWARE_DIR=$BUILD_ROOT/QEMU
    173247
     
    192266  fi
    193267  ln -sf $FV_DIR/OVMF.fd $QEMU_FIRMWARE_DIR/bios.bin
    194   ln -sf $FV_DIR/OvmfVideo.rom $QEMU_FIRMWARE_DIR/vgabios-cirrus.bin
     268  if [[ "$ENABLE_FLASH" == "yes" ]]; then
     269    QEMU_COMMAND="$QEMU_COMMAND -pflash $QEMU_FIRMWARE_DIR/bios.bin"
     270  else
     271    QEMU_COMMAND="$QEMU_COMMAND -L $QEMU_FIRMWARE_DIR"
     272  fi
    195273  if [[ "$ADD_QEMU_HDA" == "yes" ]]; then
    196     AUTO_QEMU_HDA="-hda fat:$BUILD_ROOT_ARCH"
    197   else
    198     AUTO_QEMU_HDA=
    199   fi
    200   QEMU_COMMAND="$QEMU_COMMAND -L $QEMU_FIRMWARE_DIR $AUTO_QEMU_HDA $*"
     274    QEMU_COMMAND="$QEMU_COMMAND -hda fat:$BUILD_ROOT_ARCH"
     275  fi
     276  QEMU_COMMAND="$QEMU_COMMAND $*"
    201277  echo Running: $QEMU_COMMAND
    202278  $QEMU_COMMAND
     
    208284#
    209285echo Running edk2 build for OvmfPkg$Processor
    210 build -p $PLATFORMFILE $BUILD_OPTIONS -a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS
     286build -p $PLATFORMFILE $BUILD_OPTIONS -b $BUILDTARGET -t $TARGET_TOOLS -n $THREADNUMBER
    211287exit $?
    212288
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/create-release.py

    r48674 r58459  
    11#!/usr/bin/python
    22#
    3 # Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
     3# Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
    44#
    55# This program and the accompanying materials
     
    1111# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
    1212#
    13 
    14 release_type = 'alpha'
    1513
    1614import os
     
    3331    print "OvmfPkg/OvmfPkgX64.dsc doesn't exist"
    3432    sys.exit(-1)
    35 
    36 if 'TOOLCHAIN' in os.environ:
    37     TOOLCHAIN = os.environ['TOOLCHAIN']
    38 else:
    39     TOOLCHAIN = 'GCC44'
    4033
    4134def run_and_capture_output(args, checkExitCode = True):
     
    4740    return stdout
    4841
    49 def git_svn_info():
     42gcc_version = run_and_capture_output(args=('gcc', '--version'))
     43gcc_re = re.compile(r'\s*\S+\s+\([^\)]+?\)\s+(\d+(?:\.\d+)*)(?:\s+.*)?')
     44mo = gcc_re.match(gcc_version)
     45if not mo:
     46    print "Unable to find GCC version"
     47    sys.exit(-1)
     48gcc_version = map(lambda n: int(n), mo.group(1).split('.'))
     49
     50if 'TOOLCHAIN' in os.environ:
     51    TOOLCHAIN = os.environ['TOOLCHAIN']
     52else:
     53    assert(gcc_version[0] == 4)
     54    minor = max(4, min(7, gcc_version[1]))
     55    TOOLCHAIN = 'GCC4' + str(minor)
     56
     57def git_based_version():
    5058    dir = os.getcwd()
    51     os.chdir('OvmfPkg')
    52     stdout = run_and_capture_output(args=('git', 'svn', 'info'))
     59    if not os.path.exists('.git'):
     60        os.chdir('OvmfPkg')
     61    stdout = run_and_capture_output(args=('git', 'log',
     62                                          '-n', '1',
     63                                          '--abbrev-commit'))
     64    regex = re.compile(r'^\s*git-svn-id:\s+\S+@(\d+)\s+[0-9a-f\-]+$',
     65                       re.MULTILINE)
     66    mo = regex.search(stdout)
     67    if mo:
     68        version = 'r' + mo.group(1)
     69    else:
     70        version = stdout.split(None, 3)[1]
    5371    os.chdir(dir)
    54     return stdout
     72    return version
    5573
    5674def svn_info():
     
    6179    return stdout
    6280
    63 def get_svn_info_output():
     81def svn_based_version():
     82        buf = svn_info()
     83        revision_re = re.compile('^Revision\:\s*([\da-f]+)$', re.MULTILINE)
     84        mo = revision_re.search(buf)
     85        assert(mo is not None)
     86        return 'r' + mo.group(1)
     87
     88def get_revision():
    6489    if os.path.exists(os.path.join('OvmfPkg', '.svn')):
    65         return svn_info()
     90        return svn_based_version()
    6691    else:
    67         return git_svn_info()
    68 
    69 def get_revision():
    70     buf = get_svn_info_output()
    71     revision_re = re.compile('^Revision\:\s*(\d+)$', re.MULTILINE)
    72     mo = revision_re.search(buf)
    73     if mo is not None:
    74         return int(mo.group(1))
     92        return git_based_version()
    7593
    7694revision = get_revision()
     
    85103    machine = run_and_capture_output(args=('uname', '-m')).strip()
    86104
    87     gcc_version = run_and_capture_output(args=('gcc', '--version'))
    88     gcc_version = gcc_version.split('\n')[0].split()[-1]
     105    gcc_version_str = '.'.join(map(lambda v: str(v), gcc_version))
    89106
    90107    ld_version = run_and_capture_output(args=('ld', '--version'))
     
    96113
    97114    sb = StringIO.StringIO()
    98     print >> sb, 'edk2:    ', 'r%d' % revision
    99     print >> sb, 'compiler: GCC', gcc_version
     115    print >> sb, 'edk2:    ', revision
     116    print >> sb, 'compiler: GCC', gcc_version_str, '(' + TOOLCHAIN + ')'
    100117    print >> sb, 'binutils:', ld_version
    101118    print >> sb, 'iasl:    ', iasl_version
    102119    print >> sb, 'system:  ', distro, machine.replace('_', '-')
    103120    return to_dos_text(sb.getvalue())
     121
     122def read_file(filename):
     123    f = open(filename)
     124    d = f.read()
     125    f.close()
     126    return d
    104127
    105128LICENSE = to_dos_text(
     
    117140=== BSD license: START ===
    118141
    119 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
    120 
    121 Redistribution and use in source and binary forms, with or without
    122 modification, are permitted provided that the following conditions
    123 are met:
    124 
    125 * Redistributions of source code must retain the above copyright
    126   notice, this list of conditions and the following disclaimer.
    127 * Redistributions in binary form must reproduce the above copyright
    128   notice, this list of conditions and the following disclaimer in
    129   the documentation and/or other materials provided with the
    130   distribution.
    131 * Neither the name of the Intel Corporation nor the names of its
    132   contributors may be used to endorse or promote products derived
    133   from this software without specific prior written permission.
    134 
    135 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    136 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    137 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
    138 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    139 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    140 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    141 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    142 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    143 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    144 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
    145 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    146 POSSIBILITY OF SUCH DAMAGE.
    147 
     142''')
     143
     144LICENSE += read_file(os.path.join('MdePkg', 'License.txt'))
     145
     146LICENSE += to_dos_text(
     147'''
    148148=== BSD license: END ===
    149149
    150150=== FAT filesystem driver license: START ===
    151151
    152 Copyright (c) 2004, Intel Corporation. All rights reserved.
    153 
    154 Redistribution and use in source and binary forms, with or without
    155 modification, are permitted provided that the following conditions
    156 are met:
    157 
    158 * Redistributions of source code must retain the above copyright
    159   notice, this list of conditions and the following disclaimer.
    160 * Redistributions in binary form must reproduce the above copyright
    161   notice, this list of conditions and the following disclaimer in
    162   the documentation and/or other materials provided with the
    163   distribution.
    164 * Neither the name of Intel nor the names of its
    165   contributors may be used to endorse or promote products derived
    166   from this software without specific prior written permission.
    167 
    168 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    169 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    170 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
    171 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    172 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    173 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    174 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    175 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    176 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    177 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
    178 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    179 POSSIBILITY OF SUCH DAMAGE.
    180 
    181 Additional terms:
    182 In addition to the forgoing, redistribution and use of the code is
    183 conditioned upon the FAT 32 File System Driver and all derivative
    184 works thereof being used for and designed only to read and/or write
    185 to a file system that is directly managed by an Extensible Firmware
    186 Interface (EFI) implementation or by an emulator of an EFI
    187 implementation.
    188 
     152''')
     153
     154LICENSE += read_file(os.path.join('FatBinPkg', 'License.txt'))
     155
     156LICENSE += to_dos_text(
     157'''
    189158=== FAT filesystem driver license: END ===
    190159''')
     
    211180def create_zip(arch):
    212181    global build_info
    213     filename = 'OVMF-%s-r%d-%s.zip' % (arch, revision, release_type)
     182    filename = 'OVMF-%s-%s.zip' % (arch, revision)
    214183    print 'Creating', filename, '...',
    215184    sys.stdout.flush()
     
    228197        )
    229198    zipf.write(os.path.join(FV_DIR, 'OVMF.fd'), 'OVMF.fd')
    230     zipf.write(os.path.join(FV_DIR, 'CirrusLogic5446.rom'), 'CirrusLogic5446.rom')
    231199    zipf.close()
    232200    print '[done]'
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette