Skip to content

Commit

Permalink
OCC startup (istep 21.1) (#100)
Browse files Browse the repository at this point in the history
* Add OCC operations

Signed-off-by: Igor Bagnucki <igor.bagnucki@3mdeb.com>

* Beginning of istep 21.1

Change-Id: Ia342e6befc92c52dcced360dbc5c658ddf31d6b8
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Continue with start_pm_complex()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Finish with setup_memory_boot()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Implement special_wakeup_all(enable=false)

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* pm_corequad_init()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Implement pstate_gpe_init()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Implement pm_pba_init()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Initialize MCS bits in configuration vector

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Implement wait_for_occ_checkpoint()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Implement poll_occ()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* The bulk of sending commands to OCC

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Finish implementing communication with OCC

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Implement switching OCC to active state

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Initialize user power limit (no limit)

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Start implementing send_occ_config_data()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Add PCAP config data

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Do not auto-start Pstate GPE protocol

Hostboot doesn't seem to do it and it times out anyway.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Fix SCOM addrs in pba_slave_setup_runtime_phase()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Fix bugs on constructing bootcode for OCC

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Simplify pba_slave_setup_runtime_phase()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Fix stack usage errors

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Fix PPC_PLACE() macros in pb_pba_init()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Simplify pm_pba_bar_config()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Add pm_pss_init()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* pstate_gpe_init() fixes

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Fix wait_for_occ_checkpoint()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Comments and formatting

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Bug fixes

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Pass APSS, MEMCFG and SYSCFG data to OCC

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* The rest of configuration data

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Process OCC errors

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* More error reporting

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Improve get_gpu_msg_data()

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* istep 16.2

Change-Id: I082ed14d5c6f7fa26a6edefd6d73f725b0b36cd9
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Set error masks like Hostboot does

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Better logging

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Restart SGPE before starting OCC

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Don't add istep 16.2 here

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Remove SGPE reset code

It didn't work and this can be done differently.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Start OCC in istep 15.4

This makes resetting it later unnecessary.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Some code improvements

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Remove debug output

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Add informational messages

It takes some time to start OCC.

Change-Id: I1609349c673b4f0295e4e743add61f66a66aa6b1
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Formatting corrections for occ.h/occ.c

Change-Id: I56651886bc752ce9f17707ff0393abfdb65cb51d
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* A couple of corrections

Change-Id: I4ab8a73cb73ccd486f08713920e8c389adff22b7
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Remove makeStart405Instruction() and related

Change-Id: I632fbad29216554ba44055ce803d912a4246da4c
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Extract ops.h

Change-Id: Ia3d53035ac34e64cd5c224e1423526990f62df06
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Move some OCC-specific code from homer.c to occ.c

Change-Id: Iebbba0ecaa235c37c70d182ec03022d852402971
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Update OP codes

Change-Id: Idfe51a377fd01d945ba888f4cc613742f067a955
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Fixes for sending wakeups

Change-Id: I5a011866c2453801a5e998fe87550b3e288f970d
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Don't set HOMER BAR second time

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Remove extra delay in check_ocb_mode()

Change-Id: I53c1c46492d57032d02bf3fc514933e4f4f50597
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Move ppc_* functions from occ.c to ops.h

Change-Id: Ic6ebdd8e6fa2f8347f60d6a2435ce7c4ef1eb19d
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Simplify special_occ_wakeup_disable()

Change-Id: I93427b99d18f3ca8b35c5cc9d0414a8d868f7f6d
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Comments and corrections for pm_pss_init()

Change-Id: I75a7bbf1474ffe556356f04e28d23bd47d14004f
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Remove duplicated pba slave setup

Change-Id: I8a634e023dd8cecfa771c68ebe5134c1d4acf04e
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Fix deadcode in write_occ_cmd()

Change-Id: Ia13098cedf6e68889a4152dfb616710aebb488d1
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Various review corrections

Change-Id: Ia70f487001b965648ec779353149f2c62f996670
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Compute SCOM values using PPC_* macros

Change-Id: I306de2b11cd98cc99c3262dc74dabcf8c22565d7
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Use correct PB freq in one more place

Change-Id: I212fec18384c81488b5f3de1631dda1df08248d0
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Initialize PBA slaves earlier (on PBA reset)

Change-Id: Ia0e991efe26b8abf6f020cb10eb82f951674e25b
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Add pm_occ_fir_init()

Change-Id: I483b9ce660a7d840a52437f1de0428df2ea84706
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Add pm_pba_fir_init()

Also fix a bug in pm_occ_fir_init() and move the two functions to a
separate file.

Change-Id: Idbbbe002ed673beaad18ccd144f193a290baf969
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Make SCOM writes match Hostboot

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

* Merge fir.c into occ.c

Change-Id: I3e60bd4b2299691cb18df98c218514671eb3a440
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>

Co-authored-by: Igor Bagnucki <igor.bagnucki@3mdeb.com>
  • Loading branch information
SergiiDmytruk and Igor Bagnucki committed Oct 20, 2021
1 parent f03fd4d commit 112d666
Show file tree
Hide file tree
Showing 7 changed files with 2,014 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/include/cpu/power/mvpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* Single bucket within #V keyword of version 3 */
struct voltage_data
{
uint16_t freq;
uint16_t freq; // MHz
uint16_t vdd_voltage;
uint16_t idd_current;
uint16_t vcs_voltage;
Expand Down
18 changes: 18 additions & 0 deletions src/include/cpu/power/occ.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* SPDX-License-Identifier: GPL-2.0-only */

#ifndef CPU_PPC64_OCC_H
#define CPU_PPC64_OCC_H

#include <stdint.h>

void writeOCCSRAM(uint32_t address, uint64_t *buffer, size_t data_length);
void readOCCSRAM(uint32_t address, uint64_t *buffer, size_t data_length);
void write_occ_command(uint64_t write_data);
void clear_occ_special_wakeups(uint64_t cores);
void special_occ_wakeup_disable(uint64_t cores);
void occ_start_from_mem(void);

void pm_occ_fir_init(void);
void pm_pba_fir_init(void);

#endif /* CPU_PPC64_OCC_H */
1 change: 1 addition & 0 deletions src/soc/ibm/power9/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ ramstage-y += pstates.c
ramstage-y += xive.c
ramstage-y += int_vectors.S
ramstage-y += i2c.c
ramstage-y += occ.c

endif
Loading

0 comments on commit 112d666

Please sign in to comment.