From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 573F8AC0BB4 for ; Fri, 26 Jan 2024 06:02:34 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=u9JnsY8SFOMFu8tE4PB5XRm5VPhvFfEU4gdKKHNfvB8=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1706248953; v=1; b=efsbN3NOfnnc5Jj09OHBOzlrXU9L0JQILKPC/1bR7Uo1i0MYL7amjh2UXv+mpJsr8h00w163 ubnrHev5cjbvbM1lDYJPDVNZiAKXLTtZnxzud6fv2Sq85w8NxfqLwloEFvUvrnhlwHIg8mjrqty f7ztalGqU1tDOIPKIf4QUqws= X-Received: by 127.0.0.2 with SMTP id mYCVYY7687511x7tJkqi8L3N; Thu, 25 Jan 2024 22:02:33 -0800 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.80]) by mx.groups.io with SMTP id smtpd.web10.9833.1706248952500381863 for ; Thu, 25 Jan 2024 22:02:32 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bAdlGDpqooW+vCjQe3HBgpNboaiTBWVk/TDXmBr9QU54t4CsD3XNgE5EnviEs2oj6uRPtfoS3JHOroo0kAfw63ldNexaPXuiCSQe4DjIn43l2mEaNr4JB0w6rgmLl6Hyi6CG2iwSUXCvyZwMFNHEgqFXM3ijXOXxgm5D53EYFHlSDHltJySFUsgLp3Z14BKh7J/Y/b98THx0IcXrOGHa+ekX337Q868J9HdJn9BXZhB3KlE6b8Jl9YOuLgvdsboIIxc0A3M1zEqOlJ0mkV8v4WHedzzm87p/Y5WweX6EZFIbzqMZhyZkKLr52NH4+IhD8A9fc1jnCdnBd1kk7/7WdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SreaIcVslUnmL2mn284EtCYZjwMVRvkiDWeJK9690xI=; b=LUuAI/kOyDP33zeCBUs9FQBuw9HhzvZ3NnXdevEmEtxk+5ZxB6XXFpyQyzZK+yTpFvC60xgUSW4qrk9GD4rFlzEA7bWea9oFuUdJMSQSnNFG16dZSg/Ztg13Hcc24c+NdoJz59PuMBFD0hKgpTXTHw61gdT1gCnWyirmdFZ9tFPA9GzPOWECbM1ivLKhzuKEtkPGdWkpsW0srU6/Zth3BMnRcRZD0h/4AOmzPLYg4flD3z+2BtLc6RI++fI8mvKzznlnakFPlSsE/3LDMMpe6MUPsieN7ka+vDKd320hNuK867Hnhp8gsRW8uPw8Ir3qKX4lFWIp+yJAnNWP1hphBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) X-Received: from DM6PR02CA0124.namprd02.prod.outlook.com (2603:10b6:5:1b4::26) by CH2PR12MB4214.namprd12.prod.outlook.com (2603:10b6:610:aa::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.26; Fri, 26 Jan 2024 06:02:30 +0000 X-Received: from DS2PEPF0000343F.namprd02.prod.outlook.com (2603:10b6:5:1b4:cafe::fb) by DM6PR02CA0124.outlook.office365.com (2603:10b6:5:1b4::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.27 via Frontend Transport; Fri, 26 Jan 2024 06:02:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C X-Received: from SATLEXMB04.amd.com (165.204.84.17) by DS2PEPF0000343F.mail.protection.outlook.com (10.167.18.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7228.16 via Frontend Transport; Fri, 26 Jan 2024 06:02:30 +0000 X-Received: from SHA-LX-MINGXZHA.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Fri, 26 Jan 2024 00:02:28 -0600 From: "Zhai, MingXin (Duke) via groups.io" To: CC: Eric Xing , Ken Yao , Igniculus Fu , Abner Chang Subject: [edk2-devel] [PATCH V2 15/32] AMD/VanGoghBoard: Check in SpiFlashDeviceLib Date: Fri, 26 Jan 2024 14:00:33 +0800 Message-ID: <20240126060050.1725-16-duke.zhai@amd.com> In-Reply-To: <20240126060050.1725-1-duke.zhai@amd.com> References: <20240126060050.1725-1-duke.zhai@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF0000343F:EE_|CH2PR12MB4214:EE_ X-MS-Office365-Filtering-Correlation-Id: f7f8fbe2-4b8f-47c8-4407-08dc1e3461a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: +PLT9NU4P6sDAy09usFUSTl/BbHtYC4qA2yrWT8ofiZNDzZSYpgi/Be41Q/l3F1/ZzsCSa9oWvKy1w9Xy2OCtJ7qHrBnWp+fl2VPB1qivdaHMYJuu9F4ZDX10svLdmOP2hgSGWIN065fwzU77cVpolB5SLPc0o5Gyly3v7iQoempfqEKt+IQKvHdqPuvks3tvCOAhJ0G9GtauJ1B2b8c6sBCbt7hTUd0Zv9sRXiY4hgRS2PDf9xffJ/YgKGSQtkAroI08PIKUmn/x+p7xfGoqhLWIJm7XMa25eVERKBvNhzfToRdjJWkmtgrkb45JluOjqGnLpNu+3aX6JgzDruE5NTtBuIweD04f8wCzWSnSjTBBwjpGipFyhVYiixtkGdyJJfTJZW0z02TZ+cjunWNSwFV2MbnpyWD90LI73qwukNoDLS5VVj4MqaVkqdzAqf29jDqHa6oDAv6tHFMwDKVWVkvCmt1+jZJENqfSyn2xgesqO2q20algPlGVGWeDoskAnNAluMw5hdMVvi7hihOeYN9HA+AjRskBUeUcgNMMY4TGIa9g/igjxSAfceIXwdX7pWNuUynwU+gkHIhFC2TZCwcKmDlJDxu85Kvvf8FT3gmMeRm6/YEeQiQgwJ2wV/tHwXA0wFAxby/zJ47sQJWZ69Y1q5iTIjIgwOB+bNJiWYyeg0ozBZNJzdYsibFAa0IL7F5ZO94iKtk2V0m/24Ai6xc1Y+2APF3UHf5bEWwVqvf3orC/OvJh5k5t/hSRgLZsTHHfDTaoIEghOZGjh9wEQ== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2024 06:02:30.4471 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7f8fbe2-4b8f-47c8-4407-08dc1e3461a7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF0000343F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4214 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,duke.zhai@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: n1McfKnGScxsnzcpMTgBjDmnx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=efsbN3NO; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Duke Zhai BZ #:4640 In V2: Improve coding style. 1.Remove the leading underscore and use double underscore at trailing in = C header files. 2.Remove old tianocore licenses and redundant license description. 3.Improve coding style. For example: remove space between @param. In V1: Initial AMD SpiFlashDeviceLib for Chachani board flash IC. Chachani board use the W25Q256JW as flash IC. Signed-off-by: Duke Zhai Cc: Eric Xing Cc: Ken Yao Cc: Igniculus Fu Cc: Abner Chang --- .../SpiFlashDeviceLib/SpiFlashDeviceLib.c | 42 +++++++++++++++++++ .../SpiFlashDeviceLib/SpiFlashDeviceLib.inf | 29 +++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 Platform/AMD/VanGoghBoard/VanGoghCommonPkg/Library/SpiF= lashDeviceLib/SpiFlashDeviceLib.c create mode 100644 Platform/AMD/VanGoghBoard/VanGoghCommonPkg/Library/SpiF= lashDeviceLib/SpiFlashDeviceLib.inf diff --git a/Platform/AMD/VanGoghBoard/VanGoghCommonPkg/Library/SpiFlashDev= iceLib/SpiFlashDeviceLib.c b/Platform/AMD/VanGoghBoard/VanGoghCommonPkg/Lib= rary/SpiFlashDeviceLib/SpiFlashDeviceLib.c new file mode 100644 index 0000000000..49636f6a89 --- /dev/null +++ b/Platform/AMD/VanGoghBoard/VanGoghCommonPkg/Library/SpiFlashDeviceLib/= SpiFlashDeviceLib.c @@ -0,0 +1,42 @@ +/** @file + Implements SpiFlashDeviceLib.c + + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +SPI_INIT_TABLE mSpiInitTable[] =3D { + { // W25Q256JW/W74M25JW + SF_VENDOR_ID_WINBOND, + SF_DEVICE_ID0_W25Q256JW, + SF_DEVICE_ID1_W25Q256JW, + { + SPI_COMMAND_WRITE_ENABLE, + SPI_COMMAND_WRITE_S_EN + }, + { + { EnumSpiOpcodeReadNoAddr,SPI_COMMAND_JEDEC_ID, EnumSpiOper= ationJedecId }, + { EnumSpiOpcodeWriteNoAddr,SPI_COMMAND_WRITE_S, EnumSpiOpe= rationWriteStatus }, + { EnumSpiOpcodeWrite, SPI_COMMAND_WRITE, EnumSpiOpera= tionProgramData_1_Byte }, + { EnumSpiOpcodeRead, SPI_COMMAND_READ, EnumSpiOpera= tionReadData }, + { EnumSpiOpcodeWrite, SPI_COMMAND_ERASE, EnumSpiOpera= tionErase_4K_Byte }, + { EnumSpiOpcodeReadNoAddr,SPI_COMMAND_READ_S, EnumSpiOper= ationReadStatus }, + { EnumSpiOpcodeWriteNoAddr,SPI_COMMAND_CHIP_ERASE, EnumSpiOpe= rationFullChipErase }, + { EnumSpiOpcodeRead, SPI_COMMAND_READ_SFDP, EnumSpiOpera= tionReadData }, + { EnumSpiOpcodeWriteNoAddr,SPI_COMMAND_RPMC_OP1, EnumSpiOpe= rationOther }, + { EnumSpiOpcodeReadNoAddr,SPI_COMMAND_RPMC_OP2, EnumSpiOper= ationReadData }, + { EnumSpiOpcodeReadNoAddr,SPI_COMMAND_Enter_4Byte_Addr, EnumSpiOper= ationOther }, + { EnumSpiOpcodeReadNoAddr,SPI_COMMAND_Exit_4Byte_Addr, EnumSpiOper= ationOther } + }, + 0, + 0x2000000 // BIOS image size in flash + } +}; + +// +// The total number of support flash part +// +UINT8 mNumSpiFlashMax =3D sizeof (mSpiInitTable) / sizeof (mSpiInitTable[= 0]); diff --git a/Platform/AMD/VanGoghBoard/VanGoghCommonPkg/Library/SpiFlashDev= iceLib/SpiFlashDeviceLib.inf b/Platform/AMD/VanGoghBoard/VanGoghCommonPkg/L= ibrary/SpiFlashDeviceLib/SpiFlashDeviceLib.inf new file mode 100644 index 0000000000..951cf6c480 --- /dev/null +++ b/Platform/AMD/VanGoghBoard/VanGoghCommonPkg/Library/SpiFlashDeviceLib/= SpiFlashDeviceLib.inf @@ -0,0 +1,29 @@ +## @file +# SpiFlashDeviceLib +# +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D SpiFlashDeviceLib + FILE_GUID =3D D5A903A8-4D19-4E4C-AAF4-07C5D10D5939 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D SpiFlashDeviceLib + +# +# VALID_ARCHITECTURES =3D IA32 X64 +# + +[Sources] + SpiFlashDeviceLib.c + +[Packages] + MdePkg/MdePkg.dec + VanGoghCommonPkg/AmdCommonPkg.dec + +[LibraryClasses] + SpiFlashDeviceLib -- 2.31.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114507): https://edk2.groups.io/g/devel/message/114507 Mute This Topic: https://groups.io/mt/103971404/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-