Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386 Remove the obvious parts of i386 Advanced powe...



details:   https://anonhg.NetBSD.org/src/rev/b67e0ab57da2
branches:  trunk
changeset: 781784:b67e0ab57da2
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Sep 30 20:19:51 2012 +0000

description:
Remove the obvious parts of i386 Advanced power management 'apm' support.
This is the code that predates ACPI, and might once have been able to
  power down some laptops.
It hasn't been compiled for ages (it isn't it i386/ALL or any other
  standard kernel) and hasn't worked for even longer.
The APM specification was made obsolete by ACPI before it was widely
  implemented.
This will allow some other, even more dubious code be removed.
Unfortunately apmbios.h is used by the world !

diffstat:

 sys/arch/i386/conf/files.i386  |    7 +-
 sys/arch/i386/i386/apmbios.c   |  987 -----------------------------------------
 sys/arch/i386/i386/apmcall.S   |  121 -----
 sys/arch/i386/i386/genassym.cf |   24 +-
 sys/arch/i386/i386/machdep.c   |   23 +-
 sys/arch/i386/i386/mainbus.c   |   17 +-
 6 files changed, 6 insertions(+), 1173 deletions(-)

diffs (truncated from 1278 to 300 lines):

diff -r 5e5012343f99 -r b67e0ab57da2 sys/arch/i386/conf/files.i386
--- a/sys/arch/i386/conf/files.i386     Sun Sep 30 13:15:03 2012 +0000
+++ b/sys/arch/i386/conf/files.i386     Sun Sep 30 20:19:51 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.i386,v 1.365 2012/09/27 18:28:55 alnsn Exp $
+#      $NetBSD: files.i386,v 1.366 2012/09/30 20:19:51 dsl Exp $
 #
 # new style config file for i386 architecture
 #
@@ -322,11 +322,6 @@
 
 include "dev/apm/files.apm"
 
-# Advanced Power Management support (APM)
-attach apm at apmbus with apmbios: bioscall
-file   arch/i386/i386/apmbios.c        apmbios needs-flag
-file   arch/i386/i386/apmcall.S        apmbios
-
 #
 # Compatibility modules
 #
diff -r 5e5012343f99 -r b67e0ab57da2 sys/arch/i386/i386/apmbios.c
--- a/sys/arch/i386/i386/apmbios.c      Sun Sep 30 13:15:03 2012 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,987 +0,0 @@
-/*     $NetBSD: apmbios.c,v 1.19 2011/07/17 20:54:41 joerg Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by John Kohl and Christopher G. Demetriou.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: apmbios.c,v 1.19 2011/07/17 20:54:41 joerg Exp $");
-
-#include "opt_apm.h"
-
-#ifdef APM_NOIDLE
-#error APM_NOIDLE option deprecated; use APM_NO_IDLE instead
-#endif
-
-#if defined(DEBUG) && !defined(APMDEBUG)
-#define        APMDEBUG
-#endif
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/signalvar.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/kthread.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/select.h>
-#include <sys/poll.h>
-#include <sys/conf.h>
-#include <sys/bus.h>
-#include <sys/cpu.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/cpufunc.h>
-#include <machine/gdt.h>
-#include <machine/psl.h>
-
-#include <dev/ic/i8253reg.h>
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/apm/apmvar.h>
-#include <i386/isa/nvram.h>
-
-#include <machine/bioscall.h>
-#ifdef APM_USE_KVM86
-#include <machine/kvm86.h>
-#endif
-#include <machine/apmvar.h>
-
-#if defined(APMDEBUG)
-#define        DPRINTF(f, x)           do { if (apmdebug & (f)) printf x; } while (0)
-#else
-#define        DPRINTF(f, x)
-#endif
-
-static void    apmbiosattach(device_t, device_t, void *);
-static int     apmbiosmatch(device_t, cfdata_t, void *);
-
-#if 0
-static void    apm_devpowmgt_enable(int, u_int);
-#endif
-static void    apm_disconnect(void *);
-static void    apm_enable(void *, int);
-static int     apm_get_powstat(void *, u_int, struct apm_power_info *);
-static int     apm_get_event(void *, u_int *, u_int *);
-static void    apm_cpu_busy(void *);
-static void    apm_cpu_idle(void *);
-static void    apm_get_capabilities(void *, u_int *, u_int *);
-
-struct apm_connect_info apminfo;
-
-static struct apm_accessops apm_accessops = {
-       apm_disconnect,
-       apm_enable,
-       apm_set_powstate,
-       apm_get_powstat,
-       apm_get_event,
-       apm_cpu_busy,
-       apm_cpu_idle,
-       apm_get_capabilities,
-};
-
-extern int apmdebug;
-extern int apm_enabled;
-extern int apm_force_64k_segments;
-extern int apm_allow_bogus_segments;
-extern int apm_bogus_bios;
-extern int apm_minver;
-extern int apm_inited;
-extern int apm_do_idle;
-extern int apm_v12_enabled;
-extern int apm_v11_enabled;
-
-static void    apm_perror(const char *, struct bioscallregs *, ...)
-                   __attribute__((__format__(__printf__,1,3)));
-static void    apm_powmgt_enable(int);
-static void    apm_powmgt_engage(int, u_int);
-static int     apm_get_ver(struct apm_softc *);
-
-CFATTACH_DECL_NEW(apmbios, sizeof(struct apm_softc),
-    apmbiosmatch, apmbiosattach, NULL, NULL);
-
-#ifdef APMDEBUG
-int    apmcall_debug(int, struct bioscallregs *, int);
-static void acallpr(int, const char *, struct bioscallregs *);
-
-/* bitmask defns for printing apm call args/results */
-#define ACPF_AX                0x00000001
-#define ACPF_AX_HI     0x00000002
-#define ACPF_EAX       0x00000004
-#define ACPF_BX        0x00000008
-#define ACPF_BX_HI     0x00000010
-#define ACPF_EBX       0x00000020
-#define ACPF_CX        0x00000040
-#define ACPF_CX_HI     0x00000080
-#define ACPF_ECX       0x00000100
-#define ACPF_DX        0x00000200
-#define ACPF_DX_HI     0x00000400
-#define ACPF_EDX       0x00000800
-#define ACPF_SI        0x00001000
-#define ACPF_SI_HI     0x00002000
-#define ACPF_ESI       0x00004000
-#define ACPF_DI        0x00008000
-#define ACPF_DI_HI     0x00010000
-#define ACPF_EDI       0x00020000
-#define ACPF_FLAGS     0x00040000
-#define ACPF_FLAGS_HI  0x00080000
-#define ACPF_EFLAGS    0x00100000
-
-struct acallinfo {
-       const char *name;
-       int inflag;
-       int outflag;
-};
-
-static struct acallinfo aci[] = {
-  { "install_check", ACPF_BX, ACPF_AX|ACPF_BX|ACPF_CX },
-  { "connectreal", ACPF_BX, 0 },
-  { "connect16", ACPF_BX, ACPF_AX|ACPF_BX|ACPF_CX|ACPF_SI|ACPF_DI },
-  { "connect32", ACPF_BX, ACPF_AX|ACPF_EBX|ACPF_CX|ACPF_DX|ACPF_ESI|ACPF_DI },
-  { "disconnect", ACPF_BX, 0 },
-  { "cpu_idle", 0, 0 },
-  { "cpu_busy", 0, 0 },
-  { "set_power_state", ACPF_BX|ACPF_CX, 0 },
-  { "enable_power_state", ACPF_BX|ACPF_CX, 0 }, 
-  { "restore_defaults", ACPF_BX, 0 },
-  { "get_power_status", ACPF_BX, ACPF_BX|ACPF_CX|ACPF_DX|ACPF_SI },
-  { "get_event", 0, ACPF_BX|ACPF_CX },
-  { "get_power_state" , ACPF_BX, ACPF_CX }, 
-  { "enable_dev_power_mgt", ACPF_BX|ACPF_CX, 0 },
-  { "driver_version", ACPF_BX|ACPF_CX, ACPF_AX },
-  { "engage_power_mgt",  ACPF_BX|ACPF_CX, 0 },
-  { "get_caps", ACPF_BX, ACPF_BX|ACPF_CX },
-  { "resume_timer", ACPF_BX|ACPF_CX|ACPF_SI|ACPF_DI, ACPF_CX|ACPF_SI|ACPF_DI },
-  { "resume_ring", ACPF_BX|ACPF_CX, ACPF_CX },
-  { "timer_reqs", ACPF_BX|ACPF_CX, ACPF_CX },
-};
-
-static void acallpr(int flag, const char *tag, struct bioscallregs *b) {
-  if (!flag) return;
-  printf("%s ", tag);
-  if (flag & ACPF_AX)          printf("ax=%#x ", b->AX);
-  if (flag & ACPF_AX_HI)       printf("ax_hi=%#x ", b->AX_HI);
-  if (flag & ACPF_EAX)                 printf("eax=%#x ", b->EAX);
-  if (flag & ACPF_BX )                 printf("bx=%#x ", b->BX);
-  if (flag & ACPF_BX_HI )      printf("bx_hi=%#x ", b->BX_HI);
-  if (flag & ACPF_EBX )        printf("ebx=%#x ", b->EBX);
-  if (flag & ACPF_CX )                 printf("cx=%#x ", b->CX);
-  if (flag & ACPF_CX_HI )      printf("cx_hi=%#x ", b->CX_HI);
-  if (flag & ACPF_ECX )        printf("ecx=%#x ", b->ECX);
-  if (flag & ACPF_DX )                 printf("dx=%#x ", b->DX);
-  if (flag & ACPF_DX_HI )      printf("dx_hi=%#x ", b->DX_HI);
-  if (flag & ACPF_EDX )        printf("edx=%#x ", b->EDX);
-  if (flag & ACPF_SI )                 printf("si=%#x ", b->SI);
-  if (flag & ACPF_SI_HI )      printf("si_hi=%#x ", b->SI_HI);
-  if (flag & ACPF_ESI )        printf("esi=%#x ", b->ESI);
-  if (flag & ACPF_DI )                 printf("di=%#x ", b->DI);
-  if (flag & ACPF_DI_HI )      printf("di_hi=%#x ", b->DI_HI);
-  if (flag & ACPF_EDI )        printf("edi=%#x ", b->EDI);
-  if (flag & ACPF_FLAGS )      printf("flags=%#x ", b->FLAGS);
-  if (flag & ACPF_FLAGS_HI)    printf("flags_hi=%#x ", b->FLAGS_HI);
-  if (flag & ACPF_EFLAGS )     printf("eflags=%#x ", b->EFLAGS);
-}
-
-int
-apmcall_debug(int func, struct bioscallregs *regs, int line)
-{
-       int rv;
-       int print = (apmdebug & APMDEBUG_APMCALLS) != 0;
-       const char *name;
-       int inf;
-       int outf = 0; /* XXX: gcc */
-       long long milli;
-               
-       if (print) {
-               if (func >= sizeof(aci) / sizeof(aci[0])) {
-                       name = 0;
-                       inf = outf = 0;
-               } else {
-                       name = aci[func].name;
-                       inf = aci[func].inflag;
-                       outf = aci[func].outflag;
-               }
-               inittodr(time_second);  /* update timestamp */
-               milli = time_second % 1000;
-               if (name)
-                       printf("apmcall@%03lld: %s/%#x (line=%d) ", 
-                           milli, name, func, line);
-               else
-                       printf("apmcall@%03lld: %#x (line=%d) ", 
-                           milli, func, line);
-               acallpr(inf, "in:", regs);
-       }
-       rv = apmcall(func, regs);
-       if (print) {
-               if (rv) {
-                       printf(" => error %#x (%s)\n", regs->AX >> 8,
-                               apm_strerror(regs->AX >> 8));
-               } else {
-                       printf(" => ");
-                       acallpr(outf, "out:", regs);
-                       printf("\n");
-               }
-       }
-       return (rv);
-}
-
-#define apmcall(f, r)  apmcall_debug((f), (r), __LINE__)
-#endif /* APMDEBUG */
-
-static void
-apm_perror(const char *str, struct bioscallregs *regs, ...) /* XXX cgd */
-{
-       va_list ap;
-
-       printf("APM ");
-
-       va_start(ap, regs);
-       vprintf(str, ap);                       /* XXX cgd */
-       va_end(ap);
-
-       printf(": %s (0x%x)\n", apm_strerror(APM_ERR_CODE(regs)), regs->AX);
-}
-
-static void
-apm_powmgt_enable(int onoff)



Home | Main Index | Thread Index | Old Index