Skip to content

Commit

Permalink
Add SBE driver support
Browse files Browse the repository at this point in the history
SBE (Self Boot Engine) on P9 has two different jobs:
  - Boot the chip up to the point the core is functional
  - Provide various services like timer, scom, stash MPIPL, etc., at runtime

OPAL can communicate to SBE via a set of data and control registers provided
by the PSU block in P9 chip.
 - Four 8 byte registers for Host to send command packets to SBE
 - Four 8 byte registers for SBE to send response packets to Host
 - Two doorbell registers (1 on each side) to alert either party
   when data is placed in above mentioned data register

Protocol constraints:
  Only one command is accepted in the command buffer until the response for the
  command is enqueued in the response buffer by SBE.

Usage:
  We will use SBE for various purposes like timer, MPIPL, etc.

This patch implements the SBE MBOX spec for OPAL to communicate with
SBE.

Design consideration:
  - Each chip has SBE. We need to track SBE messages per chip. Hence added
    per chip sbe structure and list of messages to that chip
  - SBE accepts only one command at a time. Hence serialized MBOX commands.
  - OPAL gets interrupted once SBE sets doorbell register
  - OPAL has to clear doorbell register after reading response
  - Every command class has timeout option. Timed out messages are discarded
  - SBE MBOX commands can be classified into four types :
    - Those that must be sent to the master only (ex: sending MDST/MDDT info)
    - Those that must be sent to slaves only (ex: continue MPIPL)
    - Those that must be sent to all chips (ex: close insecure window)
    - Those that can be sent to any chip (ex: timer)

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
Vasant Hegde authored and stewartsmith committed May 1, 2018
1 parent d654f6c commit 6739c89
Show file tree
Hide file tree
Showing 5 changed files with 893 additions and 22 deletions.
7 changes: 7 additions & 0 deletions core/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <phys-map.h>
#include <imc.h>
#include <dts.h>
#include <sbe-p9.h>

enum proc_gen proc_gen;
unsigned int pcie_max_link_speed;
Expand Down Expand Up @@ -1029,6 +1030,12 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt)
*/
chiptod_init();

/*
* SBE uses TB value for scheduling timer. Hence init after
* chiptod init
*/
p9_sbe_init();

/* Initialize i2c */
p8_i2c_init();

Expand Down
2 changes: 1 addition & 1 deletion hw/psi.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ static void psihb_p9_interrupt(struct irq_source *is, uint32_t isn)
printf("PSI: DIO irq received\n");
break;
case P9_PSI_IRQ_PSU:
sbe_interrupt(psi->chip_id);
p9_sbe_interrupt(psi->chip_id);
break;
}
}
Expand Down

0 comments on commit 6739c89

Please sign in to comment.