
Hi Bin,
On 10 March 2016 at 22:27, Bin Meng bmeng.cn@gmail.com wrote:
Hi Simon,
On Mon, Mar 7, 2016 at 10:28 AM, Simon Glass sjg@chromium.org wrote:
Some of the Intel ME code is common to several Intel CPUs. Move it into a common location. Add a header file for report_platform.c also.
Signed-off-by: Simon Glass sjg@chromium.org
arch/x86/cpu/intel_common/Makefile | 2 + .../cpu/{ivybridge => intel_common}/me_status.c | 20 +- .../{ivybridge => intel_common}/report_platform.c | 2 +- arch/x86/cpu/ivybridge/Makefile | 2 - arch/x86/cpu/ivybridge/early_me.c | 31 +- arch/x86/cpu/ivybridge/sdram.c | 3 +- arch/x86/include/asm/arch-ivybridge/me.h | 333 +----------------- arch/x86/include/asm/arch-ivybridge/sandybridge.h | 2 - arch/x86/include/asm/me_common.h | 372 +++++++++++++++++++++ arch/x86/include/asm/report_platform.h | 19 ++ 10 files changed, 417 insertions(+), 369 deletions(-) rename arch/x86/cpu/{ivybridge => intel_common}/me_status.c (93%) rename arch/x86/cpu/{ivybridge => intel_common}/report_platform.c (98%) create mode 100644 arch/x86/include/asm/me_common.h create mode 100644 arch/x86/include/asm/report_platform.h
diff --git a/arch/x86/cpu/intel_common/Makefile b/arch/x86/cpu/intel_common/Makefile index e9a2b29..50023fe 100644 --- a/arch/x86/cpu/intel_common/Makefile +++ b/arch/x86/cpu/intel_common/Makefile @@ -7,6 +7,8 @@ obj-$(CONFIG_HAVE_MRC) += car.o obj-y += cpu_common.o obj-y += lpc_common.o +obj-$(CONFIG_HAVE_MRC) += me_status.o ifndef CONFIG_TARGET_EFI obj-y += microcode_intel.o endif +obj-$(CONFIG_HAVE_MRC) += report_platform.o diff --git a/arch/x86/cpu/ivybridge/me_status.c b/arch/x86/cpu/intel_common/me_status.c similarity index 93% rename from arch/x86/cpu/ivybridge/me_status.c rename to arch/x86/cpu/intel_common/me_status.c index 15cf69f..130d219 100644 --- a/arch/x86/cpu/ivybridge/me_status.c +++ b/arch/x86/cpu/intel_common/me_status.c @@ -128,7 +128,14 @@ static const char *const me_progress_policy_values[] = { [0x10] = "Required VSCC values for flash parts do not match", };
-void intel_me_status(struct me_hfs *hfs, struct me_gmes *gmes)
+/**
- _intel_me_status() - Check Intel Management Engine status
- struct hfs: Firmware status
- struct gmes: Management engine status
- */
+static void _intel_me_status(struct me_hfs *hfs, struct me_gmes *gmes) { /* Check Current States */ debug("ME: FW Partition Table : %s\n", @@ -193,3 +200,14 @@ void intel_me_status(struct me_hfs *hfs, struct me_gmes *gmes) } debug("\n"); }
+void intel_me_status(struct udevice *me_dev) +{
struct me_hfs hfs;
struct me_gmes gmes;
pci_read_dword_ptr(me_dev, &hfs, PCI_ME_HFS);
pci_read_dword_ptr(me_dev, &gmes, PCI_ME_GMES);
The call to pci_read_dword_ptr() looks odd. Why not use the dm_pci_xx APIs directly?
It's because these are structus - in fact we are writing to a bitfield here. It could perhaps use a union.
Regards, Simon