#include "Qemu.h"\r
#include <IndustryStandard/Acpi.h>\r
\r
-EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding = {\r
+EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding = {\r
QemuVideoControllerDriverSupported,\r
QemuVideoControllerDriverStart,\r
QemuVideoControllerDriverStop,\r
NULL\r
};\r
\r
-QEMU_VIDEO_CARD gQemuVideoCardList[] = {\r
- {\r
- PCI_CLASS_DISPLAY_VGA,\r
- CIRRUS_LOGIC_VENDOR_ID,\r
- CIRRUS_LOGIC_5430_DEVICE_ID,\r
- QEMU_VIDEO_CIRRUS_5430,\r
- L"Cirrus 5430"\r
- },{\r
- PCI_CLASS_DISPLAY_VGA,\r
- CIRRUS_LOGIC_VENDOR_ID,\r
- CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID,\r
- QEMU_VIDEO_CIRRUS_5430,\r
- L"Cirrus 5430"\r
- },{\r
- PCI_CLASS_DISPLAY_VGA,\r
- CIRRUS_LOGIC_VENDOR_ID,\r
- CIRRUS_LOGIC_5446_DEVICE_ID,\r
- QEMU_VIDEO_CIRRUS_5446,\r
- L"Cirrus 5446"\r
- },{\r
- PCI_CLASS_DISPLAY_VGA,\r
- 0x1234,\r
- 0x1111,\r
- QEMU_VIDEO_BOCHS_MMIO,\r
- L"QEMU Standard VGA"\r
- },{\r
- PCI_CLASS_DISPLAY_OTHER,\r
- 0x1234,\r
- 0x1111,\r
- QEMU_VIDEO_BOCHS_MMIO,\r
- L"QEMU Standard VGA (secondary)"\r
- },{\r
- PCI_CLASS_DISPLAY_VGA,\r
- 0x1b36,\r
- 0x0100,\r
- QEMU_VIDEO_BOCHS,\r
- L"QEMU QXL VGA"\r
- },{\r
- PCI_CLASS_DISPLAY_VGA,\r
- 0x1af4,\r
- 0x1050,\r
- QEMU_VIDEO_BOCHS_MMIO,\r
- L"QEMU VirtIO VGA"\r
- },{\r
- PCI_CLASS_DISPLAY_VGA,\r
- 0x15ad,\r
- 0x0405,\r
- QEMU_VIDEO_VMWARE_SVGA,\r
- L"QEMU VMWare SVGA"\r
- },{\r
- 0 /* end of list */\r
- }\r
+QEMU_VIDEO_CARD gQemuVideoCardList[] = {\r
+ {\r
+ PCI_CLASS_DISPLAY_VGA,\r
+ CIRRUS_LOGIC_VENDOR_ID,\r
+ CIRRUS_LOGIC_5430_DEVICE_ID,\r
+ QEMU_VIDEO_CIRRUS_5430,\r
+ L"Cirrus 5430"\r
+ },{\r
+ PCI_CLASS_DISPLAY_VGA,\r
+ CIRRUS_LOGIC_VENDOR_ID,\r
+ CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID,\r
+ QEMU_VIDEO_CIRRUS_5430,\r
+ L"Cirrus 5430"\r
+ },{\r
+ PCI_CLASS_DISPLAY_VGA,\r
+ CIRRUS_LOGIC_VENDOR_ID,\r
+ CIRRUS_LOGIC_5446_DEVICE_ID,\r
+ QEMU_VIDEO_CIRRUS_5446,\r
+ L"Cirrus 5446"\r
+ },{\r
+ PCI_CLASS_DISPLAY_VGA,\r
+ 0x1234,\r
+ 0x1111,\r
+ QEMU_VIDEO_BOCHS_MMIO,\r
+ L"QEMU Standard VGA"\r
+ },{\r
+ PCI_CLASS_DISPLAY_OTHER,\r
+ 0x1234,\r
+ 0x1111,\r
+ QEMU_VIDEO_BOCHS_MMIO,\r
+ L"QEMU Standard VGA (secondary)"\r
+ },{\r
+ PCI_CLASS_DISPLAY_VGA,\r
+ 0x1b36,\r
+ 0x0100,\r
+ QEMU_VIDEO_BOCHS,\r
+ L"QEMU QXL VGA"\r
+ },{\r
+ PCI_CLASS_DISPLAY_VGA,\r
+ 0x1af4,\r
+ 0x1050,\r
+ QEMU_VIDEO_BOCHS_MMIO,\r
+ L"QEMU VirtIO VGA"\r
+ },{\r
+ PCI_CLASS_DISPLAY_VGA,\r
+ 0x15ad,\r
+ 0x0405,\r
+ QEMU_VIDEO_VMWARE_SVGA,\r
+ L"QEMU VMWare SVGA"\r
+ },{\r
+ 0 /* end of list */\r
+ }\r
};\r
\r
-static QEMU_VIDEO_CARD*\r
-QemuVideoDetect(\r
- IN UINT8 SubClass,\r
- IN UINT16 VendorId,\r
- IN UINT16 DeviceId\r
+static QEMU_VIDEO_CARD *\r
+QemuVideoDetect (\r
+ IN UINT8 SubClass,\r
+ IN UINT16 VendorId,\r
+ IN UINT16 DeviceId\r
)\r
{\r
- UINTN Index = 0;\r
+ UINTN Index = 0;\r
\r
while (gQemuVideoCardList[Index].VendorId != 0) {\r
- if (gQemuVideoCardList[Index].SubClass == SubClass &&\r
- gQemuVideoCardList[Index].VendorId == VendorId &&\r
- gQemuVideoCardList[Index].DeviceId == DeviceId) {\r
+ if ((gQemuVideoCardList[Index].SubClass == SubClass) &&\r
+ (gQemuVideoCardList[Index].VendorId == VendorId) &&\r
+ (gQemuVideoCardList[Index].DeviceId == DeviceId))\r
+ {\r
return gQemuVideoCardList + Index;\r
}\r
+\r
Index++;\r
}\r
+\r
return NULL;\r
}\r
\r
EFI_STATUS\r
EFIAPI\r
QemuVideoControllerDriverSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_PCI_IO_PROTOCOL *PciIo;\r
- PCI_TYPE00 Pci;\r
- QEMU_VIDEO_CARD *Card;\r
+ EFI_STATUS Status;\r
+ EFI_PCI_IO_PROTOCOL *PciIo;\r
+ PCI_TYPE00 Pci;\r
+ QEMU_VIDEO_CARD *Card;\r
\r
//\r
// Open the PCI I/O Protocol\r
Status = gBS->OpenProtocol (\r
Controller,\r
&gEfiPciIoProtocolGuid,\r
- (VOID **) &PciIo,\r
+ (VOID **)&PciIo,\r
This->DriverBindingHandle,\r
Controller,\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
if (!IS_PCI_DISPLAY (&Pci)) {\r
goto Done;\r
}\r
- Card = QemuVideoDetect(Pci.Hdr.ClassCode[1], Pci.Hdr.VendorId, Pci.Hdr.DeviceId);\r
+\r
+ Card = QemuVideoDetect (Pci.Hdr.ClassCode[1], Pci.Hdr.VendorId, Pci.Hdr.DeviceId);\r
if (Card != NULL) {\r
- DEBUG ((EFI_D_INFO, "QemuVideo: %s detected\n", Card->Name));\r
+ DEBUG ((DEBUG_INFO, "QemuVideo: %s detected\n", Card->Name));\r
Status = EFI_SUCCESS;\r
}\r
\r
// Close the PCI I/O Protocol\r
//\r
gBS->CloseProtocol (\r
- Controller,\r
- &gEfiPciIoProtocolGuid,\r
- This->DriverBindingHandle,\r
- Controller\r
- );\r
+ Controller,\r
+ &gEfiPciIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
\r
return Status;\r
}\r
EFI_STATUS\r
EFIAPI\r
QemuVideoControllerDriverStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
)\r
{\r
- EFI_TPL OldTpl;\r
- EFI_STATUS Status;\r
- QEMU_VIDEO_PRIVATE_DATA *Private;\r
- BOOLEAN IsQxl;\r
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
- ACPI_ADR_DEVICE_PATH AcpiDeviceNode;\r
- PCI_TYPE00 Pci;\r
- QEMU_VIDEO_CARD *Card;\r
- EFI_PCI_IO_PROTOCOL *ChildPciIo;\r
+ EFI_TPL OldTpl;\r
+ EFI_STATUS Status;\r
+ QEMU_VIDEO_PRIVATE_DATA *Private;\r
+ BOOLEAN IsQxl;\r
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
+ ACPI_ADR_DEVICE_PATH AcpiDeviceNode;\r
+ PCI_TYPE00 Pci;\r
+ QEMU_VIDEO_CARD *Card;\r
+ EFI_PCI_IO_PROTOCOL *ChildPciIo;\r
+ UINT64 SupportedVgaIo;\r
\r
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
\r
//\r
- // Allocate Private context data for GOP inteface.\r
+ // Allocate Private context data for GOP interface.\r
//\r
Private = AllocateZeroPool (sizeof (QEMU_VIDEO_PRIVATE_DATA));\r
if (Private == NULL) {\r
//\r
// Set up context record\r
//\r
- Private->Signature = QEMU_VIDEO_PRIVATE_DATA_SIGNATURE;\r
+ Private->Signature = QEMU_VIDEO_PRIVATE_DATA_SIGNATURE;\r
\r
//\r
// Open PCI I/O Protocol\r
Status = gBS->OpenProtocol (\r
Controller,\r
&gEfiPciIoProtocolGuid,\r
- (VOID **) &Private->PciIo,\r
+ (VOID **)&Private->PciIo,\r
This->DriverBindingHandle,\r
Controller,\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
// Read the PCI Configuration Header from the PCI Device\r
//\r
Status = Private->PciIo->Pci.Read (\r
- Private->PciIo,\r
- EfiPciIoWidthUint32,\r
- 0,\r
- sizeof (Pci) / sizeof (UINT32),\r
- &Pci\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoWidthUint32,\r
+ 0,\r
+ sizeof (Pci) / sizeof (UINT32),\r
+ &Pci\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto ClosePciIo;\r
}\r
//\r
// Determine card variant.\r
//\r
- Card = QemuVideoDetect(Pci.Hdr.ClassCode[1], Pci.Hdr.VendorId, Pci.Hdr.DeviceId);\r
+ Card = QemuVideoDetect (Pci.Hdr.ClassCode[1], Pci.Hdr.VendorId, Pci.Hdr.DeviceId);\r
if (Card == NULL) {\r
Status = EFI_DEVICE_ERROR;\r
goto ClosePciIo;\r
}\r
+\r
Private->Variant = Card->Variant;\r
\r
//\r
// Save original PCI attributes\r
//\r
Status = Private->PciIo->Attributes (\r
- Private->PciIo,\r
- EfiPciIoAttributeOperationGet,\r
- 0,\r
- &Private->OriginalPciAttributes\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoAttributeOperationGet,\r
+ 0,\r
+ &Private->OriginalPciAttributes\r
+ );\r
\r
if (EFI_ERROR (Status)) {\r
goto ClosePciIo;\r
}\r
\r
+ //\r
+ // Get supported PCI attributes\r
+ //\r
+ Status = Private->PciIo->Attributes (\r
+ Private->PciIo,\r
+ EfiPciIoAttributeOperationSupported,\r
+ 0,\r
+ &SupportedVgaIo\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto ClosePciIo;\r
+ }\r
+\r
+ SupportedVgaIo &= (UINT64)(EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16);\r
+ if ((SupportedVgaIo == 0) && IS_PCI_VGA (&Pci)) {\r
+ Status = EFI_UNSUPPORTED;\r
+ goto ClosePciIo;\r
+ }\r
+\r
//\r
// Set new PCI attributes\r
//\r
Status = Private->PciIo->Attributes (\r
- Private->PciIo,\r
- EfiPciIoAttributeOperationEnable,\r
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO,\r
- NULL\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoAttributeOperationEnable,\r
+ EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | SupportedVgaIo,\r
+ NULL\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto ClosePciIo;\r
}\r
// Check whenever the qemu stdvga mmio bar is present (qemu 1.3+).\r
//\r
if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO) {\r
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *MmioDesc;\r
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *MmioDesc;\r
\r
Status = Private->PciIo->GetBarAttributes (\r
- Private->PciIo,\r
- PCI_BAR_IDX2,\r
- NULL,\r
- (VOID**) &MmioDesc\r
- );\r
+ Private->PciIo,\r
+ PCI_BAR_IDX2,\r
+ NULL,\r
+ (VOID **)&MmioDesc\r
+ );\r
if (EFI_ERROR (Status) ||\r
- MmioDesc->ResType != ACPI_ADDRESS_SPACE_TYPE_MEM) {\r
- DEBUG ((EFI_D_INFO, "QemuVideo: No mmio bar, fallback to port io\n"));\r
+ (MmioDesc->ResType != ACPI_ADDRESS_SPACE_TYPE_MEM))\r
+ {\r
+ DEBUG ((DEBUG_INFO, "QemuVideo: No mmio bar, fallback to port io\n"));\r
Private->Variant = QEMU_VIDEO_BOCHS;\r
} else {\r
- DEBUG ((EFI_D_INFO, "QemuVideo: Using mmio bar @ 0x%lx\n",\r
- MmioDesc->AddrRangeMin));\r
+ DEBUG ((\r
+ DEBUG_INFO,\r
+ "QemuVideo: Using mmio bar @ 0x%lx\n",\r
+ MmioDesc->AddrRangeMin\r
+ ));\r
}\r
\r
if (!EFI_ERROR (Status)) {\r
// VMWare SVGA is handled like Bochs (with port IO only).\r
//\r
if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {\r
- Private->Variant = QEMU_VIDEO_BOCHS;\r
+ Private->Variant = QEMU_VIDEO_BOCHS;\r
Private->FrameBufferVramBarIndex = PCI_BAR_IDX1;\r
}\r
\r
//\r
// Check if accessing the bochs interface works.\r
//\r
- if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO ||\r
- Private->Variant == QEMU_VIDEO_BOCHS) {\r
- UINT16 BochsId;\r
- BochsId = BochsRead(Private, VBE_DISPI_INDEX_ID);\r
+ if ((Private->Variant == QEMU_VIDEO_BOCHS_MMIO) ||\r
+ (Private->Variant == QEMU_VIDEO_BOCHS))\r
+ {\r
+ UINT16 BochsId;\r
+ BochsId = BochsRead (Private, VBE_DISPI_INDEX_ID);\r
if ((BochsId & 0xFFF0) != VBE_DISPI_ID0) {\r
- DEBUG ((EFI_D_INFO, "QemuVideo: BochsID mismatch (got 0x%x)\n", BochsId));\r
+ DEBUG ((DEBUG_INFO, "QemuVideo: BochsID mismatch (got 0x%x)\n", BochsId));\r
Status = EFI_DEVICE_ERROR;\r
goto RestoreAttributes;\r
}\r
Status = gBS->HandleProtocol (\r
Controller,\r
&gEfiDevicePathProtocolGuid,\r
- (VOID **) &ParentDevicePath\r
+ (VOID **)&ParentDevicePath\r
);\r
if (EFI_ERROR (Status)) {\r
goto RestoreAttributes;\r
// Set Gop Device Path\r
//\r
ZeroMem (&AcpiDeviceNode, sizeof (ACPI_ADR_DEVICE_PATH));\r
- AcpiDeviceNode.Header.Type = ACPI_DEVICE_PATH;\r
+ AcpiDeviceNode.Header.Type = ACPI_DEVICE_PATH;\r
AcpiDeviceNode.Header.SubType = ACPI_ADR_DP;\r
- AcpiDeviceNode.ADR = ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, ACPI_ADR_DISPLAY_TYPE_VGA, 0, 0);\r
+ AcpiDeviceNode.ADR = ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, ACPI_ADR_DISPLAY_TYPE_VGA, 0, 0);\r
SetDevicePathNodeLength (&AcpiDeviceNode.Header, sizeof (ACPI_ADR_DEVICE_PATH));\r
\r
Private->GopDevicePath = AppendDevicePathNode (\r
- ParentDevicePath,\r
- (EFI_DEVICE_PATH_PROTOCOL *) &AcpiDeviceNode\r
- );\r
+ ParentDevicePath,\r
+ (EFI_DEVICE_PATH_PROTOCOL *)&AcpiDeviceNode\r
+ );\r
if (Private->GopDevicePath == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
goto RestoreAttributes;\r
// Construct video mode buffer\r
//\r
switch (Private->Variant) {\r
- case QEMU_VIDEO_CIRRUS_5430:\r
- case QEMU_VIDEO_CIRRUS_5446:\r
- Status = QemuVideoCirrusModeSetup (Private);\r
- break;\r
- case QEMU_VIDEO_BOCHS_MMIO:\r
- case QEMU_VIDEO_BOCHS:\r
- Status = QemuVideoBochsModeSetup (Private, IsQxl);\r
- break;\r
- default:\r
- ASSERT (FALSE);\r
- Status = EFI_DEVICE_ERROR;\r
- break;\r
+ case QEMU_VIDEO_CIRRUS_5430:\r
+ case QEMU_VIDEO_CIRRUS_5446:\r
+ Status = QemuVideoCirrusModeSetup (Private);\r
+ break;\r
+ case QEMU_VIDEO_BOCHS_MMIO:\r
+ case QEMU_VIDEO_BOCHS:\r
+ Status = QemuVideoBochsModeSetup (Private, IsQxl);\r
+ break;\r
+ default:\r
+ ASSERT (FALSE);\r
+ Status = EFI_DEVICE_ERROR;\r
+ break;\r
}\r
+\r
if (EFI_ERROR (Status)) {\r
goto UninstallGopDevicePath;\r
}\r
// Reference parent handle from child handle.\r
//\r
Status = gBS->OpenProtocol (\r
- Controller,\r
- &gEfiPciIoProtocolGuid,\r
- (VOID **) &ChildPciIo,\r
- This->DriverBindingHandle,\r
- Private->Handle,\r
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
- );\r
+ Controller,\r
+ &gEfiPciIoProtocolGuid,\r
+ (VOID **)&ChildPciIo,\r
+ This->DriverBindingHandle,\r
+ Private->Handle,\r
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto UninstallGop;\r
}\r
\r
-#if defined MDE_CPU_IA32 || defined MDE_CPU_X64\r
- if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO ||\r
- Private->Variant == QEMU_VIDEO_BOCHS) {\r
+ #if defined MDE_CPU_IA32 || defined MDE_CPU_X64\r
+ if ((Private->Variant == QEMU_VIDEO_BOCHS_MMIO) ||\r
+ (Private->Variant == QEMU_VIDEO_BOCHS))\r
+ {\r
InstallVbeShim (Card->Name, Private->GraphicsOutput.Mode->FrameBufferBase);\r
}\r
-#endif\r
+\r
+ #endif\r
\r
gBS->RestoreTPL (OldTpl);\r
return EFI_SUCCESS;\r
\r
UninstallGop:\r
- gBS->UninstallProtocolInterface (Private->Handle,\r
- &gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput);\r
+ gBS->UninstallProtocolInterface (\r
+ Private->Handle,\r
+ &gEfiGraphicsOutputProtocolGuid,\r
+ &Private->GraphicsOutput\r
+ );\r
\r
DestructQemuVideoGraphics:\r
QemuVideoGraphicsOutputDestructor (Private);\r
FreePool (Private->ModeData);\r
\r
UninstallGopDevicePath:\r
- gBS->UninstallProtocolInterface (Private->Handle,\r
- &gEfiDevicePathProtocolGuid, Private->GopDevicePath);\r
+ gBS->UninstallProtocolInterface (\r
+ Private->Handle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ Private->GopDevicePath\r
+ );\r
\r
FreeGopDevicePath:\r
FreePool (Private->GopDevicePath);\r
\r
RestoreAttributes:\r
- Private->PciIo->Attributes (Private->PciIo, EfiPciIoAttributeOperationSet,\r
- Private->OriginalPciAttributes, NULL);\r
+ Private->PciIo->Attributes (\r
+ Private->PciIo,\r
+ EfiPciIoAttributeOperationSet,\r
+ Private->OriginalPciAttributes,\r
+ NULL\r
+ );\r
\r
ClosePciIo:\r
- gBS->CloseProtocol (Controller, &gEfiPciIoProtocolGuid,\r
- This->DriverBindingHandle, Controller);\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiPciIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
\r
FreePrivate:\r
FreePool (Private);\r
EFI_STATUS\r
EFIAPI\r
QemuVideoControllerDriverStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN UINTN NumberOfChildren,\r
+ IN EFI_HANDLE *ChildHandleBuffer\r
)\r
{\r
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
QEMU_VIDEO_PRIVATE_DATA *Private;\r
\r
if (NumberOfChildren == 0) {\r
// Close the PCI I/O Protocol\r
//\r
gBS->CloseProtocol (\r
- Controller,\r
- &gEfiPciIoProtocolGuid,\r
- This->DriverBindingHandle,\r
- Controller\r
- );\r
+ Controller,\r
+ &gEfiPciIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
return EFI_SUCCESS;\r
}\r
\r
Status = gBS->OpenProtocol (\r
ChildHandleBuffer[0],\r
&gEfiGraphicsOutputProtocolGuid,\r
- (VOID **) &GraphicsOutput,\r
+ (VOID **)&GraphicsOutput,\r
This->DriverBindingHandle,\r
Controller,\r
EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
// Restore original PCI attributes\r
//\r
Private->PciIo->Attributes (\r
- Private->PciIo,\r
- EfiPciIoAttributeOperationSet,\r
- Private->OriginalPciAttributes,\r
- NULL\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoAttributeOperationSet,\r
+ Private->OriginalPciAttributes,\r
+ NULL\r
+ );\r
\r
gBS->CloseProtocol (\r
- Controller,\r
- &gEfiPciIoProtocolGuid,\r
- This->DriverBindingHandle,\r
- Private->Handle\r
- );\r
+ Controller,\r
+ &gEfiPciIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Private->Handle\r
+ );\r
\r
FreePool (Private->ModeData);\r
- gBS->UninstallProtocolInterface (Private->Handle,\r
- &gEfiDevicePathProtocolGuid, Private->GopDevicePath);\r
+ gBS->UninstallProtocolInterface (\r
+ Private->Handle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ Private->GopDevicePath\r
+ );\r
FreePool (Private->GopDevicePath);\r
\r
//\r
VOID\r
outb (\r
QEMU_VIDEO_PRIVATE_DATA *Private,\r
- UINTN Address,\r
- UINT8 Data\r
+ UINTN Address,\r
+ UINT8 Data\r
)\r
{\r
Private->PciIo->Io.Write (\r
- Private->PciIo,\r
- EfiPciIoWidthUint8,\r
- EFI_PCI_IO_PASS_THROUGH_BAR,\r
- Address,\r
- 1,\r
- &Data\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoWidthUint8,\r
+ EFI_PCI_IO_PASS_THROUGH_BAR,\r
+ Address,\r
+ 1,\r
+ &Data\r
+ );\r
}\r
\r
/**\r
VOID\r
outw (\r
QEMU_VIDEO_PRIVATE_DATA *Private,\r
- UINTN Address,\r
- UINT16 Data\r
+ UINTN Address,\r
+ UINT16 Data\r
)\r
{\r
Private->PciIo->Io.Write (\r
- Private->PciIo,\r
- EfiPciIoWidthUint16,\r
- EFI_PCI_IO_PASS_THROUGH_BAR,\r
- Address,\r
- 1,\r
- &Data\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoWidthUint16,\r
+ EFI_PCI_IO_PASS_THROUGH_BAR,\r
+ Address,\r
+ 1,\r
+ &Data\r
+ );\r
}\r
\r
/**\r
UINT8\r
inb (\r
QEMU_VIDEO_PRIVATE_DATA *Private,\r
- UINTN Address\r
+ UINTN Address\r
)\r
{\r
- UINT8 Data;\r
+ UINT8 Data;\r
\r
Private->PciIo->Io.Read (\r
- Private->PciIo,\r
- EfiPciIoWidthUint8,\r
- EFI_PCI_IO_PASS_THROUGH_BAR,\r
- Address,\r
- 1,\r
- &Data\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoWidthUint8,\r
+ EFI_PCI_IO_PASS_THROUGH_BAR,\r
+ Address,\r
+ 1,\r
+ &Data\r
+ );\r
return Data;\r
}\r
\r
UINT16\r
inw (\r
QEMU_VIDEO_PRIVATE_DATA *Private,\r
- UINTN Address\r
+ UINTN Address\r
)\r
{\r
UINT16 Data;\r
\r
Private->PciIo->Io.Read (\r
- Private->PciIo,\r
- EfiPciIoWidthUint16,\r
- EFI_PCI_IO_PASS_THROUGH_BAR,\r
- Address,\r
- 1,\r
- &Data\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoWidthUint16,\r
+ EFI_PCI_IO_PASS_THROUGH_BAR,\r
+ Address,\r
+ 1,\r
+ &Data\r
+ );\r
return Data;\r
}\r
\r
VOID\r
SetPaletteColor (\r
QEMU_VIDEO_PRIVATE_DATA *Private,\r
- UINTN Index,\r
- UINT8 Red,\r
- UINT8 Green,\r
- UINT8 Blue\r
+ UINTN Index,\r
+ UINT8 Red,\r
+ UINT8 Green,\r
+ UINT8 Blue\r
)\r
{\r
- VgaOutb (Private, PALETTE_INDEX_REGISTER, (UINT8) Index);\r
- VgaOutb (Private, PALETTE_DATA_REGISTER, (UINT8) (Red >> 2));\r
- VgaOutb (Private, PALETTE_DATA_REGISTER, (UINT8) (Green >> 2));\r
- VgaOutb (Private, PALETTE_DATA_REGISTER, (UINT8) (Blue >> 2));\r
+ VgaOutb (Private, PALETTE_INDEX_REGISTER, (UINT8)Index);\r
+ VgaOutb (Private, PALETTE_DATA_REGISTER, (UINT8)(Red >> 2));\r
+ VgaOutb (Private, PALETTE_DATA_REGISTER, (UINT8)(Green >> 2));\r
+ VgaOutb (Private, PALETTE_DATA_REGISTER, (UINT8)(Blue >> 2));\r
}\r
\r
/**\r
QEMU_VIDEO_PRIVATE_DATA *Private\r
)\r
{\r
- UINTN Index;\r
- UINTN RedIndex;\r
- UINTN GreenIndex;\r
- UINTN BlueIndex;\r
+ UINTN Index;\r
+ UINTN RedIndex;\r
+ UINTN GreenIndex;\r
+ UINTN BlueIndex;\r
\r
Index = 0;\r
for (RedIndex = 0; RedIndex < 8; RedIndex++) {\r
for (GreenIndex = 0; GreenIndex < 8; GreenIndex++) {\r
for (BlueIndex = 0; BlueIndex < 4; BlueIndex++) {\r
- SetPaletteColor (Private, Index, (UINT8) (RedIndex << 5), (UINT8) (GreenIndex << 5), (UINT8) (BlueIndex << 6));\r
+ SetPaletteColor (Private, Index, (UINT8)(RedIndex << 5), (UINT8)(GreenIndex << 5), (UINT8)(BlueIndex << 6));\r
Index++;\r
}\r
}\r
VOID\r
DrawLogo (\r
QEMU_VIDEO_PRIVATE_DATA *Private,\r
- UINTN ScreenWidth,\r
- UINTN ScreenHeight\r
+ UINTN ScreenWidth,\r
+ UINTN ScreenHeight\r
)\r
{\r
}\r
QEMU_VIDEO_CIRRUS_MODES *ModeData\r
)\r
{\r
- UINT8 Byte;\r
- UINTN Index;\r
+ UINT8 Byte;\r
+ UINTN Index;\r
\r
outw (Private, SEQ_ADDRESS_REGISTER, 0x1206);\r
outw (Private, SEQ_ADDRESS_REGISTER, 0x0012);\r
\r
if (Private->Variant == QEMU_VIDEO_CIRRUS_5430) {\r
outb (Private, SEQ_ADDRESS_REGISTER, 0x0f);\r
- Byte = (UINT8) ((inb (Private, SEQ_DATA_REGISTER) & 0xc7) ^ 0x30);\r
+ Byte = (UINT8)((inb (Private, SEQ_DATA_REGISTER) & 0xc7) ^ 0x30);\r
outb (Private, SEQ_DATA_REGISTER, Byte);\r
}\r
\r
outw (Private, CRTC_ADDRESS_REGISTER, 0x2011);\r
\r
for (Index = 0; Index < 28; Index++) {\r
- outw (Private, CRTC_ADDRESS_REGISTER, (UINT16) ((ModeData->CrtcSettings[Index] << 8) | Index));\r
+ outw (Private, CRTC_ADDRESS_REGISTER, (UINT16)((ModeData->CrtcSettings[Index] << 8) | Index));\r
}\r
\r
for (Index = 0; Index < 9; Index++) {\r
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((GraphicsController[Index] << 8) | Index));\r
+ outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16)((GraphicsController[Index] << 8) | Index));\r
}\r
\r
inb (Private, INPUT_STATUS_1_REGISTER);\r
\r
for (Index = 0; Index < 21; Index++) {\r
- outb (Private, ATT_ADDRESS_REGISTER, (UINT8) Index);\r
+ outb (Private, ATT_ADDRESS_REGISTER, (UINT8)Index);\r
outb (Private, ATT_ADDRESS_REGISTER, AttributeController[Index]);\r
}\r
\r
UINT16 Data\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO) {\r
Status = Private->PciIo->Mem.Write (\r
- Private->PciIo,\r
- EfiPciIoWidthUint16,\r
- PCI_BAR_IDX2,\r
- 0x500 + (Reg << 1),\r
- 1,\r
- &Data\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoWidthUint16,\r
+ PCI_BAR_IDX2,\r
+ 0x500 + (Reg << 1),\r
+ 1,\r
+ &Data\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
} else {\r
outw (Private, VBE_DISPI_IOPORT_INDEX, Reg);\r
- outw (Private, VBE_DISPI_IOPORT_DATA, Data);\r
+ outw (Private, VBE_DISPI_IOPORT_DATA, Data);\r
}\r
}\r
\r
UINT16 Reg\r
)\r
{\r
- EFI_STATUS Status;\r
- UINT16 Data;\r
+ EFI_STATUS Status;\r
+ UINT16 Data;\r
\r
if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO) {\r
Status = Private->PciIo->Mem.Read (\r
- Private->PciIo,\r
- EfiPciIoWidthUint16,\r
- PCI_BAR_IDX2,\r
- 0x500 + (Reg << 1),\r
- 1,\r
- &Data\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoWidthUint16,\r
+ PCI_BAR_IDX2,\r
+ 0x500 + (Reg << 1),\r
+ 1,\r
+ &Data\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
} else {\r
outw (Private, VBE_DISPI_IOPORT_INDEX, Reg);\r
Data = inw (Private, VBE_DISPI_IOPORT_DATA);\r
}\r
+\r
return Data;\r
}\r
\r
UINT8 Data\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO) {\r
Status = Private->PciIo->Mem.Write (\r
- Private->PciIo,\r
- EfiPciIoWidthUint8,\r
- PCI_BAR_IDX2,\r
- 0x400 - 0x3c0 + Reg,\r
- 1,\r
- &Data\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoWidthUint8,\r
+ PCI_BAR_IDX2,\r
+ 0x400 - 0x3c0 + Reg,\r
+ 1,\r
+ &Data\r
+ );\r
ASSERT_EFI_ERROR (Status);\r
} else {\r
outb (Private, Reg, Data);\r
VOID\r
InitializeBochsGraphicsMode (\r
QEMU_VIDEO_PRIVATE_DATA *Private,\r
- QEMU_VIDEO_BOCHS_MODES *ModeData\r
+ QEMU_VIDEO_BOCHS_MODES *ModeData\r
)\r
{\r
- DEBUG ((EFI_D_INFO, "InitializeBochsGraphicsMode: %dx%d @ %d\n",\r
- ModeData->Width, ModeData->Height, ModeData->ColorDepth));\r
+ DEBUG ((\r
+ DEBUG_INFO,\r
+ "InitializeBochsGraphicsMode: %dx%d @ %d\n",\r
+ ModeData->Width,\r
+ ModeData->Height,\r
+ ModeData->ColorDepth\r
+ ));\r
\r
/* unblank */\r
VgaOutb (Private, ATT_ADDRESS_REGISTER, 0x20);\r
\r
- BochsWrite (Private, VBE_DISPI_INDEX_ENABLE, 0);\r
- BochsWrite (Private, VBE_DISPI_INDEX_BANK, 0);\r
- BochsWrite (Private, VBE_DISPI_INDEX_X_OFFSET, 0);\r
- BochsWrite (Private, VBE_DISPI_INDEX_Y_OFFSET, 0);\r
+ BochsWrite (Private, VBE_DISPI_INDEX_ENABLE, 0);\r
+ BochsWrite (Private, VBE_DISPI_INDEX_BANK, 0);\r
+ BochsWrite (Private, VBE_DISPI_INDEX_X_OFFSET, 0);\r
+ BochsWrite (Private, VBE_DISPI_INDEX_Y_OFFSET, 0);\r
\r
- BochsWrite (Private, VBE_DISPI_INDEX_BPP, (UINT16) ModeData->ColorDepth);\r
- BochsWrite (Private, VBE_DISPI_INDEX_XRES, (UINT16) ModeData->Width);\r
- BochsWrite (Private, VBE_DISPI_INDEX_VIRT_WIDTH, (UINT16) ModeData->Width);\r
- BochsWrite (Private, VBE_DISPI_INDEX_YRES, (UINT16) ModeData->Height);\r
- BochsWrite (Private, VBE_DISPI_INDEX_VIRT_HEIGHT, (UINT16) ModeData->Height);\r
+ BochsWrite (Private, VBE_DISPI_INDEX_BPP, (UINT16)ModeData->ColorDepth);\r
+ BochsWrite (Private, VBE_DISPI_INDEX_XRES, (UINT16)ModeData->Width);\r
+ BochsWrite (Private, VBE_DISPI_INDEX_VIRT_WIDTH, (UINT16)ModeData->Width);\r
+ BochsWrite (Private, VBE_DISPI_INDEX_YRES, (UINT16)ModeData->Height);\r
+ BochsWrite (Private, VBE_DISPI_INDEX_VIRT_HEIGHT, (UINT16)ModeData->Height);\r
\r
- BochsWrite (Private, VBE_DISPI_INDEX_ENABLE,\r
- VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED);\r
+ BochsWrite (\r
+ Private,\r
+ VBE_DISPI_INDEX_ENABLE,\r
+ VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED\r
+ );\r
\r
SetDefaultPalette (Private);\r
ClearScreen (Private);\r
EFI_STATUS\r
EFIAPI\r
InitializeQemuVideo (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
Status = EfiLibInstallDriverBindingComponentName2 (\r
ImageHandle,\r