]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtLedStatusCode/RtLedStatusCode.c
EdkCompatibilityPkg: Remove EdkCompatibilityPkg
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Platform / Generic / RuntimeDxe / StatusCode / Lib / RtLedStatusCode / RtLedStatusCode.c
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtLedStatusCode/RtLedStatusCode.c b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtLedStatusCode/RtLedStatusCode.c
deleted file mode 100644 (file)
index 0aa9003..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-/*++\r
-\r
-Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>\r
-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
-                                                                                          \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
-\r
-Module Name:\r
-  \r
-  RtLedStatusCode.c\r
-   \r
-Abstract:\r
-\r
-  Lib to provide LED status code reporting Routines.\r
-\r
-  In general you should use PPI's, but some times a monolithic driver\r
-  is better. The best justification for monolithic code is debug.\r
-\r
---*/\r
-\r
-#include "RtLedStatusCode.h"\r
-\r
-//\r
-// Prepare the data to initialize LPC chipset for Server Io Configuration\r
-// This is hardcoded init value and would vary from platform to platform.\r
-//\r
-static SIO_INIT_DATA  mSioInitData[] = {\r
-  //\r
-  // Program magic values in ServerI/O configuration registers\r
-  //\r
-  {\r
-    REG_SERVERIO_CNF1,\r
-    0x19\r
-  },\r
-  {\r
-    REG_SERVERIO_CNF2,\r
-    0x22\r
-  },\r
-  {\r
-    REG_SERVERIO_CNF3,\r
-    0x76\r
-  },\r
-  {\r
-    REG_SERVERIO_CNF4,\r
-    0x26\r
-  },\r
-  //\r
-  // Force the parallel port to be disabled, override reg 30 setting\r
-  //\r
-  {\r
-    REG_SERVERIO_CNF6,\r
-    0x02\r
-  },\r
-  //\r
-  // Select GPIO device and setup GPIO base address\r
-  //\r
-  {\r
-    REG_LOGICAL_DEVICE,\r
-    SIO_GPIO\r
-  },\r
-  {\r
-    ACTIVATE,\r
-    LOGICAL_DEVICE_OFF\r
-  },\r
-  {\r
-    BASE_ADDRESS_HIGH,\r
-    SIO_GPIO_HIGH\r
-  },\r
-  {\r
-    BASE_ADDRESS_LOW,\r
-    SIO_GPIO_LOW\r
-  },\r
-  {\r
-    ACTIVATE,\r
-    LOGICAL_DEVICE_ON\r
-  },\r
-  //\r
-  // Select DLED STB, post code LED, ZZ_POST_CLK_LED_L\r
-  //\r
-  {\r
-    GPIO_GPSEL,\r
-    0x43\r
-  },\r
-  //\r
-  // Push pull output enable\r
-  //\r
-  {\r
-    GPIO_GPCFG1,\r
-    PUSH_PULL | OUTPUT_BUFFER_EN\r
-  },\r
-  //\r
-  // Disable Event IRQ routing\r
-  //\r
-  {\r
-    GPIO_GPEVR,\r
-    GPIO_EVENT_OFF\r
-  },\r
-  //\r
-  // Select DLED STB, ZZ_POST_DATA_LED_L\r
-  //\r
-  {\r
-    GPIO_GPSEL,\r
-    0x54\r
-  },\r
-  //\r
-  // Push pull output enable\r
-  //\r
-  {\r
-    GPIO_GPCFG1,\r
-    PUSH_PULL | OUTPUT_BUFFER_EN\r
-  },\r
-  //\r
-  // Disable Event IRQ routing\r
-  //\r
-  {\r
-    GPIO_GPEVR,\r
-    GPIO_EVENT_OFF\r
-  },\r
-  //\r
-  // Select Select ACPI_MODE_IND_L\r
-  //\r
-  {\r
-    GPIO_GPSEL,\r
-    0x63\r
-  },\r
-  //\r
-  // Push pull output enable\r
-  //\r
-  {\r
-    GPIO_GPCFG1,\r
-    PUSH_PULL | OUTPUT_BUFFER_EN\r
-  },\r
-\r
-  {\r
-    0xff,\r
-    0xff\r
-  }\r
-};\r
-\r
-VOID\r
-RtLedInitializeStatusCode (\r
-  IN EFI_HANDLE         ImageHandle,\r
-  IN EFI_SYSTEM_TABLE   *SystemTable\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Initialization routine. Initializes LPC47817 to configure GPIO for LED\r
-\r
-Arguments: \r
-\r
-  None\r
-\r
-Returns: \r
-\r
-  None\r
-\r
---*/\r
-{\r
-  UINT8   OutputData;\r
-  UINT16  ConfigPort;\r
-  UINT16  DataPort;\r
-  UINT32  Index;\r
-\r
-  //\r
-  // hard code for sio init\r
-  //\r
-  ConfigPort  = CONFIG_PORT0;\r
-  DataPort    = DATA_PORT0;\r
-\r
-  //\r
-  // Initialize Sio from table to enable SererIoCfg and GPIO\r
-  //\r
-  Index = 0;\r
-  while ((mSioInitData[Index]).RegAddress != 0xff) {\r
-    OutputData = (UINT8) mSioInitData[Index].RegAddress;\r
-\r
-    IoWrite8 (ConfigPort, OutputData);\r
-\r
-    OutputData = (UINT8) mSioInitData[Index].RegValue;\r
-    IoWrite8 (DataPort, OutputData);\r
-\r
-    Index++;\r
-  }\r
-\r
-  return ;\r
-}\r
-\r
-BOOLEAN\r
-CodeTypeToProgressCode (\r
-  IN  EFI_STATUS_CODE_TYPE    CodeType,\r
-  IN  EFI_STATUS_CODE_VALUE   Value,\r
-  OUT UINT8                   *PostCode\r
-  )\r
-{\r
-  //\r
-  // Convert Value to an 8 bit post code\r
-  //\r
-  if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE)) {\r
-    *PostCode = (UINT8) (((Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5);\r
-    *PostCode = (UINT8) (*PostCode | (UINT8) (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f));\r
-    return TRUE;\r
-  }\r
-\r
-  return FALSE;\r
-}\r
-\r
-VOID\r
-SendDataToPort (\r
-  IN  UINT8   Data,\r
-  IN  UINT16  DataOffset\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Writes the data to control LED output at desired port\r
-\r
-Arguments: \r
-\r
-  Data        -   Data in bit0 is the relevant data\r
-  DataOffset  -   Port address to access GPIO54\r
-\r
-Returns: \r
-\r
-  None\r
-\r
---*/\r
-{\r
-  UINT8 PinData;\r
-\r
-  //\r
-  // Read current Pin State of GPIO54\r
-  //\r
-  PinData = IoRead8 (DataOffset);\r
-\r
-  //\r
-  // Set GPIO54 pin to zero\r
-  //\r
-  PinData &= 0xEF;\r
-\r
-  if (Data & 0x01) {\r
-    //\r
-    // Set GPIO54 pin to 1 if data is 1\r
-    // otherwise it will be set to 0\r
-    //\r
-    PinData |= LED_MASK_BIT;\r
-  }\r
-\r
-  IoWrite8 (DataOffset, PinData);\r
-}\r
-\r
-VOID\r
-StrobeData (\r
-  IN  UINT16  StrobeOffset\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Controls the strobe to move the value from LSB to MSB in steps.\r
-\r
-Arguments: \r
-\r
-  StrobeOffset  -   Port address to access GPIO43. This pin controls the shifting\r
-                    of bit value from LSB to MSB\r
-\r
-Returns: \r
-\r
-  None\r
-\r
---*/\r
-{\r
-  UINT8 StrobeData;\r
-\r
-  StrobeData = IoRead8 (StrobeOffset);\r
-\r
-  //\r
-  // Make bit 3 of data to be zero\r
-  //\r
-  StrobeData &= 0xF7;\r
-\r
-  IoWrite8 (StrobeOffset, StrobeData);\r
-\r
-  //\r
-  // Make bit 3 as 1 to perform the strobe to shift the data in 74HCT164\r
-  //\r
-  StrobeData |= STROBE_MASK_BIT;\r
-\r
-  IoWrite8 (StrobeOffset, StrobeData);\r
-}\r
-\r
-VOID\r
-SendDataToLed (\r
-  UINT8                   Data\r
-  )\r
-{\r
-  UINT16  GpioBase;\r
-  UINT16  DataOffset;\r
-  UINT16  StrobeOffset;\r
-  UINTN   Index;\r
-  UINTN   DataBitPosition;\r
-  UINT8   TempData;\r
-\r
-  GpioBase        = GPIO_BASE (SIO_GPIO_HIGH, SIO_GPIO_LOW);\r
-\r
-  DataOffset      = (UINT16) (GpioBase + LED_DATA_OFFSET);\r
-\r
-  StrobeOffset    = (UINT16) (GpioBase + LED_STROBE_OFFSET);\r
-\r
-  DataBitPosition = 7;\r
-\r
-  Data            = (UINT8) (~Data);\r
-\r
-  TempData        = Data;\r
-\r
-  for (Index = 0; Index < 8; Index++) {\r
-    SendDataToPort ((UINT8) (TempData >> DataBitPosition), DataOffset);\r
-    StrobeData (StrobeOffset);\r
-    DataBitPosition--;\r
-  }\r
-  //\r
-  // To fix 5 Volt leakage problem\r
-  //\r
-  SendDataToPort (0, DataOffset);\r
-\r
-}\r
-\r
-EFI_STATUS\r
-RtLedReportStatusCode (\r
-  IN EFI_STATUS_CODE_TYPE     CodeType,\r
-  IN EFI_STATUS_CODE_VALUE    Value,\r
-  IN UINT32                   Instance,\r
-  IN EFI_GUID                 * CallerId,\r
-  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Provide a LED status code\r
-\r
-Arguments:\r
-\r
-  Same as ReportStatusCode PPI\r
-    \r
-Returns:\r
-\r
-  Status -  EFI_SUCCESS if the interface could be successfully\r
-            installed\r
-\r
---*/\r
-{\r
-  UINT8 ProgressCode;\r
-\r
-  if (CodeTypeToProgressCode (CodeType, Value, &ProgressCode)) {\r
-    SendDataToLed (ProgressCode);\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r