From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0606.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe42::606]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5439781C60 for ; Fri, 13 Jan 2017 12:10:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=0ySZx+T05hghF3YC5U04DsweH+2BZ3Eu225GxGYpZjA=; b=e6gQCl5XyeuhWeD0Dar5f1xMXvMA++JQAaj4UHic8m3MSlVcSH+tqR8hyTy2aMN0KNLqhGukAuIhhnxIYzAmph9O0Ctu5vO7+lxPnNMi8Ruw+E2XdLBlMmyDWihOJ9kaGylJY2jrVY2NhHm5u7+hOsO74Z2O5wmQCEjOAoB2nlY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=leo.duran@amd.com; Received: from leduran-Precision-WorkStation-T5400.amd.com (165.204.77.1) by CY4PR12MB1238.namprd12.prod.outlook.com (10.168.167.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Fri, 13 Jan 2017 20:10:46 +0000 From: Leo Duran To: CC: , , , , , , Leo Duran Date: Fri, 13 Jan 2017 14:09:58 -0600 Message-ID: <1484338200-31337-9-git-send-email-leo.duran@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484338200-31337-1-git-send-email-leo.duran@amd.com> References: <1484338200-31337-1-git-send-email-leo.duran@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BLUPR16CA0013.namprd16.prod.outlook.com (10.164.14.23) To CY4PR12MB1238.namprd12.prod.outlook.com (10.168.167.13) X-MS-Office365-Filtering-Correlation-Id: bf9c02e8-5021-4bc3-04a1-08d43bf04379 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR12MB1238; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1238; 3:/aRI+BYIEZGRWMMgEmSOJf9hJHMcVezeUCi/7amrprQ5w8x9Nc+TcyWPgb30p4XpgJNCDUfbDemAAqk9Bjpt1R+TWa41EvvRt2JDLu1ncxobITEsZDerL1ySLdqcMEUcjxZmvmEXhYVuckFEcrgDkzqCCfYP7+bE4cnxOoPEyiSqGswpVjMr4g/7U0AFauOLRryClQUaw7vSy7vXmIAJ8LQiFEZsJc3dlZdqPjGzOGvuX6YHLfoFbqRTn0vv1aeGrT9u6y28sbZAWQur1p5YOQ==; 25:ZUBCEMvusPzEFPEY/IVHa+S3qTJnSgGoO5Dm7gDMOD68H5T9SM6G4jcpMCbE1nlM3sQbVc6dbzHWhkkGc4eccryswJwTTImOAOkUjSK+RpRFaAIbPW/lb/lKXvBC0kn02kdIwqDVs+xMCa6D9gZ2e8JLnLJ6/yY+xPk8AqJ5Vi/p5WBM6qM0rL3BysVLlmONyZI9hkviBdzgRvErOfomBByNRW8DGeJz9SN76XNEkcR0K38AMONxLtn1xKfNsmlD7lL3KBgJwhm3BIFli134IuxiMuLPv8rwqTiS7BrJ6HJtBtgr/Erpl2wpzF8S7tXn1J5aNuawVxVX9PI7R+PMRhjYBgubXhIZSkNjMEnDFdyjPjHwvlAoA3AFiyaN3C3+rBfALWNX2W7we7sTAooTAvoJejFfYjm1b9pWhnCQ5Aru/5iXmv+8LLhi7h5jJf4oDu+wz77eRG6Nl/vjCooLnA== X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1238; 31:rL5JiMmbRHu7p5e0K+IumP2ba0pzlSir3yKd4PBIheJ8jzVxEBFrLEtSjqmpoC9I8FdsvK2YRS2fHUIFf0xFXuNRYzfZmTPzuyIHQBREHQp/Nbe+jn5mHkHo2+6/SRprSUPScBjbmzyYlTCYo3CK7fddvI2sMGWrHj4Zr4THydNIGHbyBiwGQqfxKcqXyo9HOEH/756zNlVSR1jl6R79Njb3Du84enPEL7Kiey2zomSQWsAfcj+fffZO3exn/Vx6; 20:IGJGhroc6kjF6tymyeBEALIEoP1WfTCpxYyZtJ54x8NIkymHy4Ya3vIOZ3GyWr1ACc2X7oY9WtC+8mWDHTb1QefYrhFTPiUZsXkZLqAUc9taypt0fZdTJ6PLNG74x68fpGKEviZcXe/8bjimHwWGAXDU2SszsUktmYuxEEX0ibHE4gWmAdrNUgeXsYnJT76OPbNfQabLzluXGS8uCZcb3JrEDmdWaeCHRpN1ZbEGFdlnmm9e5wRO9UFNctGpsnHXzrb5boeCoKepHQSAqxacPgVAEm9KEsxKkCm97pRx3InF/jDvHcuufbdzH9QA7vZ1oHBXEdiDdjIY/JUeVna3873ctUt74x1zuiH+aT6JcgcQeotQuIBGMX1ysr1sGA3AH8dtG+5+sFueENj0pC/LuVdUSaBZERwKqLNtPeC+0VwkpH1XfNJ40GvRmhRg4DY/RAtBuFkAcCrTxEKAAFLPwQgQN+SbqI+2EhDYPzaShz4YBeujZYKV6OPTwh3Vr1Lv X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:CY4PR12MB1238; BCL:0; PCL:0; RULEID:; SRVR:CY4PR12MB1238; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1238; 4:ska5vsB3UZALFwFEHgdO8pRsJWHysGI+hXbS7C/Ylpj9/D8Q5CPPjzev+wfA3VJTANVwyIeE/MgsQJWUZvGvUykthukJV9bg8z0bWNreFKBX2JiqZVfV/8xdZjPU09AZiYMP16gV9KDr/6Pyg3j4LKZ6dQCrUrVcF5lYpDO29ONgQNNcMy/NQJ11Dhz85a/yLiFbfwMub9ENZMhyvK0j/h4WgD5gpspFK81WObhFYf6K+2LP8SvsgfigGG2DBEnwRBwjo/8dsYdAb6nCdTciCB5RXgxFJvj1zP98FXn07Zwbdz64UrvzNO1O/1cu68JIYhIypB+gYJTv+HjSeB9fuip1Te6xezib8rqsfe8cI7a3DgMx/bxNlDYB/xw2a+xMM7kmMXyHvEQaf+Q2/+VE10bloEhz9xsAVOFNPbBS02hxQBX5sfPg8m14MKH8IjVgYqInwK08+TXgnVQokVoIVS7sAxk6VWe/yr//SNWJjhMfPmphbU4XxSqKZdpGprgGdj7affzhENPLd3s4bDSPC92yndPTgKYKx+w7GgULjbgXGOdYl7yWAIJdBS8CYKjB0YeVTGG3EzaKS9E+6+ieBCISk/aiPiynnWG/JdyQ/Uu/hKx+wbJZYRgbOyfRrRqoMfBV3x+PLrj2vplXcSh3mvF53sFFGLbHu56LZVoz8Io= X-Forefront-PRVS: 018632C080 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6029001)(6009001)(7916002)(39840400002)(39860400002)(39410400002)(39850400002)(39450400003)(189002)(199003)(6486002)(106356001)(101416001)(105586002)(2351001)(38730400001)(6916009)(6666003)(48376002)(54906002)(2950100002)(47776003)(7736002)(305945005)(110136003)(5660300001)(25786008)(50466002)(66066001)(86362001)(33646002)(4326007)(5003940100001)(42186005)(53416004)(97736004)(2906002)(6116002)(92566002)(3846002)(36756003)(68736007)(8676002)(50226002)(189998001)(81166006)(50986999)(76176999)(81156014)(27001)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1238; H:leduran-Precision-WorkStation-T5400.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR12MB1238; 23:4ioZQlWmDMyKdrxHvRVSLVI8srIxG6zUEGKh8Gp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IU9a6SaNptM5a2nxxgP5DEnniebOQ3uI+Yf6A8iGGXbgiwww==; 24:/e8NAMnDCckc9UgZA9L1AqBws1qIn4pVC4SkedHBxPpYUeygU7FOFnKooC6WWSEN9Ycfix+M0nM7TLR3LjlqU5qIzvASWOUVRIaOphEcyGo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1238; 7:TDb/UhYnE2zCaJaBwuugVgeaSL/YFH6OzLrghinTT0Ys26wC0D3P1oUho6u3S+h4KgoJdw+0ab1/blrYDN2yhRe9kKVaOMPUZAwcq6kUsWPeI5fJgKTJIDFmQqqYGgQ9NB8EJAvwNJkwhxpHMfGy3zIqqUtmtTNTRYedt6WD0CGtKx15+O2BWisHVrpHb3RtlitKDcMcMhgt7ZCLNQHVhb01ptJCnUXCE6tKrxruh7GVzvRyheucuz6843w+FyC+me+Bk+2FvhJRQKQfIpWyl9u61Yz1Mz40b9NeVaX4guXvs+VuSzyxsH0w25SSAeKKaPJkEpRoNtoWtjRCpZOLgNKE85/oJJR2CI830EcCelyogn6r5yR7hG9iYIWUPzUL/+8QTZTaV38OtcFHQ3AVnSoFWH3brr0up7mDP2MzwizCyYz9OJk+UMEIiy5WXo15tSurUTOkvmA5H/5As49F2Q==; 20:3YZokKvRBqaWqkdUdgu1p5NvSLMCW7UgV6xUuDoYKAhjld077j9t5TOwynIOM99ZEOO/2wy3PQ8T3ndC1OufzM49lsJ7nrBXEUw3eW6YnmXTwsfisETylUqLJaZ6epZ5agmOvN4UDfhODxoCXbqetskUps41f8Cal/mkkSSccIb/UPWqph3baW8fbMdYncTkqTSD7z8h2zcXoYMSgnFpoxcD9gshnSqN5oEWfGwKfJJ4WZhiE1UCw+sxK/Y+B4sh X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2017 20:10:46.7589 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1238 Subject: [PATCH v3 08/10] MdePkg/SmmIoLibSmmCpuIo2: Add new Fifo routines in IoLib class X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2017 20:10:48 -0000 Content-Type: text/plain Cc: Michael D Kinney Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Brijesh Singh Signed-off-by: Leo Duran --- MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c | 216 +++++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) diff --git a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c index 7c8a603..0279bde 100644 --- a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c +++ b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c @@ -4,6 +4,8 @@ are based on EFI_CPU_IO_PROTOCOL. Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2017, AMD Incorporated. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -367,6 +369,220 @@ IoWrite64 ( } /** + Reads an 8-bit I/O port fifo into a block of memory. + + Reads the 8-bit I/O fifo port specified by Port. + The port is read Count times, and the read data is + stored in the provided Buffer. + + This function must guarantee that all I/O read and write operations are + serialized. + + If 8-bit I/O port operations are not supported, then ASSERT(). + + @param Port The I/O port to read. + @param Count The number of times to read I/O port. + @param Buffer The buffer to store the read data into. + +**/ +VOID +EFIAPI +IoReadFifo8 ( + IN UINTN Port, + IN UINTN Count, + OUT VOID *Buffer + ) +{ + UINT8 *Buffer8; + + Buffer8 = (UINT8 *)Buffer; + while (Count--) { + *Buffer8++ = IoRead8 (Port); + } +} + +/** + Writes a block of memory into an 8-bit I/O port fifo. + + Writes the 8-bit I/O fifo port specified by Port. + The port is written Count times, and the write data is + retrieved from the provided Buffer. + + This function must guarantee that all I/O write and write operations are + serialized. + + If 8-bit I/O port operations are not supported, then ASSERT(). + + @param Port The I/O port to write. + @param Count The number of times to write I/O port. + @param Buffer The buffer to retrieve the write data from. + +**/ +VOID +EFIAPI +IoWriteFifo8 ( + IN UINTN Port, + IN UINTN Count, + IN VOID *Buffer + ) +{ + UINT8 *Buffer8; + + Buffer8 = (UINT8 *)Buffer; + while (Count--) { + IoWrite8 (Port, *Buffer8++); + } +} + +/** + Reads a 16-bit I/O port fifo into a block of memory. + + Reads the 16-bit I/O fifo port specified by Port. + The port is read Count times, and the read data is + stored in the provided Buffer. + + This function must guarantee that all I/O read and write operations are + serialized. + + If 16-bit I/O port operations are not supported, then ASSERT(). + + @param Port The I/O port to read. + @param Count The number of times to read I/O port. + @param Buffer The buffer to store the read data into. + +**/ +VOID +EFIAPI +IoReadFifo16 ( + IN UINTN Port, + IN UINTN Count, + OUT VOID *Buffer + ) +{ + UINT16 *Buffer16; + + // + // Make sure Port is aligned on a 16-bit boundary. + // + ASSERT ((Port & 1) == 0); + Buffer16 = (UINT16 *)Buffer; + while (Count--) { + *Buffer16++ = IoRead16 (Port); + } +} + +/** + Writes a block of memory into a 16-bit I/O port fifo. + + Writes the 16-bit I/O fifo port specified by Port. + The port is written Count times, and the write data is + retrieved from the provided Buffer. + + This function must guarantee that all I/O write and write operations are + serialized. + + If 16-bit I/O port operations are not supported, then ASSERT(). + + @param Port The I/O port to write. + @param Count The number of times to write I/O port. + @param Buffer The buffer to retrieve the write data from. + +**/ +VOID +EFIAPI +IoWriteFifo16 ( + IN UINTN Port, + IN UINTN Count, + IN VOID *Buffer + ) +{ + UINT16 *Buffer16; + + // + // Make sure Port is aligned on a 16-bit boundary. + // + ASSERT ((Port & 1) == 0); + Buffer16 = (UINT16 *)Buffer; + while (Count--) { + IoWrite16 (Port, *Buffer16++); + } +} + +/** + Reads a 32-bit I/O port fifo into a block of memory. + + Reads the 32-bit I/O fifo port specified by Port. + The port is read Count times, and the read data is + stored in the provided Buffer. + + This function must guarantee that all I/O read and write operations are + serialized. + + If 32-bit I/O port operations are not supported, then ASSERT(). + + @param Port The I/O port to read. + @param Count The number of times to read I/O port. + @param Buffer The buffer to store the read data into. + +**/ +VOID +EFIAPI +IoReadFifo32 ( + IN UINTN Port, + IN UINTN Count, + OUT VOID *Buffer + ) +{ + UINT32 *Buffer32; + + // + // Make sure Port is aligned on a 32-bit boundary. + // + ASSERT ((Port & 3) == 0); + Buffer32 = (UINT32 *)Buffer; + while (Count--) { + *Buffer32++ = IoRead32 (Port); + } +} + +/** + Writes a block of memory into a 32-bit I/O port fifo. + + Writes the 32-bit I/O fifo port specified by Port. + The port is written Count times, and the write data is + retrieved from the provided Buffer. + + This function must guarantee that all I/O write and write operations are + serialized. + + If 32-bit I/O port operations are not supported, then ASSERT(). + + @param Port The I/O port to write. + @param Count The number of times to write I/O port. + @param Buffer The buffer to retrieve the write data from. + +**/ +VOID +EFIAPI +IoWriteFifo32 ( + IN UINTN Port, + IN UINTN Count, + IN VOID *Buffer + ) +{ + UINT32 *Buffer32; + + // + // Make sure Port is aligned on a 32-bit boundary. + // + ASSERT ((Port & 3) == 0); + Buffer32 = (UINT32 *)Buffer; + while (Count--) { + IoWrite32 (Port, *Buffer32++); + } +} + +/** Reads an 8-bit MMIO register. Reads the 8-bit MMIO register specified by Address. The 8-bit read value is -- 1.9.1