From owner-freebsd-bugs Mon May 22 7:30: 7 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id CC1FA37B998 for ; Mon, 22 May 2000 07:30:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id HAA33498; Mon, 22 May 2000 07:30:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from mail.surf1.de (mail.surf1.de [194.25.165.21]) by hub.freebsd.org (Postfix) with ESMTP id 4A41437B5A1 for ; Mon, 22 May 2000 07:20:19 -0700 (PDT) (envelope-from alex@cichlids.com) Received: from cichlids.com (p3E9C113F.dip0.t-ipconnect.de [62.156.17.63]) by mail.surf1.de (8.9.3/8.9.3) with ESMTP id QAA27125 for ; Mon, 22 May 2000 16:19:59 +0200 Received: from cichlids.cichlids.com (cichlids.cichlids.com [192.168.0.10]) by cichlids.com (Postfix) with ESMTP id 33114AC2C for ; Mon, 22 May 2000 16:20:43 +0200 (CEST) Received: (from alex@localhost) by cichlids.cichlids.com (8.9.3/8.9.3) id QAA00738; Mon, 22 May 2000 16:20:11 +0200 (CEST) (envelope-from alex) Message-Id: <200005221420.QAA00738@cichlids.cichlids.com> Date: Mon, 22 May 2000 16:20:11 +0200 (CEST) From: Alexander Langer Reply-To: alex@cichlids.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/18744: fix newbus stuff for bktr driver Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 18744 >Category: kern >Synopsis: fix newbus stuff for bktr driver >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon May 22 07:30:00 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Alexander Langer >Release: FreeBSD 5.0-CURRENT i386 >Organization: none >Environment: recent HEAD >Description: The newbus stuff _worked_ that way, but was broken nevertheless. This fixes the code in sense of newbus. Note: The memory alloced by vm_page_alloc_contig never get's free'ed and this prevents the module from being reloaded. Must be fixed later. >How-To-Repeat: >Fix: cvs diff: Diffing . Index: bktr_os.c =================================================================== RCS file: /usr/home/ncvs/src/sys/dev/bktr/bktr_os.c,v retrieving revision 1.7 diff -u -r1.7 bktr_os.c --- bktr_os.c 2000/04/16 07:50:09 1.7 +++ bktr_os.c 2000/05/22 14:16:11 @@ -274,7 +274,6 @@ unsigned int rev; unsigned int unit; int error = 0; - int rid; #ifdef BROOKTREE_IRQ u_long old_irq, new_irq; #endif @@ -293,8 +292,8 @@ /* * Map control/status registers. */ - rid = PCI_MAP_REG_START; - bktr->res_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, + bktr->mem_rid = PCI_MAP_REG_START; + bktr->res_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &bktr->mem_rid, 0, ~0, 1, RF_ACTIVE); if (!bktr->res_mem) { @@ -324,9 +323,9 @@ /* * Allocate our interrupt. */ - rid = 0; - bktr->res_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, - RF_SHAREABLE | RF_ACTIVE); + bktr->irq_rid = 0; + bktr->res_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &bktr->irq_rid, + 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE); if (bktr->res_irq == NULL) { device_printf(dev, "could not map interrupt\n"); error = ENXIO; @@ -405,8 +404,11 @@ return 0; fail: + if (bktr->res_irq) + bus_release_resource(dev, SYS_RES_IRQ, bktr->irq_rid, bktr->res_irq); + if (bktr->res_mem) + bus_release_resource(dev, SYS_RES_IRQ, bktr->mem_rid, bktr->res_mem); return error; - } /* @@ -423,12 +425,12 @@ /* FIXME - Free memory for RISC programs, grab buffer, vbi buffers */ /* * Deallocate resources. */ bus_teardown_intr(dev, bktr->res_irq, bktr->res_ih); - bus_release_resource(dev, SYS_RES_IRQ, 0, bktr->res_irq); - bus_release_resource(dev, SYS_RES_MEMORY, PCI_MAP_REG_START, bktr->res_mem); + bus_release_resource(dev, SYS_RES_IRQ, bktr->irq_rid, bktr->res_irq); + bus_release_resource(dev, SYS_RES_MEMORY, bktr->mem_rid, bktr->res_mem); return 0; } Index: bktr_reg.h =================================================================== RCS file: /usr/home/ncvs/src/sys/dev/bktr/bktr_reg.h,v retrieving revision 1.37 diff -u -r1.37 bktr_reg.h --- bktr_reg.h 2000/04/04 16:54:13 1.37 +++ bktr_reg.h 2000/05/22 13:58:32 @@ -498,7 +498,9 @@ pcici_t tag; /* 2.x PCI tag, for doing PCI commands */ #endif #if (__FreeBSD_version >= 400000) + int mem_rid; /* 4.x resource id */ struct resource *res_mem; /* 4.x resource descriptor for registers */ + int irq_rid; /* 4.x resource id */ struct resource *res_irq; /* 4.x resource descriptor for interrupt */ void *res_ih; /* 4.x newbus interrupt handler cookie */ #endif >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message