summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
54857d5)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4324
6f19259b-4bc3-4df7-8a09-
765794883524
Protocols for the Cirrus Logic 5430 family of PCI video controllers.\r
This driver is only usable in the EFI pre-boot environment.\r
This sample is intended to show how the UGA Draw and Graphics output Protocol\r
Protocols for the Cirrus Logic 5430 family of PCI video controllers.\r
This driver is only usable in the EFI pre-boot environment.\r
This sample is intended to show how the UGA Draw and Graphics output Protocol\r
- is able to function. \r
The UGA I/O Protocol is not implemented in this sample.\r
A fully compliant EFI UGA driver requires both\r
the UGA Draw and the UGA I/O Protocol. Please refer to Microsoft's\r
documentation on UGA for details on how to write a UGA driver that is able\r
to function both in the EFI pre-boot environment and from the OS runtime.\r
\r
The UGA I/O Protocol is not implemented in this sample.\r
A fully compliant EFI UGA driver requires both\r
the UGA Draw and the UGA I/O Protocol. Please refer to Microsoft's\r
documentation on UGA for details on how to write a UGA driver that is able\r
to function both in the EFI pre-boot environment and from the OS runtime.\r
\r
- Copyright (c) 2006, Intel Corporation \r
- All rights reserved. This program and the accompanying materials \r
- are licensed and made available under the terms and conditions of the BSD License \r
- which accompanies this distribution. The full text of the license may be found at \r
- http://opensource.org/licenses/bsd-license.php \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
/// Generic Attribute Controller Register Settings\r
///\r
UINT8 AttributeController[21] = {\r
/// Generic Attribute Controller Register Settings\r
///\r
UINT8 AttributeController[21] = {\r
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, \r
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, \r
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\r
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,\r
0x41, 0x00, 0x0F, 0x00, 0x00\r
};\r
\r
0x41, 0x00, 0x0F, 0x00, 0x00\r
};\r
\r
//\r
UINT8 Crtc_640_480_256_60[28] = {\r
0x5d, 0x4f, 0x50, 0x82, 0x53, 0x9f, 0x00, 0x3e,\r
//\r
UINT8 Crtc_640_480_256_60[28] = {\r
0x5d, 0x4f, 0x50, 0x82, 0x53, 0x9f, 0x00, 0x3e,\r
- 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
+ 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
0xe1, 0x83, 0xdf, 0x50, 0x00, 0xe7, 0x04, 0xe3,\r
0xff, 0x00, 0x00, 0x22\r
};\r
\r
UINT16 Seq_640_480_256_60[15] = {\r
0xe1, 0x83, 0xdf, 0x50, 0x00, 0xe7, 0x04, 0xe3,\r
0xff, 0x00, 0x00, 0x22\r
};\r
\r
UINT16 Seq_640_480_256_60[15] = {\r
- 0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b, \r
+ 0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,\r
0x5b0c, 0x450d, 0x7e0e, 0x2b1b, 0x2f1c, 0x301d, 0x331e\r
};\r
\r
0x5b0c, 0x450d, 0x7e0e, 0x2b1b, 0x2f1c, 0x301d, 0x331e\r
};\r
\r
// 800 x 600 x 256 color @ 60 Hertz\r
//\r
UINT8 Crtc_800_600_256_60[28] = {\r
// 800 x 600 x 256 color @ 60 Hertz\r
//\r
UINT8 Crtc_800_600_256_60[28] = {\r
- 0x7F, 0x63, 0x64, 0x80, 0x6B, 0x1B, 0x72, 0xF0, \r
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
+ 0x7F, 0x63, 0x64, 0x80, 0x6B, 0x1B, 0x72, 0xF0,\r
+ 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
0x58, 0x8C, 0x57, 0x64, 0x00, 0x5F, 0x91, 0xE3,\r
0xFF, 0x00, 0x00, 0x22\r
};\r
\r
UINT16 Seq_800_600_256_60[15] = {\r
0x58, 0x8C, 0x57, 0x64, 0x00, 0x5F, 0x91, 0xE3,\r
0xFF, 0x00, 0x00, 0x22\r
};\r
\r
UINT16 Seq_800_600_256_60[15] = {\r
- 0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b, \r
+ 0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,\r
0x5b0c, 0x450d, 0x510e, 0x2b1b, 0x2f1c, 0x301d, 0x3a1e\r
};\r
\r
0x5b0c, 0x450d, 0x510e, 0x2b1b, 0x2f1c, 0x301d, 0x3a1e\r
};\r
\r
// 1024 x 768 x 256 color @ 60 Hertz\r
//\r
UINT8 Crtc_1024_768_256_60[28] = {\r
// 1024 x 768 x 256 color @ 60 Hertz\r
//\r
UINT8 Crtc_1024_768_256_60[28] = {\r
- 0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xFD, \r
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
+ 0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xFD,\r
+ 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
0x02, 0x88, 0xFF, 0x80, 0x00, 0x00, 0x24, 0xE3,\r
0xFF, 0x4A, 0x00, 0x22\r
};\r
\r
UINT16 Seq_1024_768_256_60[15] = {\r
0x02, 0x88, 0xFF, 0x80, 0x00, 0x00, 0x24, 0xE3,\r
0xFF, 0x4A, 0x00, 0x22\r
};\r
\r
UINT16 Seq_1024_768_256_60[15] = {\r
- 0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b, \r
+ 0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,\r
0x5b0c, 0x450d, 0x760e, 0x2b1b, 0x2f1c, 0x301d, 0x341e\r
};\r
\r
0x5b0c, 0x450d, 0x760e, 0x2b1b, 0x2f1c, 0x301d, 0x341e\r
};\r
\r
///\r
CIRRUS_LOGIC_5430_VIDEO_MODES CirrusLogic5430VideoModes[] = {\r
{ 640, 480, 8, 60, Crtc_640_480_256_60, Seq_640_480_256_60, 0xe3 },\r
///\r
CIRRUS_LOGIC_5430_VIDEO_MODES CirrusLogic5430VideoModes[] = {\r
{ 640, 480, 8, 60, Crtc_640_480_256_60, Seq_640_480_256_60, 0xe3 },\r
- { 800, 600, 8, 60, Crtc_800_600_256_60, Seq_800_600_256_60, 0xef }, \r
- { 1024, 768, 8, 60, Crtc_1024_768_256_60, Seq_1024_768_256_60, 0xef } \r
+ { 800, 600, 8, 60, Crtc_800_600_256_60, Seq_800_600_256_60, 0xef },\r
+ { 1024, 768, 8, 60, Crtc_1024_768_256_60, Seq_1024_768_256_60, 0xef }\r
+ //\r
+ // Save original PCI attributes\r
+ //\r
+ Status = Private->PciIo->Attributes (\r
+ Private->PciIo,\r
+ EfiPciIoAttributeOperationGet,\r
+ 0,\r
+ &Private->OriginalPciAttributes\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ goto Error;\r
+ }\r
+\r
Status = Private->PciIo->Attributes (\r
Private->PciIo,\r
EfiPciIoAttributeOperationEnable,\r
Status = Private->PciIo->Attributes (\r
Private->PciIo,\r
EfiPciIoAttributeOperationEnable,\r
&Private->GraphicsOutput,\r
NULL\r
);\r
&Private->GraphicsOutput,\r
NULL\r
);\r
} else {\r
//\r
// This driver must support eithor GOP or UGA or both.\r
} else {\r
//\r
// This driver must support eithor GOP or UGA or both.\r
ASSERT (FALSE);\r
Status = EFI_UNSUPPORTED;\r
}\r
}\r
ASSERT (FALSE);\r
Status = EFI_UNSUPPORTED;\r
}\r
}\r
\r
Error:\r
if (EFI_ERROR (Status)) {\r
if (Private) {\r
if (Private->PciIo) {\r
\r
Error:\r
if (EFI_ERROR (Status)) {\r
if (Private) {\r
if (Private->PciIo) {\r
+ //\r
+ // Restore original PCI attributes\r
+ //\r
Private->PciIo->Attributes (\r
Private->PciIo->Attributes (\r
- Private->PciIo,\r
- EfiPciIoAttributeOperationDisable,\r
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO,\r
- NULL\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoAttributeOperationSet,\r
+ Private->OriginalPciAttributes,\r
+ NULL\r
+ );\r
+\r
+ //\r
+ // Close the PCI I/O Protocol\r
+ //\r
+ gBS->CloseProtocol (\r
+ Private->Handle,\r
+ &gEfiPciIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Private->Handle\r
+ );\r
- //\r
- // Close the PCI I/O Protocol\r
- //\r
- gBS->CloseProtocol (\r
- Private->Handle,\r
- &gEfiPciIoProtocolGuid,\r
- This->DriverBindingHandle,\r
- Private->Handle\r
- );\r
- if (Private) {\r
gBS->FreePool (Private);\r
}\r
}\r
gBS->FreePool (Private);\r
}\r
}\r
- // Shutdown the hardware\r
+ // Restore original PCI attributes\r
//\r
Private->PciIo->Attributes (\r
//\r
Private->PciIo->Attributes (\r
- Private->PciIo,\r
- EfiPciIoAttributeOperationDisable,\r
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO,\r
- NULL\r
- );\r
+ Private->PciIo,\r
+ EfiPciIoAttributeOperationSet,\r
+ Private->OriginalPciAttributes,\r
+ NULL\r
+ );\r
\r
//\r
// Close the PCI I/O Protocol\r
\r
//\r
// Close the PCI I/O Protocol\r
ASSERT_EFI_ERROR (Status);\r
\r
//\r
ASSERT_EFI_ERROR (Status);\r
\r
//\r
- // Install EFI Driver Supported EFI Version Protocol required for \r
+ // Install EFI Driver Supported EFI Version Protocol required for\r
// EFI drivers that are on PCI and other plug in cards.\r
//\r
gCirrusLogic5430DriverSupportedEfiVersion.FirmwareVersion = PcdGet32 (PcdDriverSupportedEfiVersion);\r
// EFI drivers that are on PCI and other plug in cards.\r
//\r
gCirrusLogic5430DriverSupportedEfiVersion.FirmwareVersion = PcdGet32 (PcdDriverSupportedEfiVersion);\r
/** @file\r
Cirrus Logic 5430 Controller Driver\r
\r
/** @file\r
Cirrus Logic 5430 Controller Driver\r
\r
- Copyright (c) 2006, Intel Corporation \r
- All rights reserved. This program and the accompanying materials \r
- are licensed and made available under the terms and conditions of the BSD License \r
- which accompanies this distribution. The full text of the license may be found at \r
- http://opensource.org/licenses/bsd-license.php \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
UINT64 Signature;\r
EFI_HANDLE Handle;\r
EFI_PCI_IO_PROTOCOL *PciIo;\r
UINT64 Signature;\r
EFI_HANDLE Handle;\r
EFI_PCI_IO_PROTOCOL *PciIo;\r
+ UINT64 OriginalPciAttributes;\r
EFI_UGA_DRAW_PROTOCOL UgaDraw;\r
EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;\r
UINTN CurrentMode;\r
EFI_UGA_DRAW_PROTOCOL UgaDraw;\r
EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;\r
UINTN CurrentMode;\r