From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on062d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe42::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 5F27881C64 for ; Fri, 13 Jan 2017 12:10:39 -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=8NjioinMSZFOE7LsHucODqYtAVv79Tl0Ff5d3s3ymBw=; b=1cHUx8PnbnriZEtmUgEAzYLisgmBQ/tVgG3Z/YQn8ldbvEyAtAhD/hvun0V3Ax2vom+jQLrx6bu4S56x7qqOTgz9l56ZEA8EEENdIpe15g8kJsPWQ20cDBy4MDFiN0kqJVkCNzLuzx7y2iJrsyrruOQKM/saYEuoDS4KkbtZqrs= 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:35 +0000 From: Leo Duran To: CC: , , , , , , Leo Duran Date: Fri, 13 Jan 2017 14:09:51 -0600 Message-ID: <1484338200-31337-2-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: 06c73814-15ac-40fb-1a67-08d43bf03d0e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR12MB1238; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1238; 3:NOikTk0Ac2D7mt07aoSg6yem1shg5h3rJeCIJ1wmhUJ1xzgxt71lGQqmwkvM3cHh9kGDAgBK7sz4PXoxAZxMtlkSKZOhFaK2ur82nvFaBdar3oHsKQfcrCT04ZzlHMhe73P2ajf7nrPLzR4T+eCnSN/PMepbi8fiCjVRX4LKfYTauqJQt3SIyi9y33W9vy6VDBb92X8yun+FUsyhucDvQ4V93lqhCyMCQEQYgjHMCOghK/+bs1F2qhLDQgH2IiNPRFjB5nJSpUKqzc/Sqa8tCg== X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1238; 25:xwcSAHCRsKZklRaN3C0zd+ajl/aMFfJYz28BM0JW8T0uXhOf0Ha3i66F27XulUAY7pThszdlDbOai9sqydXWkVRbZX54NwrdiJhEVNacXxOMdQPMBlKharjWN/UEayUn3zmJpSgSaSixtiigp4S6yuZXlvpO4C9ss33nP9iDYe88VblLLg35iUJvSTCDNVujfL089rumwEJ8e9BQHd+97HGa0XjS2HBNgy6+D8Y3iUGi8N8rFpQdsiu7bmuuiHTPn8vj83fkamqZLvK1q3E0P740VuRiGrgKEFvOT5LNShMCiVNqeoNr3lwQ92HRiNSv7h0decnSPpFR2HdJQie5UYCvCyIul8vispA+MhKhCcUcg2RURY6ByYjHxjRtRpvuW/7HwhLdhrxpGvpCiXC/vP3MyUee6LocQd5NXK0NbJ4K5lmJz3VPGPFlofTS7l2896jNdk/+Ybo9l0Slit8pNp9FxVPEleL7SVKRRpgK9mC+ZAJ1gj6M8DEX2TqO9ayC293Z97av1YxBIPuTxVFecHNZ+sivSRjPCSSXfj6/k7uCwZ0iwZrRPn/IVkX2Zvx7tZYEKbYUpNMIxFDywRgRw5D4Q38QfeKwjmiq7L3+ZzNVuuyvnISGlo7H3drs4txpUvtePw9ESafOPZeZco7WpzYgN7hbeew9R0lzxP9lBunhBwJbdxE9GAoOurUUiPMVf6vUydWrSNrS5D17PsheNCB/Yln/H86MlW8S1bipDKm260tg+qUW1vK3v9mi57QoyLdSAIGyE1BrYzrdN8GSGfA+ij52MJSxxXZ3J7A0RXDDemWqX7iL20dKI5piaqQp X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1238; 31:J/JwNor1bbrgnUGcTu6dbR3w0uqozjorGMHhJ55HIoFnPHNSxcK5+ApNi98G8vKHHFfEnCFeS/HxBjfF61/ywTl4srINHJhno++UkwMnpPzARtNc8L13aNE/dpSXKehR4OBgBXYVyesEdqt4ZkIYM5XIwP89D7FV4Sb4oYBcMnThOVFtdh6k8o+AxU/CLmMz2/9RYXZXxJKidB80bZA2VuPxtmSwC782G1TvU9OoRbG2SLZbSOzKkiqDY8AT3nnJxFspAIRirMJzaBLndU2GPg==; 20:II5khGZDIaHBMfx2IRT+I4qtsekbs8Ac1UDnbsT3P8qLlD+c/yqbhjCC9j5jrhJOIvf+yG5HndhCylG+vav6LLU6O6CY+T+RnLfFviHa3jeo/bd7RfNyvLMZ1OoEhb93Zh46xCSpQ/g0uHSNuteT2cYBN615obf2fbo0BM01Rv9kAYvbzJkA40ta+GAy72lQIvyDy1wIVNFG3YGzR+SuS4MTIuUYYpc5qByB9tSv+lP6AaiUKARDtUTHX+ilWOszZT06+pzv+ByafSgypp/1tryTMtVctw4XOYCRYwi8GKHlPYiZ0nsbFR0clvNbKvyjr1rJ31p3XN7dRmxTJrPBy3bhCBVYpiz5FXAfp6ieFu8Lxk2SybScjyqfnx5VWUQ4uFAgagm/zIe4TnVUBFbCPLmDeqUG+VPzOxxa1YtG7BHPeVmN6lg0z4yuCioaXe5Zlmpz+4eETrtklY+u8vPcW8yPcPEM2sc2gcIhHR3HrjxB9pK8PfF5UuWubltaFJmS 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:igr34DFcy5XSGuR+wgUdbl9gmeaFYyep32P1mi/NYFIQIL+X9hWKIgUCFdyJLYwqZZqz8OW/ZWTWQTAUNE0XUON4qKylbM/AG7lJMtZXrqDZ+f+OF1gG4bopFvFF8a6R+yPEL7Cd5fhi9PYEExTC28PJ9hunzKNTxuXkslkGls1odQfLZTXFiY09UuM8yGCqGiAGHK+fzzpf4YLDqa7JfVECTejkiLX77KNNJfainES2xviVmDNSrbokSxnIyc4jpx5+dpliReH+b7QtVvD8jDhfTCTrfDYFrcQHTtWbqMUnLR8knS49nGe1kmaLBholIuq+mHPQRlFTfRqyQAfzCwIgTZO9ZWflWXHJpwEfw8cn4EY6Va/KjZ5pDs/6RKwd1XGM7Yow5wn8pEA99x7H/0N1XbzcCoE8t5HeYkaxdptRuSIWiFKRtTt31N8cj1h6euGmsLYPkhntsQbbn8c1aBXRsWHwmuKngBR++tEXHQuAajf5HCFNzJ8c5x1d0RfdJNtHZKgSpF1EHFGzFVAl6UlbLX6q+MVoBvOBB/o1d1SsQkPK004t/ZNNrfGASVBhg5v5cW4M30Al8MJs7x7IDT7TDY5i5GS2bWoOmU23Hn8d3itHLCv1dFhdNV5RvhkJN3JWpANVxla9Cto4uKfM8h/ZZ/iwrZ9GOFEnDRL5zYY= 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)(53946003)(6916009)(6666003)(48376002)(54906002)(2950100002)(47776003)(7736002)(305945005)(110136003)(5660300001)(25786008)(50466002)(6306002)(66066001)(86362001)(575784001)(33646002)(4326007)(5003940100001)(42186005)(53416004)(97736004)(2906002)(6116002)(92566002)(3846002)(15395725005)(36756003)(68736007)(8676002)(50226002)(189998001)(81166006)(50986999)(76176999)(81156014)(27001)(579004)(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:ODsYkFX9Ugh2bgRIlav+RP/UY3lhZJNu3TrLrXAd4?= =?us-ascii?Q?2G55qDwaxDQTQSNbYy0dDCkQmmxM0iqEe+ZNxZfDVRz6eIRz4Zcg16EWiac6?= =?us-ascii?Q?dxdLclvhfTF4OfPnsNwUkwNiLq79Dv+u9w/4IHAb4xT3pAMiFg2H+ifz/SGW?= =?us-ascii?Q?F4h/3lTy63PYF7v90vd1MmKHLBfSAkHnpy5kVX0c6TyXBatTM2YsBK91dvzE?= =?us-ascii?Q?AA11gca6eAfsa8EVfht04TlTFyL0B49LIdvkXy9c6jyxjR1JlVH86VaExbVt?= =?us-ascii?Q?cOLzvSVwv67BtcGPCIg7Zm3m6VsEWkGo5TzFfLj6amNgH9sDtEiXlhFk0MKA?= =?us-ascii?Q?iSYG6KZTDn4epD7iiLnsEM1Uvhz79K7WK8o0ixgViMqBR4ZZ0EFE3Vs1ojs9?= =?us-ascii?Q?qg/dbj3bWCr8xWhdYWGeaVBYkDLMLGMsjkEGRAZzGobitMYIiofF8ay3ewvd?= =?us-ascii?Q?bGBPKFjHrkee3KsKMl6/GXs8Pt+9qvn6/buNa1MdRH6fUDGYDkLAsgfA2qSw?= =?us-ascii?Q?XMhZBVSqjQgaaHMeqmhJbeCx55OHGTvL6/cj+kj6pDkDnw+eRlgSVI7Lo5xX?= =?us-ascii?Q?LUAFkdlsjTH4zD/fULwpIiwypS0pzKIFUvj0MyOt0yadYYIYv5CdViOZupsx?= =?us-ascii?Q?uCB9/tueUDUPVav8JtlsRw9mycipG5WyUYXCC3NG+ckS6mQhazB+UV+vH5Um?= =?us-ascii?Q?+M1GEV+3NmD6AjPJLvSqMLuEOD7uTYJpEMblLzZds93YRaBkavLsTSXn0/HK?= =?us-ascii?Q?d78iViW72l+N0Ex77QuodJW155HCKYy4LwrtI48wLvvjZKCBAk9e+7CXKSTA?= =?us-ascii?Q?h4CQuBu+VTSNTbV/ZBV4eQ49G986OuA8kcMencH8Bj60fwupCqIYfFk9gjpc?= =?us-ascii?Q?nvOcSDiFLkqnnL111bxzVWlL+A2ziMYgUDzLtgkDZkhpoqbiitnIn9MspaXq?= =?us-ascii?Q?LvXeYddKYspBYtOoOg7ui5XZIEi2IDggUznIF4txwFoCwlBcq/F+71ok1gyM?= =?us-ascii?Q?6Qbp2w7QPEN6hcNnPDmBIZNdb85f5GUrmakO9Yn/1Gu+P/Io/wKEyHYx4HzG?= =?us-ascii?Q?uWNgmyikAoj69RzcUjTy7Td2yoprcFniwSWBNh4FaesjMDQfx3nQTWGjnamJ?= =?us-ascii?Q?OJuyG1NntLNm9DuePEcaJt6biwSz4YO9GGZkx8X/LqOqCbp2Cz/csu3xhjMD?= =?us-ascii?Q?0kaQt82yNocQ46BWObwXm0f52AZCJjlqnGy2e1gMbHflalZM/ncLyJhGKRtY?= =?us-ascii?Q?kI1HMCdIx4sCo0gNaxA9I9g2wwMFN6d171p8TCJniqOO9wxNPJ7C4IMj4xsJ?= =?us-ascii?Q?JnPeUZy62MAwZ3j1lDnS1xBmOFg9xb8yL9kCpHVc/BUQ4zlJsAal3FkZiK1Y?= =?us-ascii?Q?7MgXa54aXHH7YklOjheoalTnss=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1238; 6:SiU6hnv8SGJ8oE6AfH2Z0GHB61eVMWSoPwelbUqROcduM+qQoLunkYWXEzoU5rYZXHJJqto6Nr1ao3P/BaQ/7Hkup6eI9FPObF5KoGh8aPcM29NNRgLTp3o303S4M5Xxjyua8Q5tllMWLKMOuGZRe67SFg6HQDDpOTKGWJxGzGGTAkEY1T5mCEmPoWmYh5rucFEQRladCGzaMp8UtOiRnu1gCkqmazGLdvVc0q5DHP793y6WcVCOadzz9FIQlQWtUdsoxZEzcXAkxAAmiqIfwJHwOkZk1ng2fDy185rM3Wj7bu6BQKaLUPV5yky4bPlYmoDLwF3oblGjEZO2Xa7AmPigDj0ezsJ5B448PShIcmrt5SOTfAojzIxmz77Qt2DfH8cviQr0ib5W6Hp5xIjt58Kld2yg9v8TuHY6BC5etAK1vcueapVigle3XkKPFEiQ/u6tM3JvAPnrs0/wqfXt5g==; 5:J1UuN9brvrWN8Nre3NlbgQtFPlAouhyWSZ5+krjDst1jtcdevq0kPSVDmXDlu+Ifj3JbqNzCrhvhnYb+shab7Ip0+dUjp80IA+WRsr9w7GT75kKH0mitxD57Q5SkIiUeV19h5ntEpO2Sx08L+L0MQg==; 24:174bVKt63iZ1j8gzq4emeRAjYSirJKnumFffuEvwQ6jTBqhu+w287bnT7kUTDEnG0Rd6C+OJ1UH9nEloEh1y99EbphzlioWffAV9pVmLN9U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1238; 7:/dxqvsFnGlcbXlAY2VB++0nOmjlyzaA+NxuwomTx/+Fqia7W+0xkrczXLUQjW4YJaOScEFdS+xyAEqOgcmJJ1tC1bXnvenoo0FutgTzpPax9leT8hycdUZ0Sbky8cHQQAxk3cCNLJ2ZegowftuN0IftYroBQWmGqK4LzVcWGF5BO/cwgpe7gAGrssGC5p6/xwTW9jHnOJfnKjxVRczCdCR7Ye1AhGmD+eHxa1M0yG2AY5GJ5obmrTAS/z7e8O/dcdgiyBYs0mJ7cHVCN/qU6m3UEH7KP0SuEtQT+CCNpghTu7qmodlZtW5JwJ9ytdwMUuNy26VXMJ9A3K7JjMXLl60ab6sHaVfRtMtGy4lCG2tMWXxdQEl/4L9ArTemqrl9x79IQQ8i7AJTK40dtBGIZRehioRvACrQQuxivFhKPiIVrI2mHug/upJybkje2/o49MsX1NUrOMTTU8XWDMkuMOQ==; 20:io6CFdbsMTxCLp7uX2QAONet78J8mgR3U22aHfz8SXNAHkroHslFmsfw4by/Z5FmM9zL17f42T0mLbGio3IM5Z2PHbp87+nxE26XSa3kgAzmH0rzfrlWwToMJcqP35iitu5Q1YW4MBPPNLJpHCIHx/9MY68qJhP6vyLnF6W6uEleQcti7itxlE17YXPZea8PSO3Q05v39LOvEnbaphIi0NqQxqyVkX6QQP77WWcA6JcEzOoacIoqdsxXoeDZSxj8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2017 20:10:35.9048 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1238 Subject: [PATCH v3 01/10] MdePkg: Expand BaseIoLibIntrinsic (IoLib class) library 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:39 -0000 Content-Type: text/plain The UefiCpuPkg/CpuIo2Dxe driver and the QemuCfgLib library have duplicate implementations of I/O Fifo routines. This patch clones the I/O Fifo routines into the BaseIoLibIntrinsic library and expands the IoLib class to include the ported I/O Fifo routines. 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/Include/Library/IoLib.h | 152 ++++++++++++++++ .../BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf | 6 +- MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm | 141 +++++++++++++++ MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm | 137 ++++++++++++++ MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c | 169 +++++++++++++++++ MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c | 171 ++++++++++++++++++ MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c | 201 +++++++++++++++++++++ MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm | 127 +++++++++++++ MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm | 126 +++++++++++++ 9 files changed, 1229 insertions(+), 1 deletion(-) create mode 100644 MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm create mode 100644 MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm create mode 100644 MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm create mode 100644 MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm diff --git a/MdePkg/Include/Library/IoLib.h b/MdePkg/Include/Library/IoLib.h index a0dd16b..b6df4c1 100644 --- a/MdePkg/Include/Library/IoLib.h +++ b/MdePkg/Include/Library/IoLib.h @@ -2,6 +2,8 @@ Provide services to access I/O Ports and MMIO registers. Copyright (c) 2006 - 2012, 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 @@ -76,6 +78,56 @@ IoWrite8 ( ); /** + 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 + ); + +/** + 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 + ); + +/** Reads an 8-bit I/O port, performs a bitwise OR, and writes the result back to the 8-bit I/O port. @@ -368,6 +420,56 @@ IoWrite16 ( ); /** + 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 + ); + +/** + 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 + ); + +/** Reads a 16-bit I/O port, performs a bitwise OR, and writes the result back to the 16-bit I/O port. @@ -669,6 +771,56 @@ IoWrite32 ( ); /** + 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 + ); + +/** + 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 + ); + +/** Reads a 32-bit I/O port, performs a bitwise OR, and writes the result back to the 32-bit I/O port. diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf index 29b9e8b..8844b1c 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf +++ b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf @@ -8,6 +8,7 @@ # # Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
# Portions copyright (c) 2008 - 2009, Apple Inc. 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 @@ -16,7 +17,6 @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -# ## [Defines] @@ -43,12 +43,16 @@ [Sources.IA32] IoLibMsc.c | MSFT IoLibIcc.c | INTEL IoLib.c + Ia32/IoFifo.nasm + Ia32/IoFifo.asm [Sources.X64] IoLibGcc.c | GCC IoLibMsc.c | MSFT IoLibIcc.c | INTEL IoLib.c + X64/IoFifo.nasm + X64/IoFifo.asm [Sources.EBC] IoLibEbc.c diff --git a/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm b/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm new file mode 100644 index 0000000..da767d1 --- /dev/null +++ b/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm @@ -0,0 +1,141 @@ +;------------------------------------------------------------------------------ +; +; Copyright (c) 2006 - 2012, 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 +; http://opensource.org/licenses/bsd-license.php. +; +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +; +;------------------------------------------------------------------------------ + + .586P + .model flat,C + .code + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoReadFifo8 ( +; IN UINTN Port, +; IN UINTN Size, +; OUT VOID *Buffer +; ); +;------------------------------------------------------------------------------ +IoReadFifo8 PROC + push edi + cld + mov dx, [esp + 8] + mov ecx, [esp + 12] + mov edi, [esp + 16] +rep insb + pop edi + ret +IoReadFifo8 ENDP + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoReadFifo16 ( +; IN UINTN Port, +; IN UINTN Size, +; OUT VOID *Buffer +; ); +;------------------------------------------------------------------------------ +IoReadFifo16 PROC + push edi + cld + mov dx, [esp + 8] + mov ecx, [esp + 12] + mov edi, [esp + 16] +rep insw + pop edi + ret +IoReadFifo16 ENDP + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoReadFifo32 ( +; IN UINTN Port, +; IN UINTN Size, +; OUT VOID *Buffer +; ); +;------------------------------------------------------------------------------ +IoReadFifo32 PROC + push edi + cld + mov dx, [esp + 8] + mov ecx, [esp + 12] + mov edi, [esp + 16] +rep insd + pop edi + ret +IoReadFifo32 ENDP + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoWriteFifo8 ( +; IN UINTN Port, +; IN UINTN Size, +; IN VOID *Buffer +; ); +;------------------------------------------------------------------------------ +IoWriteFifo8 PROC + push esi + cld + mov dx, [esp + 8] + mov ecx, [esp + 12] + mov esi, [esp + 16] +rep outsb + pop esi + ret +IoWriteFifo8 ENDP + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoWriteFifo16 ( +; IN UINTN Port, +; IN UINTN Size, +; IN VOID *Buffer +; ); +;------------------------------------------------------------------------------ +IoWriteFifo16 PROC + push esi + cld + mov dx, [esp + 8] + mov ecx, [esp + 12] + mov esi, [esp + 16] +rep outsw + pop esi + ret +IoWriteFifo16 ENDP + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoWriteFifo32 ( +; IN UINTN Port, +; IN UINTN Size, +; IN VOID *Buffer +; ); +;------------------------------------------------------------------------------ +IoWriteFifo32 PROC + push esi + cld + mov dx, [esp + 8] + mov ecx, [esp + 12] + mov esi, [esp + 16] +rep outsd + pop esi + ret +IoWriteFifo32 ENDP + + END + diff --git a/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm b/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm new file mode 100644 index 0000000..bcaa743 --- /dev/null +++ b/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm @@ -0,0 +1,137 @@ +;------------------------------------------------------------------------------ +; +; Copyright (c) 2006 - 2012, 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 +; http://opensource.org/licenses/bsd-license.php. +; +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +; +;------------------------------------------------------------------------------ + + SECTION .text + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoReadFifo8 ( +; IN UINTN Port, +; IN UINTN Size, +; OUT VOID *Buffer +; ); +;------------------------------------------------------------------------------ +global ASM_PFX(IoReadFifo8) +ASM_PFX(IoReadFifo8): + push edi + cld + mov dx, [esp + 8] + mov ecx, [esp + 12] + mov edi, [esp + 16] +rep insb + pop edi + ret + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoReadFifo16 ( +; IN UINTN Port, +; IN UINTN Size, +; OUT VOID *Buffer +; ); +;------------------------------------------------------------------------------ +global ASM_PFX(IoReadFifo16) +ASM_PFX(IoReadFifo16): + push edi + cld + mov dx, [esp + 8] + mov ecx, [esp + 12] + mov edi, [esp + 16] +rep insw + pop edi + ret + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoReadFifo32 ( +; IN UINTN Port, +; IN UINTN Size, +; OUT VOID *Buffer +; ); +;------------------------------------------------------------------------------ +global ASM_PFX(IoReadFifo32) +ASM_PFX(IoReadFifo32): + push edi + cld + mov dx, [esp + 8] + mov ecx, [esp + 12] + mov edi, [esp + 16] +rep insd + pop edi + ret + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoWriteFifo8 ( +; IN UINTN Port, +; IN UINTN Size, +; IN VOID *Buffer +; ); +;------------------------------------------------------------------------------ +global ASM_PFX(IoWriteFifo8) +ASM_PFX(IoWriteFifo8): + push esi + cld + mov dx, [esp + 8] + mov ecx, [esp + 12] + mov esi, [esp + 16] +rep outsb + pop esi + ret + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoWriteFifo16 ( +; IN UINTN Port, +; IN UINTN Size, +; IN VOID *Buffer +; ); +;------------------------------------------------------------------------------ +global ASM_PFX(IoWriteFifo16) +ASM_PFX(IoWriteFifo16): + push esi + cld + mov dx, [esp + 8] + mov ecx, [esp + 12] + mov esi, [esp + 16] +rep outsw + pop esi + ret + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoWriteFifo32 ( +; IN UINTN Port, +; IN UINTN Size, +; IN VOID *Buffer +; ); +;------------------------------------------------------------------------------ +global ASM_PFX(IoWriteFifo32) +ASM_PFX(IoWriteFifo32): + push esi + cld + mov dx, [esp + 8] + mov ecx, [esp + 12] + mov esi, [esp + 16] +rep outsd + pop esi + ret + diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c index b9f4c5e..5ce12ca 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c @@ -3,6 +3,8 @@ Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
Portions copyright (c) 2008 - 2009, Apple Inc. 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 @@ -221,6 +223,173 @@ IoWrite64 ( return 0; } +/** + 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 + ) +{ + ASSERT (FALSE); +} + +/** + 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 + ) +{ + ASSERT (FALSE); +} + +/** + 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 + ) +{ + ASSERT (FALSE); +} + +/** + 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 + ) +{ + ASSERT (FALSE); +} + +/** + 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 + ) +{ + ASSERT (FALSE); +} + +/** + 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 + ) +{ + ASSERT (FALSE); +} /** Reads an 8-bit MMIO register. diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c index e12a5ae..dd87190 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c @@ -4,6 +4,8 @@ EBC does not support port I/O. All APIs in this file ASSERT(). Copyright (c) 2015, 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 @@ -169,3 +171,172 @@ IoWrite32 ( ASSERT (FALSE); return 0; } + +/** + 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 + ) +{ + ASSERT (FALSE); +} + +/** + 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 + ) +{ + ASSERT (FALSE); +} + +/** + 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 + ) +{ + ASSERT (FALSE); +} + +/** + 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 + ) +{ + ASSERT (FALSE); +} + +/** + 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 + ) +{ + ASSERT (FALSE); +} + +/** + 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 + ) +{ + ASSERT (FALSE); +} + diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c index 6b0bf6a..e388549 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c @@ -2,6 +2,8 @@ Common I/O Library routines. Copyright (c) 2006 - 2008, 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 @@ -147,6 +149,7 @@ IoRead64 ( return 0; } + /** Writes an 8-bit I/O port. @@ -252,6 +255,204 @@ 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); + } +} + +/** + 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; + + Buffer16 = (UINT16 *)Buffer; + while (Count--) { + *Buffer16++ = IoRead16 (Port); + } +} + +/** + 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; + + Buffer32 = (UINT32 *)Buffer; + while (Count--) { + *Buffer32++ = IoRead32 (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++); + } +} + +/** + 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; + + Buffer16 = (UINT16 *)Buffer; + while (Count--) { + IoWrite16 (Port, *Buffer16++); + } +} + +/** + 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; + + 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 diff --git a/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm new file mode 100644 index 0000000..87c6107 --- /dev/null +++ b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm @@ -0,0 +1,127 @@ +;------------------------------------------------------------------------------ +; +; Copyright (c) 2006 - 2012, 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 +; http://opensource.org/licenses/bsd-license.php. +; +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +; +;------------------------------------------------------------------------------ + + .code + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoReadFifo8 ( +; IN UINTN Port, // rcx +; IN UINTN Size, // rdx +; OUT VOID *Buffer // r8 +; ); +;------------------------------------------------------------------------------ +IoReadFifo8 PROC + cld + xchg rcx, rdx + xchg rdi, r8 ; rdi: buffer address; r8: save rdi +rep insb + mov rdi, r8 ; restore rdi + ret +IoReadFifo8 ENDP + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoReadFifo16 ( +; IN UINTN Port, // rcx +; IN UINTN Size, // rdx +; OUT VOID *Buffer // r8 +; ); +;------------------------------------------------------------------------------ +IoReadFifo16 PROC + cld + xchg rcx, rdx + xchg rdi, r8 ; rdi: buffer address; r8: save rdi +rep insw + mov rdi, r8 ; restore rdi + ret +IoReadFifo16 ENDP + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoReadFifo32 ( +; IN UINTN Port, // rcx +; IN UINTN Size, // rdx +; OUT VOID *Buffer // r8 +; ); +;------------------------------------------------------------------------------ +IoReadFifo32 PROC + cld + xchg rcx, rdx + xchg rdi, r8 ; rdi: buffer address; r8: save rdi +rep insd + mov rdi, r8 ; restore rdi + ret +IoReadFifo32 ENDP + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoWriteFifo8 ( +; IN UINTN Port, // rcx +; IN UINTN Size, // rdx +; IN VOID *Buffer // r8 +; ); +;------------------------------------------------------------------------------ +IoWriteFifo8 PROC + cld + xchg rcx, rdx + xchg rsi, r8 ; rsi: buffer address; r8: save rsi +rep outsb + mov rsi, r8 ; restore rsi + ret +IoWriteFifo8 ENDP + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoWriteFifo16 ( +; IN UINTN Port, // rcx +; IN UINTN Size, // rdx +; IN VOID *Buffer // r8 +; ); +;------------------------------------------------------------------------------ +IoWriteFifo16 PROC + cld + xchg rcx, rdx + xchg rsi, r8 ; rsi: buffer address; r8: save rsi +rep outsw + mov rsi, r8 ; restore rsi + ret +IoWriteFifo16 ENDP + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoWriteFifo32 ( +; IN UINTN Port, // rcx +; IN UINTN Size, // rdx +; IN VOID *Buffer // r8 +; ); +;------------------------------------------------------------------------------ +IoWriteFifo32 PROC + cld + xchg rcx, rdx + xchg rsi, r8 ; rsi: buffer address; r8: save rsi +rep outsd + mov rsi, r8 ; restore rsi + ret +IoWriteFifo32 ENDP + + END + diff --git a/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm new file mode 100644 index 0000000..7bd72d0 --- /dev/null +++ b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm @@ -0,0 +1,126 @@ +;------------------------------------------------------------------------------ +; +; Copyright (c) 2006 - 2012, 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 +; http://opensource.org/licenses/bsd-license.php. +; +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +; +;------------------------------------------------------------------------------ + + DEFAULT REL + SECTION .text + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoReadFifo8 ( +; IN UINTN Port, // rcx +; IN UINTN Size, // rdx +; OUT VOID *Buffer // r8 +; ); +;------------------------------------------------------------------------------ +global ASM_PFX(IoReadFifo8) +ASM_PFX(IoReadFifo8): + cld + xchg rcx, rdx + xchg rdi, r8 ; rdi: buffer address; r8: save rdi +rep insb + mov rdi, r8 ; restore rdi + ret + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoReadFifo16 ( +; IN UINTN Port, // rcx +; IN UINTN Size, // rdx +; OUT VOID *Buffer // r8 +; ); +;------------------------------------------------------------------------------ +global ASM_PFX(IoReadFifo16) +ASM_PFX(IoReadFifo16): + cld + xchg rcx, rdx + xchg rdi, r8 ; rdi: buffer address; r8: save rdi +rep insw + mov rdi, r8 ; restore rdi + ret + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoReadFifo32 ( +; IN UINTN Port, // rcx +; IN UINTN Size, // rdx +; OUT VOID *Buffer // r8 +; ); +;------------------------------------------------------------------------------ +global ASM_PFX(IoReadFifo32) +ASM_PFX(IoReadFifo32): + cld + xchg rcx, rdx + xchg rdi, r8 ; rdi: buffer address; r8: save rdi +rep insd + mov rdi, r8 ; restore rdi + ret + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoWriteFifo8 ( +; IN UINTN Port, // rcx +; IN UINTN Size, // rdx +; IN VOID *Buffer // r8 +; ); +;------------------------------------------------------------------------------ +global ASM_PFX(IoWriteFifo8) +ASM_PFX(IoWriteFifo8): + cld + xchg rcx, rdx + xchg rsi, r8 ; rsi: buffer address; r8: save rsi +rep outsb + mov rsi, r8 ; restore rsi + ret + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoWriteFifo16 ( +; IN UINTN Port, // rcx +; IN UINTN Size, // rdx +; IN VOID *Buffer // r8 +; ); +;------------------------------------------------------------------------------ +global ASM_PFX(IoWriteFifo16) +ASM_PFX(IoWriteFifo16): + cld + xchg rcx, rdx + xchg rsi, r8 ; rsi: buffer address; r8: save rsi +rep outsw + mov rsi, r8 ; restore rsi + ret + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; IoWriteFifo32 ( +; IN UINTN Port, // rcx +; IN UINTN Size, // rdx +; IN VOID *Buffer // r8 +; ); +;------------------------------------------------------------------------------ +global ASM_PFX(IoWriteFifo32) +ASM_PFX(IoWriteFifo32): + cld + xchg rcx, rdx + xchg rsi, r8 ; rsi: buffer address; r8: save rsi +rep outsd + mov rsi, r8 ; restore rsi + ret + -- 1.9.1