diff options
author | Ashley Lai <adlai@linux.vnet.ibm.com> | 2012-08-14 19:34:57 -0400 |
---|---|---|
committer | Kent Yoder <key@linux.vnet.ibm.com> | 2012-08-22 17:22:24 -0400 |
commit | 4a727429abec31c4f5d9607cebb4fb1cc21e1167 (patch) | |
tree | 048a14c5ac1d5ef04bdfcd1429177c052dc792ed /arch | |
parent | 132f7629474424418a5cdd666796ad3cfa4dc0c5 (diff) |
PPC64: Add support for instantiating SML from Open Firmware
This patch instantiate Stored Measurement Log (SML) and put the
log address and size in the device tree.
Signed-off-by: Ashley Lai <adlai@us.ibm.com>
Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/prom_init.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 0794a3017b1b..e144498bcddd 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -1624,6 +1624,63 @@ static void __init prom_instantiate_rtas(void) | |||
1624 | 1624 | ||
1625 | #ifdef CONFIG_PPC64 | 1625 | #ifdef CONFIG_PPC64 |
1626 | /* | 1626 | /* |
1627 | * Allocate room for and instantiate Stored Measurement Log (SML) | ||
1628 | */ | ||
1629 | static void __init prom_instantiate_sml(void) | ||
1630 | { | ||
1631 | phandle ibmvtpm_node; | ||
1632 | ihandle ibmvtpm_inst; | ||
1633 | u32 entry = 0, size = 0; | ||
1634 | u64 base; | ||
1635 | |||
1636 | prom_debug("prom_instantiate_sml: start...\n"); | ||
1637 | |||
1638 | ibmvtpm_node = call_prom("finddevice", 1, 1, ADDR("/ibm,vtpm")); | ||
1639 | prom_debug("ibmvtpm_node: %x\n", ibmvtpm_node); | ||
1640 | if (!PHANDLE_VALID(ibmvtpm_node)) | ||
1641 | return; | ||
1642 | |||
1643 | ibmvtpm_inst = call_prom("open", 1, 1, ADDR("/ibm,vtpm")); | ||
1644 | if (!IHANDLE_VALID(ibmvtpm_inst)) { | ||
1645 | prom_printf("opening vtpm package failed (%x)\n", ibmvtpm_inst); | ||
1646 | return; | ||
1647 | } | ||
1648 | |||
1649 | if (call_prom_ret("call-method", 2, 2, &size, | ||
1650 | ADDR("sml-get-handover-size"), | ||
1651 | ibmvtpm_inst) != 0 || size == 0) { | ||
1652 | prom_printf("SML get handover size failed\n"); | ||
1653 | return; | ||
1654 | } | ||
1655 | |||
1656 | base = alloc_down(size, PAGE_SIZE, 0); | ||
1657 | if (base == 0) | ||
1658 | prom_panic("Could not allocate memory for sml\n"); | ||
1659 | |||
1660 | prom_printf("instantiating sml at 0x%x...", base); | ||
1661 | |||
1662 | if (call_prom_ret("call-method", 4, 2, &entry, | ||
1663 | ADDR("sml-handover"), | ||
1664 | ibmvtpm_inst, size, base) != 0 || entry == 0) { | ||
1665 | prom_printf("SML handover failed\n"); | ||
1666 | return; | ||
1667 | } | ||
1668 | prom_printf(" done\n"); | ||
1669 | |||
1670 | reserve_mem(base, size); | ||
1671 | |||
1672 | prom_setprop(ibmvtpm_node, "/ibm,vtpm", "linux,sml-base", | ||
1673 | &base, sizeof(base)); | ||
1674 | prom_setprop(ibmvtpm_node, "/ibm,vtpm", "linux,sml-size", | ||
1675 | &size, sizeof(size)); | ||
1676 | |||
1677 | prom_debug("sml base = 0x%x\n", base); | ||
1678 | prom_debug("sml size = 0x%x\n", (long)size); | ||
1679 | |||
1680 | prom_debug("prom_instantiate_sml: end...\n"); | ||
1681 | } | ||
1682 | |||
1683 | /* | ||
1627 | * Allocate room for and initialize TCE tables | 1684 | * Allocate room for and initialize TCE tables |
1628 | */ | 1685 | */ |
1629 | static void __init prom_initialize_tce_table(void) | 1686 | static void __init prom_initialize_tce_table(void) |
@@ -2916,6 +2973,11 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
2916 | prom_instantiate_opal(); | 2973 | prom_instantiate_opal(); |
2917 | #endif | 2974 | #endif |
2918 | 2975 | ||
2976 | #ifdef CONFIG_PPC64 | ||
2977 | /* instantiate sml */ | ||
2978 | prom_instantiate_sml(); | ||
2979 | #endif | ||
2980 | |||
2919 | /* | 2981 | /* |
2920 | * On non-powermacs, put all CPUs in spin-loops. | 2982 | * On non-powermacs, put all CPUs in spin-loops. |
2921 | * | 2983 | * |