Author: nwhitehorn
Date: Mon Nov 22 17:03:09 2010
New Revision: 215690
URL: http://svn.freebsd.org/changeset/base/215690

Log:
  MFC r214575:
  Allow access to the HT I/O port space on the IBM CPC9X5 northbridge chips.

Modified:
  stable/8/sys/powerpc/powermac/cpcht.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/powerpc/powermac/cpcht.c
==============================================================================
--- stable/8/sys/powerpc/powermac/cpcht.c       Mon Nov 22 17:01:40 2010        
(r215689)
+++ stable/8/sys/powerpc/powermac/cpcht.c       Mon Nov 22 17:03:09 2010        
(r215690)
@@ -142,6 +142,7 @@ struct cpcht_softc {
        vm_offset_t             sc_data;
        uint64_t                sc_populated_slots;
        struct                  rman sc_mem_rman;
+       struct                  rman sc_io_rman;
 
        struct cpcht_irq        htirq_map[128];
 };
@@ -156,6 +157,9 @@ static devclass_t   cpcht_devclass;
 
 DRIVER_MODULE(cpcht, nexus, cpcht_driver, cpcht_devclass, 0, 0);
 
+#define CPCHT_IOPORT_BASE      0xf4000000UL /* Hardwired */
+#define CPCHT_IOPORT_SIZE      0x00400000UL
+
 #define HTAPIC_REQUEST_EOI     0x20
 #define HTAPIC_TRIGGER_LEVEL   0x02
 #define HTAPIC_MASK            0x01
@@ -215,7 +219,14 @@ cpcht_attach(device_t dev)
        sc->sc_mem_rman.rm_type = RMAN_ARRAY;
        sc->sc_mem_rman.rm_descr = "CPCHT Device Memory";
        error = rman_init(&sc->sc_mem_rman);
+       if (error) {
+               device_printf(dev, "rman_init() failed. error = %d\n", error);
+               return (error);
+       }
 
+       sc->sc_io_rman.rm_type = RMAN_ARRAY;
+       sc->sc_io_rman.rm_descr = "CPCHT I/O Memory";
+       error = rman_init(&sc->sc_io_rman);
        if (error) {
                device_printf(dev, "rman_init() failed. error = %d\n", error);
                return (error);
@@ -227,6 +238,9 @@ cpcht_attach(device_t dev)
         * where we get the HT interrupts properties.
         */
 
+       /* I/O port mappings are usually not in the device tree */
+       rman_manage_region(&sc->sc_io_rman, 0, CPCHT_IOPORT_SIZE - 1);
+
        bzero(sc->htirq_map, sizeof(sc->htirq_map));
        for (child = OF_child(node); child != 0; child = OF_peer(child))
                cpcht_configure_htbridge(dev, child);
@@ -275,6 +289,9 @@ cpcht_configure_htbridge(device_t dev, p
                case OFW_PCI_PHYS_HI_SPACE_CONFIG:
                        break;
                case OFW_PCI_PHYS_HI_SPACE_IO:
+                       rman_manage_region(&sc->sc_io_rman, rp->pci_lo,
+                           rp->pci_lo + rp->size_lo - 1);
+                       break;
                case OFW_PCI_PHYS_HI_SPACE_MEM32:
                        rman_manage_region(&sc->sc_mem_rman, rp->pci_lo,
                            rp->pci_lo + rp->size_lo - 1);
@@ -482,8 +499,9 @@ cpcht_alloc_resource(device_t bus, devic
        switch (type) {
        case SYS_RES_IOPORT:
                end = min(end, start + count);
+               rm = &sc->sc_io_rman;
+               break;
 
-               /* FALLTHROUGH */
        case SYS_RES_MEMORY:
                rm = &sc->sc_mem_rman;
                break;
@@ -537,6 +555,9 @@ cpcht_activate_resource(device_t bus, de
 
                start = (vm_offset_t)rman_get_start(res);
 
+               if (type == SYS_RES_IOPORT)
+                       start += CPCHT_IOPORT_BASE;
+
                if (bootverbose)
                        printf("cpcht mapdev: start %zx, len %ld\n", start,
                            rman_get_size(res));
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to