NetBSD-Bugs archive

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

Re: kern/44366: poweroff doesn't work



The following reply was made to PR kern/44366; it has been noted by GNATS.

From: Jukka Ruohonen <jruohonen%iki.fi@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: mihai.chelaru%ngnetworks.ro@localhost
Subject: Re: kern/44366: poweroff doesn't work
Date: Thu, 13 Jan 2011 10:35:12 +0200

 On Tue, Jan 11, 2011 at 08:55:02PM +0000, Mihai Chelaru wrote:
 >  It still doesn't work.
 
 Can you try yet another patch?
 
 This may again be a long-shot, but I am running out of ideas...
 
 - Jukka.
 
 Index: acpi.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/acpi/acpi.c,v
 retrieving revision 1.233
 diff -u -p -r1.233 acpi.c
 --- acpi.c     13 Jan 2011 05:58:05 -0000      1.233
 +++ acpi.c     13 Jan 2011 08:31:51 -0000
 @@ -123,6 +123,8 @@ __KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.2
  #include <dev/acpi/acpi_timer.h>
  #include <dev/acpi/acpi_wakedev.h>
  
 +#include <dev/ic/i8042reg.h>  /* XXX: DEBUG. */
 +
  #define _COMPONENT    ACPI_BUS_COMPONENT
  ACPI_MODULE_NAME      ("acpi")
  
 @@ -1388,6 +1390,7 @@ acpi_enter_sleep_state(int state)
  
                sc->sc_sleepstate = state;
                acpi_md_OsDisableInterrupt();
 +              lapic_disable();
  
                (void)AcpiEnterSleepState(ACPI_STATE_S5);
  
 Index: lapic.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/x86/x86/lapic.c,v
 retrieving revision 1.44
 diff -u -p -r1.44 lapic.c
 --- lapic.c    21 Nov 2009 03:11:01 -0000      1.44
 +++ lapic.c    13 Jan 2011 08:32:06 -0000
 @@ -77,6 +77,8 @@ static void lapic_hwmask(struct pic *, i
  static void lapic_hwunmask(struct pic *, int);
  static void lapic_setup(struct pic *, struct cpu_info *, int, int, int);
  
 +static bool lapic_msr = false;
 +
  struct pic local_pic = {
        .pic_name = "lapic",
        .pic_type = PIC_LAPIC,
 @@ -108,6 +110,7 @@ lapic_map(paddr_t lapic_base)
                }
                wrmsr(LAPIC_MSR, lapic_base | LAPIC_MSR_ENABLE);
                lapic_base &= LAPIC_MSR_ADDR;
 +              lapic_msr = true;
        }
  
        x86_disable_intr();
 @@ -134,9 +137,6 @@ lapic_map(paddr_t lapic_base)
        x86_enable_intr();
  }
  
 -/*
 - * enable local apic
 - */
  void
  lapic_enable(void)
  {
 @@ -144,8 +144,33 @@ lapic_enable(void)
  }
  
  void
 +lapic_disable(void)
 +{
 +      uint64_t msr;
 +      uint32_t val;
 +
 +      val = i82489_readreg(LAPIC_SVR);
 +
 +      if ((val & LAPIC_SVR_ENABLE) != 0) {
 +              val &= ~LAPIC_SVR_ENABLE;
 +              i82489_writereg(LAPIC_SVR, val);
 +      }
 +
 +      if (lapic_msr != true)
 +              return;
 +
 +      msr = rdmsr(LAPIC_MSR);
 +
 +      if ((msr & LAPIC_MSR_ENABLE) != 0) {
 +              msr &= ~LAPIC_MSR_ENABLE;
 +              wrmsr(LAPIC_MSR, msr);
 +      }
 +}
 +
 +void
  lapic_suspend(void)
  {
 +      /* XXX. */
  }
  
  void
 Index: i82489var.h
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/x86/include/i82489var.h,v
 retrieving revision 1.12
 diff -u -p -r1.12 i82489var.h
 --- i82489var.h        28 Apr 2008 20:23:40 -0000      1.12
 +++ i82489var.h        13 Jan 2011 08:32:28 -0000
 @@ -112,6 +112,7 @@ struct cpu_info;
  extern void lapic_boot_init(paddr_t);
  extern void lapic_set_lvt(void);
  extern void lapic_enable(void);
 +extern void lapic_disable(void);
  extern void lapic_suspend(void);
  extern void lapic_resume(void);
  extern void lapic_calibrate_timer(struct cpu_info *ci);
 


Home | Main Index | Thread Index | Old Index