anchor.diff:                      (decode-edid-standard-timings edid)))))
   
   (defun intel-gma-probe (pci-device)
  -  (let ((registers (pci:pci-io-region pci-device 0)))
  -    (pci:pci-io-region pci-device 1)
  -    (pci:pci-io-region pci-device 2)
  -    (pci:pci-io-region pci-device 3)
  -    (let ((card (make-instance 'intel-gma
  -                               :device pci-device
  -                               :registers registers)))
  -      (setf *card* card)
  -      (format t "Detected intel-gma at ~S~%" pci-device)
  -      (let ((mode (save-current-mode-parameters card))
  -            (framebuffer (framebuffer-address card)))
  -        ;; Take ownership of the compositor framebuffer.
  -        (when (and (eql (sup::framebuffer-layout (sup:current-framebuffer)) :x8r8g8b8)
  -                   (eql (framebuffer-address card)
  -                        (sup::framebuffer-base-address (sup:current-framebuffer))))
  -          (sup::video-set-framebuffer
  -           framebuffer
  -           (timing-horz-active mode)
  -           (timing-vert-active mode)
  -           (* (timing-horz-active mode) 4)
  -           :x8r8g8b8
  -           :device card)
  -          (mezzano.gui.compositor:force-redisplay t)))
  -      (setf (slot-value card '%edid)
  -            (ignore-errors (decode-raw-edid (read-raw-edid card))))
  -      card)))
  +  (format t "Detected intel-gma at ~S~%" pci-device)
  +  (let* ((card (make-instance 'intel-gma
  +                              :device pci-device
  +                              :registers (pci:pci-io-region pci-device +pci-bar-mmadr+)
  +                              :gm (pci:pci-io-region pci-device +pci-bar-gmadr+)
  +                              :gtt (pci:pci-io-region pci-device +pci-bar-gttadr+)))
  +         (mode (save-current-mode-parameters card))
  +         (framebuffer (framebuffer-address card)))
  +    (pci:pci-io-region pci-device +pci-bar-iobar+)
  +    (setf *card* card)
  +    ;; Take ownership of the compositor framebuffer.
  +    (when (and (eql (sup::framebuffer-layout (sup:current-framebuffer)) :x8r8g8b8)
  +               (eql (framebuffer-address card)
  +                    (sup::framebuffer-base-address (sup:current-framebuffer))))
  +      (sup::video-set-framebuffer
  +       framebuffer
  +       (timing-horz-active mode)
  +       (timing-vert-active mode)
  +       (* (timing-horz-active mode) 4)
  +       :x8r8g8b8
  +       :device card)
  +      (mezzano.gui.compositor:force-redisplay t))
  +    (setf (slot-value card '%edid)
  +          (ignore-errors (decode-raw-edid (read-raw-edid card))))
  +    card))
   
   ;; Scary warning:
   ;;   Be careful adding new IDs here.
  
positive.code: (defclass intel-gma ()
    ((%device :initarg :device :reader gma-device)
     (%registers :initarg :registers :reader gma-registers)
     (%edid :initarg :edid :reader gma-edid)
     (%lock :reader gma-lock)))
  
  (defmethod initialize-instance :after ((instance intel-gma) &key)
    (setf (slot-value instance '%lock) (sup:make-mutex instance)))
  
  ;;; Clock Control and Power Management Registers
  (defconstant +vga0+              #x06000)
  
negative.code:        ,@body)))
  
  (defun framebuffer-address (device)
    (logand (pci:pci-io-region (gma-device device) +pci-bar-gmadr+) (lognot #xF)))
  
  (defconstant +reference-frequency+ 96000000)
  
  