diff options
author | Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> | 2015-06-05 23:39:13 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-07-09 16:19:11 +1000 |
commit | 0834687cc5fd4da2c1acdd54596bfdb23640e13b (patch) | |
tree | 3a2eaf3ee21a17b5c8f6a959d1bfef43e10aefdd /hw/chiptod.c | |
parent | df9197e3c165b9a906785fdf38476bda7278a831 (diff) | |
download | skiboot-0834687cc5fd4da2c1acdd54596bfdb23640e13b.zip skiboot-0834687cc5fd4da2c1acdd54596bfdb23640e13b.tar.gz skiboot-0834687cc5fd4da2c1acdd54596bfdb23640e13b.tar.bz2 |
opal: Check if backup master is valid before topology switch.
Check if backup chip TOD is valid and enabled before we trigger
topology switch.
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/chiptod.c')
-rw-r--r-- | hw/chiptod.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/hw/chiptod.c b/hw/chiptod.c index bb51a6d..aa4f69c 100644 --- a/hw/chiptod.c +++ b/hw/chiptod.c @@ -1028,6 +1028,24 @@ static bool is_topology_switch_required(void) return false; } +static bool chiptod_backup_valid(void) +{ + enum chiptod_topology backup_topo; + + if (current_topology < 0) + return false; + + if (current_topology == chiptod_topo_primary) + backup_topo = chiptod_topo_secondary; + else + backup_topo = chiptod_topo_primary; + + if (chiptod_topology_info[backup_topo].status == chiptod_backup_master) + return chiptod_sync_step_check_running(backup_topo); + + return false; +} + /* * Sync up TOD with other chips and get TOD in running state. * Check if current topology is active and running. If not, then @@ -1053,9 +1071,15 @@ static int chiptod_start_tod(void) * master. But make sure we move local chiptod to Not Set * before requesting TOD value. * - * Before triggering a topology switch stop all slave TODs - * in backup topology. + * Before triggering a topology switch, check if backup + * is valid and stop all slave TODs in backup topology. */ + if (!chiptod_backup_valid()) { + prerror("CHIPTOD: Backup master is not enabled.\n"); + prerror("CHIPTOD: Can not do a topology switch.\n"); + return 0; + } + chiptod_stop_slave_tods(); if (xscom_write(mchip, TOD_TTYPE_1, (1UL << 63)) != 0) { |