anchor.diff:      (setf (sys.int::io-port/8 (+ (ata-controller-command controller)
                                    +ata-register-command+))
             command))
  +  t)
  +
  +(defun ata-issue-lba48-command (device lba count command)
  +  (let* ((controller (ata-device-controller device))
  +         (command-base (ata-controller-command controller)))
  +    ;; Select the device.
  +    (when (not (ata-select-device controller (ata-device-channel device)))
  +      (debug-write-line "Could not select ata device.")
  +      (return-from ata-issue-lba48-command nil))
  +    (latch-reset (ata-controller-irq-latch controller))
  +    ;; HI3: Write_parameters
  +    (when (eql count 65536)
  +      (setf count 0))
  +    (flet ((wr (reg val)
  +             (setf (sys.int::io-port/8 (+ command-base reg)) val)))
  +      (wr +ata-register-count+    (ldb (byte 8 8) count))
  +      (wr +ata-register-count+    (ldb (byte 8 0) count))
  +      (wr +ata-register-lba-high+ (ldb (byte 8 40) lba))
  +      (wr +ata-register-lba-mid+  (ldb (byte 8 32) lba))
  +      (wr +ata-register-lba-low+  (ldb (byte 8 24) lba))
  +      (wr +ata-register-lba-high+ (ldb (byte 8 16) lba))
  +      (wr +ata-register-lba-mid+  (ldb (byte 8 8) lba))
  +      (wr +ata-register-lba-low+  (ldb (byte 8 0) lba))
  +      (wr +ata-register-device+ (logior (ecase (ata-device-channel device)
  +                                          (:master 0)
  +                                          (:slave +ata-dev+))
  +                                        +ata-lba+))
  +      ;; HI4: Write_command
  +      (wr +ata-register-command+ command)))
     t)
   
   (defun ata-check-status (device &optional (timeout 30))
  
positive.code:     (dotimes (i 256)
        (setf (svref buf i) (sys.int::io-port/16 (+ (ata-controller-command controller)
                                                    +ata-register-data+))))
      (let ((device (make-ata-device :controller controller
                                     :channel channel
                                     ;; Check for large sector drives.
                                     :block-size (if (and (logbitp 14 (svref buf 106))
                                                          (not (logbitp 13 (svref buf 106))))
                                                     (logior (ash (svref buf 118) 16)
                                                             (svref buf 117))
                                                     512)
                                     ;; TODO: LBA48 support.
                                     :sector-count (logior (ash (svref buf 61) 16)
                                                           (svref buf 60)))))
        (setf *ata-devices*
              (sys.int::cons-in-area
               device
               *ata-devices*
               :wired))
        (register-disk device (ata-device-sector-count device) (ata-device-block-size device) 256 'ata-read 'ata-write))))
  
  (defun ata-issue-lba28-command (device lba count command)
  
negative.code:     (assert (>= lba 0))
      (assert (>= count 0))
      (assert (< (+ lba count) (ata-device-sector-count device)))
      (cond
        ((ata-device-lba48-capable device)
         (when (> count 65536)
           (debug-print-line "Can't do " what " of more than 65,536 sectors.")
           (return-from ata-read-write (values nil :too-many-sectors))))
        (t
         (when (> count 256)
           (debug-print-line "Can't do " what " of more than 256 sectors.")
           (return-from ata-read-write (values nil :too-many-sectors)))))
      (when (eql count 0)
        (return-from ata-read-write t))
      (cond ((and (<= +physical-map-base+ mem-addr)
  