aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVaibhav Jain <vaibhav@linux.ibm.com>2019-01-13 11:07:10 +0530
committerStewart Smith <stewart@linux.ibm.com>2019-01-16 00:46:49 -0600
commit763f397d5be7580e3ecf525ca5939f3ab9f6ff5d (patch)
tree33afb23fc038cde0d3ec877ec1c00b0d18a2b7a1 /include
parent9d2d0115eaca5d92e8032f3c051a200e59e80971 (diff)
downloadskiboot-763f397d5be7580e3ecf525ca5939f3ab9f6ff5d.zip
skiboot-763f397d5be7580e3ecf525ca5939f3ab9f6ff5d.tar.gz
skiboot-763f397d5be7580e3ecf525ca5939f3ab9f6ff5d.tar.bz2
capp/phb: Introduce 'struct capp' to hold capp related info in 'struct phb'
Previously struct proc_chip member 'capp_phb3_attached_mask' was used for Power-8 to keep track of PHB attached to the single CAPP on the chip. CAPP on that chip supported a flexible PHB assignment scheme. However since then new chips only support a static assignment i.e a CAPP can only be attached to a specific PEC. Hence instead of using 'proc_chip.capp_phb4_attached_mask' to manage CAPP <-> PEC assignments which needs a global lock (capi_lock) to be updated, we introduce a new struct named 'capp' a pointer to which resides inside struct 'phb4'. Since updates to struct 'phb4' already happen in context of phb_lock; this eliminates the need to use mutex 'capi_lock' while updating 'capp_phb4_attached_mask'. This struct is also used to hold CAPP specific variables such as pointer to the 'struct phb' to which the CAPP is attached, 'capp_xscom_offset' which is the xscom offset to be added to CAPP registers in case there are more than 1 on the chip, 'capp_index' which is the index of the CAPP on the chip, and attached_pe' which is the process endpoint index to which CAPP is attached. Finally member 'chip_id' holds the chip-id thats used for performing xscom read/writes. Also new helpers named capp_xscom_read()/write() are introduced to make access to CAPP xscom registers easier. Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com> Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/capp.h12
-rw-r--r--include/chip.h1
-rw-r--r--include/phb4.h3
3 files changed, 15 insertions, 1 deletions
diff --git a/include/capp.h b/include/capp.h
index 6ec3f7f..cc70e44 100644
--- a/include/capp.h
+++ b/include/capp.h
@@ -79,6 +79,14 @@ struct capp_ops {
int64_t (*get_capp_info)(int, struct phb *, struct capp_info *);
};
+struct capp {
+ struct phb *phb;
+ unsigned int capp_index;
+ uint64_t capp_xscom_offset;
+ uint64_t attached_pe;
+ uint64_t chip_id;
+};
+
struct proc_chip;
extern struct lock capi_lock;
extern struct capp_ops capi_ops;
@@ -96,4 +104,8 @@ extern int64_t capp_load_ucode(unsigned int chip_id, uint32_t opal_id,
extern int64_t capp_get_info(int chip_id, struct phb *phb,
struct capp_info *info);
+
+/* Helpers to read/write capp registers */
+extern int64_t capp_xscom_read(struct capp *capp, int64_t off, uint64_t *val);
+extern int64_t capp_xscom_write(struct capp *capp, int64_t off, uint64_t val);
#endif /* __CAPP_H */
diff --git a/include/chip.h b/include/chip.h
index 2fb8126..c759d0a 100644
--- a/include/chip.h
+++ b/include/chip.h
@@ -197,7 +197,6 @@ struct proc_chip {
/* Must hold capi_lock to change */
uint8_t capp_phb3_attached_mask;
- uint8_t capp_phb4_attached_mask;
uint8_t capp_ucode_loaded;
/* Used by hw/centaur.c */
diff --git a/include/phb4.h b/include/phb4.h
index 43819d5..60c1735 100644
--- a/include/phb4.h
+++ b/include/phb4.h
@@ -232,6 +232,9 @@ struct phb4 {
/* Current NPU2 relaxed ordering state */
bool ro_state;
+ /* Any capp instance attached to the PHB4 */
+ struct capp *capp;
+
struct phb phb;
};