Enable the snoop control unit during MP startup, rather than relying on

the bootloader to have done so.

Submitted by:	Thomas Skibo <thomasskibo@sbcglobal.net>
This commit is contained in:
Ian Lepore
2015-01-16 19:49:10 +00:00
parent dcd7b3b269
commit 97665af981
+20 -3
View File
@@ -39,6 +39,9 @@ __FBSDID("$FreeBSD$");
#define ZYNQ7_CPU1_ENTRY 0xfffffff0 #define ZYNQ7_CPU1_ENTRY 0xfffffff0
#define SCU_CONTROL_REG 0xf8f00000
#define SCU_CONTROL_ENABLE (1 << 0)
void void
platform_mp_init_secondary(void) platform_mp_init_secondary(void)
{ {
@@ -64,7 +67,21 @@ platform_mp_probe(void)
void void
platform_mp_start_ap(void) platform_mp_start_ap(void)
{ {
bus_space_handle_t scu_handle;
bus_space_handle_t ocm_handle; bus_space_handle_t ocm_handle;
uint32_t scu_ctrl;
/* Map in SCU control register. */
if (bus_space_map(fdtbus_bs_tag, SCU_CONTROL_REG, 4,
0, &scu_handle) != 0)
panic("platform_mp_start_ap: Couldn't map SCU config reg\n");
/* Set SCU enable bit. */
scu_ctrl = bus_space_read_4(fdtbus_bs_tag, scu_handle, 0);
scu_ctrl |= SCU_CONTROL_ENABLE;
bus_space_write_4(fdtbus_bs_tag, scu_handle, 0, scu_ctrl);
bus_space_unmap(fdtbus_bs_tag, scu_handle, 4);
/* Map in magic location to give entry address to CPU1. */ /* Map in magic location to give entry address to CPU1. */
if (bus_space_map(fdtbus_bs_tag, ZYNQ7_CPU1_ENTRY, 4, if (bus_space_map(fdtbus_bs_tag, ZYNQ7_CPU1_ENTRY, 4,
@@ -75,8 +92,10 @@ platform_mp_start_ap(void)
bus_space_write_4(fdtbus_bs_tag, ocm_handle, 0, bus_space_write_4(fdtbus_bs_tag, ocm_handle, 0,
pmap_kextract((vm_offset_t)mpentry)); pmap_kextract((vm_offset_t)mpentry));
bus_space_unmap(fdtbus_bs_tag, ocm_handle, 4);
/* /*
* The SCU is enabled by the BOOTROM but I think the second CPU doesn't * The SCU is enabled above but I think the second CPU doesn't
* turn on filtering until after the wake-up below. I think that's why * turn on filtering until after the wake-up below. I think that's why
* things don't work if I don't put these cache ops here. Also, the * things don't work if I don't put these cache ops here. Also, the
* magic location, 0xfffffff0, isn't in the SCU's filtering range so it * magic location, 0xfffffff0, isn't in the SCU's filtering range so it
@@ -87,8 +106,6 @@ platform_mp_start_ap(void)
/* Wake up CPU1. */ /* Wake up CPU1. */
armv7_sev(); armv7_sev();
bus_space_unmap(fdtbus_bs_tag, ocm_handle, 4);
} }
void void