This source file includes following definitions.
- cardbus_config_irq_and_cls
- cb_alloc
- cb_free
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #include <linux/kernel.h>
21 #include <linux/module.h>
22 #include <linux/pci.h>
23
24 #include <pcmcia/ss.h>
25
26
27 static void cardbus_config_irq_and_cls(struct pci_bus *bus, int irq)
28 {
29 struct pci_dev *dev;
30
31 list_for_each_entry(dev, &bus->devices, bus_list) {
32 u8 irq_pin;
33
34
35
36
37
38
39 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &irq_pin);
40 if (irq_pin) {
41 dev->irq = irq;
42 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
43 }
44
45
46
47
48
49
50 pci_set_cacheline_size(dev);
51
52 if (dev->subordinate)
53 cardbus_config_irq_and_cls(dev->subordinate, irq);
54 }
55 }
56
57
58
59
60
61
62
63
64 int __ref cb_alloc(struct pcmcia_socket *s)
65 {
66 struct pci_bus *bus = s->cb_dev->subordinate;
67 struct pci_dev *dev;
68 unsigned int max, pass;
69
70 pci_lock_rescan_remove();
71
72 s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0));
73 pci_fixup_cardbus(bus);
74
75 max = bus->busn_res.start;
76 for (pass = 0; pass < 2; pass++)
77 for_each_pci_bridge(dev, bus)
78 max = pci_scan_bridge(bus, dev, max, pass);
79
80
81
82
83 pci_bus_size_bridges(bus);
84 pci_bus_assign_resources(bus);
85 cardbus_config_irq_and_cls(bus, s->pci_irq);
86
87
88 if (s->tune_bridge)
89 s->tune_bridge(s, bus);
90
91 pci_bus_add_devices(bus);
92
93 pci_unlock_rescan_remove();
94 return 0;
95 }
96
97
98
99
100
101
102
103 void cb_free(struct pcmcia_socket *s)
104 {
105 struct pci_dev *bridge, *dev, *tmp;
106 struct pci_bus *bus;
107
108 bridge = s->cb_dev;
109 if (!bridge)
110 return;
111
112 bus = bridge->subordinate;
113 if (!bus)
114 return;
115
116 pci_lock_rescan_remove();
117
118 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list)
119 pci_stop_and_remove_bus_device(dev);
120
121 pci_unlock_rescan_remove();
122 }