How do you handle devices that aren't 64-bit in long mode?
Posted: Mon Aug 20, 2012 8:51 am
I've looked at the OHCI-specification, and it cannot handle 64-bit physical addresses at all. It is fine for the scheduling lists (can "easily" be allocated below 4G), but there are issues with data. I suspect the only possibilty is to use "double buffering" and have buffers allocated below 4G that are used for data-transfers. It's a pain, but should work.
The EHCI chip is similar, but it has optional support for 64-bit physical addresses. I suppose a similar solution is required here, maybe complemented with the use of the 64-bit interface if it is available.
AHCI presents a similar problem. The specification defines 64-bit addresses for all fields, but it seems like support for 64-bit addressing is optional. I wonder if this means that if the hardware platform supports more than 4G, so would the AHCI controller, or maybe it could potentially mean that the machine might have more than 4G of memory, and an AHCI controller that cannot handle 64-bit bus-mastering. If the latter is never the case, it would be simple to just use the 64-bit addresses of buffers in the AHCI-controller, and don't worry about if the controller supports 64-bit or not. Otherwise, there would be a need to introduce new code in the disc buffer manager that makes sure that buffers passed to a particular disc never can be above 4G. I would rather not do the latter if it is uncommon. Especially since IDE never presents this problem as it always uses PIO-method.
So how do people that write long-mode OSes tackle these issues?
The EHCI chip is similar, but it has optional support for 64-bit physical addresses. I suppose a similar solution is required here, maybe complemented with the use of the 64-bit interface if it is available.
AHCI presents a similar problem. The specification defines 64-bit addresses for all fields, but it seems like support for 64-bit addressing is optional. I wonder if this means that if the hardware platform supports more than 4G, so would the AHCI controller, or maybe it could potentially mean that the machine might have more than 4G of memory, and an AHCI controller that cannot handle 64-bit bus-mastering. If the latter is never the case, it would be simple to just use the 64-bit addresses of buffers in the AHCI-controller, and don't worry about if the controller supports 64-bit or not. Otherwise, there would be a need to introduce new code in the disc buffer manager that makes sure that buffers passed to a particular disc never can be above 4G. I would rather not do the latter if it is uncommon. Especially since IDE never presents this problem as it always uses PIO-method.
So how do people that write long-mode OSes tackle these issues?