From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c05::244; helo=mail-pg0-x244.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7BEDE21F0DB18 for ; Thu, 29 Mar 2018 01:13:43 -0700 (PDT) Received: by mail-pg0-x244.google.com with SMTP id y63so2590848pgy.12 for ; Thu, 29 Mar 2018 01:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=AsA7a75/5ef5tHRQn6rBxMA0KnJquNy8MlqmPXgC21Y=; b=DBJYjnfp11WRSEdkD+sgghiDlC+2g77WqaHJgESYSbxzVVZUewAs0SZsHFiV+2+6Yu sA8PHUdJSl7L8PZmImusqtnPKRTwXxNAjWRNZzhROs0hTefJqjA80P5IR6YSqpuLdNEl 2iHxPEoXPInaDXfCsR8mggvPQ9B+tEpsClr/s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=AsA7a75/5ef5tHRQn6rBxMA0KnJquNy8MlqmPXgC21Y=; b=akTtNEWvPTYDxYfc6YjvH9rDFsSAtuHpSkXkAL8SzBP5MqTcctr+vE3nqLidecl0RI I17HFICoOXM0zITOEDuT/9dZcq/wMQjzzwf6UvS+XTEz+3LlQ26dRwq30GdqlX/vbSU2 EzUD0OdFzWu8dohNalbhtq8EG1gb/kfUNAbXg0CiaMRszDWD2tCRcLV4JO4WmkYGcIlk 69Wo/oWzPPilpkucV9ftRIrvnxRu4W+38WopINYBrFAOnwzXJOstk4lGjZG2968sRFfX 06C/CS2Gmlwpt450nLyeW4MAT1Wjw/aFbnj8nsPWOlLLSdtWsGTw25X2b0nKTn6F7+na 0GeQ== X-Gm-Message-State: AElRT7GAZpA8Sm4gRSEzNkjQLf7XDCPGB3ig7Hr7qUiCezWko77e+yrT dapDzNE7IRfgOJR3O/AGtyvNxbwZQ7k= X-Google-Smtp-Source: AIpwx48qQ97x104R5pGG7Niv6rLOz61lDinvtra46J0ZzhRzRS33v6dz995TBNeEnMZ3pwwTtItyLw== X-Received: by 2002:a17:902:8609:: with SMTP id f9-v6mr2454606plo.8.1522311622376; Thu, 29 Mar 2018 01:20:22 -0700 (PDT) Received: from localhost.localdomain ([104.237.91.79]) by smtp.gmail.com with ESMTPSA id s7sm10235471pgq.48.2018.03.29.01.20.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Mar 2018 01:20:21 -0700 (PDT) From: Heyi Guo To: edk2-devel@lists.01.org Cc: Heyi Guo , Yi Li , Renhao Liang , Star Zeng , Eric Dong , Michael D Kinney , Liming Gao , Jian J Wang , Ruiyu Ni Date: Thu, 29 Mar 2018 16:19:50 +0800 Message-Id: <1522311590-104218-1-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [PATCH 1/1] MdeModulePkg/Gcd: Fix bug of attribute conversion X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Mar 2018 08:13:43 -0000 For gDS->SetMemorySpaceAttributes(), when user passes a combined memory attribute including CPU arch attribute and other attributes, like EFI_MEMORY_RUNTIME, ConverToCpuArchAttributes() will return INVALID_CPU_ARCH_ATTRIBUTES and skip setting page/cache attribute for the specified memory space. We don't see any reason to forbid combining CPU arch attributes and non-CPU-arch attributes when calling gDS->SetMemorySpaceAttributes(), so we remove the check code in ConverToCpuArchAttributes(); the remaining code is enough to grab the interested bits for Cpu->SetMemoryAttributes(). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Heyi Guo Signed-off-by: Yi Li Signed-off-by: Renhao Liang Cc: Star Zeng Cc: Eric Dong Cc: Michael D Kinney Cc: Liming Gao Cc: Jian J Wang Cc: Ruiyu Ni --- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index 77f4adb4bc01..907245a3f512 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -673,11 +673,6 @@ ConverToCpuArchAttributes ( { UINT64 CpuArchAttributes; - if ((Attributes & ~(EXCLUSIVE_MEMORY_ATTRIBUTES | - NONEXCLUSIVE_MEMORY_ATTRIBUTES)) != 0) { - return INVALID_CPU_ARCH_ATTRIBUTES; - } - CpuArchAttributes = Attributes & NONEXCLUSIVE_MEMORY_ATTRIBUTES; if ( (Attributes & EFI_MEMORY_UC) == EFI_MEMORY_UC) { -- 2.7.4