Page MenuHomeFreeBSD

ofw_cpu: fix __riscv preprocessor check
ClosedPublic

Authored by mhorne on Dec 17 2024, 8:01 PM.
Tags
None
Referenced Files
F137879466: D48122.id148174.diff
Wed, Nov 26, 7:26 PM
F137875087: D48122.id149088.diff
Wed, Nov 26, 6:01 PM
F137847885: D48122.id.diff
Wed, Nov 26, 9:47 AM
Unknown Object (File)
Wed, Nov 19, 4:02 AM
Unknown Object (File)
Tue, Nov 18, 9:39 PM
Unknown Object (File)
Thu, Nov 13, 8:51 AM
Unknown Object (File)
Thu, Nov 13, 8:51 AM
Unknown Object (File)
Wed, Nov 12, 10:29 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 61219
Build 58103: arc lint + arc unit

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.