From owner-p4-projects@FreeBSD.ORG Sun Apr 27 18:46:53 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5E53C1065672; Sun, 27 Apr 2008 18:46:53 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06D321065670 for ; Sun, 27 Apr 2008 18:46:53 +0000 (UTC) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E1EC48FC14 for ; Sun, 27 Apr 2008 18:46:52 +0000 (UTC) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m3RIkqfs095328 for ; Sun, 27 Apr 2008 18:46:52 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m3RIkqhp095326 for perforce@freebsd.org; Sun, 27 Apr 2008 18:46:52 GMT (envelope-from marcel@freebsd.org) Date: Sun, 27 Apr 2008 18:46:52 GMT Message-Id: <200804271846.m3RIkqhp095326@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Cc: Subject: PERFORCE change 140747 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Apr 2008 18:46:53 -0000 http://perforce.freebsd.org/chv.cgi?CH=140747 Change 140747 by marcel@marcel_xcllnt on 2008/04/27 18:46:24 Improve support for ISA interrupts and devices as found on the MPC85xxCDS systems. This is a WIP. Affected files ... .. //depot/projects/e500/sys/powerpc/conf/MPC85XX#8 edit .. //depot/projects/e500/sys/powerpc/include/intr_machdep.h#6 edit .. //depot/projects/e500/sys/powerpc/mpc85xx/atpic.c#1 add .. //depot/projects/e500/sys/powerpc/mpc85xx/isa.c#1 add .. //depot/projects/e500/sys/powerpc/mpc85xx/pci_ocp.c#9 edit .. //depot/projects/e500/sys/powerpc/powerpc/autoconf.c#5 edit .. //depot/projects/e500/sys/powerpc/powerpc/intr_machdep.c#9 edit Differences ... ==== //depot/projects/e500/sys/powerpc/conf/MPC85XX#8 (text+ko) ==== @@ -54,6 +54,7 @@ device em device ether device fxp +#device isa device loop device md device miibus ==== //depot/projects/e500/sys/powerpc/include/intr_machdep.h#6 (text+ko) ==== @@ -37,6 +37,7 @@ driver_filter_t powerpc_ipi_handler; void powerpc_register_pic(device_t, u_int); +void powerpc_register_8259(device_t); void powerpc_dispatch_intr(u_int, struct trapframe *); int powerpc_enable_intr(void); ==== //depot/projects/e500/sys/powerpc/mpc85xx/pci_ocp.c#9 (text+ko) ==== @@ -427,9 +427,15 @@ * Default interrupt routing. */ if (intpin != 0) { - intline = intpin - 1; - intline += (bus != sc->sc_busnr) ? slot : 0; - intline = PIC_IRQ_EXT(intline & 3); + if (bus == 1 && slot == 4 && func == 2) + intline = 11; + else if (bus == 1 && slot == 4 && func == 3) + intline = 10; + else { + intline = intpin - 1; + intline += (bus != sc->sc_busnr) ? slot : 0; + intline = PIC_IRQ_EXT(intline & 3); + } } else intline = 0xff; @@ -490,17 +496,11 @@ } } if (vendor == 0x1106 && device == 0x0571) { + /* Enable pri & sec channels. */ + cr8 = pci_ocp_read_config(sc->sc_dev, bus, + slot, func, 0x40, 1); pci_ocp_write_config(sc->sc_dev, bus, slot, - func, 0xc4, 0x00, 1); - /* Set legacy mode. */ - pci_ocp_write_config(sc->sc_dev, bus, slot, - func, 0x40, 0x08, 1); - pci_ocp_write_config(sc->sc_dev, bus, slot, - func, PCIR_PROGIF, 0x00, 1); - pci_ocp_write_config(sc->sc_dev, bus, slot, - func, 0x42, 0x09, 1); - pci_ocp_write_config(sc->sc_dev, bus, slot, - func, 0x40, 0x0b, 1); + func, 0x40, cr8 | 3, 1); } /* Program the base address registers. */ ==== //depot/projects/e500/sys/powerpc/powerpc/autoconf.c#5 (text+ko) ==== @@ -24,6 +24,8 @@ * SUCH DAMAGE. */ +#include "opt_isa.h" + #include __FBSDID("$FreeBSD: src/sys/powerpc/powerpc/autoconf.c,v 1.17 2008/03/03 17:17:00 raj Exp $"); @@ -35,6 +37,12 @@ #include +#ifdef DEV_ISA +extern void isa_probe_children(device_t dev); + +device_t isa_bus_device; +#endif + static device_t nexusdev; static void configure_first(void *); @@ -62,6 +70,10 @@ { root_bus_configure(); +#ifdef DEV_ISA + if (isa_bus_device) + isa_probe_children(isa_bus_device); +#endif } static void ==== //depot/projects/e500/sys/powerpc/powerpc/intr_machdep.c#9 (text+ko) ==== @@ -100,6 +100,10 @@ static u_int stray_count; device_t pic; +device_t pic8259; + +#define ISA_IRQ(x) (pic8259 != NULL && (x) < 16) +#define PIC(x) (ISA_IRQ(x) ? pic8259 : pic) static void intrcnt_setname(const char *name, int index) @@ -166,7 +170,7 @@ { u_int irq = (uintptr_t)arg; - PIC_EOI(pic, irq); + PIC_EOI(PIC(irq), irq); } static void @@ -174,7 +178,7 @@ { u_int irq = (uintptr_t)arg; - PIC_MASK(pic, irq); + PIC_MASK(PIC(irq), irq); } static void @@ -182,7 +186,7 @@ { u_int irq = (uintptr_t)arg; - PIC_UNMASK(pic, irq); + PIC_UNMASK(PIC(irq), irq); } void @@ -192,6 +196,13 @@ pic = dev; } +void +powerpc_register_8259(device_t dev) +{ + + pic8259 = dev; +} + int powerpc_enable_intr(void) { @@ -205,10 +216,10 @@ if (i->trig != INTR_TRIGGER_CONFORM || i->pol != INTR_POLARITY_CONFORM) - PIC_CONFIG(pic, i->irq, i->trig, i->pol); + PIC_CONFIG(PIC(i->irq), i->irq, i->trig, i->pol); if (i->event != NULL) - PIC_ENABLE(pic, i->irq, vector); + PIC_ENABLE(PIC(i->irq), i->irq, vector); } return (0); @@ -235,7 +246,7 @@ i->cntp = &intrcnt[i->vector]; if (!cold) - PIC_ENABLE(pic, i->irq, i->vector); + PIC_ENABLE(PIC(irq), irq, i->vector); } error = intr_event_add_handler(i->event, name, filter, handler, arg, @@ -256,9 +267,6 @@ { struct powerpc_intr *i; - if (trig == INTR_TRIGGER_CONFORM && pol == INTR_POLARITY_CONFORM) - return (0); - i = intr_lookup(irq); if (i == NULL) return (ENOMEM); @@ -267,7 +275,7 @@ i->pol = pol; if (!cold) - PIC_CONFIG(pic, irq, trig, pol); + PIC_CONFIG(PIC(irq), irq, trig, pol); return (0); } @@ -302,5 +310,5 @@ } } if (i != NULL) - PIC_MASK(pic, i->irq); + PIC_MASK(PIC(i->irq), i->irq); }