SATA driver; AHCI port initialisation; Start (ST) command list;


I have an issue with initialising and running AHCI port on my devboard. Processor has SATA host controller with 2 ports implemented (port 0 & port 1). SSD drive w/ SATA interface is connected to the port 1.

According to "Serial ATA AHCI 1.3.1 Specification", chapter "10.3.1 Start (PxCMD.ST)" a bunch of conditions should be satisfied before setting PxCMD.ST to '1'. After setting this bit, PxCMD.CR should be set to indicate that port is ready and runs.

The problem is PxCMD.CR never comes to be set.

State before enabling PxCMD.ST:

  • port is in idle state, PxCMD.ST and PxCMD.CR are both '0'
  • FIS Receive Enable, PxCMD.FRE is '1'
  • Drive is connected to the port, PxSSTS = 0x00000133 (SSTS.IPM = 1, SSTS.SPD = 3, SSTS.DET = 3), PxTFD = 0x00000150 (TFD.STS.BSY = 0, TFD.STS.DRQ = 0, TFD.STS.ERR = 0)
  • PxCLB/PxCLBU are set with physical addresses to buffer and buffer is aligned. (1KB buffer, 1KB aligned)
  • PxCMD = 0x00404010 (PxCMD.FBSCP = 1 & PxCMD.FRE = 1)

After setting PxCMD.ST, PxCMD = 0x00404011 and PxCMD.CR stays '0'

  • PxSERR = 0 stay the same. ERR is cleaned in advance before setting PxCMD.FRE
  • PxSCTL = 0x00000330 (IPM = 3, SPD = 3, DET = 0)
  • PxTFD = 0x00000150 stay the same
  • PxSIG = 0x00000101. The reg has 0xFFFFFFFF when drive is not connected.

Assuming that PxSIG is set and PxSERR is '0' more likely that PLL for SATA HC is set correctly.

I have concerns about PxTFD.ERR = 1 (when drive is disconnected PxTFD has default 0x7F value and PxTFD.ERR = 0) but didn't find is it relevant or nor considering that still TFD.STS.ERR = 0

Any ideal what is missed?

PS: It has nothing to do w/ Linux.

asked on Stack Overflow Apr 11, 2017 by user3124812 • edited Apr 13, 2017 by user3124812

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0