From ksumitani@mui.biglobe.ne.jp  Thu Oct 18 05:36:49 2001
Return-Path: <ksumitani@mui.biglobe.ne.jp>
Received: from rcpt-expgw.biglobe.ne.jp (rcpt-expgw.biglobe.ne.jp [210.147.6.216])
	by hub.freebsd.org (Postfix) with ESMTP id 4623D37B405
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 18 Oct 2001 05:36:48 -0700 (PDT)
Received: from smtp-gw.biglobe.ne.jp
	by rcpt-expgw.biglobe.ne.jp (8.9.3+3.2W/3.7W-01101108) with ESMTP id VAA23224
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 18 Oct 2001 21:36:52 +0900 (JST)
Received: from server.localdomain (202.225.211.7 [202.225.211.7]) by smtp-gw.biglobe.ne.jp
	id VACVC0A8274B; Thu, 18 Oct 2001 21:36:46 +0900 (JST)
Message-Id: <20011018213646.VACVC0A8274B.C77F0C8A@mail.biglobe.ne.jp>
Date: Thu, 18 Oct 2001 21:36:39 +0900 (JST)
From: Koshin Sumitani <ksumitani@mui.biglobe.ne.jp>
Reply-To: "K.Sumitani" <ksumitani@mui.biglobe.ne.jp>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: 'shutdown -p' does not work on SMP Tyan Tiger100
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         31353
>Category:       i386
>Synopsis:       [apm] [patch] 'shutdown -p' does not work on SMP Tyan Tiger100
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    remko
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 18 05:40:01 PDT 2001
>Closed-Date:    Fri Oct 20 12:08:14 GMT 2006
>Last-Modified:  Fri Oct 20 12:08:14 GMT 2006
>Originator:     Koshin Sumitani
>Release:        FreeBSD 4.4-RELEASE i386
>Organization:
>Environment:
System: FreeBSD server.localdomain 4.4-RELEASE FreeBSD 4.4-RELEASE #3: Wed Oct 17 18:56:30 JST 2001 sumitani@server.localdomain:/work4/src-4.4/sys/compile/Server i386

	
>Description:
Tyan Tiger100's APM-BIOS does not work and return immediately if called
from CPU#1. If called from CPU#0, it works.

So, 'shutdown -p' does not work.


>How-To-Repeat:
'shutdown -p' on Dual-Processor Tyan Tiger100


>Fix:
Here is a patch for /sys/i386/apm/apm.c

I know that synchronize by smp_rendezvous() is not so good
but it's for power-off...

*** apm.c.orig	Thu Oct 18 00:01:05 2001
--- apm.c	Mon Oct 15 19:51:28 2001
***************
*** 281,299 ****
   * Turn off the entire system.
   */
  static void
! apm_power_off(void *junk, int howto)
  {
  	struct apm_softc *sc = &apm_softc;
  
- 	/* Not halting powering off, or not active */
- 	if (!(howto & RB_POWEROFF) || !apm_softc.active)
- 		return;
  	sc->bios.r.eax = (APM_BIOS << 8) | APM_SETPWSTATE;
  	sc->bios.r.ebx = PMDV_ALLDEV;
  	sc->bios.r.ecx = PMST_OFF;
  	sc->bios.r.edx = 0;
  	(void) apm_bioscall();
  }
  
  /* APM Battery low handler */
  static void
--- 281,326 ----
   * Turn off the entire system.
   */
  static void
! apm_do_power_off(void)
  {
  	struct apm_softc *sc = &apm_softc;
  
  	sc->bios.r.eax = (APM_BIOS << 8) | APM_SETPWSTATE;
  	sc->bios.r.ebx = PMDV_ALLDEV;
  	sc->bios.r.ecx = PMST_OFF;
  	sc->bios.r.edx = 0;
  	(void) apm_bioscall();
+ 
+ 	printf("power-off failed: returned from APM-BIOS\n");
+ }
+ 
+ #ifdef SMP
+ static void
+ apm_smp_power_off(void *arg)
+ {
+ 	if (cpuid != 0) {
+ 		for ( ; ; ) ;
+ 	}
+ 	apm_do_power_off();
+ }
+ #endif
+ 
+ static void
+ apm_power_off(void *junk, int howto)
+ {
+ 
+ 	/* Not halting powering off, or not active */
+ 	if (!(howto & RB_POWEROFF) || !apm_softc.active)
+ 		return;
+ 
+ #ifdef	SMP
+ 	smp_rendezvous( NULL, apm_smp_power_off, NULL, NULL );
+ 	return;
+ #else
+ 	apm_do_power_off();
+ #endif
  }
+ 
  
  /* APM Battery low handler */
  static void

	
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: remko 
State-Changed-When: Mon Sep 11 12:10:11 UTC 2006 
State-Changed-Why:  
Hello, 

We have evolved FreeBSD a lot since your report, can you please tell 
us whether this problem still persists in more recent versions? 


Responsible-Changed-From-To: freebsd-i386->remko 
Responsible-Changed-By: remko 
Responsible-Changed-When: Mon Sep 11 12:10:11 UTC 2006 
Responsible-Changed-Why:  
grab the pr 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31353 
State-Changed-From-To: feedback->closed 
State-Changed-By: remko 
State-Changed-When: Fri Oct 20 12:07:52 UTC 2006 
State-Changed-Why:  
I recieved no feedback for this, closing the PR. 

Facilitated by:	Snow B.V. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31353 
>Unformatted:
