Lines 61-66
static void sis_cleanup(void)
Link Here
|
61 |
(previous_size->size_value & ~(0x03))); |
61 |
(previous_size->size_value & ~(0x03))); |
62 |
} |
62 |
} |
63 |
|
63 |
|
|
|
64 |
static void sis_648_enable(u32 mode) |
65 |
{ |
66 |
struct pci_dev *device = NULL; |
67 |
u32 command; |
68 |
int rate; |
69 |
|
70 |
printk(KERN_INFO PFX "Found an AGP %d.%d compliant device at %s.\n", |
71 |
agp_bridge->major_version, |
72 |
agp_bridge->minor_version, |
73 |
agp_bridge->dev->slot_name); |
74 |
|
75 |
pci_read_config_dword(agp_bridge->dev, |
76 |
agp_bridge->capndx + PCI_AGP_STATUS, &command); |
77 |
|
78 |
command = agp_collect_device_status(mode, command); |
79 |
command |= AGPSTAT_AGP_ENABLE; |
80 |
rate = (command & 0x7) << 2; |
81 |
|
82 |
while ((device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, device)) != NULL) { |
83 |
u8 agp = pci_find_capability(device, PCI_CAP_ID_AGP); |
84 |
if (!agp) |
85 |
continue; |
86 |
|
87 |
printk(KERN_INFO PFX "Putting AGP V3 device at %s into %dx mode\n", |
88 |
pci_name(device), rate); |
89 |
|
90 |
pci_write_config_dword(device, agp + PCI_AGP_COMMAND, command); |
91 |
|
92 |
if(device->device == PCI_DEVICE_ID_SI_741) |
93 |
{ |
94 |
// weird: on 648 and 648fx chipsets any rate change in the target command register |
95 |
// triggers a 5ms screwup during which the master cannot be configured |
96 |
printk(KERN_INFO PFX "sis 741 agp fix - giving bridge time to recover\n"); |
97 |
set_current_state(TASK_UNINTERRUPTIBLE); |
98 |
schedule_timeout (1+(HZ*10)/1000); |
99 |
} |
100 |
} |
101 |
} |
102 |
|
64 |
static struct aper_size_info_8 sis_generic_sizes[7] = |
103 |
static struct aper_size_info_8 sis_generic_sizes[7] = |
65 |
{ |
104 |
{ |
66 |
{256, 65536, 6, 99}, |
105 |
{256, 65536, 6, 99}, |
Lines 176-181
static struct agp_device_ids sis_agp_dev
Link Here
|
176 |
{ }, /* dummy final entry, always present */ |
215 |
{ }, /* dummy final entry, always present */ |
177 |
}; |
216 |
}; |
178 |
|
217 |
|
|
|
218 |
static void __devinit sis_get_driver(struct agp_bridge_data *bridge) |
219 |
{ |
220 |
if(bridge->dev->device==PCI_DEVICE_ID_SI_741) |
221 |
{ |
222 |
if(agp_bridge->major_version==3 && agp_bridge->minor_version < 5) |
223 |
{ |
224 |
sis_driver.agp_enable=sis_648_enable; |
225 |
} |
226 |
else |
227 |
{ |
228 |
sis_driver.agp_enable = sis_648_enable; |
229 |
sis_driver.aperture_sizes = agp3_generic_sizes; |
230 |
sis_driver.size_type = U16_APER_SIZE; |
231 |
sis_driver.num_aperture_sizes = AGP_GENERIC_SIZES_ENTRIES; |
232 |
sis_driver.configure = agp3_generic_configure; |
233 |
sis_driver.fetch_size = agp3_generic_fetch_size; |
234 |
sis_driver.cleanup = agp3_generic_cleanup; |
235 |
sis_driver.tlb_flush = agp3_generic_tlbflush; |
236 |
} |
237 |
} |
238 |
bridge->driver=&sis_driver; |
239 |
} |
240 |
|
179 |
static int __devinit agp_sis_probe(struct pci_dev *pdev, |
241 |
static int __devinit agp_sis_probe(struct pci_dev *pdev, |
180 |
const struct pci_device_id *ent) |
242 |
const struct pci_device_id *ent) |
181 |
{ |
243 |
{ |
Lines 206-219
found:
Link Here
|
206 |
if (!bridge) |
268 |
if (!bridge) |
207 |
return -ENOMEM; |
269 |
return -ENOMEM; |
208 |
|
270 |
|
209 |
bridge->driver = &sis_driver; |
|
|
210 |
bridge->dev = pdev; |
271 |
bridge->dev = pdev; |
211 |
bridge->capndx = cap_ptr; |
272 |
bridge->capndx = cap_ptr; |
212 |
|
273 |
|
|
|
274 |
get_agp_version(bridge); |
275 |
|
213 |
/* Fill in the mode register */ |
276 |
/* Fill in the mode register */ |
214 |
pci_read_config_dword(pdev, |
277 |
pci_read_config_dword(pdev, |
215 |
bridge->capndx+PCI_AGP_STATUS, |
278 |
bridge->capndx+PCI_AGP_STATUS, |
216 |
&bridge->mode); |
279 |
&bridge->mode); |
|
|
280 |
|
281 |
sis_get_driver(bridge); |
217 |
|
282 |
|
218 |
pci_set_drvdata(pdev, bridge); |
283 |
pci_set_drvdata(pdev, bridge); |
219 |
return agp_add_bridge(bridge); |
284 |
return agp_add_bridge(bridge); |