\r
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);\r
\r
- if (Width < 0 || Width >= EfiPciIoWidthMaximum) {\r
+ if (Width < 0 || Width > EfiPciIoWidthUint64) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
return EFI_UNSUPPORTED;\r
}\r
\r
- if (Width > EfiPciIoWidthUint64) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
Status = PciIoDevice->PciRootBridgeIo->PollIo (\r
PciIoDevice->PciRootBridgeIo,\r
(EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
Command = 0;\r
BridgeControl = 0;\r
\r
+ //\r
+ // Check VGA and VGA16, they can not be set at the same time\r
+ //\r
+ if (((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) &&\r
+ (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) ||\r
+ ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) &&\r
+ (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) ||\r
+ ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) &&\r
+ (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) ||\r
+ ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) &&\r
+ (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) ) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
//\r
// For PPB & P2C, set relevant attribute bits\r
//\r
if (IS_PCI_BRIDGE (&PciIoDevice->Pci) || IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {\r
\r
- if (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) {\r
+ if (Attributes & (EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) {\r
BridgeControl |= EFI_PCI_BRIDGE_CONTROL_VGA;\r
}\r
\r
BridgeControl |= EFI_PCI_BRIDGE_CONTROL_ISA;\r
}\r
\r
- if (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) {\r
+ if (Attributes & (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) {\r
Command |= EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO;\r
}\r
\r
+ if (Attributes & (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) {\r
+ BridgeControl |= EFI_PCI_BRIDGE_CONTROL_VGA_16;\r
+ }\r
+\r
} else {\r
//\r
// Do with the attributes on VGA\r
+ // Only for VGA's legacy resource, we just can enable once.\r
//\r
- if ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) || \r
- (IS_PCI_VGA(&PciIoDevice->Pci) && \r
- ((Attributes & EFI_PCI_IO_ATTRIBUTE_IO) || \r
- (Attributes & EFI_PCI_IO_ATTRIBUTE_MEMORY)))) {\r
+ if (Attributes &\r
+ (EFI_PCI_IO_ATTRIBUTE_VGA_IO |\r
+ EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 |\r
+ EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY)) {\r
//\r
// Check if a VGA has been enabled before enabling a new one\r
//\r
//\r
// Do with the attributes on GFX\r
//\r
- if (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) {\r
+ if (Attributes & (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) {\r
\r
if (Operation == EfiPciIoAttributeOperationEnable) {\r
//\r