8237A DMA Controller
Posts from Michal Necasek on the OS/2 Museum

More Fun with ISA DMA  
The Danger of Datasheets  
386 Memory Managers and DMA  
EMM386 and VDS: Not Quite Working  
386MAX and EISA DMA  
VDS: Borne out of Necessity  
8237A DMA Page Fun  

Michal Necasek wrote:

   I can tell you why the PC/AT DMA controllers are so weird.

 The 8237A is an 8-bit part, it has an 8-bit data register and it can address 64K. When IBM built the PC, they extended the addressing by adding "page registers". For each DMA channel, there's an 8-bit register (outside of the DMA controller chip) that is used to modify the address generated by the DMA controller. The 8237A provides the low 16 bits, the page register provides the high 4 (in the PC) or 8 bits (in the AT) of the address. The catch is that because the page register is completely separate, if the address generated by the 8237A rolls over, it just goes back to the beginning of the 64K "page". This is what creates the 64K DMA boundaries.

 This is also why the AT DMA is limited to the low 16MB of physical memory, because the 8237A + page register can only generate 24 address bits. There was EISA DMA with full 32-bit addressing but it died out, I think Intel decided that people should just use PCI bus mastering instead (reasonable decision IMO).

 In the PC/AT, IBM hacked the 8237A to provide 16-bit transfers. This was accomplished by shifting left the address generated by the 8237A by one bit, so that it addresses words instead of bytes. There's still the page register, but for the 16-bit DMA channels, it selects a 128K window rather than a 64K one.

 This works because except for memory-to-memory transfers (effectively unusable or useless on PCs), the 8237A does not move the data, it just generates the memory read or write cycles and the device using that DMA channel either places the data on the bus (memory write) or reads from the bus (memory read). The device can use all 16 bits of the AT bus just as easily as it can use 8 bits of the PC bus. The 8237A "thinks" it's counting bytes and incrementing the address byte by byte, but the address shift causes it to go word by word instead.

 I hope this made some sense.

 - Michal