kern/115623: [patch] cardbus fails to read CIS from option ROM
goran.tal at gmail.com
goran.tal at gmail.com
Fri Dec 14 14:20:05 PST 2007
The following reply was made to PR kern/115623; it has been noted by GNATS.
From: goran.tal at gmail.com
To: bug-followup at 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) {
More information about the freebsd-bugs
mailing list