From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0631.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe46::631]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 16BB981BCF for ; Thu, 12 Jan 2017 22:21:31 -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=DyYHY1dz2xYJ2v6nB1en2dzT9yK0YzV7Dx2cp3TM3pI=; b=Pcer5DKJPfWQrSXjcSUGvo2MFJ/JkeGCcQm2gP1yp46vCEBBk7BZ3DSQO+EI5v2S6m+w9hjJ9VTbVd6Cl0nIHhmASr7ZrI5L5kKib0yrXQz1NIfw4UiA348u6LGul2MPFlpmCoY09tolDSDrvw9XwhoiMAGYXehqI5CzLKBnb6Q= 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 BN6PR12MB1235.namprd12.prod.outlook.com (10.168.227.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7; Fri, 13 Jan 2017 06:21:26 +0000 From: Leo Duran To: CC: , , , , , , Leo Duran Date: Fri, 13 Jan 2017 00:21:00 -0600 Message-ID: <1484288463-7109-8-git-send-email-leo.duran@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484288463-7109-1-git-send-email-leo.duran@amd.com> References: <1484288463-7109-1-git-send-email-leo.duran@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR14CA0015.namprd14.prod.outlook.com (10.173.227.25) To BN6PR12MB1235.namprd12.prod.outlook.com (10.168.227.21) X-MS-Office365-Filtering-Correlation-Id: 43c22b2d-162c-48d1-b1d0-08d43b7c6887 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR12MB1235; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1235; 3:Ou4a9GvFGVi3yBl4dQy5Tm1BtIplIDuZyiQOkBdtvtqp6nJG4E3EByJ8bSD89UZbML9po5OkuVmkI14lrJS34G7YRefk7hsgCMP5fFWHq5iKzCxrcgmFB7xIyt7wn+jOH9Btkg4uli11okk4Z3wgnwMrFEdvB61OVKkT3ozdDPvuZqUVMfLGfzUjZuviRbjjjzyNOuuOGiHo6ySyjJGX9Gk/LQFBgWoSc/ESiSLTlqDvI0RKIN3Y6AD6qcgZzXgQnmNE/tNlq3bKvH23M/vnHw==; 25:wfEtnI8ST8nRF3vGsd+EqFzwZ01EHOB2/qOB6+LDya85628ShiUSlxFWZu7K8Zc1jgekpUWYl03TTDolZGGdxW06iWUvGh14eLtavQJER+0COOMfLSWUBzZkOZPpPJueorz+6C7PfY3r4iK8BNJRJy8/URu/F84MI4djiJuWcHpdDbScPXZnmPJm6LHSFyS+itrMgWU7wdUVDuyGIHP+uk4y7U4yEdkZXL/qvrX3a0ad2DYaoCBsQ/NjTKFwV1BHXu1YZSm4KSxK3ISC3sJUhLKgbNt7kyJ+wuYh8ltSG4R7oHecjQSx3w7P48A0x9aMcN4e/ozUSQdzYxKus6X/bTNPuQ2waEUDSPq6d+bImh01sHXJlxGTICVRkqijq9XPPzliU6hP8h1E8XjdD6cZGUjSD5rvSpeZp+7agp6rlqmFl2QMfkwKMDlo0v35PWVpclCjPQyxdRmfEpJz++RMvA== X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1235; 31:+MwmD3hSKNv5Di09KMpiGbgGqEYh8ERytxbeFsDIZvPhrt20gPB75BlF9vwGjqXOyAeVOghkg6dDeglDDeL1ZgUUTlxS4zZ08M4dIauW+o4DX1j8MDKgzxqCaGCTod2UwkadVimG3I9K6LHyHA1IucIlnWmTUl5qZULkYroKy0DlmZP5rDH92+Yn77sjE7mH9EyR0+PYFaq50Q1VQ74qDn1zpxAQKC/1wcOrtR11PgB1c11vY9SNvb30nleZZHTUlhJGkE9is3vnKLVG14EH3Q==; 20:jESdEmwv7Y5gSg0QwbbZlPLP01qfzRz5AcMCKc42FF9G41dml6l9Qwhb4M1sXx5qff8VGHjN9AE3Xg+FjpcnBmHCBHK+jeYHJNKbUWgysKN/iQKzvtArPBCxNHlC0x5LaWLe2zDQ/uRdliGi0TA+kCnYzAjEtDJaYCyfC0tYbRjxQlqI5eoIFVkkonakA335OcaHsvp3tuqkNbLjHjTW89qQnvDwENWFOkigiRgwTGj5KzbwxW0Hczw+J3ARtTI5MdI/BHZW+oTEwcbUHQ3FfRWDIs9lWHtqrraVZwTbCL6rRsl5X6SoHTtcu4/PT5zHEX1s3Z18SYukl//b+zwrpbSae8W2xzQ+DUvLnOYhvM5YZd9qve3nRRWA6tByx9VrWroxRqanMm8w+s54aZ3TSHW4hRHexjWCosZl+HdMKAN47tyGYtfCW5IYq25jbE7YzpYHvK1YQdG6vnPh6YC4fYsMxvk8wDUVuSCVd0LxAnwYc5PRPXIwIg6jSvFmqs3M 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)(20161123560025)(20161123564025)(6072148); SRVR:BN6PR12MB1235; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1235; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1235; 4:AGn3O55KagKCCDEmJ22Q3h+zfKLX8C9BD8YMd/N2oA4wd30sSA6fredAy2dez7ZE4imy0KbYYhYhnufQeh1r0qxzfVTcZBCb978VK6KcxxL0o/KmUMjdseyr1875RokwVwrIOr83o1nzL9xh7SngBeD9uRYZBF08FIg2XLEeYCMrAWw8K2p9DYwsfxT3svUC3eqG+UF8XeZTJzS+OOtQoUPqPFryKIPmfl1l+2YBaccXJLNoZR+an6Lj1YwvmaQrdxUJUEi4AjYZwN2dZFcE+P3ZmGliTNItTsZNMzNjq9Jbd8P6tjncIQ+6/wR45m8YKwCxrUtBn8DWUOv59aNKPjZsnPTVl5LB8+GlMCTUT4Bfhl5ceunVfpPky0G9JR1EHyJy53bmisFJZsz4lZo/7tLxvRT3wINVEefmExOu7d5I2g+Xs+K49PONuXkv3jC4w/v/8LIxsAhaM4N6tfiSah9KfNuZhk3yFblgnoWfsCcrHR02nwZdATgNy9jX2P1wGTqdohlQhKdRGlFeu4toJhtj9/BJcvz2cL4YCM5W9rdV9KHusK+NIiVWr1oMqbUeIaFyqh0kmOKrAYU6wjEDwpxshUAKHCdFdfClmIip3iQs9S6QzXARsYJ9xE4/EgRthrIZL5OQHbjpEulXBpyBXUNUI5NFuOkSlu9eJLGdH0E= X-Forefront-PRVS: 018632C080 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6029001)(6009001)(7916002)(39860400002)(39840400002)(39850400002)(39410400002)(39450400003)(199003)(189002)(305945005)(575784001)(86362001)(7736002)(33646002)(4326007)(36756003)(3846002)(6116002)(106356001)(47776003)(81156014)(81166006)(8676002)(189998001)(2906002)(42186005)(50226002)(92566002)(53416004)(66066001)(76176999)(97736004)(105586002)(48376002)(5003940100001)(68736007)(50466002)(5660300001)(6486002)(110136003)(50986999)(54906002)(38730400001)(25786008)(2351001)(6916009)(101416001)(6666003)(2950100002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1235; H:leduran-Precision-WorkStation-T5400.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BN6PR12MB1235; 23:wAfwnZ59jkuKvMiq9h0sR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9n/QNd0mVSRctN9+JLkHUGn8v4SSl2YuASMUp3JG6Vm2j5X5CwiPnwI42AHbd3CHdYHh5QBlSUGxrKR4=; 24:koDc+4LwsviayfQv6XkaDH5Enst7jX8XlTvTMUgz2HLQ4FjSox5ZkXEXPZ6PFoIZOWWKRYZQWJYZHDYSrYUTUcIPF9wBVDvdkHoLkPI5KA0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1235; 7:rbOhk/9DNtA5EfGOgBuLI7xlX7rs9dofSuX8Sn39BZs3qk2rmhatwunq+RBtXivxYcQeprZUMC96bJewSOR5y0p6MCqqzWgnXV8aWccn4x9qPhD8/48AEzMroSCvb2nPeouno2oelrV1b8DmmR9yrXUpE/3TbKR0HdyBPTk7TQZMYUN+Eew44Li0N20Z/TYh0vPP1IODM2g2LvjgYffr8o4ncQe5cUXryxeF0L+g5bAbyrGNvM49TdHWNShERchoMlzBrimR+27jcWtL9og1BR5TDaSEULZp6cOmZeZ0/ZItz13Z1lp+eR8BL4/l80ja5LIlWgtyoRoojJIOceC57xkJMfD+IlGyj5cWCxPjZK68exLOmlpZut7tI1UrIsxT445QWXsGzMj+01wmC7aG3M6GM9vet4d17p7YGVhk+VDF+1WVuLQz4/obR+9bMYnJ/tlk0fKPGYQD7Mk+/OrGxQ==; 20:uVbcy1fpl3YelUqa6xAEsHIzzbjrJc7HKThsUrGqogwzEBzlLldK+dorBBWw/ldGgunwVyTva4KSrVwaumP3kgD8erk0/NkorCBItvsJsnOhg+JJmIc92PxdM2Tnew7kDy2WpeM8n7vqNzKbR5dKtrU6JoeYqYVp3kOGvjw/Xs+lRAq66rpP3G/kB02j419llhe3I0Mb9sLswckU/ytmWaYN8HdYM1jgxlhxQzGDipq7SDs1zBGD6hM5hwpRmiEX X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2017 06:21:26.9959 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1235 Subject: [PATCH v2 07/10] MdePkg/DxeIoLibEsal: 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 06:21:31 -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/DxeIoLibEsal/IoLib.c | 216 ++++++++++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) diff --git a/MdePkg/Library/DxeIoLibEsal/IoLib.c b/MdePkg/Library/DxeIoLibEsal/IoLib.c index 3a58b51..d36e0ae 100644 --- a/MdePkg/Library/DxeIoLibEsal/IoLib.c +++ b/MdePkg/Library/DxeIoLibEsal/IoLib.c @@ -2,6 +2,8 @@ I/O Library basic function implementation and worker functions. Copyright (c) 2006 - 2011, 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 @@ -397,6 +399,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