anchor.diff:    ;; LBA bit.
     (setf (ahci-fis ahci port +sata-register-device+) +ata-lba+))
   
  -(defun ahci-setup-buffer (ahci port buffer length write)
  +(defun ahci-setup-buffer (ahci port buffer length write atapi)
     "Configure the DMA buffer for this command."
     (let* ((ct (ahci-port-command-table (ahci-port ahci port)))
            (cl (ahci-port-command-list (ahci-port ahci port))))
  
positive.code:                    +ata-command-write-dma-ext+
                     t))
  
  (defun ahci-detect-drive (ahci port)
    ;; Issue IDENTIFY.
    ;; Dump the IDENTIFY data just after the command table.
    (let* ((port-info (ahci-port ahci port))
           (identify-data-phys (+ (ahci-port-command-table port-info) #x100))
           (identify-data (convert-to-pmap-address identify-data-phys)))
      (ahci-setup-buffer ahci port identify-data-phys 512 nil)
      (ahci-dump-port-registers ahci port)
      (ahci-run-command ahci port +ata-command-identify+)
      ;; ### Not sure if ATAPI devices still abort IDENTIFY. I guess they do.
      ;; Check in vbox - easy.
      (let* ((tfd (ahci-port-register ahci port +ahci-register-PxTFD+))
             (sts (ldb (byte +ahci-PxTFD-STS-size+ +ahci-PxTFD-STS-position+) tfd)))
        (when (logtest sts +ata-err+)
  
negative.code:                            +ahci-PxSSTS-DET-ready+))
                   ;; A device is attached and ready for use.
                   (debug-print-line "Initializing device on port " port)
                   (cond ((eql (ahci-port-register ahci port +ahci-register-PxSIG+)
                               #xEB140101)
                          (ahci-detect-atapi-drive ahci port))
                         (t
                          (ahci-detect-drive ahci port))))
                  (t
                   (debug-print-line "No device present on port. TFD:" tfd " SSTS:" sata-sts))))))
      (ahci-dump-global-registers ahci)
      ))
  