Merge tag 'uniphier-v2020.07' of https://gitlab.denx.de/u-boot/custodians/u-boot...
[oweals/u-boot.git] / include / cpu.h
index 22467cb9b3a42316ceb79cf030619e2622508009..2f283fe2449dcf620b6b0029ccffa2e4dfdb217f 100644 (file)
@@ -14,6 +14,8 @@
  * @device_id:     Driver-defined device identifier
  * @family:        DMTF CPU Family identifier
  * @id:            DMTF CPU Processor identifier
+ * @timebase_freq: the current frequency at which the cpu timer timebase
+ *                registers are updated (in Hz)
  *
  * This can be accessed with dev_get_parent_platdata() for any UCLASS_CPU
  * device.
@@ -24,6 +26,7 @@ struct cpu_platdata {
        ulong device_id;
        u16 family;
        u32 id[2];
+       u32 timebase_freq;
 };
 
 /* CPU features - mostly just a placeholder for now */
@@ -41,10 +44,12 @@ enum {
  *
  * @cpu_freq:  Current CPU frequency in Hz
  * @features:  Flags for supported CPU features
+ * @address_width:     Width of the CPU address space in bits (e.g. 32)
  */
 struct cpu_info {
        ulong cpu_freq;
        ulong features;
+       uint address_width;
 };
 
 struct cpu_ops {
@@ -84,6 +89,15 @@ struct cpu_ops {
         * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
         */
        int (*get_vendor)(struct udevice *dev, char *buf, int size);
+
+       /**
+        * is_current() - Check if the CPU that U-Boot is currently running from
+        *
+        * @dev:        Device to check (UCLASS_CPU)
+        * @return 1 if the CPU that U-Boot is currently running from, 0
+        *         if not.
+        */
+       int (*is_current)(struct udevice *dev);
 };
 
 #define cpu_get_ops(dev)        ((struct cpu_ops *)(dev)->driver->ops)
@@ -125,4 +139,25 @@ int cpu_get_count(struct udevice *dev);
  */
 int cpu_get_vendor(struct udevice *dev, char *buf, int size);
 
+/**
+ * cpu_probe_all() - Probe all available CPUs
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int cpu_probe_all(void);
+
+/**
+ * cpu_is_current() - Check if the CPU that U-Boot is currently running from
+ *
+ * Return: 1 if yes, - 0 if not
+ */
+int cpu_is_current(struct udevice *cpu);
+
+/**
+ * cpu_get_current_dev() - Get CPU udevice for current CPU
+ *
+ * Return: udevice if OK, - NULL on error
+ */
+struct udevice *cpu_get_current_dev(void);
+
 #endif