FreeBSD/sys/i386/i386/elan-mmcr.c
/*
 * Positively identifying the Elan can only be done through the PCI id of
 * the host-bridge, this function is called from i386/pci/pci_bus.c.
 */
Positively identifying the Elan can only be done through the PCI id of
the host-bridge, this function is called from i386/pci/pci_bus.c.
Positively identifying the Elan can only be done through the PCI id of the host - bridge this function is called from i386 / pci / pci_bus . c .
void
init_AMD_Elan_sc520(void)
{
	u_int new;
	int i;
	mmcrptr = pmap_mapdev(0xfffef000, 0x1000);
	elan_mmcr = (volatile struct elan_mmcr *)mmcrptr;
	new = 1189161;
	i = kernel_sysctlbyname(&thread0, "machdep.i8254_freq", 
	    NULL, 0, &new, sizeof new, NULL, 0);
	if (bootverbose || 1)
		printf("sysctl machdep.i8254_freq=%d returns %d\n", new, i);
	elan_mmcr->GPTMR2MAXCMPA = 0;
	elan_mmcr->GPTMR2CTL = 0xc001;
#ifdef CPU_ELAN_PPS
	elan_mmcr->CSPFS &= ~0x10;
	elan_mmcr->GPTMR1CTL = 0x8000 | 0x4000 | 0x10 | 0x1;
	elan_mmcr->GPTMR1MAXCMPA = 0x0;
	elan_mmcr->GPTMR1MAXCMPB = 0x0;
	elan_pps.ppscap |= PPS_CAPTUREASSERT;
	pps_init(&elan_pps);
#endif
	tc_init(&elan_timecounter);
}
void init_AMD_Elan_sc520 ( void ) { u_int new ; int i ; mmcrptr = pmap_mapdev ( 0xfffef000 , 0x1000 ) ; elan_mmcr = ( volatile struct elan_mmcr * ) mmcrptr ; new = 1189161 ; i = kernel_sysctlbyname ( & thread0 , " " , NULL , 0 , & new , sizeof new , NULL , 0 ) ; if ( bootverbose || 1 ) printf ( " \n " , new , i ) ; elan_mmcr -> GPTMR2MAXCMPA = 0 ; elan_mmcr -> GPTMR2CTL = 0xc001 ; #ifdef CPU_ELAN_PPS elan_mmcr -> CSPFS &= ~ 0x10 ; elan_mmcr -> GPTMR1CTL = 0x8000 | 0x4000 | 0x10 | 0x1 ; elan_mmcr -> GPTMR1MAXCMPA = 0x0 ; elan_mmcr -> GPTMR1MAXCMPB = 0x0 ; elan_pps . ppscap |= PPS_CAPTUREASSERT ; pps_init ( & elan_pps ) ; #endif tc_init ( & elan_timecounter ) ; }
Positively identifying the Elan can only be done through the PCI id of
 the host-bridge, this function is called from i386/pci/pci_bus.c.
Positively identifying the Elan can only be done through the PCI id of the host - bridge this function is called from i386 / pci / pci_bus . c .
/*-
	 * The i8254 is driven with a nonstandard frequency which is
	 * derived thusly:
	 *   f = 32768 * 45 * 25 / 31 = 1189161.29...
	 * We use the sysctl to get the i8254 (timecounter etc) into whack.
	 */ /* Start GP timer #2 and use it as timecounter, hz permitting */ /* Set up GP timer #1 as pps counter */