Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking something: Endianness of scom addresses #260

Open
hanetzer opened this issue Oct 15, 2020 · 3 comments
Open

Checking something: Endianness of scom addresses #260

hanetzer opened this issue Oct 15, 2020 · 3 comments

Comments

@hanetzer
Copy link

out_be64(xscom_addr(this_cpu()->chip_id, recv_status_reg), 0);

So I know the p9 can run in either big or little endian mode, but this bit of code leads me to believe that
scom addresses are always big endian, regardless of whether the cpu is running in big or little mode.

Just a bit of clarification would be nice, thank you.

@oohal
Copy link
Contributor

oohal commented Oct 15, 2020

SCOM addresses are just offsets into the XSCOM MMIO area. The SCOMs themselves are big endian MMIO registers so we use in_be64() and out_be64() to access them.

@hanetzer
Copy link
Author

Oh, so like, recv_status_reg is at 0x603fc00000000 + recv_status_reg on p9 systems?
And I assume that's true for any other scom reg? Neat.

@oohal
Copy link
Contributor

oohal commented Oct 16, 2020

More or less. Historically SCOMs were accessed from outside the chip via a address/data register pair and the "scom address" needs to be translated from a register number to an offset into the XSCOM MMIO area. For P9 all that requires is shifting the address up by three bits, but it was a little more complex on P8 which is why we use xscom_addr() to do the translation.

The other thing is that each chip has its own xscom MMIO range so 0x603fc00000000 + (scom_addr << 3) is the address for chip 0 and 0x623fc00000000 + (scom_addr << 3) is the same scom on the 2nd chip. xscom_addr() also handles that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants