lib: sbi_hsm: Assume a consistent resume address
authorSamuel Holland <samuel@sholland.org>
Mon, 13 Jun 2022 01:03:48 +0000 (20:03 -0500)
committerAnup Patel <anup@brainfault.org>
Mon, 13 Jun 2022 06:24:06 +0000 (11:54 +0530)
commit79e42eb2d646097198aed935042e289e53ff9876
tree1a8e0cc332bbd68c7acc98c82737c4fab9b362f5
parentb20ed9febe0b78228055ce69d8e3fbb13f64f1cc
lib: sbi_hsm: Assume a consistent resume address

The suspend code needs to know the resume address for two reasons:
  1) Programming some hardware register or management firmware. Here we
     assume the hardware/firmware maintains its state between suspends,
     so it only needs to be programmed once at startup.
  2) When a non-retentive suspend request ends up being retentive, due
     to lack of hardware support, pending interrupt, or for some other
     reason. However, the behavior here is not platform-dependent, and
     this can be handled in the generic hart suspend function.

Since neither situation requires the platform-level suspend function to
know the resume address, stop passing it to that function. Instead,
handle the non-retentive to retentive situation generically.

Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
include/sbi/sbi_hsm.h
lib/sbi/sbi_hsm.c