Initialize the PIIX timecounter in piix_attach(), which is called only

once, instead of doing it in piix_probe(), which is called every time
the PCI bus is rescanned.
This commit is contained in:
Dag-Erling Smørgrav 2003-04-06 18:42:22 +00:00
parent b5250c9f8d
commit 093395d3d5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113173

View File

@ -101,12 +101,11 @@ piix_probe (device_t dev)
switch (pci_get_devid(dev)) {
case 0x71138086:
d = pci_read_config(dev, 0x4, 2);
if (!(d & 1))
return 0; /* IO space not mapped */
d = pci_read_config(dev, 0x40, 4);
piix_timecounter_address = (d & 0xffc0) + 8;
piix_timecounter.tc_frequency = piix_freq;
tc_init(&piix_timecounter);
if (d & 1)
return (0);
printf("PIIX I/O space not mapped\n");
return (ENXIO);
default:
return (ENXIO);
};
return (ENXIO);
@ -115,8 +114,13 @@ piix_probe (device_t dev)
static int
piix_attach (device_t dev)
{
return 0;
u_int32_t d;
d = pci_read_config(dev, 0x40, 4);
piix_timecounter_address = (d & 0xffc0) + 8;
piix_timecounter.tc_frequency = piix_freq;
tc_init(&piix_timecounter);
return (0);
}
static device_method_t piix_methods[] = {