Conversation
1d3bead to
ac9d91b
Compare
62eddfa to
45e23c0
Compare
ac9d91b to
18dd63d
Compare
45e23c0 to
628e825
Compare
18dd63d to
b3dda97
Compare
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>
628e825 to
ff452dc
Compare
|
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. |
|
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. |
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:
|
| struct list_head parent_children; | ||
|
|
||
| /** | ||
| * The children of the node. |
There was a problem hiding this comment.
this is an unnecessary comment.
| * Registers a device in the tree of devices and with its device class. | ||
| * | ||
| * - `name` must be filled out. | ||
| * - `parent` and `device_class` must be `nullptr`. |
There was a problem hiding this comment.
im confused, the attribute says nonnull but the comment says must be nullptr.
|
|
||
| ## Device classes | ||
|
|
||
| Each device probably provides some functionality other than simply existing. |
There was a problem hiding this comment.
this is probably not necessary.
|
|
||
| Typically, a device class consists of three things: a vtable struct, a device struct, and a list of devices. | ||
|
|
||
| The vtable is simply a struct with methods for that kind of device. |
|
|
||
| uaddr lo, hi; | ||
| struct vma *vma; | ||
| vma = vma_alloc(&kernel_virtual_allocator, size >> 12); |
There was a problem hiding this comment.
size >> 12 is some magic
|
|
||
| /** | ||
| * The bits of the Interrupt Enable Register. | ||
| */ |
There was a problem hiding this comment.
can we add someone a link to the spec sheet for this UART device.
There was a problem hiding this comment.
im unable to verify these cant find the spec sheet.
| return &device->device; | ||
|
|
||
| fail: | ||
| if (device) { |
There was a problem hiding this comment.
might be a good idea to have a device_free(), so we don't have to remember to free the format name, unmap and free the whole thing.
| const struct uart_ops *ops; | ||
|
|
||
| /** | ||
| * A pointer to the _same_ device. |
There was a problem hiding this comment.
what does same device mean here.
|
|
||
| /** | ||
| * Maps a region of memory for memory-mapped IO. This may involve special flags | ||
| * or other setup to prevent accesses from being cached. |
There was a problem hiding this comment.
where would this setup be? or do we not have that option yet?
|
|
||
| if (!handlers) { | ||
| assert(!handlers_len); | ||
| handlers_cap = 16; |
On top of #63; merge that one first, then rebase this.
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.