+ if ((MaxColumns >= 80) && (MaxRows >= 50)) {\r
+ NewModeBuffer[ValidCount].Columns = 80;\r
+ NewModeBuffer[ValidCount].Rows = 50;\r
+ NewModeBuffer[ValidCount].DeltaX = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;\r
+ NewModeBuffer[ValidCount].DeltaY = (VerticalResolution - (50 * EFI_GLYPH_HEIGHT)) >> 1; \r
+ }\r
+ NewModeBuffer[ValidCount].GopWidth = HorizontalResolution;\r
+ NewModeBuffer[ValidCount].GopHeight = VerticalResolution;\r
+ NewModeBuffer[ValidCount].GopModeNumber = GopModeNumber;\r
+ ValidCount++;\r
+ \r
+ //\r
+ // Start from mode 2 to put the valid mode other than 80x25 and 80x50 in the output mode buffer.\r
+ //\r
+ for (Index = 0; Index < Count; Index++) {\r
+ if ((ModeBuffer[Index].Columns == 0) || (ModeBuffer[Index].Rows == 0) ||\r
+ (ModeBuffer[Index].Columns > MaxColumns) || (ModeBuffer[Index].Rows > MaxRows)) {\r
+ //\r
+ // Skip the pre-defined mode which is invalid or exceeds the max column and row.\r
+ //\r
+ continue;\r
+ }\r
+ for (ValidIndex = 0; ValidIndex < ValidCount; ValidIndex++) {\r
+ if ((ModeBuffer[Index].Columns == NewModeBuffer[ValidIndex].Columns) &&\r
+ (ModeBuffer[Index].Rows == NewModeBuffer[ValidIndex].Rows)) {\r
+ //\r
+ // Skip the duplicated mode.\r
+ //\r
+ break;\r
+ }\r
+ }\r
+ if (ValidIndex == ValidCount) {\r
+ NewModeBuffer[ValidCount].Columns = ModeBuffer[Index].Columns;\r
+ NewModeBuffer[ValidCount].Rows = ModeBuffer[Index].Rows;\r
+ NewModeBuffer[ValidCount].GopWidth = HorizontalResolution;\r
+ NewModeBuffer[ValidCount].GopHeight = VerticalResolution;\r
+ NewModeBuffer[ValidCount].GopModeNumber = GopModeNumber;\r
+ NewModeBuffer[ValidCount].DeltaX = (HorizontalResolution - (NewModeBuffer[ValidCount].Columns * EFI_GLYPH_WIDTH)) >> 1;\r
+ NewModeBuffer[ValidCount].DeltaY = (VerticalResolution - (NewModeBuffer[ValidCount].Rows * EFI_GLYPH_HEIGHT)) >> 1;\r
+ ValidCount++;\r
+ }\r
+ }\r
+ \r
+ DEBUG_CODE (\r
+ for (Index = 0; Index < ValidCount; Index++) {\r
+ DEBUG ((EFI_D_INFO, "Graphics - Mode %d, Column = %d, Row = %d\n", \r
+ Index, NewModeBuffer[Index].Columns, NewModeBuffer[Index].Rows)); \r
+ }\r
+ );\r
+ \r
+ //\r
+ // Return valid mode count and mode information buffer.\r
+ //\r
+ *TextModeCount = ValidCount;\r
+ *TextModeData = NewModeBuffer;\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+ Start this driver on Controller by opening Graphics Output protocol or\r
+ UGA Draw protocol, and installing Simple Text Out protocol on Controller.\r
+ (UGA Draw protocol could be skipped if PcdUgaConsumeSupport is set to FALSE.)\r
+\r
+ @param This Protocol instance pointer.\r
+ @param Controller Handle of device to bind driver to\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver is added to Controller.\r
+ @retval other This driver does not support this device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GraphicsConsoleControllerDriverStart (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
+ )\r