summaryrefslogtreecommitdiff
path: root/sys/dev/pci/ahci.c
AgeCommit message (Collapse)Author
2007-05-10remove and hide code that isn't used.David Gwynne
found by deraadt@
2007-04-22mark the ccb used for error handling as complete when it completes. thisDavid Gwynne
prevents dmesg spam when we return this ccb to the free list.
2007-04-22unload the dmamap of the ccb used in ncq error handling once we've finishedDavid Gwynne
with it. prevents free panics on sparc64. found by deraadt on a v215.
2007-04-22prettier debug, if it is ever re-enabled, ok dlgTheo de Raadt
2007-04-21disable ahci debug output. ahci is working on the majority of chipsets,David Gwynne
and its not helping us on those that arent.
2007-04-08Whitespace/long line fixups. No code change.Christopher Pascoe
2007-04-08Add compile-time support for coalescing command interrupts to reduce theChristopher Pascoe
overall interrupt rate. #define AHCI_COALESCE to enable.
2007-04-06Wait until we have idled the port before obtaining the error CCB, so asChristopher Pascoe
to avoid tripping a KASSERT in the case when there is more than one outstanding command. ok dlg@
2007-04-02Read log page 10h to determine the NCQ error, instead of aborting allChristopher Pascoe
active commands when an error is encountered. ok dlg@
2007-03-31re-blacklist the via vt8251, there's still something fishy..Jasper Lievisse Adriaanse
ok dlg@
2007-03-31reenable the via 8251 sata chipset. jasper proved it can work if we dontDavid Gwynne
do ncq, so this diff quirks it. tested by jasper@
2007-03-30the VT8251 SATA says it is ahci, but we aren't ready for it. we need toDavid Gwynne
quirk a few things before it will work. this blacklists that controller in ahci so pciide will be able to match it instead. found by jasper@
2007-03-29Avoid leaking a ccb in error paths.Christopher Pascoe
2007-03-29Correct some minor whitespace issues.Christopher Pascoe
2007-03-28While we are determining which NCQ command failed, we will need to ensureChristopher Pascoe
that we don't accidentally complete any other outstanding commands. This introduces wrappers around get_ccb and put_ccb that can temporarily stash our outstanding command state while we are issuing recovery commands. This is just the first step in NCQ recovery - for now we will reset the port on error which will permit further commands to be issued after a NCQ error. ok dlg@
2007-03-28Due to a logic inversion, we would error out any commands that had completedChristopher Pascoe
successfully and not the ones that had actually failed to complete when unable to recover from an NCQ error. ok dlg@
2007-03-28Improve output of some debugging messages.Christopher Pascoe
2007-03-28Some more safety checks on ccb state.Christopher Pascoe
2007-03-27attach ahci based on the pci class and interface fields, not just on aDavid Gwynne
list of pci devices. WARNING: this will cause your disks to change name (wd -> sd) on a supported controller.
2007-03-23Turn AHCI_DEBUG back on for now, so we can see if any commands are timingChristopher Pascoe
out or erroring around the cache flush time.
2007-03-23Track the ATA xfer's state more closely - may help us identify why someChristopher Pascoe
are seeing a panic at halt time.
2007-03-22Let atascsi issue NCQ commands if the controller supports it.Christopher Pascoe
This includes a nasty hack to reduce openings and throw away command slots if the device supports a lower queue depth than the host controller does. Yes, we're thinking about a better solution.
2007-03-21NCQ commands generate a "Set Device Bits" FIS upon completion. Enable theChristopher Pascoe
generation of interrupts when they arrive.
2007-03-21Add support for issuing NCQ commands via AHCI.Christopher Pascoe
Because you cannot have NCQ commands active at the same time as standard (non-queued) commands, we must introduce a queueing scheme into the driver. This scheme ensures that a standard command is only issued to the drive when all currently active NCQ commands have finished, and that NCQ command issue is delayed when we have a pending standard command. Additionally, the queueing scheme adds a constraint to ensure that there are never more than two standard commands issued on a port at once. This should ensure that commands become active in the order they were submitted (regardless of their command slot number) both initially and when the port is reactivated after error recovery. These points mean that issuing a standard command effectively serialises the port, which may help us implement meaningful I/O barriers in the future.
2007-03-21dont print if there is a device found or not, you can figure that out byDavid Gwynne
seeing things attach to the scsibus. ok pascoe@
2007-03-21replace the array of u_int8_ts for the fis/registers with a struct to makeDavid Gwynne
it a bit easier to read. there are variations on this, but they can be defined later.
2007-03-21For now, reserve one opening so we always have a CCB free to issue a softChristopher Pascoe
reset with during error recovery. Also, ensure that that CCB has been stopped on the chip before putting it back in the pool.
2007-03-20Use ALLOCNOW flag when creating PRDT dmamap, otherwise it could fail duringChristopher Pascoe
error handling.
2007-03-20Our timeout and error handlers complete the commands for us, so we shouldChristopher Pascoe
always return ATA_COMPLETE in the polled transfer case. Also, respect the passed in timeout value when polling.
2007-03-20commit the rest of the jmicron ids. jsg has been trying to get me to addDavid Gwynne
these since last year, but i didnt see the point till the code would be useful anywhere.
2007-03-20Add support for ATA PACKET commands. This should make ATAPI cdrom drives,Christopher Pascoe
etc, just work.
2007-03-20Catch failed commands and copy the error taskfile back to the ata_cmd,Christopher Pascoe
so that atascsi can deal with it.
2007-03-20Add timeout handling for ATA commands.Christopher Pascoe
2007-03-20Spec says we can't write anything other than the global host control registerChristopher Pascoe
before we enable AHCI, so enable it before resetting saved capabilities.
2007-03-20Minor style fixup.Christopher Pascoe
2007-03-20Request "descriptor processed" interrupts only for PIO requests (inquiry,Christopher Pascoe
etc), and request that the D2H FIS at the completion of all (DMA) commands generate an interrupt. This makes each data transfer generate one interrupt instead of two and should guarantee that the interrupt that is generated actually arrives after the command has completed.
2007-03-20Calculate the residual and copy it back to the scsi_xfer, so that RW actuallyChristopher Pascoe
works. From dlg@
2007-03-20Split PRDT unload out into its own function, for symmetry.Christopher Pascoe
2007-03-20Instead of having a copy of every register that we will issue in the ata_cmd,Christopher Pascoe
simply include a pointer to the command FIS that we will issue to the device. Include another space where we can copy back an error register set from a failed command. This means that we can now build and issue arbitrary commands from atascsi, and retrieve errors back.
2007-03-20Change API for struct ata_xfer allocation to move it into the device thatChristopher Pascoe
atascsi will be driving, and add it to the AHCI CCB. This effectively gives us all the resources we need for a transfer in one hit, meaning that we don't need to worry about whether we will have a pool shortage or not enough CCBs. The SCSI mid layer should take care to never exceed the number of CCBs we have available, based on our sc_link.openings.
2007-03-07Implement hardware interrupt handler. For now, detect command completionChristopher Pascoe
and shut down the controller upon error (no recovery).
2007-03-06Add missing splx in poll path.Christopher Pascoe
2007-03-06Update CCS macro to return the current command slot rather than just beingChristopher Pascoe
a mask. Fix some typos and try to keep functions in the same order as prototypes to make the code easier to navigate.
2007-03-06big changes to the completion path in ahci.cDavid Gwynne
- add a ccb_done member to the ahci_ccb, which points to a function that is used to complete the current xfer - ccbs no longer rely on an ata_xfer being provided for submission to work - ahci is stupid and has no way to telling you the difference between an empty command slot, and a completed command. we keep track of active commands with ap_active in ahci_port, so we dont try and complete commands we havent actually submitted - ahci_start simple submits a command to the hardware now - provide the start of an interrupt handler for each port (which is not yet called by the controllers interrupt handler) - provide an ahci_poll which is built on top of ahci_start and ahci_port_intr - remove the fake ata_xfers from the softreset path - on completion of an ahci command, sync the relevant dma memory - provide a completion path for ata_xfers which syncs the xfers buffer and calls the xfers completion handler in atascsi.c: - start defining the contents of the response to an ATA IDENTIFY command specific to SATA - implement the faking of scsi inquiries, so now you'll actually see a disk attach to ahci. - start implementing a fake scsi read capacity. it presents a fake geometry though, so dont get too excited when ahci magically makes your disk have a terabyte in size. lots of discussion, help, tweaks, and an ok from pascoe@
2007-03-06since we dont overwrite the dva of the cmd_table in the cmd_hdr now, weDavid Gwynne
dont have to carry the cmd_tables dva around in the ccb anymore.
2007-03-06dont do pointer maths with void *David Gwynne
2007-03-06Apply a SG segment size limit and remove the length check.Christopher Pascoe
2007-03-06No need to continually assign the control table addresses, provided we don'tChristopher Pascoe
ever zero out the whole command header. Also add some diagnostic checks to ensure we don't violate any of the controller's DMA address/size restrictions.
2007-03-06dlg@ advises that the bus_space operations will endian convert the DMA baseChristopher Pascoe
addresses for me when it writes to the registers. Don't swap them manually.
2007-03-06Make the 1:1 mapping of command slot to command header/table entriesChristopher Pascoe
explicit by including pointers to both of them in the ccb. Inspired by dlg@