Handling devices that only supports 32-bit addresses
Posted: Thu Jan 02, 2014 1:28 pm
Thought I'd get some feedback + other solutions for this. As many modern chips use memory-mapped IO, and most of them comes in both 32 bit and 64 bit versions, it seems like a relevant issue.
Here is how I handle them:
1. Network chips. I allocate static buffers for the buffer rings that always are 32-bit in the specific driver
2. HDA audio chips. Same. Allocate static sound buffers below 4G and copy data to them as part of the mixing process
3. USB. This is a tricky one. OHCI and UHCI have no support at all for 64-bit addressing. In EHCI it is optional, and you would want to pass pointers as is when the chip support 64-bit addressing. I solve this in the USB interface module by copying incoming requests to buffers that are 32-bit when the USB driver indicates it cannot handle 64-bit addresses, and the computer has any available address above 4G. This causes a lot of overhead for USB 1 and 1.1 devices that are not on hubs.
4. SATA discs. In AHCI, supporting 64-bit addressing is optional, and there are machines with 32-bit only AHCI controllers equipped with more than 4G of memory. I solve this in the low-level disc handler module by allocating all buffers below 4G when the disc driver indicates it cannot handle 64-bit addressing. This doesn't cause much overhead as no copying is required.
Feel free to post how you handle these issues in the thread.
Here is how I handle them:
1. Network chips. I allocate static buffers for the buffer rings that always are 32-bit in the specific driver
2. HDA audio chips. Same. Allocate static sound buffers below 4G and copy data to them as part of the mixing process
3. USB. This is a tricky one. OHCI and UHCI have no support at all for 64-bit addressing. In EHCI it is optional, and you would want to pass pointers as is when the chip support 64-bit addressing. I solve this in the USB interface module by copying incoming requests to buffers that are 32-bit when the USB driver indicates it cannot handle 64-bit addresses, and the computer has any available address above 4G. This causes a lot of overhead for USB 1 and 1.1 devices that are not on hubs.
4. SATA discs. In AHCI, supporting 64-bit addressing is optional, and there are machines with 32-bit only AHCI controllers equipped with more than 4G of memory. I solve this in the low-level disc handler module by allocating all buffers below 4G when the disc driver indicates it cannot handle 64-bit addressing. This doesn't cause much overhead as no copying is required.
Feel free to post how you handle these issues in the thread.