📄 acpi-debug.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>使用和调试 FreeBSD ACPI</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD 使用手册" href="index.html" /><link rel="UP" title="设置和调整" href="config-tuning.html" /><link rel="PREVIOUS" title="电源和资源管理" href="acpi-overview.html" /><link rel="NEXT" title="FreeBSD引导过程" href="boot.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /><meta http-equiv="Content-Type" content="text/html; charset=GB2312" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD 使用手册</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="acpi-overview.html"accesskey="P">后退</a></td><td width="80%" align="center" valign="bottom">章 11. 设置和调整</td><td width="10%" align="right" valign="bottom"><a href="boot.html"accesskey="N">前进</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="ACPI-DEBUG" name="ACPI-DEBUG">11.16. 使用和调试 FreeBSD <acronymclass="ACRONYM">ACPI</acronym></a></h1><i class="AUTHORGROUP"><span class="CONTRIB">撰写人:</span>Nate Lawson.</i> <iclass="AUTHORGROUP"><span class="CONTRIB">协力:</span>Peter Schultz 和 Tom Rhodes.</i> <p><acronym class="ACRONYM">ACPI</acronym> 是在本质上是一种发现设备、管理电源使用,提供过去由 <acronym class="ACRONYM">BIOS</acronym> 管理的访问不同硬件的标准化方法。 让<acronym class="ACRONYM">ACPI</acronym> 在各种系统上都能正确使用的工作一直在进行,但许多主板的 <i class="FIRSTTERM"><acronym class="ACRONYM">ACPI</acronym> 机器语言</i>(<acronym class="ACRONYM">AML</acronym>) 字节代码中的 bug, FreeBSD的内核中资系统设计的不完善, 以及 Intel <acronym class="ACRONYM">ACPI-CA</acronym>解释器中的 bug 仍然市场会出现。</p><p>这份文档期望能够帮助您协助 FreeBSD <acronym class="ACRONYM">ACPI</acronym>的维护人员来找到您所观察到的问题的根源, 并通过调试找到其解决方法。 感谢您阅读这份文档,我们也希望能够解决您的系统上的问题。</p><div class="SECT2"><h2 class="SECT2"><a id="ACPI-SUBMITDEBUG" name="ACPI-SUBMITDEBUG">11.16.1.提交调试信息</a></h2><div class="NOTE"><blockquote class="NOTE"><p><b>注:</b> 在提交问题之前, 请确认您已经在运行最新的 <acronymclass="ACRONYM">BIOS</acronym> 版本, 此外, 也包括嵌入式控制器的固件版本。</p></blockquote></div><p>如果您希望提交一个问题, 请确保将下述信息法到 <ahref="mailto:freebsd-acpi@FreeBSD.org" target="_top">freebsd-acpi@FreeBSD.org</a></p><ul><li><p>问题行为的描述, 包括系统类型、型号,以及任何触发问题的相关信息。 另外,请注意尽可能准确地描述这一问题是否对您是陌生的。</p></li><li><p>在 ``boot <var class="OPTION">-v</var>''之后得到的 dmesg 输出, 包括任何在重现 bug之后出现的错误信息。</p></li><li><p>在禁用了 <acronym class="ACRONYM">ACPI</acronym> 之后的 ``boot <varclass="OPTION">-v</var>'' 的 dmesg 输出, 如果您发现禁用 ACPI 能够帮助消除问题。</p></li><li><p>来自 ``sysctl hw.acpi'' 的输出。 这也是找到您的系统所提供的功能的一种好办法。</p></li><li><p>能够得到您的 <i class="FIRSTTERM"><acronym class="ACRONYM">ACPI</acronym> SourceLanguage</i> (<acronym class="ACRONYM">ASL</acronym>) 的 <acronymclass="ACRONYM">URL</acronym>。 <span class="emphasis"><iclass="EMPHASIS">不要</i></span> 把 <acronym class="ACRONYM">ASL</acronym>直接发到邮件列表中, 因为它们可能非常大。 为了得到 <acronym class="ACRONYM">ASL</acronym>您可以运行这个命令:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">acpidump -t -d > <varclass="REPLACEABLE">name</var>-<var class="REPLACEABLE">system</var>.asl</kbd></pre><p>(把 <var class="REPLACEABLE">name</var> 改为您的登录名, 并把 <varclass="REPLACEABLE">system</var> 改为您的硬件制造商及其型号。 例如: <ttclass="FILENAME">njl-FooCo6000.asl</tt>)</p></li></ul><p>许多开发者也会订阅 <a href="http://lists.FreeBSD.org/mailman/listinfo/freebsd-current"target="_top">FreeBSD-CURRENT 邮件列表</a> 但还是请发到 <ahref="http://lists.FreeBSD.org/mailman/listinfo/freebsd-acpi"target="_top">freebsd-acpi</a> 这样它会被更多人看到。 请耐心等待,因为我们都有全职的其他工作。 如果您的 bug 不是显而易见的, 我们可能会要求您通过 <spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">send-pr</span>(1)</span> 来提交一个<acronym class="ACRONYM">PR</acronym>。 在输入 <acronym class="ACRONYM">PR</acronym>时,请将同样的信息包含进去。 这将帮助我们来追踪和解决问题。 不要在给 <ahref="http://lists.FreeBSD.org/mailman/listinfo/freebsd-acpi"target="_top">freebsd-acpi</a> 写信之前发送 <acronym class="ACRONYM">PR</acronym>因为我们把它当作已知文体的备忘录而不是报告机制。 您的问题很可能已经被其他人报告过了。</p></div><div class="SECT2"><h2 class="SECT2"><a id="ACPI-BACKGROUND" name="ACPI-BACKGROUND">11.16.2.Background</a></h2><p><acronym class="ACRONYM">ACPI</acronym> is present in all modern computers thatconform to the ia32 (x86), ia64 (Itanium), and amd64 (AMD) architectures. The fullstandard has many features including <acronym class="ACRONYM">CPU</acronym> performancemanagement, power planes control, thermal zones, various battery systems, embeddedcontrollers, and bus enumeration. Most systems implement less than the full standard. Forinstance, a desktop system usually only implements the bus enumeration parts while alaptop might have cooling and battery management support as well. Laptops also havesuspend and resume, with their own associated complexity.</p><p>An <acronym class="ACRONYM">ACPI</acronym>-compliant system has various components.The <acronym class="ACRONYM">BIOS</acronym> and chipset vendors provide various fixedtables (e.g., <acronym class="ACRONYM">FADT</acronym>) in memory that specify things likethe <acronym class="ACRONYM">APIC</acronym> map (used for <acronymclass="ACRONYM">SMP</acronym>), config registers, and simple configuration values.Additionally, a table of bytecode (the <i class="FIRSTTERM">Differentiated SystemDescription Table</i> <acronym class="ACRONYM">DSDT</acronym>) is provided that specifiesa tree-like name space of devices and methods.</p><p>The <acronym class="ACRONYM">ACPI</acronym> driver must parse the fixed tables,implement an interpreter for the bytecode, and modify device drivers and the kernel toaccept information from the <acronym class="ACRONYM">ACPI</acronym> subsystem. ForFreeBSD, Intel has provided an interpreter (<acronym class="ACRONYM">ACPI-CA</acronym>)that is shared with Linux and NetBSD. The path to the <acronymclass="ACRONYM">ACPI-CA</acronym> source code is <ttclass="FILENAME">src/sys/contrib/dev/acpica</tt>. The glue code that allows <acronymclass="ACRONYM">ACPI-CA</acronym> to work on FreeBSD is in <ttclass="FILENAME">src/sys/dev/acpica/Osd</tt>. Finally, drivers that implement various<acronym class="ACRONYM">ACPI</acronym> devices are found in <ttclass="FILENAME">src/sys/dev/acpica</tt>.</p></div><div class="SECT2"><h2 class="SECT2"><a id="ACPI-COMPROB" name="ACPI-COMPROB">11.16.3. CommonProblems</a></h2><p>For <acronym class="ACRONYM">ACPI</acronym> to work correctly, all the parts have towork correctly. Here are some common problems, in order of frequency of appearance, andsome possible workarounds or fixes.</p><div class="SECT3"><h3 class="SECT3"><a id="AEN16964" name="AEN16964">11.16.3.1. Suspend/Resume</a></h3><p><acronym class="ACRONYM">ACPI</acronym> has three suspend to <acronymclass="ACRONYM">RAM</acronym> (<acronym class="ACRONYM">STR</acronym>) states, <varclass="LITERAL">S1</var>-<var class="LITERAL">S3</var>, and one suspend to disk state(<var class="LITERAL">STD</var>), called <var class="LITERAL">S4</var>. <varclass="LITERAL">S5</var> is ``soft off'' and is the normal state your system is in whenplugged in but not powered up. <var class="LITERAL">S4</var> can actually be implementedtwo separate ways. <var class="LITERAL">S4</var><acronym class="ACRONYM">BIOS</acronym>is a <acronym class="ACRONYM">BIOS</acronym>-assisted suspend to disk. <varclass="LITERAL">S4</var><acronym class="ACRONYM">OS</acronym> is implemented entirely bythe operating system.</p><p>Start by checking <tt class="COMMAND">sysctl</tt> <var class="OPTION">hw.acpi</var>for the suspend-related items. Here are the results for my Thinkpad:</p><pre class="SCREEN">hw.acpi.supported_sleep_state: S3 S4 S5</pre><pre class="SCREEN">hw.acpi.s4bios: 0</pre><p>This means that I can use <tt class="COMMAND">acpiconf -s</tt> to test <varclass="LITERAL">S3</var>, <var class="LITERAL">S4</var><acronymclass="ACRONYM">OS</acronym>, and <var class="LITERAL">S5</var>. If <varclass="OPTION">s4bios</var> was one (<var class="LITERAL">1</var>), I would have <varclass="LITERAL">S4</var><acronym class="ACRONYM">BIOS</acronym> support instead of <varclass="LITERAL">S4</var> <acronym class="ACRONYM">OS</acronym>.</p><p>When testing suspend/resume, start with <var class="LITERAL">S1</var>, if supported.This state is most likely to work since it doesn't require much driver support. No onehas implemented <var class="LITERAL">S2</var> but if you have it, it's similar to <varclass="LITERAL">S1</var>. The next thing to try is <var class="LITERAL">S3</var>. This isthe deepest <acronym class="ACRONYM">STR</acronym> state and requires a lot of driversupport to properly reinitialize your hardware. If you have problems resuming, feel freeto email the <a href="http://lists.FreeBSD.org/mailman/listinfo/freebsd-acpi"target="_top">freebsd-acpi</a> list but do not expect the problem to be resolved sincethere are a lot of drivers/hardware that need more testing and work.</p><p>To help isolate the problem, remove as many drivers from your kernel as possible. Ifit works, you can narrow down which driver is the problem by loading drivers until itfails again. Typically binary drivers like <tt class="FILENAME">nvidia.ko</tt>, <bclass="APPLICATION">X11</b> display drivers, and <acronym class="ACRONYM">USB</acronym>will have the most problems while Ethernet interfaces usually work fine. If you canload/unload the drivers ok, you can automate this by putting the appropriate commands in<tt class="FILENAME">/etc/rc.suspend</tt> and <tt class="FILENAME">/etc/rc.resume</tt>.There is a commented-out example for unloading and loading a driver. Try setting <varclass="OPTION">hw.acpi.reset_video</var> to zero (0) if your display is messed up afterresume. Try setting longer or shorter values for <varclass="OPTION">hw.acpi.sleep_delay</var> to see if that helps.</p><p>Another thing to try is load a recent Linux distribution with <acronymclass="ACRONYM">ACPI</acronym> support and test their suspend/resume support on the samehardware. If it works on Linux, it's likely a FreeBSD driver problem and narrowing downwhich driver causes the problems will help us fix the problem. Note that the <acronymclass="ACRONYM">ACPI</acronym> maintainers do not usually maintain other drivers (e.gsound, <acronym class="ACRONYM">ATA</acronym>, etc.) so any work done on tracking down adriver problem should probably eventually be posted to the <ahref="http://lists.FreeBSD.org/mailman/listinfo/freebsd-current"target="_top">freebsd-current</a> list and mailed to the driver maintainer. If you arefeeling adventurous, go ahead and start putting some debugging <spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">printf</span>(3)</span>s in aproblematic driver to track down where in its resume function it hangs.</p><p>Finally, try disabling <acronym class="ACRONYM">ACPI</acronym> and enabling <acronymclass="ACRONYM">APM</acronym> instead. If suspend/resume works with <acronymclass="ACRONYM">APM</acronym>, you may be better off sticking with <acronymclass="ACRONYM">APM</acronym>, especially on older hardware (pre-2000). It took vendors awhile to get <acronym class="ACRONYM">ACPI</acronym> support correct and older hardwareis more likely to have <acronym class="ACRONYM">BIOS</acronym> problems with <acronymclass="ACRONYM">ACPI</acronym>.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN17030" name="AEN17030">11.16.3.2. System Hangs (temporary orpermanent)</a></h3><p>Most system hangs are a result of lost interrupts or an interrupt storm. Chipsets havea lot of problems based on how the <acronym class="ACRONYM">BIOS</acronym> configuresinterrupts before boot, correctness of the <acronym class="ACRONYM">APIC</acronym>(<acronym class="ACRONYM">MADT</acronym>) table, and routing of the <iclass="FIRSTTERM">System Control Interrupt</i> (<acronymclass="ACRONYM">SCI</acronym>).</p><p>Interrupt storms can be distinguished from lost interrupts by checking the output of<tt class="COMMAND">vmstat -i</tt> and looking at the line that has <varclass="LITERAL">acpi0</var>. If the counter is increasing at more than a couple persecond, you have an interrupt storm. If the system appears hung, try breaking to <acronymclass="ACRONYM">DDB</acronym> (<b class="KEYCAP">CTRL</b>+<b class="KEYCAP">ALT</b>+<bclass="KEYCAP">ESC</b> on console) and type <var class="OPTION">showinterrupts</var>.</p><p>Your best hope when dealing with interrupt problems is to try disabling <acronymclass="ACRONYM">APIC</acronym> support with <varclass="LITERAL">hint.apic.0.disabled="1"</var> in <ttclass="FILENAME">loader.conf</tt>.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN17051" name="AEN17051">11.16.3.3. Panics</a></h3><p>Panics are relatively rare for <acronym class="ACRONYM">ACPI</acronym> and are the toppriority to be fixed. The first step is to isolate the steps to reproduce the panic (ifpossible) and get a backtrace. Follow the advice for enabling <var class="OPTION">optionsDDB</var> and setting up a serial console (see <ahref="serialconsole-setup.html#SERIALCONSOLE-DDB">µÚ 20.6.5.3 节</a>) orsetting up a <span class="CITEREFENTRY"><span class="REFENTRYTITLE">dump</span>(8)</span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -