On Thu, Sep 11, 2008 at 06:30:11AM +0200, Tristan Gingold wrote:
> On Thu, Sep 11, 2008 at 11:47:15AM +0900, Isaku Yamahata wrote:
> > > Hi Isaku,
> > >
> > > this looks to be slightly over-complex. Why not programming the VGA
> > > inside VgaInit ?
> >
> > Because ioemu requires that tells xen chip before starting programming
> > the VGA. After initializing VGA, it's too late to tell ioemu
> > address of memory for vram.
>
> Ok, but VgaInit is the first DXE to access to the VGA. So you can
> modify VgaInit to allocate and set address of vram memory before it
> initializes the VGA card.
Updated the patch following the above.
I also attached the patch to update Xen-Xz1.fpd and Qemu-Ia32.fpd,
but I only compiled for Xen-Ipf.fpd, not for compiled for Xen-Xz1.fpd and
Qemu-Ia32.fpd.
allocate xen vram area and tell xen pci chip.
This is GFW counter part of xen-unstable 18383:dade7f0bdc8d.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
diff -r 830ed5449dd4
edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/VgaInit.c
--- a/edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/VgaInit.c Wed May
14 11:22:58 2008 +0900
+++ b/edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/VgaInit.c Thu Sep
11 21:27:18 2008 +0900
@@ -35,6 +35,7 @@
*/
#include <VgaBios.h>
+#include "XenVRam.h"
extern const unsigned char console_font[];
static const unsigned int palette[] = {
@@ -307,6 +308,7 @@
IN EFI_SYSTEM_TABLE *SystemTable
)
{
+ InitializeXenVRam();
if (FeaturePcdGet (PcdVgaInitAtBoot)) {
VgaReset();
VgaBiosInit();
diff -r 830ed5449dd4
edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/VgaInit.msa
--- a/edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/VgaInit.msa
Wed May 14 11:22:58 2008 +0900
+++ b/edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/VgaInit.msa
Thu Sep 11 21:27:18 2008 +0900
@@ -54,10 +54,17 @@
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseMemoryLib</Keyword>
</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>MemoryAllocationLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>PciLib</Keyword>
+ </LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>Font.c</Filename>
<Filename>VgaInit.c</Filename>
+ <Filename>XenVRam.c</Filename>
</SourceFiles>
<PackageDependencies>
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
diff -r 830ed5449dd4
edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/XenVRam.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/XenVRam.c Thu Sep
11 21:27:18 2008 +0900
@@ -0,0 +1,116 @@
+/*++
+
+Copyright (c) 2008 Isaku Yamahata All rights reserved
+
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD
License
+which accompanies this distribution. The full text of the license may be
found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+
+Module Name:
+
+ XenVRam.c
+
+Abstract:
+
+
+Revision History
+--*/
+#include <IndustryStandard/pci22.h>
+
+#define PCI_BASE_ADDRESS_IO_MASK (~0x03UL)
+#define XEN_PLATFORM_VENDOR_ID 0x5853
+#define XEN_PLATFORM_DEVICE_ID 0x0001
+
+//
+// BAR 0
+// Offset 4 bytes
+//
+#define XEN_BAR_INDEX PCI_BAR_IDX0
+#define XEN_VGA_OFFSET 4
+
+//
+// In x86 case page size is 4k.
+// In ia64 case page size is usually 16k, but 64K page size can be used
+// with compile time option of Xen VMM/kernel/tools stack.
+// Alignment bigger than effective xen page size doesn't harm and we don't
+// want to have many gfw binaries for each page size.
+//
+#define XEN_PAGE_SIZE (64 * 1024)
+#define VGA_RAM_SIZE (8192 * 1024)
+
+// Round up to XEN_PAGE_SIZE
+#define VGA_RAM_PAGES EFI_SIZE_TO_PAGES (((VGA_RAM_SIZE +
(XEN_PAGE_SIZE - 1)) / XEN_PAGE_SIZE) * XEN_PAGE_SIZE)
+
+VOID
+InitializeXenVRam(
+ VOID
+ )
+{
+ CONST UINTN Bus = 0;
+ UINTN Device;
+ CONST UINTN Function = 0;
+
+ VOID *VgaRam;
+ UINT64 Data64;
+ UINT32 Data32;
+ UINT32 Bar0;
+
+ for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
+ UINT16 VendorId;
+ UINT16 DeviceId;
+
+ VendorId = PciRead16 (PCI_LIB_ADDRESS (
+ Bus,
+ Device,
+ Function,
+ PCI_VENDOR_ID_OFFSET
+ ));
+ DeviceId = PciRead16 (PCI_LIB_ADDRESS (
+ Bus,
+ Device,
+ Function,
+ PCI_DEVICE_ID_OFFSET
+ ));
+
+ if (VendorId == XEN_PLATFORM_VENDOR_ID &&
+ DeviceId == XEN_PLATFORM_DEVICE_ID) {
+ break;
+ }
+ }
+
+ if (Device >= PCI_MAX_DEVICE) {
+ // Not found
+ return;
+ }
+
+ VgaRam = AllocateAlignedRuntimePages (VGA_RAM_PAGES, XEN_PAGE_SIZE);
+ if (VgaRam == NULL) {
+ return;
+ }
+ ZeroMem (VgaRam, VGA_RAM_PAGES << EFI_PAGE_SHIFT);
+
+ Data64 = (UINT64)VgaRam;
+ Data32 = (UINT32)VgaRam;
+ if (Data64 != Data32) {
+ //
+ // At this moment, 32bit is only supported by qemu-dm
+ //
+ FreeAlignedPages (VgaRam, VGA_RAM_PAGES);
+ return;
+ }
+
+ Bar0 = PciRead32 (
+ PCI_LIB_ADDRESS (
+ Bus,
+ Device,
+ Function,
+ PCI_BASE_ADDRESSREG_OFFSET + XEN_BAR_INDEX * 4
+ ));
+ Bar0 &= PCI_BASE_ADDRESS_IO_MASK;
+ IoWrite32 (Bar0 + XEN_VGA_OFFSET, Data32);
+}
diff -r 830ed5449dd4
edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/XenVRam.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/XenVRam.h Thu Sep
11 21:27:18 2008 +0900
@@ -0,0 +1,31 @@
+/*++
+
+Copyright (c) 2008 Isaku Yamahata All rights reserved
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD
License
+which accompanies this distribution. The full text of the license may be
found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+
+Module Name:
+
+ XenVRam.h
+
+Abstract:
+
+
+Revision History
+--*/
+
+#ifndef _XEN_VRAM_H
+#define _XEN_VRAM_H
+
+VOID
+InitializeXenVRam(
+ VOID
+ );
+
+#endif
diff -r 830ed5449dd4 edk2-sparse/EdkXenPkg/Xen-Ipf.fpd
--- a/edk2-sparse/EdkXenPkg/Xen-Ipf.fpd Wed May 14 11:22:58 2008 +0900
+++ b/edk2-sparse/EdkXenPkg/Xen-Ipf.fpd Thu Sep 11 21:27:18 2008 +0900
@@ -3439,6 +3439,12 @@
<Instance ModuleGuid="40096a3a-5c2a-4fbc-aef7-5475dd7ab334"
ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"
PackageVersion="0.3"/>
<!--Pkg: MdePkg Mod: BaseMemoryLib Path:
MdePkg/Library/BaseMemoryLib/BaseMemoryLib.msa-->
<Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165"
ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"
PackageVersion="0.3"/>
+ <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path:
MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.msa-->
+ <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194"
ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"
PackageVersion="0.3"/>
+ <!--Pkg: MdePkg Mod: BasePciLibCf8 Path:
MdePkg/Library/BasePciLibCf8/BasePciLibCf8.msa-->
+ <Instance ModuleGuid="28bde99c-e8a7-4e3e-9a8a-e66cd64f31c6"
ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"
PackageVersion="0.3"/>
+ <!--Pkg: MdePkg Mod: BasePciCf8Lib Path:
MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.msa-->
+ <Instance ModuleGuid="472ab06d-9810-4c00-bb7f-dad1828fc1ab"
ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"
PackageVersion="0.3"/>
</Libraries>
<PcdBuildDefinition>
<PcdData ItemType="FEATURE_FLAG">
--
yamahata
update-fpd.patch
Description: Text Data
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
|