Page MenuHomeFreeBSD

ofw_cpu: fix __riscv preprocessor check
ClosedPublic

Authored by mhorne on Dec 17 2024, 8:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 23, 5:50 AM
Unknown Object (File)
Sun, Jan 12, 4:04 PM
Unknown Object (File)
Fri, Jan 10, 7:18 PM
Unknown Object (File)
Dec 19 2024, 7:03 PM
Subscribers

Details

Summary

The canonical name is riscv, not riscv__. Newer compilers no longer
emit the latter.

This re-enables finding the nominal frequency from the CPU's clock.

I checked, and there are no remaining mistakes like this in the tree.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Do we need to update arch(7)?

This revision is now accepted and ready to land.Dec 17 2024, 8:03 PM
In D48122#1097216, @imp wrote:

Do we need to update arch(7)?

No, that seems to be correct already.

jrtc27 added a subscriber: jrtc27.

From grepping the tree this doesn't actually have any consequences currently, right, other than possible prints? The only real use I see is cpufreq, which we don't currently have for RISC-V.

jhb added a subscriber: jhb.
jhb added inline comments.
sys/dev/ofw/ofw_cpu.c
279

If we moved the variable declarations to here, would that reduce the need for the second #if above? That might be preferable as a followup commit to keep the number of #if's down.

sys/dev/ofw/ofw_cpu.c
46

Add

#define HAS_CLOCK

here. Ideally this would be global, but that makes this change too large.

(of course, this is tweaking an otherwise boring tweak, so maybe a followup)

209

#ifdef HAS_CLOCK

279

#ifdef HAS_CLOCK

My suggestions likely are out of scope, though...

sys/dev/ofw/ofw_cpu.c
46

Yes, ideally a global coming from the kernel config. Leaving that part for another day :)

279

D48149. I will still commit this one as-is first, somewhat redundantly.

This revision was automatically updated to reflect the committed changes.