summaryrefslogtreecommitdiff
path: root/Silicon/TexasInstruments/Omap35xxPkg/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Silicon/TexasInstruments/Omap35xxPkg/Library')
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.c159
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.inf41
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/GdbSerialLib/GdbSerialLib.c96
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/GdbSerialLib/GdbSerialLib.inf35
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/Omap35xxTimerLib/Omap35xxTimerLib.inf40
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c151
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/OmapDmaLib/OmapDmaLib.c170
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/OmapDmaLib/OmapDmaLib.inf43
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/OmapLib/OmapLib.c77
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/OmapLib/OmapLib.inf31
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.c256
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.inf32
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.c208
-rw-r--r--Silicon/TexasInstruments/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.inf40
14 files changed, 0 insertions, 1379 deletions
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.c b/Silicon/TexasInstruments/Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.c
deleted file mode 100644
index d0e77e12e5..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/** @file
- Debug Agent timer lib for OMAP 35xx.
-
- Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-#include <Base.h>
-#include <Library/BaseLib.h>
-#include <Library/IoLib.h>
-#include <Library/OmapLib.h>
-#include <Library/ArmLib.h>
-#include <Library/PcdLib.h>
-
-#include <Omap3530/Omap3530.h>
-
-
-volatile UINT32 gVector;
-
-// Cached registers
-volatile UINT32 gTISR;
-volatile UINT32 gTCLR;
-volatile UINT32 gTLDR;
-volatile UINT32 gTCRR;
-volatile UINT32 gTIER;
-
-VOID
-EnableInterruptSource (
- VOID
- )
-{
- UINTN Bank;
- UINTN Bit;
-
- // Map vector to FIQ, IRQ is default
- MmioWrite32 (INTCPS_ILR (gVector), 1);
-
- Bank = gVector / 32;
- Bit = 1UL << (gVector % 32);
-
- MmioWrite32 (INTCPS_MIR_CLEAR(Bank), Bit);
-}
-
-VOID
-DisableInterruptSource (
- VOID
- )
-{
- UINTN Bank;
- UINTN Bit;
-
- Bank = gVector / 32;
- Bit = 1UL << (gVector % 32);
-
- MmioWrite32 (INTCPS_MIR_SET(Bank), Bit);
-}
-
-
-
-/**
- Setup all the hardware needed for the debug agents timer.
-
- This function is used to set up debug enviroment. It may enable interrupts.
-
-**/
-VOID
-EFIAPI
-DebugAgentTimerIntialize (
- VOID
- )
-{
- UINT32 TimerBaseAddress;
- UINT32 TimerNumber;
-
- TimerNumber = PcdGet32(PcdOmap35xxDebugAgentTimer);
- gVector = InterruptVectorForTimer (TimerNumber);
-
- // Set up the timer registers
- TimerBaseAddress = TimerBase (TimerNumber);
- gTISR = TimerBaseAddress + GPTIMER_TISR;
- gTCLR = TimerBaseAddress + GPTIMER_TCLR;
- gTLDR = TimerBaseAddress + GPTIMER_TLDR;
- gTCRR = TimerBaseAddress + GPTIMER_TCRR;
- gTIER = TimerBaseAddress + GPTIMER_TIER;
-
- if ((TimerNumber < 2) || (TimerNumber > 9)) {
- // This code assumes one the General Purpose timers is used
- // GPT2 - GPT9
- CpuDeadLoop ();
- }
- // Set source clock for GPT2 - GPT9 to SYS_CLK
- MmioOr32 (CM_CLKSEL_PER, 1 << (TimerNumber - 2));
-
-}
-
-
-/**
- Set the period for the debug agent timer. Zero means disable the timer.
-
- @param[in] TimerPeriodMilliseconds Frequency of the debug agent timer.
-
-**/
-VOID
-EFIAPI
-DebugAgentTimerSetPeriod (
- IN UINT32 TimerPeriodMilliseconds
- )
-{
- UINT64 TimerCount;
- INT32 LoadValue;
-
- if (TimerPeriodMilliseconds == 0) {
- // Turn off GPTIMER3
- MmioWrite32 (gTCLR, TCLR_ST_OFF);
-
- DisableInterruptSource ();
- } else {
- // Calculate required timer count
- TimerCount = DivU64x32(TimerPeriodMilliseconds * 1000000, PcdGet32(PcdDebugAgentTimerFreqNanoSeconds));
-
- // Set GPTIMER5 Load register
- LoadValue = (INT32) -TimerCount;
- MmioWrite32 (gTLDR, LoadValue);
- MmioWrite32 (gTCRR, LoadValue);
-
- // Enable Overflow interrupt
- MmioWrite32 (gTIER, TIER_TCAR_IT_DISABLE | TIER_OVF_IT_ENABLE | TIER_MAT_IT_DISABLE);
-
- // Turn on GPTIMER3, it will reload at overflow
- MmioWrite32 (gTCLR, TCLR_AR_AUTORELOAD | TCLR_ST_ON);
-
- EnableInterruptSource ();
- }
-}
-
-
-/**
- Perform End Of Interrupt for the debug agent timer. This is called in the
- interrupt handler after the interrupt has been processed.
-
-**/
-VOID
-EFIAPI
-DebugAgentTimerEndOfInterrupt (
- VOID
- )
-{
- // Clear all timer interrupts
- MmioWrite32 (gTISR, TISR_CLEAR_ALL);
-
- // Poll interrupt status bits to ensure clearing
- while ((MmioRead32 (gTISR) & TISR_ALL_INTERRUPT_MASK) != TISR_NO_INTERRUPTS_PENDING);
-
- MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWFIQAGR);
- ArmDataSynchronizationBarrier ();
-
-}
-
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.inf b/Silicon/TexasInstruments/Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.inf
deleted file mode 100644
index 74c03eab78..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.inf
+++ /dev/null
@@ -1,41 +0,0 @@
-#/** @file
-# Component description file for Base PCI Cf8 Library.
-#
-# PCI CF8 Library that uses I/O ports 0xCF8 and 0xCFC to perform PCI Configuration cycles.
-# Layers on top of an I/O Library instance.
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DebugAgentTimerLibNull
- FILE_GUID = E82F99DE-74ED-4e56-BBA1-B143FCA3F69A
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = DebugAgentTimerLib|SEC BASE DXE_CORE
-
-
-[Sources.common]
- DebugAgentTimerLib.c
-
-
-[Packages]
- ArmPkg/ArmPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
- Silicon/TexasInstruments/Omap35xxPkg/Omap35xxPkg.dec
-
-[LibraryClasses]
- BaseLib
- IoLib
- OmapLib
- ArmLib
-
-[Pcd]
- gOmap35xxTokenSpaceGuid.PcdOmap35xxDebugAgentTimer
- gOmap35xxTokenSpaceGuid.PcdDebugAgentTimerFreqNanoSeconds
- gEmbeddedTokenSpaceGuid.PcdInterruptBaseAddress
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/GdbSerialLib/GdbSerialLib.c b/Silicon/TexasInstruments/Omap35xxPkg/Library/GdbSerialLib/GdbSerialLib.c
deleted file mode 100644
index 4e9fa0175b..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/GdbSerialLib/GdbSerialLib.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/** @file
- Basic serial IO abstaction for GDB
-
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Uefi.h>
-#include <Library/GdbSerialLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IoLib.h>
-#include <Library/DebugLib.h>
-#include <Library/OmapLib.h>
-#include <Omap3530/Omap3530.h>
-
-RETURN_STATUS
-EFIAPI
-GdbSerialLibConstructor (
- VOID
- )
-{
- return RETURN_SUCCESS;
-}
-
-RETURN_STATUS
-EFIAPI
-GdbSerialInit (
- IN UINT64 BaudRate,
- IN UINT8 Parity,
- IN UINT8 DataBits,
- IN UINT8 StopBits
- )
-{
- return RETURN_SUCCESS;
-}
-
-BOOLEAN
-EFIAPI
-GdbIsCharAvailable (
- VOID
- )
-{
- UINT32 LSR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_LSR_REG;
-
- if ((MmioRead8(LSR) & UART_LSR_RX_FIFO_E_MASK) == UART_LSR_RX_FIFO_E_NOT_EMPTY) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-CHAR8
-EFIAPI
-GdbGetChar (
- VOID
- )
-{
- UINT32 LSR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_LSR_REG;
- UINT32 RBR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_RBR_REG;
- CHAR8 Char;
-
- while ((MmioRead8(LSR) & UART_LSR_RX_FIFO_E_MASK) == UART_LSR_RX_FIFO_E_EMPTY);
- Char = MmioRead8(RBR);
-
- return Char;
-}
-
-VOID
-EFIAPI
-GdbPutChar (
- IN CHAR8 Char
- )
-{
- UINT32 LSR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_LSR_REG;
- UINT32 THR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_THR_REG;
-
- while ((MmioRead8(LSR) & UART_LSR_TX_FIFO_E_MASK) == UART_LSR_TX_FIFO_E_NOT_EMPTY);
- MmioWrite8(THR, Char);
-}
-
-VOID
-GdbPutString (
- IN CHAR8 *String
- )
-{
- while (*String != '\0') {
- GdbPutChar (*String);
- String++;
- }
-}
-
-
-
-
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/GdbSerialLib/GdbSerialLib.inf b/Silicon/TexasInstruments/Omap35xxPkg/Library/GdbSerialLib/GdbSerialLib.inf
deleted file mode 100644
index d13744f587..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/GdbSerialLib/GdbSerialLib.inf
+++ /dev/null
@@ -1,35 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = GdbSerialLib
- FILE_GUID = E2423349-EF5D-439B-95F5-8B8D8E3B443F
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = GdbSerialLib
-
- CONSTRUCTOR = GdbSerialLibConstructor
-
-
-[Sources.common]
- GdbSerialLib.c
-
-
-[Packages]
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
- Silicon/TexasInstruments/Omap35xxPkg/Omap35xxPkg.dec
-
-[LibraryClasses]
- DebugLib
- IoLib
- OmapLib
-
-[FixedPcd]
- gOmap35xxTokenSpaceGuid.PcdOmap35xxConsoleUart
-
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/Omap35xxTimerLib/Omap35xxTimerLib.inf b/Silicon/TexasInstruments/Omap35xxPkg/Library/Omap35xxTimerLib/Omap35xxTimerLib.inf
deleted file mode 100644
index 0ef4ecdbca..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/Omap35xxTimerLib/Omap35xxTimerLib.inf
+++ /dev/null
@@ -1,40 +0,0 @@
-#/** @file
-# Timer library implementation
-#
-# A non-functional instance of the Timer Library that can be used as a template
-# for the implementation of a functional timer library instance. This library instance can
-# also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer
-# services as well as EBC modules that require timer services
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = BeagleBoardTimerLib
- FILE_GUID = fe1d7183-9abb-42ce-9a3b-36d7c6a8959f
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = TimerLib
-
-[Sources.common]
- TimerLib.c
-
-[Packages]
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
- Silicon/TexasInstruments/Omap35xxPkg/Omap35xxPkg.dec
-
-[LibraryClasses]
- DebugLib
- OmapLib
- IoLib
-
-[Pcd]
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds
- gOmap35xxTokenSpaceGuid.PcdOmap35xxFreeTimer
-
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c b/Silicon/TexasInstruments/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c
deleted file mode 100644
index 92e179e6ae..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/** @file
-
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Uefi.h>
-
-#include <Library/BaseLib.h>
-#include <Library/TimerLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IoLib.h>
-#include <Library/OmapLib.h>
-
-#include <Omap3530/Omap3530.h>
-
-RETURN_STATUS
-EFIAPI
-TimerConstructor (
- VOID
- )
-{
- UINTN Timer = PcdGet32(PcdOmap35xxFreeTimer);
- UINT32 TimerBaseAddress = TimerBase(Timer);
-
- if ((MmioRead32 (TimerBaseAddress + GPTIMER_TCLR) & TCLR_ST_ON) == 0) {
- // Set source clock for GPT3 & GPT4 to SYS_CLK
- MmioOr32 (CM_CLKSEL_PER, CM_CLKSEL_PER_CLKSEL_GPT3_SYS | CM_CLKSEL_PER_CLKSEL_GPT4_SYS);
-
- // Set count & reload registers
- MmioWrite32 (TimerBaseAddress + GPTIMER_TCRR, 0x00000000);
- MmioWrite32 (TimerBaseAddress + GPTIMER_TLDR, 0x00000000);
-
- // Disable interrupts
- MmioWrite32 (TimerBaseAddress + GPTIMER_TIER, TIER_TCAR_IT_DISABLE | TIER_OVF_IT_DISABLE | TIER_MAT_IT_DISABLE);
-
- // Start Timer
- MmioWrite32 (TimerBaseAddress + GPTIMER_TCLR, TCLR_AR_AUTORELOAD | TCLR_ST_ON);
-
- // Disable OMAP Watchdog timer (WDT2)
- MmioWrite32 (WDTIMER2_BASE + WSPR, 0xAAAA);
- DEBUG ((DEBUG_ERROR, "Magic delay to disable watchdog timers properly.\n"));
- MmioWrite32 (WDTIMER2_BASE + WSPR, 0x5555);
- }
- return EFI_SUCCESS;
-}
-
-UINTN
-EFIAPI
-MicroSecondDelay (
- IN UINTN MicroSeconds
- )
-{
- UINT64 NanoSeconds;
-
- NanoSeconds = MultU64x32(MicroSeconds, 1000);
-
- while (NanoSeconds > (UINTN)-1) {
- NanoSecondDelay((UINTN)-1);
- NanoSeconds -= (UINTN)-1;
- }
-
- NanoSecondDelay(NanoSeconds);
-
- return MicroSeconds;
-}
-
-UINTN
-EFIAPI
-NanoSecondDelay (
- IN UINTN NanoSeconds
- )
-{
- UINT32 Delay;
- UINT32 StartTime;
- UINT32 CurrentTime;
- UINT32 ElapsedTime;
- UINT32 TimerCountRegister;
-
- Delay = (NanoSeconds / PcdGet32(PcdEmbeddedPerformanceCounterPeriodInNanoseconds)) + 1;
-
- TimerCountRegister = TimerBase(PcdGet32(PcdOmap35xxFreeTimer)) + GPTIMER_TCRR;
-
- StartTime = MmioRead32 (TimerCountRegister);
-
- do
- {
- CurrentTime = MmioRead32 (TimerCountRegister);
- ElapsedTime = CurrentTime - StartTime;
- } while (ElapsedTime < Delay);
-
- NanoSeconds = ElapsedTime * PcdGet32(PcdEmbeddedPerformanceCounterPeriodInNanoseconds);
-
- return NanoSeconds;
-}
-
-UINT64
-EFIAPI
-GetPerformanceCounter (
- VOID
- )
-{
- return (UINT64)MmioRead32 (TimerBase(PcdGet32(PcdOmap35xxFreeTimer)) + GPTIMER_TCRR);
-}
-
-UINT64
-EFIAPI
-GetPerformanceCounterProperties (
- OUT UINT64 *StartValue, OPTIONAL
- OUT UINT64 *EndValue OPTIONAL
- )
-{
- if (StartValue != NULL) {
- // Timer starts with the reload value
- *StartValue = (UINT64)MmioRead32 (TimerBase(PcdGet32(PcdOmap35xxFreeTimer)) + GPTIMER_TLDR);
- }
-
- if (EndValue != NULL) {
- // Timer counts up to 0xFFFFFFFF
- *EndValue = 0xFFFFFFFF;
- }
-
- return PcdGet64(PcdEmbeddedPerformanceCounterFrequencyInHz);
-}
-
-/**
- Converts elapsed ticks of performance counter to time in nanoseconds.
-
- This function converts the elapsed ticks of running performance counter to
- time value in unit of nanoseconds.
-
- @param Ticks The number of elapsed ticks of running performance counter.
-
- @return The elapsed time in nanoseconds.
-
-**/
-UINT64
-EFIAPI
-GetTimeInNanoSecond (
- IN UINT64 Ticks
- )
-{
- UINT32 Period;
-
- Period = PcdGet32 (PcdEmbeddedPerformanceCounterPeriodInNanoseconds);
-
- return (Ticks * Period);
-}
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/OmapDmaLib/OmapDmaLib.c b/Silicon/TexasInstruments/Omap35xxPkg/Library/OmapDmaLib/OmapDmaLib.c
deleted file mode 100644
index 28a806be43..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/OmapDmaLib/OmapDmaLib.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/** @file
- Abstractions for simple OMAP DMA channel.
-
-
- Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Base.h>
-#include <Library/DebugLib.h>
-#include <Library/OmapDmaLib.h>
-#include <Library/IoLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Omap3530/Omap3530.h>
-
-
-/**
- Configure OMAP DMA Channel
-
- @param Channel DMA Channel to configure
- @param Dma4 Pointer to structure used to initialize DMA registers for the Channel
-
- @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
- @retval EFI_INVALID_PARAMETER Channel is not valid
- @retval EFI_DEVICE_ERROR The system hardware could not map the requested information.
-
-**/
-EFI_STATUS
-EFIAPI
-EnableDmaChannel (
- IN UINTN Channel,
- IN OMAP_DMA4 *DMA4
- )
-{
- UINT32 RegVal;
-
-
- if (Channel > DMA4_MAX_CHANNEL) {
- return EFI_INVALID_PARAMETER;
- }
-
- /* 1) Configure the transfer parameters in the logical DMA registers */
- /*-------------------------------------------------------------------*/
-
- /* a) Set the data type CSDP[1:0], the Read/Write Port access type
- CSDP[8:7]/[15:14], the Source/dest endianism CSDP[21]/CSDP[19],
- write mode CSDP[17:16], source/dest packed or nonpacked CSDP[6]/CSDP[13] */
-
- // Read CSDP
- RegVal = MmioRead32 (DMA4_CSDP (Channel));
-
- // Build reg
- RegVal = ((RegVal & ~ 0x3) | DMA4->DataType );
- RegVal = ((RegVal & ~(0x3 << 7)) | (DMA4->ReadPortAccessType << 7));
- RegVal = ((RegVal & ~(0x3 << 14)) | (DMA4->WritePortAccessType << 14));
- RegVal = ((RegVal & ~(0x1 << 21)) | (DMA4->SourceEndiansim << 21));
- RegVal = ((RegVal & ~(0x1 << 19)) | (DMA4->DestinationEndianism << 19));
- RegVal = ((RegVal & ~(0x3 << 16)) | (DMA4->WriteMode << 16));
- RegVal = ((RegVal & ~(0x1 << 6)) | (DMA4->SourcePacked << 6));
- RegVal = ((RegVal & ~(0x1 << 13)) | (DMA4->DestinationPacked << 13));
- // Write CSDP
- MmioWrite32 (DMA4_CSDP (Channel), RegVal);
-
- /* b) Set the number of element per frame CEN[23:0]*/
- MmioWrite32 (DMA4_CEN (Channel), DMA4->NumberOfElementPerFrame);
-
- /* c) Set the number of frame per block CFN[15:0]*/
- MmioWrite32 (DMA4_CFN (Channel), DMA4->NumberOfFramePerTransferBlock);
-
- /* d) Set the Source/dest start address index CSSA[31:0]/CDSA[31:0]*/
- MmioWrite32 (DMA4_CSSA (Channel), DMA4->SourceStartAddress);
- MmioWrite32 (DMA4_CDSA (Channel), DMA4->DestinationStartAddress);
-
- /* e) Set the Read Port addressing mode CCR[13:12], the Write Port addressing mode CCR[15:14],
- read/write priority CCR[6]/CCR[26]
- I changed LCH CCR[20:19]=00 and CCR[4:0]=00000 to
- LCH CCR[20:19]= DMA4->WriteRequestNumber and CCR[4:0]=DMA4->ReadRequestNumber
- */
-
- // Read CCR
- RegVal = MmioRead32 (DMA4_CCR (Channel));
-
- // Build reg
- RegVal = ((RegVal & ~0x1f) | DMA4->ReadRequestNumber);
- RegVal = ((RegVal & ~(BIT20 | BIT19)) | DMA4->WriteRequestNumber << 19);
- RegVal = ((RegVal & ~(0x3 << 12)) | (DMA4->ReadPortAccessMode << 12));
- RegVal = ((RegVal & ~(0x3 << 14)) | (DMA4->WritePortAccessMode << 14));
- RegVal = ((RegVal & ~(0x1 << 6)) | (DMA4->ReadPriority << 6));
- RegVal = ((RegVal & ~(0x1 << 26)) | (DMA4->WritePriority << 26));
-
- // Write CCR
- MmioWrite32 (DMA4_CCR (Channel), RegVal);
-
- /* f)- Set the source element index CSEI[15:0]*/
- MmioWrite32 (DMA4_CSEI (Channel), DMA4->SourceElementIndex);
-
- /* - Set the source frame index CSFI[15:0]*/
- MmioWrite32 (DMA4_CSFI (Channel), DMA4->SourceFrameIndex);
-
-
- /* - Set the destination element index CDEI[15:0]*/
- MmioWrite32 (DMA4_CDEI (Channel), DMA4->DestinationElementIndex);
-
- /* - Set the destination frame index CDFI[31:0]*/
- MmioWrite32 (DMA4_CDFI (Channel), DMA4->DestinationFrameIndex);
-
- MmioWrite32 (DMA4_CDFI (Channel), DMA4->DestinationFrameIndex);
-
- // Enable all the status bits since we are polling
- MmioWrite32 (DMA4_CICR (Channel), DMA4_CICR_ENABLE_ALL);
- MmioWrite32 (DMA4_CSR (Channel), DMA4_CSR_RESET);
-
- /* 2) Start the DMA transfer by Setting the enable bit CCR[7]=1 */
- /*--------------------------------------------------------------*/
- //write enable bit
- MmioOr32 (DMA4_CCR(Channel), DMA4_CCR_ENABLE); //Launch transfer
-
- return EFI_SUCCESS;
-}
-
-/**
- Turn of DMA channel configured by EnableDma().
-
- @param Channel DMA Channel to configure
- @param SuccesMask Bits in DMA4_CSR register indicate EFI_SUCCESS
- @param ErrorMask Bits in DMA4_CSR register indicate EFI_DEVICE_ERROR
-
- @retval EFI_SUCCESS DMA hardware disabled
- @retval EFI_INVALID_PARAMETER Channel is not valid
- @retval EFI_DEVICE_ERROR The system hardware could not map the requested information.
-
-**/
-EFI_STATUS
-EFIAPI
-DisableDmaChannel (
- IN UINTN Channel,
- IN UINT32 SuccessMask,
- IN UINT32 ErrorMask
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
- UINT32 Reg;
-
-
- if (Channel > DMA4_MAX_CHANNEL) {
- return EFI_INVALID_PARAMETER;
- }
-
- do {
- Reg = MmioRead32 (DMA4_CSR(Channel));
- if ((Reg & ErrorMask) != 0) {
- Status = EFI_DEVICE_ERROR;
- DEBUG ((DEBUG_ERROR, "DMA Error (%d) %x\n", Channel, Reg));
- break;
- }
- } while ((Reg & SuccessMask) != SuccessMask);
-
-
- // Disable all status bits and clear them
- MmioWrite32 (DMA4_CICR (Channel), 0);
- MmioWrite32 (DMA4_CSR (Channel), DMA4_CSR_RESET);
-
- MmioAnd32 (DMA4_CCR(0), ~(DMA4_CCR_ENABLE | DMA4_CCR_RD_ACTIVE | DMA4_CCR_WR_ACTIVE));
- return Status;
-}
-
-
-
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/OmapDmaLib/OmapDmaLib.inf b/Silicon/TexasInstruments/Omap35xxPkg/Library/OmapDmaLib/OmapDmaLib.inf
deleted file mode 100644
index d92a95cb0d..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/OmapDmaLib/OmapDmaLib.inf
+++ /dev/null
@@ -1,43 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = OmapDmaLib
- FILE_GUID = 09B17D99-BB07-49a8-B0D2-06D6AFCBE3AB
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = OmapDmaLib
-
-
-[Sources.common]
- OmapDmaLib.c
-
-[Packages]
- ArmPkg/ArmPkg.dec
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
- Silicon/TexasInstruments/Omap35xxPkg/Omap35xxPkg.dec
-
-[LibraryClasses]
- DebugLib
- UefiBootServicesTableLib
- MemoryAllocationLib
- IoLib
- BaseMemoryLib
- ArmLib
-
-
-[Protocols]
- gEfiCpuArchProtocolGuid
-
-[Guids]
-
-[Pcd]
-
-[Depex]
- gEfiCpuArchProtocolGuid
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/OmapLib/OmapLib.c b/Silicon/TexasInstruments/Omap35xxPkg/Library/OmapLib/OmapLib.c
deleted file mode 100644
index cfea62e6d6..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/OmapLib/OmapLib.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/** @file
-
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Base.h>
-#include <Library/DebugLib.h>
-#include <Library/OmapLib.h>
-#include <Omap3530/Omap3530.h>
-
-UINT32
-GpioBase (
- IN UINTN Port
- )
-{
- switch (Port) {
- case 1: return GPIO1_BASE;
- case 2: return GPIO2_BASE;
- case 3: return GPIO3_BASE;
- case 4: return GPIO4_BASE;
- case 5: return GPIO5_BASE;
- case 6: return GPIO6_BASE;
- default: ASSERT(FALSE); return 0;
- }
-}
-
-UINT32
-TimerBase (
- IN UINTN Timer
- )
-{
- switch (Timer) {
- case 1: return GPTIMER1_BASE;
- case 2: return GPTIMER2_BASE;
- case 3: return GPTIMER3_BASE;
- case 4: return GPTIMER4_BASE;
- case 5: return GPTIMER5_BASE;
- case 6: return GPTIMER6_BASE;
- case 7: return GPTIMER7_BASE;
- case 8: return GPTIMER8_BASE;
- case 9: return GPTIMER9_BASE;
- case 10: return GPTIMER10_BASE;
- case 11: return GPTIMER11_BASE;
- case 12: return GPTIMER12_BASE;
- default: return 0;
- }
-}
-
-UINTN
-InterruptVectorForTimer (
- IN UINTN Timer
- )
-{
- if ((Timer < 1) || (Timer > 12)) {
- ASSERT(FALSE);
- return 0xFFFFFFFF;
- }
-
- return 36 + Timer;
-}
-
-UINT32
-UartBase (
- IN UINTN Uart
- )
-{
- switch (Uart) {
- case 1: return UART1_BASE;
- case 2: return UART2_BASE;
- case 3: return UART3_BASE;
- default: ASSERT(FALSE); return 0;
- }
-}
-
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/OmapLib/OmapLib.inf b/Silicon/TexasInstruments/Omap35xxPkg/Library/OmapLib/OmapLib.inf
deleted file mode 100644
index ca0554b740..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/OmapLib/OmapLib.inf
+++ /dev/null
@@ -1,31 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = OmapLib
- FILE_GUID = d035f5c2-1b92-4746-9f6c-5ff6202970df
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = OmapLib
-
-[Sources.common]
- OmapLib.c
-
-[Packages]
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
- Silicon/TexasInstruments/Omap35xxPkg/Omap35xxPkg.dec
-
-[LibraryClasses]
- DebugLib
-
-[Protocols]
-
-[Guids]
-
-[Pcd]
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.c b/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.c
deleted file mode 100644
index 24fcaaf125..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
-*
-* SPDX-License-Identifier: BSD-2-Clause-Patent
-*
-**/
-
-#include <Uefi.h>
-
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-
-#include <Protocol/EmbeddedExternalDevice.h>
-
-#include <Omap3530/Omap3530.h>
-#include <TPS65950.h>
-
-
-EMBEDDED_EXTERNAL_DEVICE *gTPS65950;
-INT16 TimeZone = EFI_UNSPECIFIED_TIMEZONE;
-
-/**
- Returns the current time and date information, and the time-keeping capabilities
- of the hardware platform.
-
- @param Time A pointer to storage to receive a snapshot of the current time.
- @param Capabilities An optional pointer to a buffer to receive the real time clock
- device's capabilities.
-
- @retval EFI_SUCCESS The operation completed successfully.
- @retval EFI_INVALID_PARAMETER Time is NULL.
- @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.
-
-**/
-EFI_STATUS
-EFIAPI
-LibGetTime (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities
- )
-{
- EFI_STATUS Status;
- UINT8 Data;
- EFI_TPL OldTpl;
-
- if (Time == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL(TPL_NOTIFY);
-
- /* Get time and date */
- ZeroMem(Time, sizeof(EFI_TIME));
-
- // Latch values
- Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, RTC_CTRL_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
- Data |= BIT6;
- Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, RTC_CTRL_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
-
- // Read registers
- Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, YEARS_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
- Time->Year = 2000 + ((Data >> 4) & 0xF) * 10 + (Data & 0xF);
-
- Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, MONTHS_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
- Time->Month = ((Data >> 4) & 0x1) * 10 + (Data & 0xF);
-
- Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, DAYS_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
- Time->Day = ((Data >> 4) & 0x3) * 10 + (Data & 0xF);
-
- Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, HOURS_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
- Time->Hour = ((Data >> 4) & 0x3) * 10 + (Data & 0xF);
-
- Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, MINUTES_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
- Time->Minute = ((Data >> 4) & 0x7) * 10 + (Data & 0xF);
-
- Status = gTPS65950->Read (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, SECONDS_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
- Time->Second = ((Data >> 4) & 0x7) * 10 + (Data & 0xF);
-
- Time->TimeZone = TimeZone;
- // TODO: check what to use here
- Time->Daylight = EFI_TIME_ADJUST_DAYLIGHT;
-
- // Set capabilities
-
- // TODO: Set real capabilities
- if (Capabilities != NULL) {
- Capabilities->Resolution = 1;
- Capabilities->Accuracy = 50000000;
- Capabilities->SetsToZero = FALSE;
- }
-
-EXIT:
- gBS->RestoreTPL(OldTpl);
-
- return (Status == EFI_SUCCESS) ? Status : EFI_DEVICE_ERROR;
-}
-
-/**
- Sets the current local time and date information.
-
- @param Time A pointer to the current time.
-
- @retval EFI_SUCCESS The operation completed successfully.
- @retval EFI_INVALID_PARAMETER A time field is out of range.
- @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.
-
-**/
-EFI_STATUS
-EFIAPI
-LibSetTime (
- IN EFI_TIME *Time
- )
-{
- EFI_STATUS Status;
- UINT8 Data;
- UINT8 MonthDayCount[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
- EFI_TPL OldTpl;
-
- // Input validation according both to UEFI spec and hardware constraints
- // UEFI spec says valid year range is 1900-9999 but TPS only supports 2000-2099
- if ( (Time == NULL)
- || (Time->Year < 2000 || Time->Year > 2099)
- || (Time->Month < 1 || Time->Month > 12)
- || (Time->Day < 1 || Time->Day > MonthDayCount[Time->Month])
- || (Time->Hour > 23)
- || (Time->Minute > 59)
- || (Time->Second > 59)
- || (Time->Nanosecond > 999999999)
- || ((Time->TimeZone < -1440 || Time->TimeZone > 1440) && Time->TimeZone != 2047)
- ) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL(TPL_NOTIFY);
-
- Data = Time->Year - 2000;
- Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, YEARS_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
-
- Data = ((Time->Month / 10) << 4) | (Time->Month % 10);
- Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, MONTHS_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
-
- Data = ((Time->Day / 10) << 4) | (Time->Day % 10);
- Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, DAYS_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
-
- Data = ((Time->Hour / 10) << 4) | (Time->Hour % 10);
- Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, HOURS_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
-
- Data = ((Time->Minute / 10) << 4) | (Time->Minute % 10);
- Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, MINUTES_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
-
- Data = ((Time->Second / 10) << 4) | (Time->Second % 10);
- Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, SECONDS_REG), 1, &Data);
- if (Status != EFI_SUCCESS) goto EXIT;
-
- TimeZone = Time->TimeZone;
-
-EXIT:
- gBS->RestoreTPL(OldTpl);
-
- return (Status == EFI_SUCCESS) ? Status : EFI_DEVICE_ERROR;
-}
-
-/**
- Returns the current wakeup alarm clock setting.
-
- @param Enabled Indicates if the alarm is currently enabled or disabled.
- @param Pending Indicates if the alarm signal is pending and requires acknowledgement.
- @param Time The current alarm setting.
-
- @retval EFI_SUCCESS The alarm settings were returned.
- @retval EFI_INVALID_PARAMETER Any parameter is NULL.
- @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.
-
-**/
-EFI_STATUS
-EFIAPI
-LibGetWakeupTime (
- OUT BOOLEAN *Enabled,
- OUT BOOLEAN *Pending,
- OUT EFI_TIME *Time
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-/**
- Sets the system wakeup alarm clock time.
-
- @param Enabled Enable or disable the wakeup alarm.
- @param Time If Enable is TRUE, the time to set the wakeup alarm for.
-
- @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If
- Enable is FALSE, then the wakeup alarm was disabled.
- @retval EFI_INVALID_PARAMETER A time field is out of range.
- @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.
- @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.
-
-**/
-EFI_STATUS
-EFIAPI
-LibSetWakeupTime (
- IN BOOLEAN Enabled,
- OUT EFI_TIME *Time
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-/**
- This is the declaration of an EFI image entry point. This can be the entry point to an application
- written to this specification, an EFI boot service driver, or an EFI runtime driver.
-
- @param ImageHandle Handle that identifies the loaded image.
- @param SystemTable System Table for this image.
-
- @retval EFI_SUCCESS The operation completed successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-LibRtcInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- UINT8 Data;
- EFI_TPL OldTpl;
-
- Status = gBS->LocateProtocol (&gEmbeddedExternalDeviceProtocolGuid, NULL, (VOID **)&gTPS65950);
- ASSERT_EFI_ERROR(Status);
-
- OldTpl = gBS->RaiseTPL(TPL_NOTIFY);
- Data = 1;
- Status = gTPS65950->Write (gTPS65950, EXTERNAL_DEVICE_REGISTER(I2C_ADDR_GRP_ID4, RTC_CTRL_REG), 1, &Data);
- ASSERT_EFI_ERROR(Status);
- gBS->RestoreTPL(OldTpl);
-
- return EFI_SUCCESS;
-}
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.inf b/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.inf
deleted file mode 100644
index 876546e1c1..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.inf
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (c) 2011, ARM Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = RealTimeClockLib
- FILE_GUID = EC1713DB-7DB5-4c99-8FE2-6F52F95A1132
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = RealTimeClockLib
-
-[Sources.common]
- RealTimeClockLib.c
-
-[Packages]
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
- Silicon/TexasInstruments/Omap35xxPkg/Omap35xxPkg.dec
-
-[LibraryClasses]
- IoLib
- UefiLib
- DebugLib
- PcdLib
-
-[Protocols]
- gEmbeddedExternalDeviceProtocolGuid
-
-[depex]
- gEmbeddedExternalDeviceProtocolGuid
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.c b/Silicon/TexasInstruments/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.c
deleted file mode 100644
index 2b94f0bfc2..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/** @file
- Serial I/O Port library functions with no library constructor/destructor
-
-
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Base.h>
-#include <Library/DebugLib.h>
-#include <Library/SerialPortLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IoLib.h>
-#include <Library/OmapLib.h>
-#include <Omap3530/Omap3530.h>
-
-/*
-
- Programmed hardware of Serial port.
-
- @return Always return EFI_UNSUPPORTED.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortInitialize (
- VOID
- )
-{
- // assume assembly code at reset vector has setup UART
- return RETURN_SUCCESS;
-}
-
-/**
- Write data to serial device.
-
- @param Buffer Point of data buffer which need to be writed.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Write data failed.
- @retval !0 Actual number of bytes writed to serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortWrite (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
-)
-{
- UINT32 LSR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_LSR_REG;
- UINT32 THR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_THR_REG;
- UINTN Count;
-
- for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) {
- while ((MmioRead8(LSR) & UART_LSR_TX_FIFO_E_MASK) == UART_LSR_TX_FIFO_E_NOT_EMPTY);
- MmioWrite8(THR, *Buffer);
- }
-
- return NumberOfBytes;
-}
-
-
-/**
- Read data from serial device and save the datas in buffer.
-
- @param Buffer Point of data buffer which need to be writed.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Read data failed.
- @retval !0 Aactual number of bytes read from serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortRead (
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
-)
-{
- UINT32 LSR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_LSR_REG;
- UINT32 RBR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_RBR_REG;
- UINTN Count;
-
- for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) {
- while ((MmioRead8(LSR) & UART_LSR_RX_FIFO_E_MASK) == UART_LSR_RX_FIFO_E_EMPTY);
- *Buffer = MmioRead8(RBR);
- }
-
- return NumberOfBytes;
-}
-
-
-/**
- Check to see if any data is avaiable to be read from the debug device.
-
- @retval EFI_SUCCESS At least one byte of data is avaiable to be read
- @retval EFI_NOT_READY No data is avaiable to be read
- @retval EFI_DEVICE_ERROR The serial device is not functioning properly
-
-**/
-BOOLEAN
-EFIAPI
-SerialPortPoll (
- VOID
- )
-{
- UINT32 LSR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_LSR_REG;
-
- if ((MmioRead8(LSR) & UART_LSR_RX_FIFO_E_MASK) == UART_LSR_RX_FIFO_E_NOT_EMPTY) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-/**
- Sets the control bits on a serial device.
-
- @param[in] Control Sets the bits of Control that are settable.
-
- @retval RETURN_SUCCESS The new control bits were set on the serial device.
- @retval RETURN_UNSUPPORTED The serial device does not support this operation.
- @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetControl (
- IN UINT32 Control
- )
-{
- return RETURN_UNSUPPORTED;
-}
-
-/**
- Retrieve the status of the control bits on a serial device.
-
- @param[out] Control A pointer to return the current control signals from the serial device.
-
- @retval RETURN_SUCCESS The control bits were read from the serial device.
- @retval RETURN_UNSUPPORTED The serial device does not support this operation.
- @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortGetControl (
- OUT UINT32 *Control
- )
-{
- *Control = 0;
- if (!SerialPortPoll ()) {
- *Control = EFI_SERIAL_INPUT_BUFFER_EMPTY;
- }
- return RETURN_SUCCESS;
-}
-
-/**
- Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
- data bits, and stop bits on a serial device.
-
- @param BaudRate The requested baud rate. A BaudRate value of 0 will use the
- device's default interface speed.
- On output, the value actually set.
- @param ReveiveFifoDepth The requested depth of the FIFO on the receive side of the
- serial interface. A ReceiveFifoDepth value of 0 will use
- the device's default FIFO depth.
- On output, the value actually set.
- @param Timeout The requested time out for a single character in microseconds.
- This timeout applies to both the transmit and receive side of the
- interface. A Timeout value of 0 will use the device's default time
- out value.
- On output, the value actually set.
- @param Parity The type of parity to use on this serial device. A Parity value of
- DefaultParity will use the device's default parity value.
- On output, the value actually set.
- @param DataBits The number of data bits to use on the serial device. A DataBits
- vaule of 0 will use the device's default data bit setting.
- On output, the value actually set.
- @param StopBits The number of stop bits to use on this serial device. A StopBits
- value of DefaultStopBits will use the device's default number of
- stop bits.
- On output, the value actually set.
-
- @retval RETURN_SUCCESS The new attributes were set on the serial device.
- @retval RETURN_UNSUPPORTED The serial device does not support this operation.
- @retval RETURN_INVALID_PARAMETER One or more of the attributes has an unsupported value.
- @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
-
-**/
-RETURN_STATUS
-EFIAPI
-SerialPortSetAttributes (
- IN OUT UINT64 *BaudRate,
- IN OUT UINT32 *ReceiveFifoDepth,
- IN OUT UINT32 *Timeout,
- IN OUT EFI_PARITY_TYPE *Parity,
- IN OUT UINT8 *DataBits,
- IN OUT EFI_STOP_BITS_TYPE *StopBits
- )
-{
- return RETURN_UNSUPPORTED;
-}
-
diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.inf b/Silicon/TexasInstruments/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.inf
deleted file mode 100644
index a494605955..0000000000
--- a/Silicon/TexasInstruments/Omap35xxPkg/Library/SerialPortLib/SerialPortLib.inf
+++ /dev/null
@@ -1,40 +0,0 @@
-#/** @file
-# EDK Serial port lib
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-# Copyright (c) 2009, Apple Inc. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = BeagleBoardSerialPortLib
- FILE_GUID = 97546cbd-c0ff-4c48-ab0b-e4f58862acd3
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = SerialPortLib
-
-
-#
-# VALID_ARCHITECTURES = ARM IA32 X64 EBC
-#
-
-[Sources.common]
- SerialPortLib.c
-
-[LibraryClasses]
- DebugLib
- IoLib
- OmapLib
-
-[Packages]
- EmbeddedPkg/EmbeddedPkg.dec
- MdePkg/MdePkg.dec
- Silicon/TexasInstruments/Omap35xxPkg/Omap35xxPkg.dec
-
-[FixedPcd]
- gOmap35xxTokenSpaceGuid.PcdOmap35xxConsoleUart
-