From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on062d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe49::62d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 803628178E for ; Tue, 10 Jan 2017 15:56:19 -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=F63ggD/eFmKbVYW5P+DqDkptUeVYXliL8NbtptZnzW0=; b=hKRUIqYG/rlXOOGKETGo3/HWdZ/ymdHTAJygE3MGAgDWH1CxwjDPnKr+TWhTxv2gXa62XKVP9Ylr/EaY0JtOGgw72A7tkB3oDaoz0IFUc75nvl5udH+uhRUZzzGB2NU7Sm/3po6fKoXS/DVqtujTNteo5P0Hbk3FmC6FTyr9lJQ= 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 MWHPR12MB1247.namprd12.prod.outlook.com (10.169.205.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7; Tue, 10 Jan 2017 23:56:17 +0000 From: Leo Duran To: CC: , , , , , , Leo Duran Date: Tue, 10 Jan 2017 17:55:51 -0600 Message-ID: <1484092554-26224-6-git-send-email-leo.duran@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484092554-26224-1-git-send-email-leo.duran@amd.com> References: <1484092554-26224-1-git-send-email-leo.duran@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR15CA0019.namprd15.prod.outlook.com (10.172.204.157) To MWHPR12MB1247.namprd12.prod.outlook.com (10.169.205.7) X-MS-Office365-Filtering-Correlation-Id: 2b05cb59-f701-4848-c151-08d439b44537 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR12MB1247; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 3:CWgXrejeNLspVGTVPsK/NMviWA23g4ag2dzglH9Ld7+qy+M4uGnXnYvTvJ/2xseaD6r7UgD5bLQIqediCHT5/0BNyoeJShPSA5KzQhBZU+9l5GhY3dBson8uVgDUH/xW6HdTaL4fuGLUB40dM6ofW1xRbEuS7MDt/2Pc2obVjZ+IMUyec25hPKJ2k5TqpTg+xLYNEIZMQxBEu/bwiqzZpsuuKNyRsiM1zSrltNvmHNj1hZGNyT+JO/Z9+IXFXLqnnQ+VXKc1v5wuVlZPENtWrA==; 25:o9QXqgA4FofEFEzlF3H8lhiv711iZcp/x/buS5DV6UbiJUpfkexO3BatCcl8pPyXfdILlDP1uMWty/i5DvD108u/eQzm54UuRU7V+/rPsF6/05We+N2SyrqwCnvFUFhid+Fgj+Wxl08RuYh1WlvaXRDb3SN1VGc8NpK4E+x1TVjFaqqsybGxSc35xZ7HEj5j9Inffc9YjkydNAndzhZXqkUu4ee8VhyBaXwU/9/AYwzrv2jF3ySqwzXgUnd/vhQmxzPiO/7J4Y5QqvM3htU3GoR6YbbwlnikdR0Q1FIwKzp/GuOxLPoq4S/zzr5vS3+pIwsiE7TzjRxXUZ28cz/jSB0sF9k6vTEzMinvTY0cUXD3rHllbMVvQyeKq5vo2fmCatPuNf1wcxulh1rpI4ex33FyLmS9PfwZfsTrtM8Q0QmUDy9u4i5uGRgtQfmXSLP+sI2da5UImyMygNjiFOhA+Q== X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 31:nLUr4S28KaxvrA7zkPZ/TOhUG9xz+gvOFS1A2hOfL2ZggKB9g0auRoxWaU3My9IWgb+P7nIT+tzJd8HoDGo3J++Nj6/J1A7wEcEUcjZAfiWe4Hqw8Jp/fxckTETzVCB9PEf2JElSZi1bkVwQA0ablMZk1NMmGsx53TxHirZR6MAGIFWvYK4uw4NpZfNE1l+wQ9rsdg5YQK0g5Ee86keJiB+MkAg3oQeIVHBDPyMyPCCK28UiRW/NkUTZtQctwumA5EIa7uiuaIoCPSQ3MCuWgQ==; 20:g2GL5S/J8GdywdGILQEWEXbR90w2AJibX6ApfttXdajizDAP9qgHekj8bI7nQcvRhmuAuZ3aPHgwrw++uBFHLvrLMaQzwZ3Z03pIzzOgds+/vpJZJH7BrggDhI6PYRfl1yJXkjYj1B+WBUR5Oh9oMee5c/dFhar2SxRgIZvOMfmLpeCo/I5JF6uFPKi/ATJbGY2PBrVp0RS6I1no1QyfFgo7icuTWESjZNv1dtyMZ4WFxErH/fx1INa3KJVIMCtFW1GLtrT4iaDLs+2QfvYp90HECJBi9dFjpZ5PfnWRqIZG6ZUimH1UPSUDdiaAg7SQd8wmN/5X41Vm+SEYgSx4lJUc760wc+mlMxxT5kUd6Cs/s2AXCOCs+I7I/9ngIaZOsodNJaej9y0mkJxB3jt1XCw1yUoQzkr8sJitY7NID3iHNeuIvm3RtrgNM1hSqBP2RDKOR9igt+7Sru4c/IcAkXUyhwfIUBxPllYl3NCq7V/iEkiURhw9YGQJ+eSRMECD 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:MWHPR12MB1247; BCL:0; PCL:0; RULEID:; SRVR:MWHPR12MB1247; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 4:4UahwcjI55mEe9HXk+X+yvgbCmeZOy9kqPGpQw1QkgFvPKyP7cyUCG9CZu5l7eHrjk/ZmeQel0lP2FfZ8mECvvMXcLWVZt5tDWX6iW6QXHHZERWRdTqmHCbyAlLnbtDJfetSWS4+t5+VoXfF6nZrJkdV2Bh0UnTf3/47nDM6pHVPV2MjzyEzb+lZVUCiNW9vSSpQ+oxW/l239RsVOsVVcnwQ0T4ZPfUk2z1BxUjvF+sxdDbmqC/Cdh1qdFfTvvyXmcppzwFHDyiauBa+wUU6NKfsl5DyXnjf3GXK2kfIsb+EszRgjcQ49gCzVkZXSrmSOaWSkbFisrBuNsvoZAxziVVSELMh9vHX/4GxTImV1AThNs1aK8uTRvMBNXOm9emFQao5zvLG9JsVk5G029dgQjYMIUERxgNmdzmthzoNowN3nxMmuR908HnSi7O7VTBtPtAizenr1+8Mu6i9lQsyOoviyfv7j4m6Yp5I2RkODgjD0L6xl4THnNByNFBN6VjQ2F9Ks4x+HRtCjlJVTo0tqJI8x20xx1BORt6vPL7/Th+uQNdZoeIfO1ZvPl+TpFA1zZd0T2Hr4Yqy3arbtuvD+C59xD7HJOFQ5TdcAf/h88J2KZG6w3LWAEIIn1C6ef2TlYRhIGVe0QAAFoPBIYnnY3lyl9I1u0Mp1hRZbnDmC9I= X-Forefront-PRVS: 01834E39B7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6029001)(7916002)(39860400002)(39840400002)(39450400003)(39410400002)(39850400002)(189002)(199003)(105586002)(33646002)(101416001)(97736004)(92566002)(3846002)(189998001)(7736002)(305945005)(5660300001)(50466002)(50226002)(6116002)(48376002)(8676002)(6666003)(81166006)(81156014)(68736007)(2950100002)(110136003)(106356001)(2906002)(25786008)(47776003)(38730400001)(5003940100001)(42186005)(53416004)(54906002)(6916009)(6486002)(4326007)(76176999)(66066001)(2351001)(36756003)(86362001)(50986999)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1247; 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; MWHPR12MB1247; 23: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WD6P9gz52JLimslYRQGRiWkGEphxGqssT8HwzzTh7pBw9we1HHgyFcEutYkkTDQ==; 24:j8sJZjQbkZD2IG6FX6Wb4I8ehggeAFcdUS8MUbjrABJSH6zJD5xVh47zDc2yCyF8UmgJ0mHFbvunWAi8yXfgKwtloJBABZxSaxe0oourTC8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 7:q+NwQUfLbOzVwdorc5/sQI1FlMBoISctHYj6w40lT7eCVl1zAxdjAv2W5QAhjKfnjSo+vF2gKwfjOlXEr5/hj1fm0Xa3s2ZrkJbIhvXeoyK0u9Pdeh7Qcf9NLSaBbz1ad0ggZFS5+e3BaqLZWKrbkjkVw9NVN9WTbb62uHAJfwq/e9ZGdUJYn+a9LxJniatuLifLqdvib8/tPKYwH79FWvTDOJLdeLWlERSe8yJCNwDTsDbTIAWwx2edX/NYS9Ob0tJ05mVpSN3vjCBSXW5nr/rd2FHsbZoa773ihbeEAYpdKdi1CrV0fa9tdkRe4BPF6f2bF03rTnmkRE0yNM4XV/VixU2dD9/a3Sbho6sYXquWNauBIyY5eN9MsQyDHUX6Lu8GGlCR6kKhjsWtN1yDM+hHYWj0VYxqxDZE8x9xl4Cig1zMTR8he/PKz+z8CHZb3mwiD69qj55ideouFgIJ3A==; 20:TLo7KQp1+RNEoEL9ZOtql8HeAU23+PPf+hZKmYeFI/W2cUN9QPltW6zZAit3xx3+32/5OrRbA7Z3T6gKH4aXU1jNPPpepUiH0AJWTPMdSZ2MBa9STY32JVsL7PpjP87hlG6rnm84+PPlJmGn68CGS5HB9kVJoVaVXzerOZTb/3iQF+oUKK+MfsEl6Y0w3gdpsfWc/pC5yf0ZwX9J5e/2RsQeqCSgBitFFLtVREwnyrplJcU/e6RyLUU1ZY2IQFS6 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2017 23:56:17.2601 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1247 Subject: [PATCH 5/8] 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: Tue, 10 Jan 2017 23:56:19 -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 | 203 +++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) diff --git a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c index 7c8a603..35ad1d7 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,207 @@ 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 = (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 store the write data into. + +**/ +VOID +EFIAPI +IoWriteFifo8 ( + IN UINTN Port, + IN UINTN Count, + OUT VOID *Buffer + ) +{ + UINT8 *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 = (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 store the write data into. + +**/ +VOID +EFIAPI +IoWriteFifo16 ( + IN UINTN Port, + IN UINTN Count, + OUT VOID *Buffer + ) +{ + UINT16 *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 = (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 store the write data into. + +**/ +VOID +EFIAPI +IoWriteFifo32 ( + IN UINTN Port, + IN UINTN Count, + OUT VOID *Buffer + ) +{ + UINT32 *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