@param[in] ModeNumber Display mode number.\r
\r
@retval EFI_SUCCESS Display mode set successfully.\r
- @retval EFI_DEVICE_ERROR Reurns an error if display timing\r
- information is not available.\r
+ @retval !(EFI_SUCCESS) Other errors.\r
**/\r
EFI_STATUS\r
LcdSetMode (\r
)\r
{\r
EFI_STATUS Status;\r
- UINT32 HRes;\r
- UINT32 HSync;\r
- UINT32 HBackPorch;\r
- UINT32 HFrontPorch;\r
- UINT32 VRes;\r
- UINT32 VSync;\r
- UINT32 VBackPorch;\r
- UINT32 VFrontPorch;\r
+ SCAN_TIMINGS *Horizontal;\r
+ SCAN_TIMINGS *Vertical;\r
UINT32 BytesPerPixel;\r
LCD_BPP LcdBpp;\r
\r
// Set the video mode timings and other relevant information\r
Status = LcdPlatformGetTimings (\r
ModeNumber,\r
- &HRes,\r
- &HSync,\r
- &HBackPorch,\r
- &HFrontPorch,\r
- &VRes,\r
- &VSync,\r
- &VBackPorch,\r
- &VFrontPorch\r
+ &Horizontal,\r
+ &Vertical\r
);\r
- ASSERT_EFI_ERROR (Status);\r
if (EFI_ERROR (Status)) {\r
- return EFI_DEVICE_ERROR;\r
+ ASSERT_EFI_ERROR (Status);\r
+ return Status;\r
}\r
\r
+ ASSERT (Horizontal != NULL);\r
+ ASSERT (Vertical != NULL);\r
+\r
Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);\r
- ASSERT_EFI_ERROR (Status);\r
if (EFI_ERROR (Status)) {\r
- return EFI_DEVICE_ERROR;\r
+ ASSERT_EFI_ERROR (Status);\r
+ return Status;\r
}\r
\r
BytesPerPixel = GetBytesPerPixel (LcdBpp);\r
MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE);\r
\r
// Update the frame buffer information with the new settings\r
- MmioWrite32 (HDLCD_REG_FB_LINE_LENGTH, HRes * BytesPerPixel);\r
- MmioWrite32 (HDLCD_REG_FB_LINE_PITCH, HRes * BytesPerPixel);\r
- MmioWrite32 (HDLCD_REG_FB_LINE_COUNT, VRes - 1);\r
+ MmioWrite32 (\r
+ HDLCD_REG_FB_LINE_LENGTH,\r
+ Horizontal->Resolution * BytesPerPixel\r
+ );\r
+\r
+ MmioWrite32 (HDLCD_REG_FB_LINE_PITCH, Horizontal->Resolution * BytesPerPixel);\r
+\r
+ MmioWrite32 (HDLCD_REG_FB_LINE_COUNT, Vertical->Resolution - 1);\r
\r
// Set the vertical timing information\r
- MmioWrite32 (HDLCD_REG_V_SYNC, VSync);\r
- MmioWrite32 (HDLCD_REG_V_BACK_PORCH, VBackPorch);\r
- MmioWrite32 (HDLCD_REG_V_DATA, VRes - 1);\r
- MmioWrite32 (HDLCD_REG_V_FRONT_PORCH, VFrontPorch);\r
+ MmioWrite32 (HDLCD_REG_V_SYNC, Vertical->Sync);\r
+ MmioWrite32 (HDLCD_REG_V_BACK_PORCH, Vertical->BackPorch);\r
+ MmioWrite32 (HDLCD_REG_V_DATA, Vertical->Resolution - 1);\r
+ MmioWrite32 (HDLCD_REG_V_FRONT_PORCH, Vertical->FrontPorch);\r
\r
// Set the horizontal timing information\r
- MmioWrite32 (HDLCD_REG_H_SYNC, HSync);\r
- MmioWrite32 (HDLCD_REG_H_BACK_PORCH, HBackPorch);\r
- MmioWrite32 (HDLCD_REG_H_DATA, HRes - 1);\r
- MmioWrite32 (HDLCD_REG_H_FRONT_PORCH, HFrontPorch);\r
+ MmioWrite32 (HDLCD_REG_H_SYNC, Horizontal->Sync);\r
+ MmioWrite32 (HDLCD_REG_H_BACK_PORCH, Horizontal->BackPorch);\r
+ MmioWrite32 (HDLCD_REG_H_DATA, Horizontal->Resolution - 1);\r
+ MmioWrite32 (HDLCD_REG_H_FRONT_PORCH, Horizontal->FrontPorch);\r
\r
// Enable the controller\r
MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_ENABLE);\r
\r
@retval EFI_SUCCESS Returns success if platform implements a HDLCD\r
controller.\r
+ @retval EFI_NOT_FOUND HDLCD display controller not found on the\r
+ platform.\r
**/\r
EFI_STATUS\r
LcdIdentify (\r
VOID\r
)\r
{\r
- return EFI_SUCCESS;\r
+ if ((MmioRead32 (HDLCD_REG_VERSION) >> 16) == HDLCD_PRODUCT_ID) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ return EFI_NOT_FOUND;\r
}\r