Skip to content

Conversation

Martinfx
Copy link
Contributor

@Martinfx Martinfx commented Aug 11, 2025

Hi, @bsdimp
This is patch for early putc ns8250 on arm
I tested on bananapi-r64

Copy link

github-actions bot commented Aug 11, 2025

Thank you for taking the time to contribute to FreeBSD!
There is an issue that needs to be fixed:

  • Missing Signed-off-by lines8cd1964

Please review CONTRIBUTING.md, then update and push your branch again.

@Martinfx Martinfx changed the title bananapi-r64: patch for early printf ns8250 on arm patch for early printf ns8250 on arm Aug 11, 2025
@Martinfx Martinfx changed the title patch for early printf ns8250 on arm patch for early putc ns8250 on arm Aug 11, 2025
@Martinfx Martinfx force-pushed the max-fix-for-ns8250 branch 5 times, most recently from 705a113 to 48f3933 Compare August 12, 2025 13:38
@Martinfx Martinfx requested a review from bsdimp August 13, 2025 05:07
@Martinfx Martinfx force-pushed the max-fix-for-ns8250 branch 2 times, most recently from 50680a2 to 0545a39 Compare August 13, 2025 11:56
Copy link
Member

@bsdimp bsdimp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ready. There's no socdev_va/pa on other platofrms, so arm and arm64 is the complete list.

@Martinfx
Copy link
Contributor Author

I think this is ready. There's no socdev_va/pa on other platofrms, so arm and arm64 is the complete list.

Ok. Thank you.

@strejda
Copy link
Contributor

strejda commented Aug 26, 2025

Unfortunately, this only works for some UART implementations. It does not take into account the register layout and access restrictions of different UARTs ("reg-shift", "reg-io-width"). These are not available at an early stage, which is why we do not yet have the early_putc() function implemented. It should not be commited in this form.

@Martinfx
Copy link
Contributor Author

Unfortunately, this only works for some UART implementations. It does not take into account the register layout and access restrictions of different UARTs ("reg-shift", "reg-io-width"). These are not available at an early stage, which is why we do not yet have the early_putc() function implemented. It should not be commited in this form.

Ok. I thought it was okay.

@zxombie
Copy link
Member

zxombie commented Aug 26, 2025

We could add options to set them, e.g. options EARLY_PRINTF_REG_SHIFT=2.

@bsdimp
Copy link
Member

bsdimp commented Aug 26, 2025

We could add options to set them, e.g. options EARLY_PRINTF_REG_SHIFT=2.

Couldn't we just read the SPCR table to get these values as well?

@zxombie
Copy link
Member

zxombie commented Aug 27, 2025

I would prefer to not depend on the SPCR/FDT so printf works before we parse them, e.g. we may need to call printf from within the parsing code to debug it.

@bsdimp
Copy link
Member

bsdimp commented Aug 27, 2025

I would prefer to not depend on the SPCR/FDT so printf works before we parse them, e.g. we may need to call printf from within the parsing code to debug it.

Since we parse it in the boot loader, maybe it could provide adequate hints? Or do we have the same issue?

@strejda
Copy link
Contributor

strejda commented Aug 29, 2025

IMHO, early_putc() should work from the first line of initarm(). I am afraid that the only viable solution is #define at compile time, runtime detection looks impossible.

@Martinfx Martinfx force-pushed the max-fix-for-ns8250 branch 5 times, most recently from fdc9de8 to 175171a Compare September 21, 2025 12:55
@Martinfx Martinfx force-pushed the max-fix-for-ns8250 branch 2 times, most recently from d556ab2 to 8cd1964 Compare September 22, 2025 17:22
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

Successfully merging this pull request may close these issues.

4 participants