Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147368855
D1824.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D1824.id.diff
View Options
Index: head/sys/dev/ofw/ofw_cpu.c
===================================================================
--- head/sys/dev/ofw/ofw_cpu.c
+++ head/sys/dev/ofw/ofw_cpu.c
@@ -244,6 +244,7 @@
static int
ofw_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
{
+ struct ofw_cpulist_softc *psc;
struct ofw_cpu_softc *sc;
sc = device_get_softc(dev);
@@ -258,6 +259,16 @@
return (0);
}
break;
+ case CPU_IVAR_CPUID_SIZE:
+ psc = device_get_softc(device_get_parent(dev));
+ *result = psc->sc_addr_cells;
+ return (0);
+ case CPU_IVAR_CPUID:
+ if (sc->sc_reg_valid) {
+ *result = (uintptr_t)sc->sc_reg;
+ return (0);
+ }
+ break;
}
return (ENOENT);
Index: head/sys/sys/cpu.h
===================================================================
--- head/sys/sys/cpu.h
+++ head/sys/sys/cpu.h
@@ -37,6 +37,8 @@
#define CPU_IVAR_PCPU 1
#define CPU_IVAR_NOMINAL_MHZ 2
+#define CPU_IVAR_CPUID_SIZE 3
+#define CPU_IVAR_CPUID 4
static __inline struct pcpu *cpu_get_pcpu(device_t dev)
{
@@ -54,6 +56,20 @@
return ((int32_t)v);
}
+static __inline const uint32_t *cpu_get_cpuid(device_t dev, size_t *count)
+{
+ uintptr_t v = 0;
+ if (BUS_READ_IVAR(device_get_parent(dev), dev,
+ CPU_IVAR_CPUID_SIZE, &v) != 0)
+ return (NULL);
+ *count = (size_t)v;
+
+ if (BUS_READ_IVAR(device_get_parent(dev), dev,
+ CPU_IVAR_CPUID, &v) != 0)
+ return (NULL);
+ return ((const uint32_t *)v);
+}
+
/*
* CPU frequency control interface.
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 11, 9:41 AM (2 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29534897
Default Alt Text
D1824.id.diff (1 KB)
Attached To
Mode
D1824: Add support to read the CPU register in a generic way.
Attached
Detach File
Event Timeline
Log In to Comment