diff -u /home/ctm/src/sys/pci/intpm.c ./intpm.c --- /home/ctm/src/sys/pci/intpm.c Fri Sep 3 03:16:24 1999 +++ ./intpm.c Mon Sep 13 00:07:12 1999 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -43,7 +44,7 @@ #include #include #include - +#include #include "smbus_if.h" /*This should be removed if force_pci_map_int supported*/ @@ -640,8 +641,17 @@ } DRIVER_MODULE(intsmb, intpm , intpm_driver, intsmb_devclass, 0, 0); - - +#ifdef PIIX_POWEROFF_ENABLE +static void intpm_poweroff(void *,int); +static void intpm_poweroff(void *arg,int howto) +{ + struct intpm_pci_softc *sc=(struct intpm_pci_softc *) arg; + if(!(howto &RB_POWEROFF)) + return; + /*Powermanagment Control register, Power off(b13), method=0(b12:10)*/ + bus_space_write_2(sc->pmst,sc->pmsh,PIIX4_PMCTL,1<<13); +} +#endif static void intpm_intr __P((void *arg)); static int intpm_attach(device_t dev) @@ -649,10 +659,10 @@ int value; int unit=device_get_unit(dev); void *ih; + struct intpm_pci_softc *sciic; int error; char * str; { - struct intpm_pci_softc *sciic; device_t smbinterface; int rid; struct resource *res; @@ -675,7 +685,7 @@ /*Do as I tell!*/ value=pci_read_config(dev,rid,4); res=bus_alloc_resource(dev,SYS_RES_IOPORT,&rid,value&(~1), - (value&(~1))+256,256,RF_ACTIVE); + (value&(~1))+0x10,0x10,RF_ACTIVE); #endif if(res==NULL){ device_printf(dev,"Could not allocate Bus space\n"); @@ -729,10 +739,29 @@ } device_probe_and_attach(smbinterface); } - - value=pci_read_config(dev,PCI_BASE_ADDR_PM,4); - printf("intpm%d: PM %s %x \n",unit,(value&1)?"I/O mapped":"Memory",value&0xfffe); - return 0; + /*Install Poweroff Handler*/ + { + int rid; + struct resource *respm; + rid=PCI_BASE_ADDR_PM; + value=pci_read_config(dev,PCI_BASE_ADDR_PM,4); + respm=bus_alloc_resource(dev,SYS_RES_IOPORT,&rid,value&(~1), + (value&(~1))+0x40, + 0x40,RF_ACTIVE); + sciic->pmst=rman_get_bustag(respm); + sciic->pmsh=rman_get_bushandle(respm); + /* + * XXX This Functional *ALWAYS* conflict ACPI. + * (ACPI is impremented by this controller.) + */ +#ifdef PIIX_POWEROFF_ENABLE + EVENTHANDLER_REGISTER(shutdown_final,intpm_poweroff,sciic, + SHUTDOWN_PRI_LAST); + device_printf(dev,"Poweroff handler installed\n"); +#endif + printf("intpm%d: PM %s %x \n",unit,(value&1)?"I/O mapped":"Memory",sciic->pmsh); + } + return 0; } static int intpm_probe(device_t dev) Only in .: intpmpci.diff diff -u /home/ctm/src/sys/pci/intpmreg.h ./intpmreg.h --- /home/ctm/src/sys/pci/intpmreg.h Fri Sep 3 03:16:24 1999 +++ ./intpmreg.h Mon Sep 13 00:03:00 1999 @@ -73,5 +73,6 @@ #define PIIX4_SMBSLVCMD 0x09 #define PIIX4_SMBSLVEVT 0x0a #define PIIX4_SMBSLVDAT 0x0c +#define PIIX4_PMCTL 0x4 /*This is SMBus alart response address*/ #define SMBALTRESP 0x18