Re: ichwd0: unable to reserve GCS registers

From: John Baldwin <jhb_at_freebsd.org>
Date: Tue, 2 Aug 2011 18:06:04 -0400
On Saturday, July 30, 2011 2:49:52 am Andriy Gapon wrote:
> on 19/07/2011 18:16 John Baldwin said the following:
> > Hmm, can you get devinfo -r output from a working kernel with ichwd loaded?  
> > You might be able to just build the kernel with 'nooptions NEW_PCIB'.
> 
> I believe that I've got a similar problem with amdsbwd(4).
> It needs some resources (I/O ports) that belong to ACPI.
> The problem is that the driver attaches to isa bus which is under
> isab->pci->pcib and those particular resources are not assigned to the Host-PCI
> bridge.
> 
> I think that you already made a suggestion that perhaps isa bus should  directly
> attach to acpi bus when acpi is available.  Not sure if there are any
> alternative approaches.

Can you try this:

--- //depot/projects/pci/sys/dev/acpica/acpi.c	2011-06-25 12:05:19.000000000 0000
+++ //depot/projects/pci/sys/dev/acpica/acpi.c	2011-08-02 20:21:42.000000000 0000
_at__at_ -1238,7 +1238,6 _at__at_
     struct resource_list_entry *rle;
     struct resource_list *rl;
     struct resource *res;
-    struct rman *rm;
     int isdefault = (start == 0UL && end == ~0UL);
 
     /*
_at__at_ -1291,15 +1290,29 _at__at_
     } else
 	res = BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type, rid,
 	    start, end, count, flags);
-    if (res != NULL || start + count - 1 != end)
-	return (res);
 
     /*
      * If the first attempt failed and this is an allocation of a
      * specific range, try to satisfy the request via a suballocation
-     * from our system resource regions.  Note that we only handle
-     * memory and I/O port system resources.
+     * from our system resource regions.
      */
+    if (res == NULL && start + count - 1 == end)
+	res = acpi_alloc_sysres(child, type, rid, start, end, count, flags);
+    return (res);
+}
+
+/*
+ * Attempt to allocate a specific resource range from the system
+ * resource ranges.  Note that we only handle memory and I/O port
+ * system resources.
+ */
+struct resource *
+acpi_alloc_sysres(device_t child, int type, int *rid, u_long start, u_long end,
+    u_long count, u_int flags)
+{
+    struct rman *rm;
+    struct resource *res;
+
     switch (type) {
     case SYS_RES_IOPORT:
 	rm = &acpi_rman_io;
_at__at_ -1311,6 +1324,7 _at__at_
 	return (NULL);
     }
 
+    KASSERT(start + count - 1 == end, ("wildcard resource range"));
     res = rman_reserve_resource(rm, start, end, count, flags & ~RF_ACTIVE,
 	child);
     if (res == NULL)
--- //depot/projects/pci/sys/dev/acpica/acpi_pcib_acpi.c	2011-07-22 18:19:55.000000000 0000
+++ //depot/projects/pci/sys/dev/acpica/acpi_pcib_acpi.c	2011-08-02 20:21:42.000000000 0000
_at__at_ -541,6 +541,7 _at__at_
 {
 #ifdef NEW_PCIB
     struct acpi_hpcib_softc *sc;
+    struct resource *res;
 #endif
 
 #if defined(__i386__) || defined(__amd64__)
_at__at_ -549,8 +550,11 _at__at_
 
 #ifdef NEW_PCIB
     sc = device_get_softc(dev);
-    return (pcib_host_res_alloc(&sc->ap_host_res, child, type, rid, start, end,
-	count, flags));
+    res = pcib_host_res_alloc(&sc->ap_host_res, child, type, rid, start, end,
+	count, flags);
+    if (res == NULL && start + count - 1 == end)
+	res = acpi_alloc_sysres(child, type, rid, start, end, count, flags);
+    return (res);
 #else
     return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
 	count, flags));
--- //depot/projects/pci/sys/dev/acpica/acpivar.h	2011-06-22 16:25:39.000000000 0000
+++ //depot/projects/pci/sys/dev/acpica/acpivar.h	2011-08-02 20:21:42.000000000 0000
_at__at_ -382,6 +382,8 _at__at_
 		    struct resource *res, ACPI_RESOURCE *acpi_res);
 ACPI_STATUS	acpi_parse_resources(device_t dev, ACPI_HANDLE handle,
 		    struct acpi_parse_resource_set *set, void *arg);
+struct resource *acpi_alloc_sysres(device_t child, int type, int *rid,
+		    u_long start, u_long end, u_long count, u_int flags);
 
 /* ACPI event handling */
 UINT32		acpi_event_power_button_sleep(void *context);

-- 
John Baldwin
Received on Tue Aug 02 2011 - 20:06:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:16 UTC