Skip to content

Device model#70

Merged
jastintime merged 15 commits intotrunkfrom
remexre/driver-model
Mar 18, 2026
Merged

Device model#70
jastintime merged 15 commits intotrunkfrom
remexre/driver-model

Conversation

@remexre
Copy link
Copy Markdown
Member

@remexre remexre commented Nov 9, 2025

On top of #63; merge that one first, then rebase this.


  • Adds initializers. These are used to register drivers with the appropriate subsystems.
  • Adds the device model and documentation about it.
  • Adds support for enumerating devices in the Devicetree.
  • Adds the UART device class.
  • Adds an incomplete ns16550a driver. This is the UART we get in QEMU, and most UARTs in the wild are compatible with it. This driver is currently very basic, since we don't have interrupts (Trap handling #9) and it doesn't do DMA.

Relevant to #10, but it is not resolved by this PR.

The UART device class and ns16550a driver here are not very finished.
They currently act as an example of the device model, but don't implement all of what's needed for the driver itself.

@remexre remexre mentioned this pull request Nov 9, 2025
@remexre remexre changed the base branch from trunk to remexre/split-up-objects-in-makefile January 3, 2026 01:18
@remexre remexre force-pushed the remexre/split-up-objects-in-makefile branch 2 times, most recently from 1d3bead to ac9d91b Compare January 12, 2026 15:35
@remexre remexre force-pushed the remexre/driver-model branch from 62eddfa to 45e23c0 Compare January 12, 2026 15:39
@remexre remexre force-pushed the remexre/split-up-objects-in-makefile branch from ac9d91b to 18dd63d Compare January 12, 2026 16:04
@remexre remexre force-pushed the remexre/driver-model branch from 45e23c0 to 628e825 Compare January 12, 2026 16:04
@remexre remexre force-pushed the remexre/split-up-objects-in-makefile branch from 18dd63d to b3dda97 Compare January 12, 2026 23:20
Base automatically changed from remexre/split-up-objects-in-makefile to trunk January 12, 2026 23:23
@remexre remexre mentioned this pull request Jan 13, 2026
@remexre remexre force-pushed the remexre/driver-model branch from 628e825 to ff452dc Compare January 13, 2026 00:17
@remexre
Copy link
Copy Markdown
Member Author

remexre commented Jan 13, 2026

Since there are other drivers in development (#81), despite the actual ns16550a driver and UART device class here being very unfinished, I'm un-drafting this and looking for review.

@remexre remexre marked this pull request as ready for review January 13, 2026 00:29
@KieranMusser
Copy link
Copy Markdown
Contributor

I'll look a bit more into this later (as I rewrite my driver), but should we include PCI somewhere in this? I feel it might be good to separate the PCI driver from the RTL8139 driver. I'll be doing all the work for PCI as a part of the RTL fixing, but PCI is useful to more than just that one driver.

@remexre
Copy link
Copy Markdown
Member Author

remexre commented Jan 13, 2026

I'll look a bit more into this later (as I rewrite my driver), but should we include PCI somewhere in this? I feel it might be good to separate the PCI driver from the RTL8139 driver.

Depends how big it is, I suppose; if the PCI and RTL8139 drivers are small enough together that they make sense to review together, then eh, whatever's fine.

If the PCI driver is large enough to need separate review, I would make a separate PR for it that has a target branch of this one, then set the RTL8139 PR to have a target branch of that one.

A few advantages there:

  • The GitHub UI only shows the diff against that other branch, so your reviewers don't end up re-reviewing commits that're really from the other branch.
  • The list of PRs makes it visually obvious when a branch depends on another in this way.
  • Once the target branch gets merged, GitHub will email you and your reviewer(s). The message is phrased a bit rudely ("dismissed their stale review"), but... it's at least a ping lol.

@remexre remexre mentioned this pull request Feb 14, 2026
Comment thread src/kernel/include/device.h
Comment thread src/kernel/include/device.h Outdated
Comment thread doc/kernel/devices.md Outdated
Comment thread doc/kernel/devices.md
Comment thread src/kernel/arch/riscv64/paging.c Outdated
Comment thread src/kernel/drivers/ns16550a.c
Comment thread src/kernel/drivers/ns16550a.c
Comment thread src/kernel/include/devices/uart.h Outdated
Comment thread src/kernel/include/mm/paging.h
Comment thread src/kernel/devicetree.c
Signed-off-by: Amy Ringo <me@remexre.com>
These functions are for mapping IO memory.

Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
@remexre remexre force-pushed the remexre/driver-model branch from ff452dc to 42c8ab0 Compare February 28, 2026 19:24
remexre added 3 commits March 4, 2026 18:43
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
@remexre remexre mentioned this pull request Mar 14, 2026
remexre added 3 commits March 15, 2026 12:57
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
@remexre remexre force-pushed the remexre/driver-model branch from f7f1186 to d09e768 Compare March 15, 2026 17:58
@remexre
Copy link
Copy Markdown
Member Author

remexre commented Mar 15, 2026

I think I addressed everything? Ready for re-review @jastintime

Copy link
Copy Markdown
Contributor

@jastintime jastintime left a comment

Choose a reason for hiding this comment

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

lgtm

Comment thread src/kernel/drivers/ns16550a.c
@jastintime jastintime added this pull request to the merge queue Mar 18, 2026
Merged via the queue into trunk with commit 04ff962 Mar 18, 2026
13 checks passed
@jastintime jastintime deleted the remexre/driver-model branch March 18, 2026 16:23
@remexre remexre mentioned this pull request Mar 21, 2026
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.

3 participants