+ \r
+ /**\r
+ *This function first order the library instances, then collect\r
+ *library instance 's PPI, Protocol, GUID,\r
+ *SetVirtalAddressMapCallBack, ExitBootServiceCallBack, and\r
+ *Destructor, Constructor.\r
+ *\r
+ **/\r
+ private void collectLibInstanceInfo(){\r
+ int index;\r
+\r
+ String moduleType = SurfaceAreaQuery.getModuleType();\r
+ String libConstructName = null;\r
+ String libDestructName = null;\r
+ String[] setVirtuals = null;\r
+ String[] exitBoots = null;\r
+\r
+ ModuleIdentification[] libraryIdList = SurfaceAreaQuery\r
+ .getLibraryInstance(this.arch);\r
+ try {\r
+ if (libraryIdList != null) {\r
+ //\r
+ // Reorder library instance sequence.\r
+ //\r
+ AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList,\r
+ this.arch);\r
+ List<ModuleIdentification> orderList = libOrder\r
+ .orderLibInstance();\r
+\r
+ if (orderList != null) {\r
+ //\r
+ // Process library instance one by one.\r
+ //\r
+ for (int i = 0; i < orderList.size(); i++) {\r
+\r
+ //\r
+ // Get library instance basename.\r
+ //\r
+ ModuleIdentification libInstanceId = orderList.get(i);\r
+\r
+ //\r
+ // Get override map\r
+ //\r
+\r
+ Map<String, XmlObject> libDoc = GlobalData.getDoc(\r
+ libInstanceId, this.arch);\r
+ SurfaceAreaQuery.push(libDoc);\r
+ //\r
+ // Get <PPis>, <Protocols>, <Guids> list of this library\r
+ // instance.\r
+ //\r
+ String[] ppiList = SurfaceAreaQuery.getPpiArray(this.arch);\r
+ String[] ppiNotifyList = SurfaceAreaQuery\r
+ .getPpiNotifyArray(this.arch);\r
+ String[] protocolList = SurfaceAreaQuery\r
+ .getProtocolArray(this.arch);\r
+ String[] protocolNotifyList = SurfaceAreaQuery\r
+ .getProtocolNotifyArray(this.arch);\r
+ String[] guidList = SurfaceAreaQuery\r
+ .getGuidEntryArray(this.arch);\r
+ PackageIdentification[] pkgList = SurfaceAreaQuery.getDependencePkg(this.arch);\r
+\r
+ //\r
+ // Add those ppi, protocol, guid in global ppi,\r
+ // protocol, guid\r
+ // list.\r
+ //\r
+ for (index = 0; index < ppiList.length; index++) {\r
+ this.mPpiList.add(ppiList[index]);\r
+ }\r
+\r
+ for (index = 0; index < ppiNotifyList.length; index++) {\r
+ this.mPpiList.add(ppiNotifyList[index]);\r
+ }\r
+\r
+ for (index = 0; index < protocolList.length; index++) {\r
+ this.mProtocolList.add(protocolList[index]);\r
+ }\r
+\r
+ for (index = 0; index < protocolNotifyList.length; index++) {\r
+ this.mProtocolList.add(protocolNotifyList[index]);\r
+ }\r
+\r
+ for (index = 0; index < guidList.length; index++) {\r
+ this.mGuidList.add(guidList[index]);\r
+ }\r
+ for (index = 0; index < pkgList.length; index++){\r
+ if (!this.mDepPkgList.contains(pkgList[index])){\r
+ this.mDepPkgList.add(pkgList[index]);\r
+ }\r
+ }\r
+\r
+ //\r
+ // If not yet parse this library instance's constructor\r
+ // element,parse it.\r
+ //\r
+ libConstructName = SurfaceAreaQuery\r
+ .getLibConstructorName();\r
+ libDestructName = SurfaceAreaQuery\r
+ .getLibDestructorName();\r
+\r
+ //\r
+ // Collect SetVirtualAddressMapCallBack and \r
+ // ExitBootServiceCallBack.\r
+ // \r
+ setVirtuals = SurfaceAreaQuery.getSetVirtualAddressMapCallBackArray();\r
+ exitBoots = SurfaceAreaQuery.getExitBootServicesCallBackArray();\r
+ if (setVirtuals != null) {\r
+ for (int j = 0; j < setVirtuals.length; j++) {\r
+ this.setVirtalAddList.add(setVirtuals[j]);\r
+ }\r
+ }\r
+ if (exitBoots != null) {\r
+ for (int k = 0; k < exitBoots.length; k++) {\r
+ this.exitBootServiceList.add(exitBoots[k]);\r
+ }\r
+ }\r
+ SurfaceAreaQuery.pop();\r
+ //\r
+ // Add dependent library instance constructor function.\r
+ //\r
+ if (libConstructName != null) {\r
+ this.libConstructList.add(libConstructName);\r
+ }\r
+ //\r
+ // Add dependent library instance destructor fuction.\r
+ //\r
+ if (libDestructName != null) {\r
+ this.libDestructList.add(libDestructName);\r
+ }\r
+ }\r
+ }\r
+\r
+ }\r