From owner-freebsd-bugs@FreeBSD.ORG Fri Dec 14 22:20:04 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC92016A46E for ; Fri, 14 Dec 2007 22:20:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id AC8DE13C469 for ; Fri, 14 Dec 2007 22:20:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id lBEMK4LF091386 for ; Fri, 14 Dec 2007 22:20:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id lBEMK4Tq091385; Fri, 14 Dec 2007 22:20:04 GMT (envelope-from gnats) Date: Fri, 14 Dec 2007 22:20:04 GMT Message-Id: <200712142220.lBEMK4Tq091385@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: goran.tal@gmail.com Cc: Subject: Re: kern/115623: [patch] cardbus fails to read CIS from option ROM X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: goran.tal@gmail.com List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2007 22:20:05 -0000 The following reply was made to PR kern/115623; it has been noted by GNATS. From: goran.tal@gmail.com To: bug-followup@freebsd.org Cc: Subject: Re: kern/115623: [patch] cardbus fails to read CIS from option ROM Date: Fri, 14 Dec 2007 17:18:48 -0500 This is the same patch, this time send inline, as there were problems with the attachment. --- src/sys/dev/cardbus/cardbus_cis.c~ 2007-06-08 00:03:57.000000000 -0400 +++ src/sys/dev/cardbus/cardbus_cis.c 2007-12-09 16:20:26.000000000 -0500 @@ -435,10 +435,11 @@ struct resource *res) { if (res != CIS_CONFIG_SPACE) { - bus_release_resource(child, SYS_RES_MEMORY, rid, res); + bus_release_resource(cbdev, SYS_RES_MEMORY, rid, res); if (rid == PCIM_CIS_ASI_ROM) pci_write_config(child, rid, pci_read_config(child, rid, 4) & ~PCIR_BIOS, 4); + PCI_DISABLE_IO(cbdev, child, SYS_RES_MEMORY); } } @@ -448,6 +449,8 @@ { struct resource *res; uint32_t space; + uint32_t testval; + uint32_t size; space = *start & PCIM_CIS_ASI_MASK; switch (space) { @@ -476,10 +479,13 @@ space); return (NULL); } + pci_write_config(child, *rid, 0xffffffff, 4); + testval = pci_read_config(child, *rid, 4); + size = CARDBUS_MAPREG_MEM_SIZE(testval); /* allocate the memory space to read CIS */ - res = bus_alloc_resource(child, SYS_RES_MEMORY, rid, 0, ~0, 1, - rman_make_alignment_flags(4096) | RF_ACTIVE); + res = bus_alloc_resource(cbdev, SYS_RES_MEMORY, rid, 0, ~0, size, + rman_make_alignment_flags(size) | RF_ACTIVE); if (res == NULL) { device_printf(cbdev, "Unable to allocate resource " "to read CIS.\n"); @@ -488,6 +494,7 @@ if (*rid == PCIR_BIOS) pci_write_config(child, *rid, rman_get_start(res) | PCIM_BIOS_ENABLE, 4); + PCI_ENABLE_IO(cbdev, child, SYS_RES_MEMORY); /* Flip to the right ROM image if CIS is in ROM */ if (space == PCIM_CIS_ASI_ROM) {