vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Nov 25, 2007 1:29 PM, Ted Unangst <ted.unangst@gmail.com> wrote: > On 11/25/07, Nikolay Sturm <sturm@erisiandiscord.de> wrote: > > * Ted Unangst [2007-11-24]: > > > revised: the stub is now called acpiapm (this name is only a prefix > > > > this doesn't build > > yes, sorry, i was trying to rename things and primarily use a amd64. > machine/ps.h should be machine/acpiapm.h and cdev_apm_init in conf.c > should be cdev_acpiapm_init. > > > > > > > Index: sys/arch/i386/i386/apm.c > > > ================================================== ================= > > > RCS file: /home/tedu/cvs/src/sys/arch/i386/i386/apm.c,v > > > retrieving revision 1.78 > > > diff -u -u -r1.78 apm.c > > > --- sys/arch/i386/i386/apm.c 3 Nov 2007 03:37:08 -0000 1.78 > > > +++ sys/arch/i386/i386/apm.c 24 Nov 2007 21:23:24 -0000 > > > @@ -66,6 +66,7 @@ > > > #include <i386/isa/nvram.h> > > > #include <dev/isa/isavar.h> > > > > > > +#include <machine/ps.h> > > > > I don't have this file on my machine and this > > > > > Index: sys/arch/i386/i386/conf.c > > > ================================================== ================= > > > RCS file: /home/tedu/cvs/src/sys/arch/i386/i386/conf.c,v > > > retrieving revision 1.119 > > > diff -u -u -r1.119 conf.c > > > --- sys/arch/i386/i386/conf.c 18 Sep 2007 18:13:06 -0000 1.119 > > > +++ sys/arch/i386/i386/conf.c 24 Nov 2007 21:24:21 -0000 > > > @@ -224,7 +222,7 @@ > > > cdev_disk_init(NCCD,ccd), /* 18: concatenated disk driver */ > > > cdev_ss_init(NSS,ss), /* 19: SCSI scanner */ > > > cdev_uk_init(NUK,uk), /* 20: unknown SCSI */ > > > - cdev_apm_init(NAPM,apm), /* 21: Advanced Power Management */ > > > + cdev_apm_init(1,acpiapm), /* 21: Advanced Power Management */ > > > cdev_fd_init(1,filedesc), /* 22: file descriptor pseudo-device */ > > > cdev_bpftun_init(NBPFILTER,bpf),/* 23: Berkeley packet filter */ > > > cdev_notdef(), /* 24 */ > > > Index: sys/arch/i386/include/conf.h > > > ================================================== ================= > > > RCS file: /home/tedu/cvs/src/sys/arch/i386/include/conf.h,v > > > retrieving revision 1.12 > > > diff -u -u -r1.12 conf.h > > > --- sys/arch/i386/include/conf.h 31 Dec 2005 21:22:34 -0000 1.12 > > > +++ sys/arch/i386/include/conf.h 24 Nov 2007 21:13:13 -0000 > > > @@ -49,13 +49,7 @@ > > > cdev_decl(pc); > > > > > > > > > -#define cdev_apm_init(c,n) {\ > > > - dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ > > > - (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ > > > - (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \ > > > - (dev_type_mmap((*))) enodev, 0, D_KQFILTER, dev_init(c,n,kqfilter) } > > > - > > > -#define cdev_acpi_init(c,n) {\ > > > +#define cdev_acpiapm_init(c,n) {\ > > > dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ > > > (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ > > > (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \ > > > > kills the build. > > > > Nikolay > > Hello. I also tried to test your patch but there are unfortunately more stuff that doesn't seem to work. In acpi_machdep.c there are references to acipopen and a few more functions that is not exposed (from sys/dev/acpi/acpi.c). Dmesgs in the bottom. This is of an old laptop that has problems with acpi. It gets very hot if acpi is enabled. Tedus patch updated here that works for me (can also be find here:http://www.dunceor.org/patches/acpiapm.diff) br dunceor Index: sys/arch/i386/conf/files.i386 ================================================== ================= RCS file: /cvs/src/sys/arch/i386/conf/files.i386,v retrieving revision 1.167 diff -u -r1.167 files.i386 --- sys/arch/i386/conf/files.i386 16 Nov 2007 21:07:01 -0000 1.167 +++ sys/arch/i386/conf/files.i386 25 Nov 2007 14:51:33 -0000 @@ -300,6 +300,8 @@ file arch/i386/i386/apm.c apm needs-count file arch/i386/i386/apmcall.S apm +file arch/i386/i386/acpiapm.c apm | acpi + # Intel SMP specification 1.4 define mpbios file arch/i386/i386/mpbios.c mpbios needs-flag Index: sys/arch/i386/i386/acpi_machdep.c ================================================== ================= RCS file: /cvs/src/sys/arch/i386/i386/acpi_machdep.c,v retrieving revision 1.8 diff -u -r1.8 acpi_machdep.c --- sys/arch/i386/i386/acpi_machdep.c 16 Nov 2007 02:45:56 -0000 1.8 +++ sys/arch/i386/i386/acpi_machdep.c 25 Nov 2007 14:51:33 -0000 @@ -24,6 +24,7 @@ #include <uvm/uvm_extern.h> #include <machine/bus.h> +#include <machine/acpiapm.h> #include <i386/isa/isa_machdep.h> #include <dev/isa/isareg.h> @@ -172,4 +173,8 @@ { sc->sc_interrupt = isa_intr_establish(NULL, sc->sc_fadt->sci_int, IST_LEVEL, IPL_TTY, acpi_interrupt, sc, sc->sc_dev.dv_xname); + acpiapm_open = acpiopen; + acpiapm_close = acpiclose; + acpiapm_ioctl = acpiioctl; + acpiapm_kqfilter = acpikqfilter; } Index: sys/arch/i386/i386/apm.c ================================================== ================= RCS file: /cvs/src/sys/arch/i386/i386/apm.c,v retrieving revision 1.78 diff -u -r1.78 apm.c --- sys/arch/i386/i386/apm.c 3 Nov 2007 03:37:08 -0000 1.78 +++ sys/arch/i386/i386/apm.c 25 Nov 2007 14:51:33 -0000 @@ -66,6 +66,7 @@ #include <i386/isa/nvram.h> #include <dev/isa/isavar.h> +#include <machine/acpiapm.h> #include <machine/biosvar.h> #include <machine/apmvar.h> @@ -916,6 +917,10 @@ } /* All is well, let the rest of the world know */ + acpiapm_open = acpiopen; + acpiapm_close = acpiclose; + acpiapm_ioctl = acpiioctl; + acpiapm_kqfilter = acpikqfilter; apm_attached = 1; } } else { Index: sys/arch/i386/i386/conf.c ================================================== ================= RCS file: /cvs/src/sys/arch/i386/i386/conf.c,v retrieving revision 1.119 diff -u -r1.119 conf.c --- sys/arch/i386/i386/conf.c 18 Sep 2007 18:13:06 -0000 1.119 +++ sys/arch/i386/i386/conf.c 25 Nov 2007 14:51:33 -0000 @@ -151,8 +151,6 @@ #include "sequencer.h" cdev_decl(music); #include "joy.h" -#include "acpi.h" -#include "apm.h" #include "bthub.h" #include "pctr.h" #include "bios.h" @@ -224,7 +222,7 @@ cdev_disk_init(NCCD,ccd), /* 18: concatenated disk driver */ cdev_ss_init(NSS,ss), /* 19: SCSI scanner */ cdev_uk_init(NUK,uk), /* 20: unknown SCSI */ - cdev_apm_init(NAPM,apm), /* 21: Advanced Power Management */ + cdev_acpiapm_init(1,acpiapm), /* 21: Advanced Power Management */ cdev_fd_init(1,filedesc), /* 22: file descriptor pseudo-device */ cdev_bpftun_init(NBPFILTER,bpf),/* 23: Berkeley packet filter */ cdev_notdef(), /* 24 */ @@ -307,7 +305,7 @@ cdev_hotplug_init(NHOTPLUG,hotplug), /* 82: devices hot plugging */ cdev_gpio_init(NGPIO,gpio), /* 83: GPIO interface */ cdev_nvram_init(NNVRAM,nvram), /* 84: NVRAM interface */ - cdev_acpi_init(NACPI,acpi), /* 85: ACPI */ + cdev_notdef(), /* 85: ACPI (deprecated) */ cdev_bthub_init(NBTHUB,bthub), /* 86: bthub */ }; int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); Index: sys/arch/i386/i386/acpiapm.c ================================================== ================= RCS file: sys/arch/i386/i386/acpiapm.c diff -N sys/arch/i386/i386/acpiapm.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sys/arch/i386/i386/acpiapm.c 25 Nov 2007 14:51:33 -0000 @@ -0,0 +1,58 @@ +/* $OpenBSD$ */ +/* + * Copyright (c) 2007 Ted Unangst <tedu@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/param.h> +#include <machine/conf.h> +#include <sys/event.h> + + +int (*acpiapm_open)(dev_t, int, int, struct proc *); +int (*acpiapm_close)(dev_t, int, int, struct proc *); +int (*acpiapm_ioctl)(dev_t, u_long, caddr_t, int, struct proc *); +int (*acpiapm_kqfilter)(dev_t, struct knote *); + +int +acpiapmopen(dev_t dev, int flag, int mode, struct proc *p) +{ + if (!acpiapm_open) + return ENODEV; + return acpiapm_open(dev, flag, mode, p); +} + +int +acpiapmclose(dev_t dev, int flag, int mode, struct proc *p) +{ + if (!acpiapm_close) + return ENODEV; + return acpiapm_close(dev, flag, mode, p); +} + +int +acpiapmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +{ + if (!acpiapm_ioctl) + return ENODEV; + return acpiapm_ioctl(dev, cmd, data, flag, p); +} + +int +acpiapmkqfilter(dev_t dev, struct knote *kn) +{ + if (!acpiapm_kqfilter) + return ENODEV; + return acpiapm_kqfilter(dev, kn); +} Index: sys/arch/i386/include/conf.h ================================================== ================= RCS file: /cvs/src/sys/arch/i386/include/conf.h,v retrieving revision 1.12 diff -u -r1.12 conf.h --- sys/arch/i386/include/conf.h 31 Dec 2005 21:22:34 -0000 1.12 +++ sys/arch/i386/include/conf.h 25 Nov 2007 14:51:33 -0000 @@ -49,13 +49,7 @@ cdev_decl(pc); -#define cdev_apm_init(c,n) {\ - dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ - (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ - (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \ - (dev_type_mmap((*))) enodev, 0, D_KQFILTER, dev_init(c,n,kqfilter) } - -#define cdev_acpi_init(c,n) {\ +#define cdev_acpiapm_init(c,n) {\ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \ @@ -77,6 +71,8 @@ cdev_decl(acpi); cdev_decl(apm); + +cdev_decl(acpiapm); #define pctrpoll seltrue cdev_decl(pctr); Index: sys/arch/i386/include/acpiapm.h ================================================== ================= RCS file: sys/arch/i386/include/acpiapm.h diff -N sys/arch/i386/include/acpiapm.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sys/arch/i386/include/acpiapm.h 25 Nov 2007 14:51:33 -0000 @@ -0,0 +1,30 @@ +/* $OpenBSD$ */ +/* + * Copyright (c) 2007 Ted Unangst <tedu@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +#ifndef _I386_ACPIAPM_H_ +#define _I386_ACPIAPM_H_ + +extern int (*acpiapm_open)(dev_t, int, int, struct proc *); +extern int (*acpiapm_close)(dev_t, int, int, struct proc *); +extern int (*acpiapm_ioctl)(dev_t, u_long, caddr_t, int, struct proc *); +extern int (*acpiapm_kqfilter)(dev_t, struct knote *); + +extern int acpiopen(dev_t dev, int flag, int mode, struct proc *p); +extern int acpiclose(dev_t dev, int flag, int mode, struct proc *p); +extern int acpiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p); +extern int acpikqfilter(dev_t dev, struct knote *kn); + +#endif /* _I386_ACPIAPM_H_ */ Dmesg: OpenBSD 4.2-current (GENERIC) #1: Sun Nov 25 15:33:41 CET 2007 root@lamer.dunceor.org:/usr/src/sys/arch/i386/compile/GENERIC cpu0: Mobile Intel(R) Celeron(R) CPU 2.00GHz ("GenuineIntel" 686-class) 2 GHz cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MC A,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2, SS,HTT,TM,SBF,CNXT-ID real mem = 200306688 (191MB) avail mem = 185704448 (177MB) mainbus0 at root bios0 at mainbus0: AT/286+ BIOS, date 06/18/03, BIOS32 rev. 0 @ 0xfd750, SMBIOS rev. 2.3 @ 0xdf010 (44 entries) bios0: vendor Phoenix Technologies Ltd. version "KE.M1.60" date 06/18/20032 bios0: Hewlett-Packard Presario 2100 (DM428A) pcibios0 at bios0: rev 2.1 @ 0xfd750/0x8b0 pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfdf30/176 (9 entries) pcibios0: PCI Interrupt Router at 000:07:0 ("Acer Labs M1533 ISA" rev 0x00) pcibios0: PCI bus #3 is the last bus bios0: ROM list: 0xc0000/0xf000 0xcf000/0x800 0xdf000/0x1000! 0xe0000/0x4000! acpi0 at mainbus0: rev 0 acpi0: tables DSDT FACP BOOT acpi0: wakeup devices PCI0(S5) MDEM(S4) LAN_(S5) COM1(S4) LID_(S3) acpitimer0 at acpi0: 3579545 Hz, 32 bits acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus 1 (AGPB) acpiec0 at acpi0 acpicpu0 at acpi0: C2, C1 acpitz0 at acpi0: critical temperature 95 degC acpibtn0 at acpi0: PWRB acpibtn1 at acpi0: LID_ acpiac0 at acpi0: AC unit online acpibat0 at acpi0: BAT1 not present cpu0 at mainbus0 pci0 at mainbus0 bus 0: configuration mode 1 (no bios) pchb0 at pci0 dev 0 function 0 "ATI RS200 AGP" rev 0x02 ppb0 at pci0 dev 1 function 0 "ATI RS200 PCI" rev 0x00 pci1 at ppb0 bus 1 vga1 at pci1 dev 5 function 0 "ATI Mobility M6" rev 0x00 wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation) wsdisplay0: screen 1-5 added (80x25, vt100 emulation) ohci0 at pci0 dev 2 function 0 "Acer Labs M5237 USB" rev 0x03: irq 10, version 1.0, legacy support autri0 at pci0 dev 6 function 0 "Acer Labs M5451 Audio" rev 0x02: irq 5 ac97: codec id 0x43585429 (Conexant CX20468 rev 1) ac97: codec features reserved, headphone, 18 bit DAC, 18 bit ADC, No 3D Stereo audio0 at autri0 midi0 at autri0: <4DWAVE MIDI UART> pcib0 at pci0 dev 7 function 0 "Acer Labs M1533 ISA" rev 0x00 "Acer Labs M5457 Modem" rev 0x00 at pci0 dev 8 function 0 not configured cbb0 at pci0 dev 10 function 0 "O2 Micro OZ69[17]2 CardBus" rev 0x00: irq 11 pciide0 at pci0 dev 16 function 0 "Acer Labs M5229 UDMA IDE" rev 0xc4: DMA, channel 0 configured to compatibility, channel 1 configured to compatibility wd0 at pciide0 channel 0 drive 0: <SAMSUNG MP0402H> wd0: 16-sector PIO, LBA48, 38154MB, 78140160 sectors wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5 atapiscsi0 at pciide0 channel 1 drive 0 scsibus0 at atapiscsi0: 2 targets cd0 at scsibus0 targ 0 lun 0: <HL-DT-ST, RW/DVD GCC-4241N, 0C27> SCSI0 5/cdrom removable cd0(pciide0:1:0): using PIO mode 4, DMA mode 2 alipm0 at pci0 dev 17 function 0 "Acer Labs M7101 Power" rev 0x00: 74KHz clock iic0 at alipm0 spdmem0 at iic0 addr 0x50: 256MB DDR SDRAM non-parity PC2300CL2.5 sis0 at pci0 dev 18 function 0 "NS DP83815 10/100" rev 0x00, DP83816A: irq 10, address 00:0b:cd:a7:6b:1b nsphyter0 at sis0 phy 0: DP83815 10/100 PHY, rev. 1 usb0 at ohci0: USB revision 1.0 uhub0 at usb0 "Acer Labs OHCI root hub" rev 1.00/1.00 addr 1 isa0 at pcib0 isadma0 at isa0 pckbc0 at isa0 port 0x60/5 pckbd0 at pckbc0 (kbd slot) pckbc0: using irq 1 for kbd slot wskbd0 at pckbd0: console keyboard, using wsdisplay0 pmsi0 at pckbc0 (aux slot) pckbc0: using irq 12 for aux slot wsmouse0 at pmsi0 mux 0 pcppi0 at isa0 port 0x61 midi1 at pcppi0: <PC speaker> spkr0 at pcppi0 lpt0 at isa0 port 0x378/4 irq 7 npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16 pccom0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo cardslot0 at cbb0 slot 0 flags 0 cardbus0 at cardslot0: bus 3 device 0 cacheline 0x0, lattimer 0x20 pcmcia0 at cardslot0 biomask ed4d netmask ed4d ttymask ffcf mtrr: Pentium Pro MTRR support dkcsum: wd0 matches BIOS drive 0x80 root on wd0a swap on wd0b dump on wd0b |