From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe46::626]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 08EEF81C15 for ; Thu, 12 Jan 2017 22:21:26 -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=ntuEoEPU9g7kFv8Cltx/ptNAcSO6vtC6Qjf2af3WHks=; b=WsUCNVBdM2AeauIJr5OfyJU12DrAiI7K4bX9mMgj7Py0rG/0paQXk4p4HYlDdvUnJIJdLrCOF00j3vwDd20+/ZXRHoFrZwwkM86fgj/hhtQOh0L2OtwITPGV4aZzS2PS4Qh2p1hFp8QDooeRkdfWncYos/9VtNIKFhQWikWmkaw= 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:23 +0000 From: Leo Duran To: CC: , , , , , , Leo Duran Date: Fri, 13 Jan 2017 00:20:58 -0600 Message-ID: <1484288463-7109-6-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: 5c5283c0-e5c5-4b2b-55c7-08d43b7c66a6 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR12MB1235; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1235; 3:p9ZPY/3nTF2n0TsBv/VSAXScyKCrZTrWtSqFDP5CjFNHnqk36FX9gOen1vjiUpbyKfv0jQaHSDiUFq2gLEvv7csMpIpkQs7EueTzBNL0571Si6quZ4IS74NIIhUHaBsplB50N6plCvFRD6tR3jPQGX3r+LPhbKBdaRUL4Bg/fNVURqPQ19EQ7Cui10XBzVe28wudjtcUpy9JF2wGL7aZbmL3D3tcUyanMwBc6JeSmMKzja33D7o5SjRD57rXgpBHOkcfnbb+KnfI8GEUNikHUQ==; 25:9/pyYBDBhX0SF+NFuYDNyrkAt2xYtFyQPN5MZsVb793P3A9Iv6WjL53zpskIVzH8bpMjljZeD/YmsurAXuEEpG/FIr/637IaHBBEgOZ2nFN3E1w31qKwOre9gEvUizdsUk2cBRTxVqfWLIENVi3+uvCXtVE7zMzWEEte/3J5SI+Ly3xjWhAtPcRtQ5/mXO3vvE9A/IZtmwKA88LH3PZ6krQrm3W1+tNhfKmNuCJzy0LmHuSS+BCjxxJsoNMi/z0KIgBSy+Krz2hqhC6vb3eamqzBu/A4btace6P1TZyJ0W4FCwOLx0t4+9nMXJOO7dW31cBcuPS4uboaoTED+dQ1XyEQ18OEQ6Zy2kVnM8j8bzW6TfO1xhhZHHU5QZsBK5kGxb7Y+Tjdv4UZuOERLvueXwOSZktXx4FI9nz7yTSQdO7iJv77QyT2FS2Dj76MofG1DjdWFLqt0DwGxOwQt9PIRQ== X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1235; 31:4L8yCUHlveFWRmPNmg8rshgfd61waseaIOSClE/f5HGl66yzGgiPYOjc0fOPuhfULTjWKwPTwedQ1FUgwJf8byHjJ1GLcyUhk5RjMPcEmqMAgdz6URdZ33+DMowV1KLb2ZAJQom+/QPMEs5Nss2olTVYHsunXw1UCTI8gt+dngZouB3wutmuupIYUN/bDKglWorilmUswpbN5hg2CtnXtzxvl5A/B93arV0XlLNmTz7WOxPIvj1q25Ht+yWICajSg/yKD2T2H9e4si0lSFuyKA==; 20:2NQJs2TRKXdUcTDX8mkmHFpg6cZLOxvBXkNitOwv1o04PawhHAujkW3fYv54hWwMB1ljbzMw9hyWB1rfCrVq57EJ3d425/13+TI6iKCyhhpl+PbtYoRpgfegCrHQYsmwuvxFtz2LtRdYgADbhvseRalmChzm25dx8BJ/g1uHLEZGhTeEaa3z25Nv/sOXdEV51t3hsBQZ1pQUmsYXb9JUT9e339+rBIGrdOvXCOtGQFFuEYuiV1rujLaMPtcb0DARbp++LvLCPIf7RXeqrHrN2A32fPOhcojdvXdQCFkHBdx9UNifgSIvyNgX5zQKPCK5QApotoXpK1nMFwUVDcYmiIPyPduh/rWti6UVZBn40Yk9G9ecSXQWAIAoq861U6/kXbBLAdjdIl/MYWsWuy8uA4x7n6UiSFV3VwXEkoaOTcsEyvpoDt8ZWg++YE8oRSbHrqjdX0g/lx/p5gEs2/9scQoEqSsUhpH4MqokNtRQMNrKvq1bJEM7zIfei4698vG2 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:XhN9gcSYZUWICDKwH2kIeMP+qnE9n0pBaEacQ15tCMgb3MClvLBt6vvZ606YxIY4dxx97WN3LumOKIG7ctZq9jvbms/zOzWr7P6FWiwPwACozzfmOQkvnzkmq6r05eaXW23Hc2MioFwJZuFzPJqO5rW/7Q8m4b6i0x7MdEfxjKu+BBiQM5k4EgKl25LbgFd8eIXaJUPAJqeldjXw9xyN2XAH1nW98W6Rh990hx/P+MFPVQ5uc/rEbhH96R/sl3Ejwhf5LDhX+6IdCpw3W+b67lvF7Sdv3NIZZPqvEcgaogCAtK+XIEH2wKBjqu64t0tojmW+o0CSEt9ApeJdUxfz7YGhf6HqTuwOw0Ge0c5vyTUiX+V7L66ZyPENXPQK7QpT2JW/uE1FXptQA8QDRGNJS7PA4vkudUz6ewhCHDI87J6FVjzrG6WPklnjrWv0A/9bxzslcr/UiK7wOL4yL+3gi45xSpj5mdoG30x+ZJfwA+jkMcewC4dR4wEL6rsPNYSC9MbA5F7wrYIFIonVhNieuXs7AONYr13eHNPRVWegQmf9V5qUo2cTH70VleuN0BQ7tZlyxqTQ5Tbf3vGvWeyW77hvNXCQK+uqpGr8c0zNKcdPkQ/GXX4lHg/4wDaakhcWUL/dIqdHPWRqE+8MidaMM1Xa+lf2U8cQf1tGqo/eCHI= X-Forefront-PRVS: 018632C080 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6029001)(6009001)(7916002)(39860400002)(39840400002)(39850400002)(39410400002)(39450400003)(199003)(189002)(305945005)(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)(19627235001); 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:9u6i4tISgWGLjgV6r4s/5hqI0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NLV4FZTh4eKE5xpOwKf5I3lSxm78xIiTyWmTl9J1tjwK4aX3jHczQSBKnFMMFT84nlk=; 24:fu9AC+5M6/K8en4IUSg1hGUI4AAA790SZBnbd81IrB1qjDuTDdWg21DDRvbqHELwsfUjINpLB2nn+SlZ0WjYVlfNscVWV02QzEqt8UfXu5U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1235; 7:2f/HsXWU4MGmDU8lItz6S40HG64QoTmhzt2CJZJhEppzJE1Oc6OIOEzikmb4ZH1gJcJ3aki5NzdE1ykezhyIR69P3tdDCHJgNqTkNsVRwt5Pn4pUY2goSi9W8rEoN0O1cFF8GEipYnksQbKLSaeP+alCQ563r9q5Hz0inPMmxk7aGPS1gc3gR52/cokzDb6GZidLvKdoQLKF/LW48g2EAQ9Uh9dQ8Zl46T/G06xthi9XQWsAdRM95ROFFqZogYDR0llFLH2Qga62ghjYaoF59fc2toWySDGO79wJfh0287hBX3iVe1DPSduBsQcbGf2ypT22SPsgqNX69XrAJRdzr+DPQex4lDaNEUqS/xg0lLpVgwqv6uGoQDzn0jR9rPz4iagYQVQa14f99LmN3qZM7n9P2OQ27cX1N8gA5Dww5JYxcio0bGvcv3P5M9A+rzNQGEfvaZTQL++uZsP/KEISMg==; 20:FkCWeckknC7LsSD5cqZAjuFgedpaqhtOovfPf5XhTF3GjzjIkyPFU0+t3Dime/DjKrIEIpfVWVBwenQT3+Mpf1u0VPBCHLiDVXxAeH/nt7SJ5MQ4bbqIOumU2BjGNH7UfB+9mo3oUuHwrXoVaLJ35nlhaoZyQF2ygEpWbTVBiDVVghIKAM930tLbiwuSy3Yk57xDsk30vRQZirVhhdT9nhNQt6d5bG+7+ApRSPleTDUxx8U+2MBNe5sLcxOAHXEZ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2017 06:21:23.7972 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1235 Subject: [PATCH v2 05/10] MdePkg/DxeIoLibCpuIo2: 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:26 -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 --- .../Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h | 71 +++++- MdePkg/Library/DxeIoLibCpuIo2/IoLib.c | 260 ++++++++++++++++++++- 2 files changed, 320 insertions(+), 11 deletions(-) diff --git a/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h b/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h index 160bedf..c84ce6b 100644 --- a/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h +++ b/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h @@ -2,6 +2,8 @@ Internal include file of DXE CPU IO2 Library. Copyright (c) 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 @@ -29,8 +31,10 @@ Reads registers in the EFI CPU I/O space. Reads the I/O port specified by Port with registers width specified by Width. - The read value is returned. If such operations are not supported, then ASSERT(). + The read value is returned. + This function must guarantee that all I/O read and write operations are serialized. + If such operations are not supported, then ASSERT(). @param Port The base address of the I/O operation. The caller is responsible for aligning the Address if required. @@ -42,16 +46,18 @@ UINT64 EFIAPI IoReadWorker ( - IN UINTN Port, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width + IN UINTN Port, + IN EFI_CPU_IO_PROTOCOL_WIDTH Width ); /** Writes registers in the EFI CPU I/O space. Writes the I/O port specified by Port with registers width and value specified by Width - and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). + and Data respectively. Data is returned. + This function must guarantee that all I/O read and write operations are serialized. + If such operations are not supported, then ASSERT(). @param Port The base address of the I/O operation. The caller is responsible for aligning the Address if required. @@ -64,9 +70,59 @@ IoReadWorker ( UINT64 EFIAPI IoWriteWorker ( - IN UINTN Port, - IN EFI_CPU_IO_PROTOCOL_WIDTH Width, - IN UINT64 Data + IN UINTN Port, + IN EFI_CPU_IO_PROTOCOL_WIDTH Width, + IN UINT64 Data + ); + +/** + Reads registers in the EFI CPU I/O space. + + Reads the I/O port specified by Port with registers width specified by Width. + 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 such operations are not supported, then ASSERT(). + + @param Port The base address of the I/O operation. + The caller is responsible for aligning the Address if required. + @param Width The width of the I/O operation. + @param Count The number of times to read I/O port. + @param Buffer The buffer to store the read data into. + +**/ +VOID +EFIAPI +IoReadFifoWorker ( + IN UINTN Port, + IN EFI_CPU_IO_PROTOCOL_WIDTH Width, + IN UINTN Count, + IN VOID *Buffer + ); + +/** + Writes registers in the EFI CPU I/O space. + + Writes the I/O port specified by Port with registers width specified by Width. + The port is written Count times, and the write data is retrieved from the provided Buffer. + + This function must guarantee that all I/O read and write operations are serialized. + If such operations are not supported, then ASSERT(). + + @param Port The base address of the I/O operation. + The caller is responsible for aligning the Address if required. + @param Width The width of the I/O operation. + @param Count The number of times to write I/O port. + @param Buffer The buffer to store the read data into. + +**/ +VOID +EFIAPI +IoWriteFifoWorker ( + IN UINTN Port, + IN EFI_CPU_IO_PROTOCOL_WIDTH Width, + IN UINTN Count, + IN VOID *Buffer ); /** @@ -79,6 +135,7 @@ IoWriteWorker ( @param Address The MMIO register to read. The caller is responsible for aligning the Address if required. @param Width The width of the I/O operation. + @param Count The number of times to write I/O port. @return Data read from registers in the EFI system memory space. diff --git a/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c b/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c index 110f66c..4182e29 100644 --- a/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c +++ b/MdePkg/Library/DxeIoLibCpuIo2/IoLib.c @@ -2,6 +2,8 @@ I/O Library instance based on EFI_CPU_IO2_PROTOCOL. Copyright (c) 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 @@ -50,8 +52,10 @@ IoLibConstructor ( Reads registers in the EFI CPU I/O space. Reads the I/O port specified by Port with registers width specified by Width. - The read value is returned. If such operations are not supported, then ASSERT(). + The read value is returned. + This function must guarantee that all I/O read and write operations are serialized. + If such operations are not supported, then ASSERT(). @param Port The base address of the I/O operation. The caller is responsible for aligning the Address if required. @@ -67,8 +71,8 @@ IoReadWorker ( IN EFI_CPU_IO_PROTOCOL_WIDTH Width ) { - EFI_STATUS Status; - UINT64 Data; + EFI_STATUS Status; + UINT64 Data; Status = mCpuIo->Io.Read (mCpuIo, Width, Port, 1, &Data); ASSERT_EFI_ERROR (Status); @@ -80,8 +84,10 @@ IoReadWorker ( Writes registers in the EFI CPU I/O space. Writes the I/O port specified by Port with registers width and value specified by Width - and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). + and Data respectively. Data is returned. + This function must guarantee that all I/O read and write operations are serialized. + If such operations are not supported, then ASSERT(). @param Port The base address of the I/O operation. The caller is responsible for aligning the Address if required. @@ -108,6 +114,68 @@ IoWriteWorker ( } /** + Reads registers in the EFI CPU I/O space. + + Reads the I/O port specified by Port with registers width specified by Width. + 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 such operations are not supported, then ASSERT(). + + @param Port The base address of the I/O operation. + The caller is responsible for aligning the Address if required. + @param Width The width of the I/O operation. + @param Count The number of times to read I/O port. + @param Buffer The buffer to store the read data into. + +**/ +VOID +EFIAPI +IoReadFifoWorker ( + IN UINTN Port, + IN EFI_CPU_IO_PROTOCOL_WIDTH Width, + IN UINTN Count, + IN VOID *Buffer + ) +{ + EFI_STATUS Status; + + Status = mCpuIo->Io.Read (mCpuIo, Width, Port, Count, Buffer); + ASSERT_EFI_ERROR (Status); +} + +/** + Writes registers in the EFI CPU I/O space. + + Writes the I/O port specified by Port with registers width specified by Width. + The port is written Count times, and the write data is retrieved from the provided Buffer. + + This function must guarantee that all I/O read and write operations are serialized. + If such operations are not supported, then ASSERT(). + + @param Port The base address of the I/O operation. + The caller is responsible for aligning the Address if required. + @param Width The width of the I/O operation. + @param Count The number of times to write I/O port. + @param Buffer The buffer to store the read data into. + +**/ +VOID +EFIAPI +IoWriteFifoWorker ( + IN UINTN Port, + IN EFI_CPU_IO_PROTOCOL_WIDTH Width, + IN UINTN Count, + IN VOID *Buffer + ) +{ + EFI_STATUS Status; + + Status = mCpuIo->Io.Write (mCpuIo, Width, Port, Count, Buffer); + ASSERT_EFI_ERROR (Status); +} + +/** Reads memory-mapped registers in the EFI system memory space. Reads the MMIO registers specified by Address with registers width specified by Width. @@ -397,6 +465,190 @@ 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 + ) +{ + IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer); +} + +/** + 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 + ) +{ + IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer); +} + +/** + 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 + ) +{ + // + // Make sure Port is aligned on a 16-bit boundary. + // + ASSERT ((Port & 1) == 0); + IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint16, Count, Buffer); +} + +/** + 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 + ) +{ + // + // Make sure Port is aligned on a 16-bit boundary. + // + ASSERT ((Port & 1) == 0); + IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint16, Count, Buffer); +} + +/** + 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 + ) +{ + // + // Make sure Port is aligned on a 32-bit boundary. + // + ASSERT ((Port & 3) == 0); + IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer); +} + +/** + 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 + ) +{ + // + // Make sure Port is aligned on a 32-bit boundary. + // + ASSERT ((Port & 3) == 0); + IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer); +} + +/** Reads an 8-bit MMIO register. Reads the 8-bit MMIO register specified by Address. The 8-bit read value is -- 1.9.1