From owner-p4-projects@FreeBSD.ORG Mon Nov 5 18:54:52 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AAD6C16A418; Mon, 5 Nov 2007 18:54:52 +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 846E216A41B for ; Mon, 5 Nov 2007 18:54:51 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 54AB513C480 for ; Mon, 5 Nov 2007 18:54:51 +0000 (UTC) (envelope-from gonzo@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 lA5IspQT014788 for ; Mon, 5 Nov 2007 18:54:51 GMT (envelope-from gonzo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lA5IspJx014785 for perforce@freebsd.org; Mon, 5 Nov 2007 18:54:51 GMT (envelope-from gonzo@FreeBSD.org) Date: Mon, 5 Nov 2007 18:54:51 GMT Message-Id: <200711051854.lA5IspJx014785@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko To: Perforce Change Reviews Cc: Subject: PERFORCE change 128688 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: Mon, 05 Nov 2007 18:54:53 -0000 http://perforce.freebsd.org/chv.cgi?CH=128688 Change 128688 by gonzo@gonzo_jeeves on 2007/11/05 18:53:51 o Perform PCI registers fixup for Korina ethernet on PCI bridge initialization. Affected files ... .. //depot/projects/mips2/src/sys/mips/mips32/idt/idtpci.c#4 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips32/idt/idtpci.c#4 (text+ko) ==== @@ -111,6 +111,13 @@ #define REG_READ(o) *((volatile uint32_t *)MIPS_PHYS_TO_KSEG1(IDT_BASE_PCI + (o))) #define REG_WRITE(o,v) (REG_READ(o)) = (v) +unsigned int korina_fixup[24] = { + 0x00000157, 0x00000000, 0x00003c04, 0x00000008, 0x18800001, 0x18000001, + 0x48000008, 0x00000000, 0x00000000, 0x00000000, 0x011d0214, 0x00000000, + 0x00000000, 0x00000000, 0x38080101, 0x00008080, 0x00000d6e, 0x00000000, + 0x00000051, 0x00000000, 0x00000055, 0x18000000, 0x00000000, 0x00000000 +}; + struct idtpci_softc { device_t sc_dev; @@ -122,6 +129,13 @@ uint32_t sc_io; }; +static uint32_t +idtpci_make_addr(int bus, int slot, int func, int reg) +{ + + return 0x80000000 | (bus << 16) | (slot << 11) | (func << 8) | reg; +} + static int idtpci_probe(device_t dev) { @@ -135,6 +149,8 @@ int busno = 0; struct idtpci_softc *sc = device_get_softc(dev); unsigned int pci_data, force_endianess = 0; + int i; + bus_addr_t addr; sc->sc_dev = dev; sc->sc_busno = busno; @@ -210,6 +226,19 @@ /* Rewrite Target Control register with default values */ REG_WRITE(IDT_PCI_TC, (IDT_PCI_TC_DTIMER << 8) | IDT_PCI_TC_RTIMER); + /* Perform Korina fixup */ + addr = idtpci_make_addr(0, 0, 0, 4); + for (i = 0; i < 24; i++) { + + REG_WRITE(IDT_PCI_CFG_ADDR, addr); + REG_WRITE(IDT_PCI_CFG_DATA, korina_fixup[i]); + __asm__ volatile ("sync"); + + REG_WRITE(IDT_PCI_CFG_ADDR, 0); + REG_WRITE(IDT_PCI_CFG_DATA, 0); + addr += 4; + } + /* Use KSEG1 to access IO ports for it is uncached */ sc->sc_io = 0; sc->sc_io_rman.rm_type = RMAN_ARRAY; @@ -249,13 +278,6 @@ } static uint32_t -idtpci_make_addr(int bus, int slot, int func, int reg) -{ - - return 0x80000000 | (bus << 16) | (slot << 11) | (func << 8) | reg; -} - -static uint32_t idtpci_read_config(device_t dev, int bus, int slot, int func, int reg, int bytes) { @@ -455,6 +477,7 @@ } rv = rman_reserve_resource(rm, start, end, count, flags, child); + if (rv == NULL) return (NULL); @@ -493,7 +516,7 @@ int flags, driver_filter_t *filt, driver_intr_t *handler, void *arg, void **cookiep) { - + panic("setup_intr"); #if 0 struct idtpci_softc *sc = device_get_softc(dev); struct intr_event *event;