source: hybrid/trunk/nanobsd/misc/patches/cardbus_cis.c.patch@ 10123

Last change on this file since 10123 was 10123, checked in by richardvm, 13 years ago

creating trunk based on 9.0

  • Property svn:mime-type set to text/txt
File size: 1.5 KB
Line 
1--- src/sys/dev/cardbus/cardbus_cis.c~ 2007-06-08 00:03:57.000000000 -0400
2+++ src/sys/dev/cardbus/cardbus_cis.c 2007-12-09 16:20:26.000000000 -0500
3@@ -435,10 +435,11 @@
4 struct resource *res)
5 {
6 if (res != CIS_CONFIG_SPACE) {
7- bus_release_resource(child, SYS_RES_MEMORY, rid, res);
8+ bus_release_resource(cbdev, SYS_RES_MEMORY, rid, res);
9 if (rid == PCIM_CIS_ASI_ROM)
10 pci_write_config(child, rid, pci_read_config(child,
11 rid, 4) & ~PCIR_BIOS, 4);
12+ PCI_DISABLE_IO(cbdev, child, SYS_RES_MEMORY);
13 }
14 }
15
16@@ -448,6 +449,8 @@
17 {
18 struct resource *res;
19 uint32_t space;
20+ uint32_t testval;
21+ uint32_t size;
22
23 space = *start & PCIM_CIS_ASI_MASK;
24 switch (space) {
25@@ -476,10 +479,13 @@
26 space);
27 return (NULL);
28 }
29+ pci_write_config(child, *rid, 0xffffffff, 4);
30+ testval = pci_read_config(child, *rid, 4);
31+ size = CARDBUS_MAPREG_MEM_SIZE(testval);
32
33 /* allocate the memory space to read CIS */
34- res = bus_alloc_resource(child, SYS_RES_MEMORY, rid, 0, ~0, 1,
35- rman_make_alignment_flags(4096) | RF_ACTIVE);
36+ res = bus_alloc_resource(cbdev, SYS_RES_MEMORY, rid, 0, ~0, size,
37+ rman_make_alignment_flags(size) | RF_ACTIVE);
38 if (res == NULL) {
39 device_printf(cbdev, "Unable to allocate resource "
40 "to read CIS.\n");
41@@ -488,6 +494,7 @@
42 if (*rid == PCIR_BIOS)
43 pci_write_config(child, *rid,
44 rman_get_start(res) | PCIM_BIOS_ENABLE, 4);
45+ PCI_ENABLE_IO(cbdev, child, SYS_RES_MEMORY);
46
47 /* Flip to the right ROM image if CIS is in ROM */
48 if (space == PCIM_CIS_ASI_ROM) {
Note: See TracBrowser for help on using the repository browser.