# Meaning of UDMA mode wrt SATA Drives



## aseemjolly (Aug 2, 2014)

I am booting MayanCity Intel haswell based reference board and have a SATA drive installed. BIOS has programmed the AHCI controller in AHCI mode.
When FreeBSD ATA driver attaches to the drive, ATA driver is putting the device in UDMA5 transfer mode by sending ATA command ‘Set Transfer Mode’ to the device; ad_attach calls ad_init, ad_init calls ad_setmode and which calls ata_sata_setmode

I am not sure if UDMA plays any role with SATA drives specially after looking Wellsburg chipset specifications
"SATA interface transfer rates are independent of UDMA mode settings. SATA interface transfer rates will operate at the bus’s maximum speed, regardless of the UDMA mode reported by the SATA device or the system BIOS”

And how the behavior of AHCI controller would change if I select PIO mode on the device by sending "Set Transfer Mode" command.

I am quite sure that this may have been answered multiple times but I didn't find any concrete answer.


----------



## kpa (Aug 2, 2014)

*Re: Meaning of UDMA mode with SATA Drives*

SATA drives will use only the SATA transfer mode, no matter what the OS tells you or what you try to tell the drive to do. The on wire protocol is completely different from what is used on PATA drives and UDMA vs. PIO simply doesn't make any sense with SATA.


----------



## aseemjolly (Aug 4, 2014)

From the AHCI controller spec http://www.intel.com/content/dam/www/pu ... v1-3-1.pdf

All data transfers between the device and system memory occur through the HBA acting as a bus master 
to system memory. Whether the transaction is of a DMA type or a PIO type, the HBA fetches and stores 
data to memory, offloading the CPU. 

There is no accessible data port. All transfers are performed using DMA.

From the HBA’s point of view, PIO data transfers look like a DMA transfer. A command table is set up, 
and the data is bus mastered from or to system memory by the HBA

Going through the code(ata-ahci.c), Even for the ATA IDENTIFY PIO command, it does look like that data has been DMA'ed to the memory.

I have one last question, Is it possible at the software side to have a different view point than the hardware i.e. to read 2 bytes at a time and to make it look like a PIO transfer?


----------

