Index: src/sys/arch/i386/i386/apm.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/apm.c,v
retrieving revision 1.14
retrieving revision 1.19
diff -c -b -r1.14 -r1.19
*** apm.c	1997/10/24 06:49:19	1.14
--- apm.c	1997/12/17 22:05:31	1.19
***************
*** 1,4 ****
! /*	$OpenBSD: apm.c,v 1.14 1997/10/24 06:49:19 mickey Exp $	*/
  
  /*-
   * Copyright (c) 1995 John T. Kohl.  All rights reserved.
--- 1,4 ----
! /*	$OpenBSD: apm.c,v 1.19 1997/12/17 22:05:31 rees Exp $	*/
  
  /*-
   * Copyright (c) 1995 John T. Kohl.  All rights reserved.
***************
*** 219,240 ****
  	if (apm_minver == 0)
  		switch (BATT_STATE(regs)) {
  		case APM_BATT_HIGH:
! 			printf("high\n");
  			break;
  		case APM_BATT_LOW:
! 			printf("low\n");
  			break;
  		case APM_BATT_CRITICAL:
! 			printf("critical\n");
  			break;
  		case APM_BATT_CHARGING:
! 			printf("charging\n");
  			break;
  		case APM_BATT_UNKNOWN:
! 			printf("unknown\n");
  			break;
  		default:
! 			printf("undecoded (%x)\n", BATT_STATE(regs));
  			break;
  		}
  	else if (apm_minver >= 1) {
--- 219,240 ----
  	if (apm_minver == 0)
  		switch (BATT_STATE(regs)) {
  		case APM_BATT_HIGH:
! 			printf("high");
  			break;
  		case APM_BATT_LOW:
! 			printf("low");
  			break;
  		case APM_BATT_CRITICAL:
! 			printf("critical");
  			break;
  		case APM_BATT_CHARGING:
! 			printf("charging");
  			break;
  		case APM_BATT_UNKNOWN:
! 			printf("unknown");
  			break;
  		default:
! 			printf("undecoded (%x)", BATT_STATE(regs));
  			break;
  		}
  	else if (apm_minver >= 1) {
***************
*** 243,258 ****
  		else {
  			if (BATT_FLAGS(regs) & APM_BATT_FLAG_HIGH)
  				printf("high");
! 			if (BATT_FLAGS(regs) & APM_BATT_FLAG_LOW)
  				printf("low");
! 			if (BATT_FLAGS(regs) & APM_BATT_FLAG_CRITICAL)
  				printf("critical");
  			if (BATT_FLAGS(regs) & APM_BATT_FLAG_CHARGING)
! 				printf("charging");
  			if (BATT_REM_VALID(regs))
! 				printf(", estimated %d:%02d minutes\n",
  				    BATT_REMAINING(regs) / 60,
! 				    BATT_REMAINING(regs)%60);
  		}
  	}
  
--- 243,260 ----
  		else {
  			if (BATT_FLAGS(regs) & APM_BATT_FLAG_HIGH)
  				printf("high");
! 			else if (BATT_FLAGS(regs) & APM_BATT_FLAG_LOW)
  				printf("low");
! 			else if (BATT_FLAGS(regs) & APM_BATT_FLAG_CRITICAL)
  				printf("critical");
+ 			else
+ 				printf("unknown");
  			if (BATT_FLAGS(regs) & APM_BATT_FLAG_CHARGING)
! 				printf(", charging");
  			if (BATT_REM_VALID(regs))
! 				printf(", estimated %d:%02d minutes",
  				    BATT_REMAINING(regs) / 60,
! 				    BATT_REMAINING(regs) % 60);
  		}
  	}
  
***************
*** 620,626 ****
  	if (apm_cd.cd_ndevs ||
  	    strcmp(ba->bios_dev, "apm") ||
  	    ba->bios_apmp->apm_detail & APM_BIOS_PM_DISABLED ||
- 	    ba->bios_apmp->apm_detail & APM_BIOS_PM_DISENGAGED ||
  	    !(ba->bios_apmp->apm_detail & APM_32BIT_SUPPORTED)) {
  #ifdef DEBUG
  		printf("%s: %x\n", ba->bios_dev, ba->bios_apmp->apm_detail);
--- 622,627 ----
***************
*** 746,755 ****
  	int flag, mode;
  	struct proc *p;
  {
! 	struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)];
  
  	/* apm0 only */
! 	if (APMUNIT(dev) != 0 || sc == NULL)
  		return ENXIO;
  	
  	switch (APMDEV(dev)) {
--- 747,756 ----
  	int flag, mode;
  	struct proc *p;
  {
! 	struct apm_softc *sc;
  
  	/* apm0 only */
! 	if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || !(sc = apm_cd.cd_devs[APMUNIT(dev)]))
  		return ENXIO;
  	
  	switch (APMDEV(dev)) {
***************
*** 778,787 ****
  	int flag, mode;
  	struct proc *p;
  {
! 	struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)];
  
  	/* apm0 only */
! 	if (APMUNIT(dev) != 0 || sc == NULL)
  		return ENXIO;
  	
  	DPRINTF(("apmclose: pid %d flag %x mode %x\n", p->p_pid, flag, mode));
--- 779,788 ----
  	int flag, mode;
  	struct proc *p;
  {
! 	struct apm_softc *sc;
  
  	/* apm0 only */
! 	if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || !(sc = apm_cd.cd_devs[APMUNIT(dev)]))
  		return ENXIO;
  	
  	DPRINTF(("apmclose: pid %d flag %x mode %x\n", p->p_pid, flag, mode));
***************
*** 809,815 ****
  	int flag;
  	struct proc *p;
  {
! 	struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)];
  	struct apm_power_info *powerp;
  	struct apm_event_info *evp;
  	struct apmregs regs;
--- 810,816 ----
  	int flag;
  	struct proc *p;
  {
! 	struct apm_softc *sc;
  	struct apm_power_info *powerp;
  	struct apm_event_info *evp;
  	struct apmregs regs;
***************
*** 817,823 ****
  	struct apm_ctl *actl;
  
  	/* apm0 only */
! 	if (APMUNIT(dev) != 0 || sc == NULL)
  		return ENXIO;
  	
  	switch (cmd) {
--- 818,824 ----
  	struct apm_ctl *actl;
  
  	/* apm0 only */
! 	if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || !(sc = apm_cd.cd_devs[APMUNIT(dev)]))
  		return ENXIO;
  	
  	switch (cmd) {
***************
*** 901,910 ****
  	int rw;
  	struct proc *p;
  {
! 	struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)];
  
  	/* apm0 only */
! 	if (APMUNIT(dev) != 0 || sc == NULL)
  		return ENXIO;
  	
  	switch (rw) {
--- 902,911 ----
  	int rw;
  	struct proc *p;
  {
! 	struct apm_softc *sc;
  
  	/* apm0 only */
! 	if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || !(sc = apm_cd.cd_devs[APMUNIT(dev)]))
  		return ENXIO;
  	
  	switch (rw) {
