snir nisim

SATA power interrupt dissabling &  make rc.local running only on startup

Discussion created by snir nisim on Apr 11, 2012

hello everyone,

i'm interfacing a very complicated problem.


first i'll describe my configuration:

my sata drive is getting power from a power supply i built that implies a UPS.

the UPS is built with supercaps and gives me a 3.5s of backup power from the moment the input power goes down.

the imx is also fed from this supply but inorder to solve the problem i'm describing i dissconected it and power it with the supplied power adapter from freescale.

i'm getting a "poweroff" msg to the OS (linux minimum bootable config with extra configs and packages i've added) from USB, i have an external uC that sends this message and a progrem running on the QSB that gets it and run syste("poweroff") command.

i also want to metion that the program on the QSB starts after booting (i've added the ./myprogram command to rc.local).


1. now the first problem is:

that the sata drive is indicating the main power disconnection immidiattly some how (even thow it's connected throught a voltage regulator and a UPS that keeps the voltage in same level for 3.5s)

and sends the following to the serial terminal:


ata1: exception Emask 0x10 SAct 0x0 SErr 0x10200 action 0xe frozen

ata1: irq_stat 0x00400000, PHY RDY changed

ata1: SError: { Persist PHYRdyChg } ata1: hard resetting link

ata1: SATA link down (SStatus 0 SControl 300)

ata1: hard resetting link

ata1: SATA link down (SStatus 0 SControl 300)

ata1: limiting SATA link speed to 1.5 Gbps

ata1: hard resetting link ata1: SATA link down (SStatus 0 SControl 310)

ata1.00: disabled

ata1: EH complete

ata1.00: detaching (SCSI 0:0:0:0)

sd 0:0:0:0: [sda] Synchronizing SCSI cache

sd 0:0:0:0: [sda] Result: hostbyte=0x04 driverbyte=0x00

sd 0:0:0:0: [sda] Stopping disk

sd 0:0:0:0: [sda] START_STOP FAILED

 sd 0:0:0:0: [sda] Result: hostbyte=0x04 driverbyte=0x00


basiclly i don't have problem with this except it's blocking the poweroff command.

i need that the system will poweroff properly in 3.5s (and it does if the sata isn't posting this message, not indicating the power fail).

what i need is a way to disable the system interset of the sata link when it fails so it will continue poweroff without bloking by those messages and will shutdown in 3.5s.


i've tried configuring the kernel without checking the Verbus error messages in device drivers->ATA but that didn't solved the problem.

is there a way to mask this sata interrupt without distrub the sata regular functionality on stady state, so it won't distrub the poweroff command that my program sends?


2. another problem i have is with the rc.local commands i've enterd...

i found that the script executes both on startup and shutdown instead of onlt in startup.

i want to run few commands only in startup is it possible?

i think the problem is with the rcS script definig only 1:start variable and sends it whether it's startup or


thank's in advance,