--- linux.19p2/drivers/char/Config.in Fri Mar 1 18:26:31 2002 +++ linux.19pre2-ac2/drivers/char/Config.in Sat Mar 2 00:51:24 2002 @@ -212,7 +219,9 @@ tristate 'NetWinder flash support' CONFIG_NWFLASH fi +dep_tristate 'AMD 768 Random Number Generator support' CONFIG_AMD_RNG $CONFIG_PCI dep_tristate 'Intel i8x0 Random Number Generator support' CONFIG_INTEL_RNG $CONFIG_PCI +dep_tristate 'AMD 762/768 native power management' CONFIG_AMD_PM768 $CONFIG_PCI tristate '/dev/nvram support' CONFIG_NVRAM tristate 'Enhanced Real Time Clock Support' CONFIG_RTC if [ "$CONFIG_IA64" = "y" ]; then --- linux.19p2/drivers/char/Makefile Fri Mar 1 18:26:31 2002 +++ linux.19pre2-ac2/drivers/char/Makefile Fri Mar 1 19:50:30 2002 @@ -204,6 +204,9 @@ obj-$(CONFIG_I8K) += i8k.o obj-$(CONFIG_DS1620) += ds1620.o obj-$(CONFIG_INTEL_RNG) += i810_rng.o +obj-$(CONFIG_AMD_RNG) += amd768_rng.o +obj-$(CONFIG_AMD_PM768) += amd768_pm.o + obj-$(CONFIG_ITE_GPIO) += ite_gpio.o obj-$(CONFIG_AU1000_GPIO) += au1000_gpio.o obj-$(CONFIG_COBALT_LCD) += lcd.o --- linux.19p2/drivers/char/amd768_pm.c Thu Jan 1 01:00:00 1970 +++ linux.19pre2-ac2/drivers/char/amd768_pm.c Sun Feb 10 21:28:33 2002 @@ -0,0 +1,151 @@ +/* + * Native power management driver for the AMD 760MPx series + * + * (c) Copyright 2002, Red Hat Inc, + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static u32 pmbase; /* PMxx I/O base */ +static struct pci_dev *amd762; + +/* + * amd768pm_init_one - look for and attempt to init PM + */ +static int __init amd768pm_init_one (struct pci_dev *dev) +{ + u32 reg; + u8 rnen; + int i; + + amd762 = pci_find_device(0x1022, 0x700C, NULL); + if(amd762 == NULL) + return -ENODEV; + + pci_read_config_dword(amd762, 0x70, ®); + if(!(reg & (1<<18))) + { + printk(KERN_INFO "AMD768_pm: enabling self refresh.\n"); + reg |= (1<<18); /* Enable self refresh */ + pci_write_config_dword(amd762, 0x70, reg); + } + + pci_read_config_dword(amd762, 0x58, ®); + if(reg&(1<<19)) + { + printk(KERN_INFO "AMD768_pm: DRAM refresh enabled.\n"); + reg &= ~(1<<19); /* Disable to allow self refresh modes */ + pci_write_config_dword(amd762, 0x58, reg); + } + + for(i=0; i 2) + { + printk(KERN_ERR "Only single and dual processor AMD762/768 is supported.\n"); + return -ENODEV; + } + pci_for_each_dev(pdev) { + if (pci_match_device (amd768pm_pci_tbl, pdev) != NULL) + goto match; + } + + return -ENODEV; + +match: + rc = amd768pm_init_one (pdev); + if (rc) + return rc; + return 0; +} + + +/* + * amd768pm_cleanup - shutdown the AMD pm module + */ +static void __exit amd768pm_cleanup (void) +{ +} + + +module_init (amd768pm_init); +module_exit (amd768pm_cleanup);