Lines Matching +full:cpu +full:- +full:idle +full:- +full:states
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/cpu.h>
7 * of_get_cpu_hwid - Get the hardware ID from a CPU device node
9 * @cpun: CPU number(logical index) for which device node is required
12 * Return: The hardware ID for the CPU node or ~0ULL if not found.
29 * arch_match_cpu_phys_id - Match the given logical CPU and physical id
31 * @cpu: logical cpu index of a core/thread
34 * CPU logical to physical index mapping is architecture specific.
36 * id to logical cpu index. phys_id provided here is usually values read
39 * Returns true if the physical identifier and the logical cpu index
42 bool __weak arch_match_cpu_phys_id(int cpu, u64 phys_id) in arch_match_cpu_phys_id() argument
44 return (u32)phys_id == cpu; in arch_match_cpu_phys_id()
49 * core/thread corresponding to the logical cpu 'cpu'. If 'thread' is not
53 const char *prop_name, int cpu, unsigned int *thread) in __of_find_n_match_cpu_property() argument
61 if (!cell && !ac && arch_match_cpu_phys_id(cpu, 0)) in __of_find_n_match_cpu_property()
68 if (arch_match_cpu_phys_id(cpu, hwid)) { in __of_find_n_match_cpu_property()
79 * arch_find_n_match_cpu_physical_id - See if the given device node is
80 * for the cpu corresponding to logical cpu 'cpu'. Return true if so,
81 * else false. If 'thread' is non-NULL, the local thread number within the
85 int cpu, unsigned int *thread) in arch_find_n_match_cpu_physical_id() argument
87 /* Check for non-standard "ibm,ppc-interrupt-server#s" property in arch_find_n_match_cpu_physical_id()
93 "ibm,ppc-interrupt-server#s", in arch_find_n_match_cpu_physical_id()
94 cpu, thread)) in arch_find_n_match_cpu_physical_id()
97 return __of_find_n_match_cpu_property(cpun, "reg", cpu, thread); in arch_find_n_match_cpu_physical_id()
101 * of_get_cpu_node - Get device node associated with the given logical CPU
103 * @cpu: CPU number(logical index) for which device node is required
108 * given logical CPU index. It should be used to initialize the of_node in
109 * cpu device. Once of_node in cpu device is populated, all the further
112 * CPU logical to physical index mapping is architecture specific and is built
116 * Return: A node pointer for the logical cpu with refcount incremented, use
119 struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) in of_get_cpu_node() argument
124 if (arch_find_n_match_cpu_physical_id(cpun, cpu, thread)) in of_get_cpu_node()
132 * of_cpu_device_node_get: Get the CPU device_node for a given logical CPU number
134 * @cpu: The logical CPU number
136 * Return: Pointer to the device_node for CPU with its reference count
137 * incremented of the given logical CPU number or NULL if the CPU device_node
140 struct device_node *of_cpu_device_node_get(int cpu) in of_cpu_device_node_get() argument
143 cpu_dev = get_cpu_device(cpu); in of_cpu_device_node_get()
145 return of_get_cpu_node(cpu, NULL); in of_cpu_device_node_get()
146 return of_node_get(cpu_dev->of_node); in of_cpu_device_node_get()
151 * of_cpu_node_to_id: Get the logical CPU number for a given device_node
153 * @cpu_node: Pointer to the device_node for CPU.
155 * Return: The logical CPU number of the given CPU device_node or -ENODEV if the
156 * CPU is not found.
160 int cpu; in of_cpu_node_to_id() local
164 for_each_possible_cpu(cpu) { in of_cpu_node_to_id()
165 np = of_cpu_device_node_get(cpu); in of_cpu_node_to_id()
169 return cpu; in of_cpu_node_to_id()
172 return -ENODEV; in of_cpu_node_to_id()
177 * of_get_cpu_state_node - Get CPU's idle state node at the given index
179 * @cpu_node: The device node for the CPU
180 * @index: The index in the list of the idle states
182 * Two generic methods can be used to describe a CPU's idle states, either via
183 * a flattened description through the "cpu-idle-states" binding or via the
184 * hierarchical layout, using the "power-domains" and the "domain-idle-states"
185 * bindings. This function check for both and returns the idle state node for
188 * Return: An idle state node if found at @index. The refcount is incremented
197 err = of_parse_phandle_with_args(cpu_node, "power-domains", in of_get_cpu_state_node()
198 "#power-domain-cells", 0, &args); in of_get_cpu_state_node()
201 of_parse_phandle(args.np, "domain-idle-states", index); in of_get_cpu_state_node()
208 return of_parse_phandle(cpu_node, "cpu-idle-states", index); in of_get_cpu_state_node()