Deleted Added
full compact
apm.c (9540) apm.c (11872)
1/*
2 * APM (Advanced Power Management) BIOS Device Driver
3 *
4 * Copyright (c) 1994 UKAI, Fumitoshi.
5 * Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
6 *
7 * This software may be used, modified, copied, and distributed, in
8 * both source and binary form provided that the above copyright and
9 * these terms are retained. Under no circumstances is the author
10 * responsible for the proper functioning of this software, nor does
11 * the author assume any responsibility for damages incurred with its
12 * use.
13 *
14 * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
15 *
1/*
2 * APM (Advanced Power Management) BIOS Device Driver
3 *
4 * Copyright (c) 1994 UKAI, Fumitoshi.
5 * Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
6 *
7 * This software may be used, modified, copied, and distributed, in
8 * both source and binary form provided that the above copyright and
9 * these terms are retained. Under no circumstances is the author
10 * responsible for the proper functioning of this software, nor does
11 * the author assume any responsibility for damages incurred with its
12 * use.
13 *
14 * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
15 *
16 * $Id: apm.c,v 1.12 1995/05/30 07:58:06 rgrimes Exp $
16 * $Id: apm.c,v 1.13 1995/07/16 10:11:30 bde Exp $
17 */
18
19#include "apm.h"
20
21#if NAPM > 0
22
23#ifdef __FreeBSD__
24#include <sys/param.h>

--- 172 unchanged lines hidden (view full) ---

197 ecx = enable;
198 return apm_int(&eax, &ebx, &ecx);
199}
200
201/* Tell APM-BIOS that WE will do 1.1 and see what they say... */
202static void
203apm_driver_version(void)
204{
17 */
18
19#include "apm.h"
20
21#if NAPM > 0
22
23#ifdef __FreeBSD__
24#include <sys/param.h>

--- 172 unchanged lines hidden (view full) ---

197 ecx = enable;
198 return apm_int(&eax, &ebx, &ecx);
199}
200
201/* Tell APM-BIOS that WE will do 1.1 and see what they say... */
202static void
203apm_driver_version(void)
204{
205 u_long eax, ebx, ecx, i;
205 u_long eax, ebx, ecx;
206
207#ifdef APM_DEBUG
208 eax = (APM_BIOS<<8) | APM_INSTCHECK;
209 ebx = 0x0;
210 ecx = 0x0101;
211 i = apm_int(&eax, &ebx, &ecx);
212 printf("[%04lx %04lx %04lx %ld %02x]\n",
213 eax, ebx, ecx, i, apm_errno);

--- 448 unchanged lines hidden (view full) ---

662#endif /* MACH_KERNEL */
663{
664#ifdef __FreeBSD__
665 int unit = dvp->id_unit;
666#endif /* __FreeBSD__ */
667#ifdef MACH_KERNEL
668 int unit = devc->unit;
669#endif /* MACH_KERNEL */
206
207#ifdef APM_DEBUG
208 eax = (APM_BIOS<<8) | APM_INSTCHECK;
209 ebx = 0x0;
210 ecx = 0x0101;
211 i = apm_int(&eax, &ebx, &ecx);
212 printf("[%04lx %04lx %04lx %ld %02x]\n",
213 eax, ebx, ecx, i, apm_errno);

--- 448 unchanged lines hidden (view full) ---

662#endif /* MACH_KERNEL */
663{
664#ifdef __FreeBSD__
665 int unit = dvp->id_unit;
666#endif /* __FreeBSD__ */
667#ifdef MACH_KERNEL
668 int unit = devc->unit;
669#endif /* MACH_KERNEL */
670 struct apm_softc *sc = &apm_softc[unit];
671
672 switch (apm_version) {
673 case APMINI_CANTFIND:
674 /* silent */
675 return 0;
676 case APMINI_NOT32BIT:
677 printf("apm%d: 32bit connection is not supported.\n", unit);
678 return 0;

--- 103 unchanged lines hidden (view full) ---

782 int unit = dvp->id_unit;
783#define APM_KERNBASE KERNBASE
784#endif /* __FreeBSD__ */
785#ifdef MACH_KERNEL
786 int unit = dvp->unit;
787#define APM_KERNBASE VM_MIN_KERNEL_ADDRESS
788#endif /* MACH_KERNEL */
789 struct apm_softc *sc = &apm_softc[unit];
670
671 switch (apm_version) {
672 case APMINI_CANTFIND:
673 /* silent */
674 return 0;
675 case APMINI_NOT32BIT:
676 printf("apm%d: 32bit connection is not supported.\n", unit);
677 return 0;

--- 103 unchanged lines hidden (view full) ---

781 int unit = dvp->id_unit;
782#define APM_KERNBASE KERNBASE
783#endif /* __FreeBSD__ */
784#ifdef MACH_KERNEL
785 int unit = dvp->unit;
786#define APM_KERNBASE VM_MIN_KERNEL_ADDRESS
787#endif /* MACH_KERNEL */
788 struct apm_softc *sc = &apm_softc[unit];
790 int i;
791
792 master_softc = sc; /* XXX */
793 sc->initialized = 0;
794 sc->active = 0;
795 sc->halt_cpu = 1;
796
797 /* setup APM parameters */
798 sc->cs16_base = (apm_cs32_base << 4) + APM_KERNBASE;

--- 120 unchanged lines hidden (view full) ---

919 return 0;
920}
921
922int
923apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
924{
925 struct apm_softc *sc = &apm_softc[minor(dev)];
926 int error = 0;
789
790 master_softc = sc; /* XXX */
791 sc->initialized = 0;
792 sc->active = 0;
793 sc->halt_cpu = 1;
794
795 /* setup APM parameters */
796 sc->cs16_base = (apm_cs32_base << 4) + APM_KERNBASE;

--- 120 unchanged lines hidden (view full) ---

917 return 0;
918}
919
920int
921apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
922{
923 struct apm_softc *sc = &apm_softc[minor(dev)];
924 int error = 0;
927 int pl;
928
929#ifdef APM_DEBUG
930 printf("APM ioctl: minor = %d, cmd = 0x%x\n", minor(dev), cmd);
931#endif
932
933 if (minor(dev) >= NAPM) {
934 return ENXIO;
935 }

--- 61 unchanged lines hidden ---
925
926#ifdef APM_DEBUG
927 printf("APM ioctl: minor = %d, cmd = 0x%x\n", minor(dev), cmd);
928#endif
929
930 if (minor(dev) >= NAPM) {
931 return ENXIO;
932 }

--- 61 unchanged lines hidden ---