From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>,
Eric Dong <eric.dong@intel.com>, Dandan Bi <dandan.bi@intel.com>
Subject: [PATCH 02/13] MdeModulePkg/HiiDatabase: Move common code to LocatePackageList()
Date: Fri, 23 Sep 2016 16:25:10 +0800 [thread overview]
Message-ID: <20160923082521.99872-3-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20160923082521.99872-1-ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
MdeModulePkg/Universal/HiiDatabaseDxe/Image.c | 88 +++++++++++----------------
1 file changed, 34 insertions(+), 54 deletions(-)
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
index 5bdeacc..b72d556 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
@@ -569,6 +569,37 @@ ImageToBlt (
return EFI_SUCCESS;
}
+/**
+ Return the HII package list identified by PackageList HII handle.
+
+ @param Database Pointer to HII database list header.
+ @param PackageList HII handle of the package list to locate.
+
+ @retval The HII package list instance.
+**/
+HII_DATABASE_PACKAGE_LIST_INSTANCE *
+LocatePackageList (
+ IN LIST_ENTRY *Database,
+ IN EFI_HII_HANDLE PackageList
+ )
+{
+ LIST_ENTRY *Link;
+ HII_DATABASE_RECORD *Record;
+
+ //
+ // Get the specified package list and image package.
+ //
+ for (Link = GetFirstNode (Database);
+ !IsNull (Database, Link);
+ Link = GetNextNode (Database, Link)
+ ) {
+ Record = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE);
+ if (Record->Handle == PackageList) {
+ return Record->PackageList;
+ }
+ }
+ return NULL;
+}
/**
This function adds the image Image to the group of images owned by PackageList, and returns
@@ -598,8 +629,6 @@ HiiNewImage (
)
{
HII_DATABASE_PRIVATE_DATA *Private;
- LIST_ENTRY *Link;
- HII_DATABASE_RECORD *DatabaseRecord;
HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageListNode;
HII_IMAGE_PACKAGE_INSTANCE *ImagePackage;
UINT8 *ImageBlock;
@@ -618,24 +647,7 @@ HiiNewImage (
}
Private = HII_IMAGE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // Get the specified package list
- //
-
- PackageListNode = NULL;
-
- for (Link = Private->DatabaseList.ForwardLink;
- Link != &Private->DatabaseList;
- Link = Link->ForwardLink
- ) {
- DatabaseRecord = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE);
- if (DatabaseRecord->Handle == PackageList) {
- PackageListNode = DatabaseRecord->PackageList;
- break;
- }
- }
-
+ PackageListNode = LocatePackageList (&Private->DatabaseList, PackageList);
if (PackageListNode == NULL) {
return EFI_NOT_FOUND;
}
@@ -820,8 +832,6 @@ HiiGetImage (
)
{
HII_DATABASE_PRIVATE_DATA *Private;
- LIST_ENTRY *Link;
- HII_DATABASE_RECORD *DatabaseRecord;
HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageListNode;
HII_IMAGE_PACKAGE_INSTANCE *ImagePackage;
UINT8 *ImageBlock;
@@ -845,21 +855,7 @@ HiiGetImage (
}
Private = HII_IMAGE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // Get the specified package list and image package.
- //
- PackageListNode = NULL;
- for (Link = Private->DatabaseList.ForwardLink;
- Link != &Private->DatabaseList;
- Link = Link->ForwardLink
- ) {
- DatabaseRecord = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE);
- if (DatabaseRecord->Handle == PackageList) {
- PackageListNode = DatabaseRecord->PackageList;
- break;
- }
- }
+ PackageListNode = LocatePackageList (&Private->DatabaseList, PackageList);
if (PackageListNode == NULL) {
return EFI_NOT_FOUND;
}
@@ -1011,8 +1007,6 @@ HiiSetImage (
)
{
HII_DATABASE_PRIVATE_DATA *Private;
- LIST_ENTRY *Link;
- HII_DATABASE_RECORD *DatabaseRecord;
HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageListNode;
HII_IMAGE_PACKAGE_INSTANCE *ImagePackage;
UINT8 *ImageBlock;
@@ -1043,21 +1037,7 @@ HiiSetImage (
}
Private = HII_IMAGE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // Get the specified package list and image package.
- //
- PackageListNode = NULL;
- for (Link = Private->DatabaseList.ForwardLink;
- Link != &Private->DatabaseList;
- Link = Link->ForwardLink
- ) {
- DatabaseRecord = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE);
- if (DatabaseRecord->Handle == PackageList) {
- PackageListNode = DatabaseRecord->PackageList;
- break;
- }
- }
+ PackageListNode = LocatePackageList (&Private->DatabaseList, PackageList);
if (PackageListNode == NULL) {
return EFI_NOT_FOUND;
}
--
2.9.0.windows.1
next prev parent reply other threads:[~2016-09-23 8:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-23 8:25 [PATCH 00/13] Add HiiImageEx implementation and demonstrate in Nt32 Ruiyu Ni
2016-09-23 8:25 ` [PATCH 01/13] MdeModulePkg/HiiDatabase: Refine GetImageIdOrAddress Ruiyu Ni
2016-09-23 8:25 ` Ruiyu Ni [this message]
2016-09-23 8:25 ` [PATCH 03/13] MdeModulePkg/HiiDatabase: Refine HiiNewImage() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 04/13] MdeModulePkg/HiiDatabase: Refine HiiGetImage() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 05/13] MdeModulePkg/HiiDatabase: Refine HiiSetImage() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 06/13] MdeModulePkg/HiiDatabase: Refine HiiDrawImage() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 07/13] MdemodulePkg/HiiDatabase: Correct typo in comments Ruiyu Ni
2016-09-23 8:25 ` [PATCH 08/13] MdeModulePkg/HiiDatabase: Update HiiImage to support PNG/JPEG Ruiyu Ni
2016-09-23 8:25 ` [PATCH 09/13] MdeModulePkg/HiiDatabase: Add HiiImageEx implementation Ruiyu Ni
2016-09-23 8:25 ` [PATCH 10/13] Nt32Pkg/PlatformBds: Do not call BootLogoEnableLogo Ruiyu Ni
2016-09-23 8:25 ` [PATCH 11/13] MdeModulePkg/BootLogoLib&PlatformLogo: Use HII data types in parameters Ruiyu Ni
2016-09-23 8:25 ` [PATCH 12/13] MdeModulePkg/Logo: Add LogoDxe module Ruiyu Ni
2016-09-23 8:25 ` [PATCH 13/13] Nt32Pkg: Use the new LogoDxe driver Ruiyu Ni
2016-09-26 2:55 ` [PATCH 00/13] Add HiiImageEx implementation and demonstrate in Nt32 Gao, Liming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160923082521.99872-3-ruiyu.ni@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox