Author: jhb
Date: Sat Apr 28 00:16:54 2018
New Revision: 333080
URL: https://svnweb.freebsd.org/changeset/base/333080

Log:
  MFC 332733:
  Workaround fixed I/O port resources encoded as I/O port ranges in _CRS.
  
  ACPI I/O port descriptors use _MIN and _MAX fields to specify the set
  of allowable base (start) addresses for an I/O port resource along with
  a _LEN field specifying the length.  A fixed resource is supposed to be
  encoded with _MIN == _MAX, but some buggy firmwares instead set _MAX to
  the end of the fixed range.  Relocating I/O ranges only make sense in
  _PRS (possible resource settings), not in _CRS (current resource settings),
  so if an I/O port range with _MAX set set to the end of the range is
  present in _CRS, treat it as a fixed I/O port resource starting at
  _MIN.
  
  PR:           224096

Modified:
  stable/10/sys/dev/acpica/acpi_resource.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/dev/acpica/acpi_resource.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/sys/dev/acpica/acpi_resource.c
==============================================================================
--- stable/10/sys/dev/acpica/acpi_resource.c    Fri Apr 27 22:15:18 2018        
(r333079)
+++ stable/10/sys/dev/acpica/acpi_resource.c    Sat Apr 28 00:16:54 2018        
(r333080)
@@ -515,6 +515,24 @@ acpi_res_set_iorange(device_t dev, void *context, uint
 
     if (cp == NULL)
        return;
+
+    /*
+     * XXX: Some BIOSes contain buggy _CRS entries where fixed I/O
+     * ranges have the maximum base address (_MAX) to the end of the
+     * I/O range instead of the start.  These are then treated as a
+     * relocatable I/O range rather than a fixed I/O resource.  As a
+     * workaround, treat I/O resources encoded this way as fixed I/O
+     * ports.
+     */
+    if (high == (low + length)) {
+       if (bootverbose)
+           device_printf(dev,
+               "_CRS has fixed I/O port range defined as relocatable\n");
+
+       bus_set_resource(dev, SYS_RES_IOPORT, cp->ar_nio++, low, length);
+       return;
+    }
+
     device_printf(dev, "I/O range not supported\n");
 }
 
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to