From owner-svn-src-user@FreeBSD.ORG  Sat Mar 28 11:29:08 2009
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 788E51065673;
	Sat, 28 Mar 2009 11:29:08 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 629E08FC1A;
	Sat, 28 Mar 2009 11:29:08 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2SBT8LT001193;
	Sat, 28 Mar 2009 11:29:08 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2SBT7ks001184;
	Sat, 28 Mar 2009 11:29:07 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200903281129.n2SBT7ks001184@svn.freebsd.org>
From: Alexander Motin <mav@FreeBSD.org>
Date: Sat, 28 Mar 2009 11:29:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190504 - in user/mav/ata/sys: . amd64/acpica
	amd64/amd64 amd64/conf amd64/include amd64/linux32 amd64/pci
	arm/conf arm/include boot/forth boot/pc98/libpc98
	boot/pc98/loader cddl/contri...
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 28 Mar 2009 11:29:08 -0000

Author: mav
Date: Sat Mar 28 11:29:07 2009
New Revision: 190504
URL: http://svn.freebsd.org/changeset/base/190504

Log:
  Update to the HEAD.

Added:
  user/mav/ata/sys/amd64/acpica/Makefile
     - copied unchanged from r190503, head/sys/amd64/acpica/Makefile
  user/mav/ata/sys/amd64/acpica/acpi_switch.S
     - copied unchanged from r190503, head/sys/amd64/acpica/acpi_switch.S
  user/mav/ata/sys/amd64/acpica/acpi_wakecode.S
     - copied unchanged from r190503, head/sys/amd64/acpica/acpi_wakecode.S
  user/mav/ata/sys/amd64/acpica/genwakecode.sh
     - copied unchanged from r190503, head/sys/amd64/acpica/genwakecode.sh
  user/mav/ata/sys/amd64/acpica/genwakedata.sh
     - copied unchanged from r190503, head/sys/amd64/acpica/genwakedata.sh
  user/mav/ata/sys/cddl/dev/dtnfsclient/
     - copied from r190503, head/sys/cddl/dev/dtnfsclient/
  user/mav/ata/sys/dev/ipmi/ipmi_linux.c
     - copied unchanged from r190503, head/sys/dev/ipmi/ipmi_linux.c
  user/mav/ata/sys/i386/cpufreq/hwpstate.c
     - copied unchanged from r190503, head/sys/i386/cpufreq/hwpstate.c
  user/mav/ata/sys/modules/dtrace/dtnfsclient/
     - copied from r190503, head/sys/modules/dtrace/dtnfsclient/
  user/mav/ata/sys/modules/ip6_mroute_mod/
     - copied from r190503, head/sys/modules/ip6_mroute_mod/
  user/mav/ata/sys/modules/ipmi/ipmi_linux/
     - copied from r190503, head/sys/modules/ipmi/ipmi_linux/
  user/mav/ata/sys/net80211/ieee80211_superg.c
     - copied unchanged from r190503, head/sys/net80211/ieee80211_superg.c
  user/mav/ata/sys/net80211/ieee80211_superg.h
     - copied unchanged from r190503, head/sys/net80211/ieee80211_superg.h
  user/mav/ata/sys/nfsclient/nfs_kdtrace.c
     - copied unchanged from r190503, head/sys/nfsclient/nfs_kdtrace.c
  user/mav/ata/sys/nfsclient/nfs_kdtrace.h
     - copied unchanged from r190503, head/sys/nfsclient/nfs_kdtrace.h
Deleted:
  user/mav/ata/sys/dev/usb/image/
  user/mav/ata/sys/modules/usb/uscanner/
Modified:
  user/mav/ata/sys/   (props changed)
  user/mav/ata/sys/amd64/acpica/acpi_machdep.c
  user/mav/ata/sys/amd64/acpica/acpi_wakeup.c
  user/mav/ata/sys/amd64/amd64/amd64_mem.c
  user/mav/ata/sys/amd64/amd64/apic_vector.S
  user/mav/ata/sys/amd64/amd64/cpu_switch.S
  user/mav/ata/sys/amd64/amd64/db_trace.c
  user/mav/ata/sys/amd64/amd64/fpu.c
  user/mav/ata/sys/amd64/amd64/genassym.c
  user/mav/ata/sys/amd64/amd64/machdep.c
  user/mav/ata/sys/amd64/amd64/mp_machdep.c
  user/mav/ata/sys/amd64/amd64/pmap.c
  user/mav/ata/sys/amd64/amd64/vm_machdep.c
  user/mav/ata/sys/amd64/conf/GENERIC
  user/mav/ata/sys/amd64/conf/NOTES
  user/mav/ata/sys/amd64/include/apicvar.h
  user/mav/ata/sys/amd64/include/elf.h
  user/mav/ata/sys/amd64/include/pcb.h
  user/mav/ata/sys/amd64/include/pmap.h
  user/mav/ata/sys/amd64/include/smp.h
  user/mav/ata/sys/amd64/linux32/linux.h
  user/mav/ata/sys/amd64/pci/pci_cfgreg.c
  user/mav/ata/sys/arm/conf/HL200
  user/mav/ata/sys/arm/conf/KB920X
  user/mav/ata/sys/arm/include/elf.h
  user/mav/ata/sys/boot/forth/loader.conf
  user/mav/ata/sys/boot/pc98/libpc98/Makefile
  user/mav/ata/sys/boot/pc98/libpc98/bioscd.c
  user/mav/ata/sys/boot/pc98/libpc98/biosdisk.c
  user/mav/ata/sys/boot/pc98/libpc98/time.c
  user/mav/ata/sys/boot/pc98/loader/Makefile
  user/mav/ata/sys/boot/pc98/loader/main.c
  user/mav/ata/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
  user/mav/ata/sys/compat/freebsd32/freebsd32_misc.c
  user/mav/ata/sys/compat/ia32/ia32_sysvec.c
  user/mav/ata/sys/compat/linprocfs/linprocfs.c
  user/mav/ata/sys/compat/linux/linux_emul.h
  user/mav/ata/sys/compat/linux/linux_file.c
  user/mav/ata/sys/compat/linux/linux_futex.c
  user/mav/ata/sys/compat/linux/linux_futex.h
  user/mav/ata/sys/compat/ndis/subr_ntoskrnl.c
  user/mav/ata/sys/compat/ndis/subr_usbd.c
  user/mav/ata/sys/conf/NOTES
  user/mav/ata/sys/conf/files
  user/mav/ata/sys/conf/files.amd64
  user/mav/ata/sys/conf/files.i386
  user/mav/ata/sys/conf/files.pc98
  user/mav/ata/sys/conf/options
  user/mav/ata/sys/dev/acpica/acpi.c
  user/mav/ata/sys/dev/acpica/acpi_cpu.c
  user/mav/ata/sys/dev/acpica/acpi_ec.c
  user/mav/ata/sys/dev/acpica/acpivar.h
  user/mav/ata/sys/dev/age/if_age.c
  user/mav/ata/sys/dev/age/if_agereg.h
  user/mav/ata/sys/dev/agp/agp.c
  user/mav/ata/sys/dev/agp/agp_amd64.c
  user/mav/ata/sys/dev/agp/agp_i810.c
  user/mav/ata/sys/dev/agp/agp_intel.c
  user/mav/ata/sys/dev/agp/agp_via.c
  user/mav/ata/sys/dev/ath/ah_osdep.c
  user/mav/ata/sys/dev/ath/ath_hal/ah.h
  user/mav/ata/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
  user/mav/ata/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
  user/mav/ata/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
  user/mav/ata/sys/dev/ath/if_ath.c
  user/mav/ata/sys/dev/ath/if_athvar.h
  user/mav/ata/sys/dev/atkbdc/psm.c
  user/mav/ata/sys/dev/bge/if_bge.c
  user/mav/ata/sys/dev/bge/if_bgereg.h
  user/mav/ata/sys/dev/cxgb/cxgb_main.c
  user/mav/ata/sys/dev/cxgb/cxgb_offload.c
  user/mav/ata/sys/dev/dc/dcphy.c
  user/mav/ata/sys/dev/dc/pnphy.c
  user/mav/ata/sys/dev/drm/ati_pcigart.c
  user/mav/ata/sys/dev/drm/drmP.h
  user/mav/ata/sys/dev/drm/drm_bufs.c
  user/mav/ata/sys/dev/drm/drm_drv.c
  user/mav/ata/sys/dev/drm/drm_irq.c
  user/mav/ata/sys/dev/drm/drm_linux_list.h
  user/mav/ata/sys/dev/drm/drm_lock.c
  user/mav/ata/sys/dev/drm/drm_pciids.h
  user/mav/ata/sys/dev/drm/drm_scatter.c
  user/mav/ata/sys/dev/drm/drm_vm.c
  user/mav/ata/sys/dev/drm/i915_dma.c
  user/mav/ata/sys/dev/drm/i915_drv.c
  user/mav/ata/sys/dev/drm/i915_drv.h
  user/mav/ata/sys/dev/drm/i915_irq.c
  user/mav/ata/sys/dev/drm/i915_reg.h
  user/mav/ata/sys/dev/drm/i915_suspend.c
  user/mav/ata/sys/dev/drm/mga_irq.c
  user/mav/ata/sys/dev/drm/r600_cp.c
  user/mav/ata/sys/dev/drm/radeon_cp.c
  user/mav/ata/sys/dev/drm/radeon_irq.c
  user/mav/ata/sys/dev/ed/if_ed.c
  user/mav/ata/sys/dev/ed/if_ed_pccard.c
  user/mav/ata/sys/dev/ed/if_ed_wd80x3.c
  user/mav/ata/sys/dev/ed/if_edvar.h
  user/mav/ata/sys/dev/fe/if_fe_pccard.c
  user/mav/ata/sys/dev/firewire/firewire.c
  user/mav/ata/sys/dev/hptiop/hptiop.h
  user/mav/ata/sys/dev/ichwd/ichwd.c
  user/mav/ata/sys/dev/if_ndis/if_ndis.c
  user/mav/ata/sys/dev/if_ndis/if_ndis_usb.c
  user/mav/ata/sys/dev/if_ndis/if_ndisvar.h
  user/mav/ata/sys/dev/iwn/if_iwn.c
  user/mav/ata/sys/dev/msk/if_msk.c
  user/mav/ata/sys/dev/my/if_my.c
  user/mav/ata/sys/dev/pccard/pccarddevs
  user/mav/ata/sys/dev/pci/pci_pci.c
  user/mav/ata/sys/dev/sound/pci/hda/hdac.c
  user/mav/ata/sys/dev/syscons/teken/teken.c
  user/mav/ata/sys/dev/syscons/teken/teken_subr.h
  user/mav/ata/sys/dev/twa/tw_cl_init.c
  user/mav/ata/sys/dev/twa/tw_osl.h
  user/mav/ata/sys/dev/twa/tw_osl_freebsd.c
  user/mav/ata/sys/dev/usb/controller/at91dci.c
  user/mav/ata/sys/dev/usb/controller/at91dci_atmelarm.c
  user/mav/ata/sys/dev/usb/controller/atmegadci.c
  user/mav/ata/sys/dev/usb/controller/atmegadci_atmelarm.c
  user/mav/ata/sys/dev/usb/controller/ehci.c
  user/mav/ata/sys/dev/usb/controller/ehci.h
  user/mav/ata/sys/dev/usb/controller/ehci_ixp4xx.c
  user/mav/ata/sys/dev/usb/controller/ehci_mbus.c
  user/mav/ata/sys/dev/usb/controller/ehci_pci.c
  user/mav/ata/sys/dev/usb/controller/musb_otg.c
  user/mav/ata/sys/dev/usb/controller/musb_otg_atmelarm.c
  user/mav/ata/sys/dev/usb/controller/ohci.c
  user/mav/ata/sys/dev/usb/controller/ohci.h
  user/mav/ata/sys/dev/usb/controller/ohci_atmelarm.c
  user/mav/ata/sys/dev/usb/controller/ohci_pci.c
  user/mav/ata/sys/dev/usb/controller/uhci.c
  user/mav/ata/sys/dev/usb/controller/uhci.h
  user/mav/ata/sys/dev/usb/controller/uhci_pci.c
  user/mav/ata/sys/dev/usb/controller/usb_controller.c
  user/mav/ata/sys/dev/usb/controller/uss820dci.c
  user/mav/ata/sys/dev/usb/controller/uss820dci_atmelarm.c
  user/mav/ata/sys/dev/usb/input/uhid.c
  user/mav/ata/sys/dev/usb/input/ums.c
  user/mav/ata/sys/dev/usb/misc/udbp.c
  user/mav/ata/sys/dev/usb/net/if_cdce.c
  user/mav/ata/sys/dev/usb/serial/u3g.c
  user/mav/ata/sys/dev/usb/serial/ubser.c
  user/mav/ata/sys/dev/usb/serial/ucycom.c
  user/mav/ata/sys/dev/usb/serial/ufoma.c
  user/mav/ata/sys/dev/usb/serial/ugensa.c
  user/mav/ata/sys/dev/usb/serial/ulpt.c
  user/mav/ata/sys/dev/usb/serial/umct.c
  user/mav/ata/sys/dev/usb/serial/umodem.c
  user/mav/ata/sys/dev/usb/serial/uplcom.c
  user/mav/ata/sys/dev/usb/serial/uvisor.c
  user/mav/ata/sys/dev/usb/storage/umass.c
  user/mav/ata/sys/dev/usb/storage/urio.c
  user/mav/ata/sys/dev/usb/storage/ustorage_fs.c
  user/mav/ata/sys/dev/usb/template/usb_template.c
  user/mav/ata/sys/dev/usb/usb_bus.h
  user/mav/ata/sys/dev/usb/usb_busdma.c
  user/mav/ata/sys/dev/usb/usb_busdma.h
  user/mav/ata/sys/dev/usb/usb_compat_linux.c
  user/mav/ata/sys/dev/usb/usb_compat_linux.h
  user/mav/ata/sys/dev/usb/usb_controller.h
  user/mav/ata/sys/dev/usb/usb_core.h
  user/mav/ata/sys/dev/usb/usb_debug.c
  user/mav/ata/sys/dev/usb/usb_debug.h
  user/mav/ata/sys/dev/usb/usb_defs.h
  user/mav/ata/sys/dev/usb/usb_dev.c
  user/mav/ata/sys/dev/usb/usb_dev.h
  user/mav/ata/sys/dev/usb/usb_device.c
  user/mav/ata/sys/dev/usb/usb_device.h
  user/mav/ata/sys/dev/usb/usb_dynamic.c
  user/mav/ata/sys/dev/usb/usb_generic.c
  user/mav/ata/sys/dev/usb/usb_handle_request.c
  user/mav/ata/sys/dev/usb/usb_hid.c
  user/mav/ata/sys/dev/usb/usb_hid.h
  user/mav/ata/sys/dev/usb/usb_hub.c
  user/mav/ata/sys/dev/usb/usb_hub.h
  user/mav/ata/sys/dev/usb/usb_lookup.c
  user/mav/ata/sys/dev/usb/usb_lookup.h
  user/mav/ata/sys/dev/usb/usb_mbuf.c
  user/mav/ata/sys/dev/usb/usb_mbuf.h
  user/mav/ata/sys/dev/usb/usb_msctest.c
  user/mav/ata/sys/dev/usb/usb_process.c
  user/mav/ata/sys/dev/usb/usb_process.h
  user/mav/ata/sys/dev/usb/usb_request.c
  user/mav/ata/sys/dev/usb/usb_request.h
  user/mav/ata/sys/dev/usb/usb_sw_transfer.c
  user/mav/ata/sys/dev/usb/usb_transfer.c
  user/mav/ata/sys/dev/usb/usb_transfer.h
  user/mav/ata/sys/dev/usb/usb_util.c
  user/mav/ata/sys/dev/usb/usb_util.h
  user/mav/ata/sys/dev/usb/usbdevs
  user/mav/ata/sys/dev/wpi/if_wpi.c
  user/mav/ata/sys/dev/wpi/if_wpireg.h
  user/mav/ata/sys/dev/xen/netfront/   (props changed)
  user/mav/ata/sys/dev/xen/xenpci/   (props changed)
  user/mav/ata/sys/fs/nullfs/null_vnops.c
  user/mav/ata/sys/geom/eli/g_eli.c
  user/mav/ata/sys/geom/label/g_label.c
  user/mav/ata/sys/geom/label/g_label.h
  user/mav/ata/sys/geom/label/g_label_ufs.c
  user/mav/ata/sys/geom/part/g_part.c
  user/mav/ata/sys/geom/part/g_part_apm.c
  user/mav/ata/sys/geom/part/g_part_bsd.c
  user/mav/ata/sys/geom/part/g_part_ebr.c
  user/mav/ata/sys/gnu/fs/xfs/FreeBSD/xfs_buf.c
  user/mav/ata/sys/i386/conf/GENERIC
  user/mav/ata/sys/i386/conf/NOTES
  user/mav/ata/sys/i386/conf/XBOX
  user/mav/ata/sys/i386/i386/i686_mem.c
  user/mav/ata/sys/i386/i386/k6_mem.c
  user/mav/ata/sys/i386/i386/machdep.c
  user/mav/ata/sys/i386/i386/pmap.c
  user/mav/ata/sys/i386/i386/vm_machdep.c
  user/mav/ata/sys/i386/include/elf.h
  user/mav/ata/sys/i386/include/pmap.h
  user/mav/ata/sys/i386/isa/npx.c
  user/mav/ata/sys/i386/pci/pci_cfgreg.c
  user/mav/ata/sys/ia64/include/elf.h
  user/mav/ata/sys/kern/imgact_elf.c
  user/mav/ata/sys/kern/kern_environment.c
  user/mav/ata/sys/kern/kern_exec.c
  user/mav/ata/sys/kern/kern_jail.c
  user/mav/ata/sys/kern/kern_lock.c
  user/mav/ata/sys/kern/kern_mutex.c
  user/mav/ata/sys/kern/kern_poll.c
  user/mav/ata/sys/kern/kern_rwlock.c
  user/mav/ata/sys/kern/kern_sx.c
  user/mav/ata/sys/kern/kern_thread.c
  user/mav/ata/sys/kern/kern_time.c
  user/mav/ata/sys/kern/subr_bus.c
  user/mav/ata/sys/kern/subr_lock.c
  user/mav/ata/sys/kern/subr_param.c
  user/mav/ata/sys/kern/subr_rtc.c
  user/mav/ata/sys/kern/subr_smp.c
  user/mav/ata/sys/kern/vfs_bio.c
  user/mav/ata/sys/kern/vfs_cache.c
  user/mav/ata/sys/kern/vfs_lookup.c
  user/mav/ata/sys/kern/vfs_mount.c
  user/mav/ata/sys/mips/include/elf.h
  user/mav/ata/sys/modules/Makefile
  user/mav/ata/sys/modules/cpufreq/Makefile
  user/mav/ata/sys/modules/dtrace/Makefile
  user/mav/ata/sys/modules/dtrace/dtraceall/dtraceall.c
  user/mav/ata/sys/modules/ip_mroute_mod/Makefile
  user/mav/ata/sys/modules/ipmi/Makefile
  user/mav/ata/sys/modules/linprocfs/Makefile
  user/mav/ata/sys/modules/netgraph/Makefile
  user/mav/ata/sys/modules/opensolaris/Makefile
  user/mav/ata/sys/modules/usb/Makefile
  user/mav/ata/sys/net/if.c
  user/mav/ata/sys/net/if_bridge.c
  user/mav/ata/sys/net/if_loop.c
  user/mav/ata/sys/net/if_tap.c
  user/mav/ata/sys/net/if_var.h
  user/mav/ata/sys/net80211/ieee80211.c
  user/mav/ata/sys/net80211/ieee80211.h
  user/mav/ata/sys/net80211/ieee80211_adhoc.c
  user/mav/ata/sys/net80211/ieee80211_freebsd.h
  user/mav/ata/sys/net80211/ieee80211_hostap.c
  user/mav/ata/sys/net80211/ieee80211_input.c
  user/mav/ata/sys/net80211/ieee80211_input.h
  user/mav/ata/sys/net80211/ieee80211_ioctl.c
  user/mav/ata/sys/net80211/ieee80211_node.c
  user/mav/ata/sys/net80211/ieee80211_node.h
  user/mav/ata/sys/net80211/ieee80211_output.c
  user/mav/ata/sys/net80211/ieee80211_proto.c
  user/mav/ata/sys/net80211/ieee80211_proto.h
  user/mav/ata/sys/net80211/ieee80211_scan_sta.c
  user/mav/ata/sys/net80211/ieee80211_sta.c
  user/mav/ata/sys/net80211/ieee80211_tdma.c
  user/mav/ata/sys/net80211/ieee80211_tdma.h
  user/mav/ata/sys/net80211/ieee80211_var.h
  user/mav/ata/sys/net80211/ieee80211_wds.c
  user/mav/ata/sys/netinet/igmp.c
  user/mav/ata/sys/netinet/igmp.h
  user/mav/ata/sys/netinet/in.c
  user/mav/ata/sys/netinet/in.h
  user/mav/ata/sys/netinet/in_mcast.c
  user/mav/ata/sys/netinet/in_pcb.c
  user/mav/ata/sys/netinet/in_pcb.h
  user/mav/ata/sys/netinet/ip_mroute.c
  user/mav/ata/sys/netinet/ip_mroute.h
  user/mav/ata/sys/netinet/sctp_structs.h
  user/mav/ata/sys/netinet/tcp_input.c
  user/mav/ata/sys/netinet/tcp_subr.c
  user/mav/ata/sys/netinet/tcp_timer.c
  user/mav/ata/sys/netinet/tcp_timewait.c
  user/mav/ata/sys/netinet/tcp_usrreq.c
  user/mav/ata/sys/netinet6/in6.c
  user/mav/ata/sys/netinet6/in6_ifattach.c
  user/mav/ata/sys/netinet6/in6_pcb.c
  user/mav/ata/sys/netinet6/ip6_mroute.c
  user/mav/ata/sys/netinet6/ip6_mroute.h
  user/mav/ata/sys/netinet6/mld6.c
  user/mav/ata/sys/netipsec/key.c
  user/mav/ata/sys/netnatm/natm.c
  user/mav/ata/sys/nfs4client/nfs4_vnops.c
  user/mav/ata/sys/nfsclient/nfs.h
  user/mav/ata/sys/nfsclient/nfs_bio.c
  user/mav/ata/sys/nfsclient/nfs_krpc.c
  user/mav/ata/sys/nfsclient/nfs_subs.c
  user/mav/ata/sys/nfsclient/nfs_vnops.c
  user/mav/ata/sys/nfsclient/nfsnode.h
  user/mav/ata/sys/nfsserver/nfs_srvkrpc.c
  user/mav/ata/sys/pc98/conf/GENERIC
  user/mav/ata/sys/pc98/conf/NOTES
  user/mav/ata/sys/pc98/pc98/machdep.c
  user/mav/ata/sys/pci/intpm.c
  user/mav/ata/sys/powerpc/conf/GENERIC
  user/mav/ata/sys/powerpc/include/elf.h
  user/mav/ata/sys/powerpc/powermac/ata_macio.c
  user/mav/ata/sys/security/mac/mac_atalk.c
  user/mav/ata/sys/security/mac/mac_audit.c
  user/mav/ata/sys/security/mac/mac_cred.c
  user/mav/ata/sys/security/mac/mac_framework.c
  user/mav/ata/sys/security/mac/mac_inet.c
  user/mav/ata/sys/security/mac/mac_inet6.c
  user/mav/ata/sys/security/mac/mac_internal.h
  user/mav/ata/sys/security/mac/mac_net.c
  user/mav/ata/sys/security/mac/mac_pipe.c
  user/mav/ata/sys/security/mac/mac_posix_sem.c
  user/mav/ata/sys/security/mac/mac_posix_shm.c
  user/mav/ata/sys/security/mac/mac_priv.c
  user/mav/ata/sys/security/mac/mac_process.c
  user/mav/ata/sys/security/mac/mac_socket.c
  user/mav/ata/sys/security/mac/mac_syscalls.c
  user/mav/ata/sys/security/mac/mac_system.c
  user/mav/ata/sys/security/mac/mac_sysv_msg.c
  user/mav/ata/sys/security/mac/mac_sysv_sem.c
  user/mav/ata/sys/security/mac/mac_sysv_shm.c
  user/mav/ata/sys/security/mac/mac_vfs.c
  user/mav/ata/sys/security/mac_portacl/mac_portacl.c
  user/mav/ata/sys/sparc64/central/central.c
  user/mav/ata/sys/sparc64/conf/GENERIC
  user/mav/ata/sys/sparc64/ebus/ebus.c
  user/mav/ata/sys/sparc64/fhc/fhc.c
  user/mav/ata/sys/sparc64/include/elf.h
  user/mav/ata/sys/sparc64/include/trap.h
  user/mav/ata/sys/sparc64/isa/isa.c
  user/mav/ata/sys/sparc64/isa/ofw_isa.c
  user/mav/ata/sys/sparc64/pci/apb.c
  user/mav/ata/sys/sparc64/pci/ofw_pcib.c
  user/mav/ata/sys/sparc64/pci/ofw_pcibus.c
  user/mav/ata/sys/sparc64/pci/psycho.c
  user/mav/ata/sys/sparc64/pci/psychovar.h
  user/mav/ata/sys/sparc64/pci/schizo.c
  user/mav/ata/sys/sparc64/sbus/dma_sbus.c
  user/mav/ata/sys/sparc64/sbus/sbus.c
  user/mav/ata/sys/sparc64/sbus/sbusvar.h
  user/mav/ata/sys/sparc64/sparc64/db_disasm.c
  user/mav/ata/sys/sparc64/sparc64/eeprom.c
  user/mav/ata/sys/sparc64/sparc64/jbusppm.c
  user/mav/ata/sys/sparc64/sparc64/mp_machdep.c
  user/mav/ata/sys/sparc64/sparc64/nexus.c
  user/mav/ata/sys/sparc64/sparc64/rtc.c
  user/mav/ata/sys/sparc64/sparc64/sc_machdep.c
  user/mav/ata/sys/sparc64/sparc64/schppm.c
  user/mav/ata/sys/sparc64/sparc64/trap.c
  user/mav/ata/sys/sparc64/sparc64/upa.c
  user/mav/ata/sys/sun4v/conf/GENERIC
  user/mav/ata/sys/sun4v/include/elf.h
  user/mav/ata/sys/sun4v/include/trap.h
  user/mav/ata/sys/sun4v/sun4v/trap.c
  user/mav/ata/sys/sys/_pthreadtypes.h
  user/mav/ata/sys/sys/aio.h
  user/mav/ata/sys/sys/buf.h
  user/mav/ata/sys/sys/dtrace_bsd.h
  user/mav/ata/sys/sys/elf_common.h
  user/mav/ata/sys/sys/imgact.h
  user/mav/ata/sys/sys/jail.h
  user/mav/ata/sys/sys/lock_profile.h
  user/mav/ata/sys/sys/memrange.h
  user/mav/ata/sys/sys/param.h
  user/mav/ata/sys/sys/proc.h
  user/mav/ata/sys/sys/sem.h
  user/mav/ata/sys/sys/shm.h
  user/mav/ata/sys/sys/smp.h
  user/mav/ata/sys/sys/stat.h
  user/mav/ata/sys/sys/syslog.h
  user/mav/ata/sys/sys/termios.h
  user/mav/ata/sys/sys/time.h
  user/mav/ata/sys/sys/uio.h
  user/mav/ata/sys/sys/vnode.h
  user/mav/ata/sys/ufs/ffs/ffs_vfsops.c
  user/mav/ata/sys/ufs/ffs/ffs_vnops.c

Copied: user/mav/ata/sys/amd64/acpica/Makefile (from r190503, head/sys/amd64/acpica/Makefile)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/mav/ata/sys/amd64/acpica/Makefile	Sat Mar 28 11:29:07 2009	(r190504, copy of r190503, head/sys/amd64/acpica/Makefile)
@@ -0,0 +1,33 @@
+# $FreeBSD$
+
+# Correct path for kernel builds
+# Don't rely on the kernel's .depend file
+.ifdef MAKESRCPATH
+.PATH: ${MAKESRCPATH}
+DEPENDFILE=
+.else
+MAKESRCPATH= ${.CURDIR}
+CLEANFILES= acpi_wakecode.h acpi_wakedata.h acpi_wakecode.bin acpi_wakecode.o
+.endif
+.if ${CC} == "icc"
+CFLAGS+=	-restrict
+NOSTDINC=	-X
+.else
+NOSTDINC=	-nostdinc
+.endif
+CFLAGS+=	${NOSTDINC} -include opt_global.h -I. -I${MAKESRCPATH}/../..
+
+all: acpi_wakecode.h acpi_wakedata.h
+
+acpi_wakecode.o: acpi_wakecode.S assym.s
+
+acpi_wakecode.bin: acpi_wakecode.o
+	objcopy -S -O binary acpi_wakecode.o acpi_wakecode.bin
+
+acpi_wakecode.h: acpi_wakecode.bin
+	sh ${MAKESRCPATH}/genwakecode.sh > acpi_wakecode.h
+
+acpi_wakedata.h: acpi_wakecode.bin
+	sh ${MAKESRCPATH}/genwakedata.sh > acpi_wakedata.h
+
+.include <bsd.prog.mk>

Modified: user/mav/ata/sys/amd64/acpica/acpi_machdep.c
==============================================================================
--- user/mav/ata/sys/amd64/acpica/acpi_machdep.c	Sat Mar 28 11:01:44 2009	(r190503)
+++ user/mav/ata/sys/amd64/acpica/acpi_machdep.c	Sat Mar 28 11:29:07 2009	(r190504)
@@ -31,25 +31,51 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
+#include <sys/sysctl.h>
 
 #include <contrib/dev/acpica/acpi.h>
 #include <dev/acpica/acpivar.h>
 
 #include <machine/nexusvar.h>
 
+SYSCTL_DECL(_debug_acpi);
+
+int acpi_resume_beep;
+TUNABLE_INT("debug.acpi.resume_beep", &acpi_resume_beep);
+SYSCTL_INT(_debug_acpi, OID_AUTO, resume_beep, CTLFLAG_RW, &acpi_resume_beep,
+    0, "Beep the PC speaker when resuming");
+
+int acpi_reset_video;
+TUNABLE_INT("hw.acpi.reset_video", &acpi_reset_video);
+
 static int intr_model = ACPI_INTR_PIC;
+static struct apm_clone_data acpi_clone;
 
 int
 acpi_machdep_init(device_t dev)
 {
-	struct	acpi_softc *sc;
+	struct acpi_softc	*sc;
 
 	sc = devclass_get_softc(devclass_find("acpi"), 0);
+
+	/* Create a fake clone for /dev/acpi. */
+	STAILQ_INIT(&sc->apm_cdevs);
+	acpi_clone.cdev = sc->acpi_dev_t;
+	acpi_clone.acpi_sc = sc;
+	ACPI_LOCK(acpi);
+	STAILQ_INSERT_TAIL(&sc->apm_cdevs, &acpi_clone, entries);
+	ACPI_UNLOCK(acpi);
+	sc->acpi_clone = &acpi_clone;
 	acpi_install_wakeup_handler(sc);
 
 	if (intr_model != ACPI_INTR_PIC)
 		acpi_SetIntrModel(intr_model);
 
+	SYSCTL_ADD_UINT(&sc->acpi_sysctl_ctx,
+	    SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO,
+	    "reset_video", CTLFLAG_RW, &acpi_reset_video, 0,
+	    "Call the VESA reset BIOS vector on the resume path");
+
 	return (0);
 }
 

Copied: user/mav/ata/sys/amd64/acpica/acpi_switch.S (from r190503, head/sys/amd64/acpica/acpi_switch.S)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/mav/ata/sys/amd64/acpica/acpi_switch.S	Sat Mar 28 11:29:07 2009	(r190504, copy of r190503, head/sys/amd64/acpica/acpi_switch.S)
@@ -0,0 +1,177 @@
+/*-
+ * Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
+ * Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
+ * Copyright (c) 2008-2009 Jung-uk Kim <jkim@FreeBSD.org>
+ * All rights reserved.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ *
+ * $FreeBSD$
+ */
+
+#include <machine/asmacros.h>
+#include <machine/specialreg.h>
+
+#include "acpi_wakedata.h"
+#include "assym.s"
+
+#define	WAKEUP_DECL(member)	\
+    .set WAKEUP_ ## member, wakeup_ ## member - wakeup_ctx
+
+	WAKEUP_DECL(xpcb)
+	WAKEUP_DECL(gdt)
+	WAKEUP_DECL(efer)
+	WAKEUP_DECL(pat)
+	WAKEUP_DECL(star)
+	WAKEUP_DECL(lstar)
+	WAKEUP_DECL(cstar)
+	WAKEUP_DECL(sfmask)
+	WAKEUP_DECL(cpu)
+
+#define	WAKEUP_CTX(member)	WAKEUP_ ## member (%rdi)
+#define	WAKEUP_PCB(member)	PCB_ ## member(%r11)
+#define	WAKEUP_XPCB(member)	XPCB_ ## member(%r11)
+
+ENTRY(acpi_restorecpu)
+	/* Switch to KPML4phys. */
+	movq	%rsi, %rax
+	movq	%rax, %cr3
+
+	/* Restore GDT. */
+	lgdt	WAKEUP_CTX(gdt)
+	jmp	1f
+1:
+
+	/* Fetch PCB. */
+	movq	WAKEUP_CTX(xpcb), %r11
+
+	/* Restore segment registers. */
+	mov	WAKEUP_PCB(DS), %ds
+	mov	WAKEUP_PCB(ES), %es
+	mov	WAKEUP_XPCB(SS), %ss
+	mov	WAKEUP_PCB(FS), %fs
+	mov	WAKEUP_PCB(GS), %gs
+
+	movl	$MSR_FSBASE, %ecx
+	movl	WAKEUP_PCB(FSBASE), %eax
+	movl	4 + WAKEUP_PCB(FSBASE), %edx
+	wrmsr
+	movl	$MSR_GSBASE, %ecx
+	movl	WAKEUP_PCB(GSBASE), %eax
+	movl	4 + WAKEUP_PCB(GSBASE), %edx
+	wrmsr
+	movl	$MSR_KGSBASE, %ecx
+	movl	WAKEUP_XPCB(KGSBASE), %eax
+	movl	4 + WAKEUP_XPCB(KGSBASE), %edx
+	wrmsr
+
+	/* Restore EFER. */
+	movl	$MSR_EFER, %ecx
+	movl	WAKEUP_CTX(efer), %eax
+	wrmsr
+
+	/* Restore PAT. */
+	movl	$MSR_PAT, %ecx
+	movl	WAKEUP_CTX(pat), %eax
+	movl	4 + WAKEUP_CTX(pat), %edx
+	wrmsr
+
+	/* Restore fast syscall stuff. */
+	movl	$MSR_STAR, %ecx
+	movl	WAKEUP_CTX(star), %eax
+	movl	4 + WAKEUP_CTX(star), %edx
+	wrmsr
+	movl	$MSR_LSTAR, %ecx
+	movl	WAKEUP_CTX(lstar), %eax
+	movl	4 + WAKEUP_CTX(lstar), %edx
+	wrmsr
+	movl	$MSR_CSTAR, %ecx
+	movl	WAKEUP_CTX(cstar), %eax
+	movl	4 + WAKEUP_CTX(cstar), %edx
+	wrmsr
+	movl	$MSR_SF_MASK, %ecx
+	movl	WAKEUP_CTX(sfmask), %eax
+	wrmsr
+
+	/* Restore CR0, CR2 and CR4. */
+	movq	WAKEUP_XPCB(CR0), %rax
+	movq	%rax, %cr0
+	movq	WAKEUP_XPCB(CR2), %rax
+	movq	%rax, %cr2
+	movq	WAKEUP_XPCB(CR4), %rax
+	movq	%rax, %cr4
+
+	/* Restore descriptor tables. */
+	lidt	WAKEUP_XPCB(IDT)
+	lldt	WAKEUP_XPCB(LDT)
+	movw	WAKEUP_XPCB(TR), %ax
+	ltr	%ax
+
+	/* Restore other callee saved registers. */
+	movq	WAKEUP_PCB(R15), %r15
+	movq	WAKEUP_PCB(R14), %r14
+	movq	WAKEUP_PCB(R13), %r13
+	movq	WAKEUP_PCB(R12), %r12
+	movq	WAKEUP_PCB(RBP), %rbp
+	movq	WAKEUP_PCB(RSP), %rsp
+	movq	WAKEUP_PCB(RBX), %rbx
+
+	/* Restore debug registers. */
+	movq	WAKEUP_PCB(DR0), %rax
+	movq	%rax, %dr0
+	movq	WAKEUP_PCB(DR1), %rax
+	movq	%rax, %dr1
+	movq	WAKEUP_PCB(DR2), %rax
+	movq	%rax, %dr2
+	movq	WAKEUP_PCB(DR3), %rax
+	movq	%rax, %dr3
+	movq	WAKEUP_PCB(DR6), %rax
+	movq	%rax, %dr6
+	movq	WAKEUP_PCB(DR7), %rax
+	movq	%rax, %dr7
+
+	/* Restore return address. */
+	movq	WAKEUP_PCB(RIP), %rax
+	movq	%rax, (%rsp)
+
+	/* Indicate the CPU is resumed. */
+	xorl	%eax, %eax
+	movl	%eax, WAKEUP_CTX(cpu)
+
+	ret
+END(acpi_restorecpu)
+
+ENTRY(acpi_savecpu)
+	/* Fetch XPCB and save CPU context. */
+	movq	%rdi, %r10
+	call	savectx2
+	movq	%r10, %r11
+
+	/* Patch caller's return address and stack pointer. */
+	movq	(%rsp), %rax
+	movq	%rax, WAKEUP_PCB(RIP)
+	movq	%rsp, %rax
+	movq	%rax, WAKEUP_PCB(RSP)
+
+	movl	$1, %eax
+	ret
+END(acpi_savecpu)

Copied: user/mav/ata/sys/amd64/acpica/acpi_wakecode.S (from r190503, head/sys/amd64/acpica/acpi_wakecode.S)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/mav/ata/sys/amd64/acpica/acpi_wakecode.S	Sat Mar 28 11:29:07 2009	(r190504, copy of r190503, head/sys/amd64/acpica/acpi_wakecode.S)
@@ -0,0 +1,278 @@
+/*-
+ * Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
+ * Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
+ * Copyright (c) 2003 Peter Wemm
+ * Copyright (c) 2008-2009 Jung-uk Kim <jkim@FreeBSD.org>
+ * All rights reserved.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ *
+ * $FreeBSD$
+ */
+
+#define LOCORE
+
+#include <machine/asmacros.h>
+#include <machine/specialreg.h>
+
+#include "assym.s"
+
+/*
+ * Resume entry point for real mode.
+ *
+ * If XFirmwareWakingVector is zero and FirmwareWakingVector is non-zero
+ * in FACS, the BIOS enters here in real mode after POST with CS set to
+ * (FirmwareWakingVector >> 4) and IP set to (FirmwareWakingVector & 0xf).
+ * Depending on the previous sleep state, we may need to initialize more
+ * of the system (i.e., S3 suspend-to-RAM vs. S4 suspend-to-disk).
+ *
+ * Note: If XFirmwareWakingVector is non-zero, it should disable address
+ * translation/paging and interrupts, load all segment registers with
+ * a flat 4 GB address space, and set EFLAGS.IF to zero.  Currently
+ * this mode is not supported by this code.
+ */
+
+	.data				/* So we can modify it */
+
+	ALIGN_TEXT
+wakeup_start:
+	.code16
+	/*
+	 * Set up segment registers for real mode, a small stack for
+	 * any calls we make, and clear any flags.
+	 */
+	cli				/* make sure no interrupts */
+	cld
+	mov	%cs, %ax		/* copy %cs to %ds.  Remember these */
+	mov	%ax, %ds		/* are offsets rather than selectors */
+	mov	%ax, %ss
+	movw	$PAGE_SIZE - 8, %sp
+	xorw	%ax, %ax
+	pushw	%ax
+	popfw
+
+	/* To debug resume hangs, beep the speaker if the user requested. */
+	testb	$~0, resume_beep - wakeup_start
+	jz	1f
+	movb	$0, resume_beep - wakeup_start
+	movb	$0xc0, %al
+	outb	%al, $0x42
+	movb	$0x04, %al
+	outb	%al, $0x42
+	inb	$0x61, %al
+	orb	$0x3, %al
+	outb	%al, $0x61
+1:
+
+	/* Re-initialize video BIOS if the reset_video tunable is set. */
+	testb	$~0, reset_video - wakeup_start
+	jz	1f
+	movb	$0, reset_video - wakeup_start
+	lcall	$0xc000, $3
+
+	/* Re-start in case the previous BIOS call clobbers them. */
+	jmp	wakeup_start
+1:
+
+	/*
+	 * Find relocation base and patch the gdt descript and ljmp targets
+	 */
+	xorl	%ebx, %ebx
+	mov	%cs, %bx
+	sall	$4, %ebx		/* %ebx is now our relocation base */
+
+	/*
+	 * Load the descriptor table pointer.  We'll need it when running
+	 * in 16-bit protected mode.
+	 */
+	lgdtl	bootgdtdesc - wakeup_start
+
+	/* Enable protected mode */
+	movl	$CR0_PE, %eax
+	mov	%eax, %cr0
+
+	/*
+	 * Now execute a far jump to turn on protected mode.  This
+	 * causes the segment registers to turn into selectors and causes
+	 * %cs to be loaded from the gdt.
+	 *
+	 * The following instruction is:
+	 * ljmpl $bootcode32 - bootgdt, $wakeup_32 - wakeup_start
+	 * but gas cannot assemble that.  And besides, we patch the targets
+	 * in early startup and its a little clearer what we are patching.
+	 */
+wakeup_sw32:
+	.byte	0x66			/* size override to 32 bits */
+	.byte	0xea			/* opcode for far jump */
+	.long	wakeup_32 - wakeup_start /* offset in segment */
+	.word	bootcode32 - bootgdt	/* index in gdt for 32 bit code */
+
+	/*
+	 * At this point, we are running in 32 bit legacy protected mode.
+	 */
+	.code32
+wakeup_32:
+
+	mov	$bootdata32 - bootgdt, %eax
+	mov	%ax, %ds
+
+	/* Turn on the PAE and PSE bits for when paging is enabled */
+	mov	%cr4, %eax
+	orl	$(CR4_PAE | CR4_PSE), %eax
+	mov	%eax, %cr4
+
+	/*
+	 * Enable EFER.LME so that we get long mode when all the prereqs are
+	 * in place.  In this case, it turns on when CR0_PG is finally enabled.
+	 * Pick up a few other EFER bits that we'll use need we're here.
+	 */
+	movl	$MSR_EFER, %ecx
+	rdmsr
+	orl	$EFER_LME | EFER_SCE, %eax
+	wrmsr
+
+	/*
+	 * Point to the embedded page tables for startup.  Note that this
+	 * only gets accessed after we're actually in 64 bit mode, however
+	 * we can only set the bottom 32 bits of %cr3 in this state.  This
+	 * means we are required to use a temporary page table that is below
+	 * the 4GB limit.  %ebx is still our relocation base.  We could just
+	 * subtract 3 * PAGE_SIZE, but that would be too easy.
+	 */
+	leal	wakeup_pagetables - wakeup_start(%ebx), %eax
+	movl	(%eax), %eax
+	mov	%eax, %cr3
+
+	/*
+	 * Finally, switch to long bit mode by enabling paging.  We have
+	 * to be very careful here because all the segmentation disappears
+	 * out from underneath us.  The spec says we can depend on the
+	 * subsequent pipelined branch to execute, but *only if* everthing
+	 * is still identity mapped.  If any mappings change, the pipeline
+	 * will flush.
+	 */
+	mov	%cr0, %eax
+	orl	$CR0_PG, %eax
+	mov	%eax, %cr0
+
+	/*
+	 * At this point paging is enabled, and we are in "compatability" mode.
+	 * We do another far jump to reload %cs with the 64 bit selector.
+	 * %cr3 points to a 4-level page table page.
+	 * We cannot yet jump all the way to the kernel because we can only
+	 * specify a 32 bit linear address.  So, yet another trampoline.
+	 *
+	 * The following instruction is:
+	 * ljmp $bootcode64 - bootgdt, $wakeup_64 - wakeup_start
+	 * but gas cannot assemble that.  And besides, we patch the targets
+	 * in early startup and its a little clearer what we are patching.
+	 */
+wakeup_sw64:
+	.byte	0xea			/* opcode for far jump */
+	.long	wakeup_64 - wakeup_start /* offset in segment */
+	.word	bootcode64 - bootgdt	/* index in gdt for 64 bit code */
+
+	/*
+	 * Yeehar!  We're running in 64-bit mode!  We can mostly ignore our
+	 * segment registers, and get on with it.
+	 * Note that we are running at the correct virtual address, but with
+	 * a 1:1 1GB mirrored mapping over entire address space.  We had better
+	 * switch to a real %cr3 promptly so that we can get to the direct map
+	 * space. Remember that jmp is relative and that we've been relocated,
+	 * so use an indirect jump.
+	 */
+	ALIGN_TEXT
+	.code64
+wakeup_64:
+	mov	$bootdata64 - bootgdt, %eax
+	mov	%ax, %ds
+
+	/* Restore arguments and return. */
+	movq	wakeup_ctx - wakeup_start(%rbx), %rdi
+	movq	wakeup_kpml4 - wakeup_start(%rbx), %rsi
+	movq	wakeup_retaddr - wakeup_start(%rbx), %rax
+	jmp	*%rax
+
+	.data
+
+resume_beep:
+	.byte	0
+reset_video:
+	.byte	0
+
+	ALIGN_DATA
+bootgdt:
+	.long	0x00000000
+	.long	0x00000000
+
+bootcode64:
+	.long	0x0000ffff
+	.long	0x00af9b00
+
+bootdata64:
+	.long	0x0000ffff
+	.long	0x00af9300
+
+bootcode32:
+	.long	0x0000ffff
+	.long	0x00cf9b00
+
+bootdata32:
+	.long	0x0000ffff
+	.long	0x00cf9300
+bootgdtend:
+
+wakeup_pagetables:
+	.long	0
+
+bootgdtdesc:
+	.word	bootgdtend - bootgdt	/* Length */
+	.long	bootgdt - wakeup_start	/* Offset plus %ds << 4 */
+
+	ALIGN_DATA
+wakeup_retaddr:
+	.quad	0
+wakeup_kpml4:
+	.quad	0
+
+wakeup_ctx:
+	.quad	0
+wakeup_xpcb:
+	.quad	0
+wakeup_gdt:
+	.word	0
+	.quad	0
+wakeup_efer:
+	.quad	0
+wakeup_pat:
+	.quad	0
+wakeup_star:
+	.quad	0
+wakeup_lstar:
+	.quad	0
+wakeup_cstar:
+	.quad	0
+wakeup_sfmask:
+	.quad	0
+wakeup_cpu:
+	.long	0
+dummy:

Modified: user/mav/ata/sys/amd64/acpica/acpi_wakeup.c
==============================================================================
--- user/mav/ata/sys/amd64/acpica/acpi_wakeup.c	Sat Mar 28 11:01:44 2009	(r190503)
+++ user/mav/ata/sys/amd64/acpica/acpi_wakeup.c	Sat Mar 28 11:29:07 2009	(r190504)
@@ -1,6 +1,8 @@
 /*-
  * Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
  * Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
+ * Copyright (c) 2003 Peter Wemm
+ * Copyright (c) 2008-2009 Jung-uk Kim <jkim@FreeBSD.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,18 +31,408 @@
 __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
+#include <sys/systm.h>
 #include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/memrange.h>
+#include <sys/smp.h>
+#include <sys/types.h>
+
+#include <vm/vm.h>
+#include <vm/pmap.h>
+
+#include <machine/intr_machdep.h>
+#include <machine/pcb.h>
+#include <machine/pmap.h>
+#include <machine/specialreg.h>
+#include <machine/vmparam.h>
+
+#ifdef SMP
+#include <machine/apicreg.h>
+#include <machine/smp.h>
+#endif
 
 #include <contrib/dev/acpica/acpi.h>
 #include <dev/acpica/acpivar.h>
 
+#include "acpi_wakecode.h"
+#include "acpi_wakedata.h"
+
+/* Make sure the code is less than a page and leave room for the stack. */
+CTASSERT(sizeof(wakecode) < PAGE_SIZE - 1024);
+
+#ifndef _SYS_CDEFS_H_
+#error this file needs sys/cdefs.h as a prerequisite
+#endif
+
+extern int		acpi_resume_beep;
+extern int		acpi_reset_video;
+
+#ifdef SMP
+extern struct xpcb	*stopxpcbs;
+#else
+static struct xpcb	*stopxpcbs;
+#endif
+
+int			acpi_restorecpu(struct xpcb *, vm_offset_t);
+int			acpi_savecpu(struct xpcb *);
+
+static void		acpi_reset_tss(int cpu);
+static void		acpi_alloc_wakeup_handler(void);
+static void		acpi_stop_beep(void *);
+
+#ifdef SMP
+static int		acpi_wakeup_ap(struct acpi_softc *, int);
+static void		acpi_wakeup_cpus(struct acpi_softc *, cpumask_t);
+#endif
+
+#define	WAKECODE_VADDR(sc)	((sc)->acpi_wakeaddr + (3 * PAGE_SIZE))
+#define	WAKECODE_PADDR(sc)	((sc)->acpi_wakephys + (3 * PAGE_SIZE))
+#define	WAKECODE_FIXUP(offset, type, val) do	{	\
+	type	*addr;					\
+	addr = (type *)(WAKECODE_VADDR(sc) + offset);	\
+	*addr = val;					\
+} while (0)
+
+/* Turn off bits 1&2 of the PIT, stopping the beep. */
+static void
+acpi_stop_beep(void *arg)
+{
+	outb(0x61, inb(0x61) & ~0x3);
+}
+
+#ifdef SMP
+static int
+acpi_wakeup_ap(struct acpi_softc *sc, int cpu)
+{
+	int		vector = (WAKECODE_PADDR(sc) >> 12) & 0xff;
+	int		apic_id = cpu_apic_ids[cpu];
+	int		ms;
+
+	WAKECODE_FIXUP(wakeup_xpcb, struct xpcb *, &stopxpcbs[cpu]);
+	WAKECODE_FIXUP(wakeup_gdt, uint16_t, stopxpcbs[cpu].xpcb_gdt.rd_limit);
+	WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t,
+	    stopxpcbs[cpu].xpcb_gdt.rd_base);
+	WAKECODE_FIXUP(wakeup_cpu, int, cpu);
+
+	acpi_reset_tss(cpu);
+
+	/* do an INIT IPI: assert RESET */
+	lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE |
+	    APIC_LEVEL_ASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, apic_id);
+
+	/* wait for pending status end */
+	lapic_ipi_wait(-1);
+
+	/* do an INIT IPI: deassert RESET */
+	lapic_ipi_raw(APIC_DEST_ALLESELF | APIC_TRIGMOD_LEVEL |
+	    APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, 0);
+
+	/* wait for pending status end */
+	DELAY(10000);		/* wait ~10mS */
+	lapic_ipi_wait(-1);
+
+	/*
+	 * next we do a STARTUP IPI: the previous INIT IPI might still be
+	 * latched, (P5 bug) this 1st STARTUP would then terminate
+	 * immediately, and the previously started INIT IPI would continue. OR
+	 * the previous INIT IPI has already run. and this STARTUP IPI will
+	 * run. OR the previous INIT IPI was ignored. and this STARTUP IPI
+	 * will run.
+	 */
+
+	/* do a STARTUP IPI */
+	lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE |
+	    APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_STARTUP |
+	    vector, apic_id);
+	lapic_ipi_wait(-1);
+	DELAY(200);		/* wait ~200uS */
+
+	/*
+	 * finally we do a 2nd STARTUP IPI: this 2nd STARTUP IPI should run IF
+	 * the previous STARTUP IPI was cancelled by a latched INIT IPI. OR
+	 * this STARTUP IPI will be ignored, as only ONE STARTUP IPI is
+	 * recognized after hardware RESET or INIT IPI.
+	 */
+
+	lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE |
+	    APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_STARTUP |
+	    vector, apic_id);
+	lapic_ipi_wait(-1);
+	DELAY(200);		/* wait ~200uS */
+
+	/* Wait up to 5 seconds for it to start. */
+	for (ms = 0; ms < 5000; ms++) {
+		if (*(int *)(WAKECODE_VADDR(sc) + wakeup_cpu) == 0)
+			return (1);	/* return SUCCESS */
+		DELAY(1000);
+	}
+	return (0);		/* return FAILURE */
+}
+
+#define	WARMBOOT_TARGET		0
+#define	WARMBOOT_OFF		(KERNBASE + 0x0467)
+#define	WARMBOOT_SEG		(KERNBASE + 0x0469)
+
+#define	CMOS_REG		(0x70)
+#define	CMOS_DATA		(0x71)
+#define	BIOS_RESET		(0x0f)
+#define	BIOS_WARM		(0x0a)
+
+static void
+acpi_wakeup_cpus(struct acpi_softc *sc, cpumask_t wakeup_cpus)
+{
+	uint32_t	mpbioswarmvec;
+	cpumask_t	map;
+	int		cpu;
+	u_char		mpbiosreason;
+
+	/* save the current value of the warm-start vector */
+	mpbioswarmvec = *((uint32_t *)WARMBOOT_OFF);
+	outb(CMOS_REG, BIOS_RESET);
+	mpbiosreason = inb(CMOS_DATA);
+
+	/* setup a vector to our boot code */
+	*((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET;
+	*((volatile u_short *)WARMBOOT_SEG) = WAKECODE_PADDR(sc) >> 4;
+	outb(CMOS_REG, BIOS_RESET);
+	outb(CMOS_DATA, BIOS_WARM);	/* 'warm-start' */
+
+	/* Wake up each AP. */
+	for (cpu = 1; cpu < mp_ncpus; cpu++) {
+		map = 1ul << cpu;
+		if ((wakeup_cpus & map) != map)
+			continue;
+		if (acpi_wakeup_ap(sc, cpu) == 0) {
+			/* restore the warmstart vector */
+			*(uint32_t *)WARMBOOT_OFF = mpbioswarmvec;
+			panic("acpi_wakeup: failed to resume AP #%d (PHY #%d)",
+			    cpu, cpu_apic_ids[cpu]);
+		}
+	}
+
+	/* restore the warmstart vector */
+	*(uint32_t *)WARMBOOT_OFF = mpbioswarmvec;
+
+	outb(CMOS_REG, BIOS_RESET);
+	outb(CMOS_DATA, mpbiosreason);
+}
+#endif
+
+static void
+acpi_reset_tss(int cpu)
+{
+	uint32_t	*tss;
+
+	/*
+	 * We have to clear "task busy" bit in TSS to restore
+	 * task register later.  Otherwise, ltr causes GPF.
+	 */
+	tss = (uint32_t *)&gdt[NGDT * cpu + GPROC0_SEL] + 1;
+	*tss &= ~((SDT_SYSBSY ^ SDT_SYSTSS) << 8);
+}
+
 int
 acpi_sleep_machdep(struct acpi_softc *sc, int state)
 {
-	return (0);
+	struct savefpu	*stopfpu;
+#ifdef SMP
+	cpumask_t	wakeup_cpus;
+#endif
+	register_t	cr3, rf;
+	ACPI_STATUS	status;
+	int		ret;
+
+	ret = -1;
+
+	if (sc->acpi_wakeaddr == 0ul)
+		return (ret);
+
+#ifdef SMP
+	wakeup_cpus = PCPU_GET(other_cpus);
+#endif
+
+	AcpiSetFirmwareWakingVector(WAKECODE_PADDR(sc));
+
+	rf = intr_disable();
+	intr_suspend();
+
+	/*
+	 * Temporarily switch to the kernel pmap because it provides
+	 * an identity mapping (setup at boot) for the low physical
+	 * memory region containing the wakeup code.
+	 */
+	cr3 = rcr3();
+	load_cr3(KPML4phys);
+
+	stopfpu = &stopxpcbs[0].xpcb_pcb.pcb_save;
+	if (acpi_savecpu(&stopxpcbs[0])) {
+		fpugetregs(curthread, stopfpu);
+
+#ifdef SMP
+		if (wakeup_cpus != 0 && suspend_cpus(wakeup_cpus) == 0) {
+			device_printf(sc->acpi_dev,
+			    "Failed to suspend APs: CPU mask = 0x%jx\n",
+			    (uintmax_t)(wakeup_cpus & ~stopped_cpus));
+			goto out;
+		}
+#endif
+
+		WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0));
+		WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0));
+
+		WAKECODE_FIXUP(wakeup_xpcb, struct xpcb *, &stopxpcbs[0]);
+		WAKECODE_FIXUP(wakeup_gdt, uint16_t,
+		    stopxpcbs[0].xpcb_gdt.rd_limit);
+		WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t,
+		    stopxpcbs[0].xpcb_gdt.rd_base);
+		WAKECODE_FIXUP(wakeup_cpu, int, 0);
+
+		acpi_reset_tss(0);
+
+		/* Call ACPICA to enter the desired sleep state */
+		if (state == ACPI_STATE_S4 && sc->acpi_s4bios)
+			status = AcpiEnterSleepStateS4bios();
+		else
+			status = AcpiEnterSleepState(state);
+
+		if (status != AE_OK) {
+			device_printf(sc->acpi_dev,
+			    "AcpiEnterSleepState failed - %s\n",
+			    AcpiFormatException(status));
+			goto out;
+		}
+
+		for (;;)
+			ia32_pause();
+	} else {
+		fpusetregs(curthread, stopfpu);
+#ifdef SMP
+		if (wakeup_cpus != 0)
+			acpi_wakeup_cpus(sc, wakeup_cpus);
+#endif
+		acpi_resync_clock(sc);
+		ret = 0;
+	}
+
+out:
+#ifdef SMP
+	if (wakeup_cpus != 0)
+		restart_cpus(wakeup_cpus);
+#endif
+
+	load_cr3(cr3);
+	intr_resume();
+	intr_restore(rf);
+
+	AcpiSetFirmwareWakingVector(0);
+
+	if (ret == 0 && mem_range_softc.mr_op != NULL &&
+	    mem_range_softc.mr_op->reinit != NULL)
+		mem_range_softc.mr_op->reinit(&mem_range_softc);
+
+	/* If we beeped, turn it off after a delay. */
+	if (acpi_resume_beep)
+		timeout(acpi_stop_beep, NULL, 3 * hz);
+
+	return (ret);
+}
+
+static vm_offset_t	acpi_wakeaddr;
+
+static void
+acpi_alloc_wakeup_handler(void)
+{
+	void		*wakeaddr;
+
+	if (!cold)
+		return;
+
+	/*
+	 * Specify the region for our wakeup code.  We want it in the low 1 MB
+	 * region, excluding video memory and above (0xa0000).  We ask for
+	 * it to be page-aligned, just to be safe.
+	 */
+	wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0, 0x9ffff,
+	    PAGE_SIZE, 0ul);
+	if (wakeaddr == NULL) {
+		printf("%s: can't alloc wake memory\n", __func__);
+		return;
+	}
+	stopxpcbs = malloc(mp_ncpus * sizeof(*stopxpcbs), M_DEVBUF, M_NOWAIT);
+	if (stopxpcbs == NULL) {
+		contigfree(wakeaddr, 4 * PAGE_SIZE, M_DEVBUF);
+		printf("%s: can't alloc CPU state memory\n", __func__);
+		return;
+	}
+	acpi_wakeaddr = (vm_offset_t)wakeaddr;
 }
 
+SYSINIT(acpiwakeup, SI_SUB_KMEM, SI_ORDER_ANY, acpi_alloc_wakeup_handler, 0);
+
 void
 acpi_install_wakeup_handler(struct acpi_softc *sc)
 {
+	uint64_t	*pt4, *pt3, *pt2;
+	int		i;
+
+	if (acpi_wakeaddr == 0ul)
+		return;
+
+	sc->acpi_wakeaddr = acpi_wakeaddr;
+	sc->acpi_wakephys = vtophys(acpi_wakeaddr);
+
+	bcopy(wakecode, (void *)WAKECODE_VADDR(sc), sizeof(wakecode));
+
+	/* Patch GDT base address, ljmp targets and page table base address. */
+	WAKECODE_FIXUP((bootgdtdesc + 2), uint32_t,
+	    WAKECODE_PADDR(sc) + bootgdt);
+	WAKECODE_FIXUP((wakeup_sw32 + 2), uint32_t,
+	    WAKECODE_PADDR(sc) + wakeup_32);
+	WAKECODE_FIXUP((wakeup_sw64 + 1), uint32_t,
+	    WAKECODE_PADDR(sc) + wakeup_64);
+	WAKECODE_FIXUP(wakeup_pagetables, uint32_t, sc->acpi_wakephys);
+
+	/* Save pointers to some global data. */
+	WAKECODE_FIXUP(wakeup_retaddr, void *, acpi_restorecpu);
+	WAKECODE_FIXUP(wakeup_kpml4, uint64_t, KPML4phys);
+	WAKECODE_FIXUP(wakeup_ctx, vm_offset_t,
+	    WAKECODE_VADDR(sc) + wakeup_ctx);
+	WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER));
+	WAKECODE_FIXUP(wakeup_pat, uint64_t, rdmsr(MSR_PAT));
+	WAKECODE_FIXUP(wakeup_star, uint64_t, rdmsr(MSR_STAR));
+	WAKECODE_FIXUP(wakeup_lstar, uint64_t, rdmsr(MSR_LSTAR));
+	WAKECODE_FIXUP(wakeup_cstar, uint64_t, rdmsr(MSR_CSTAR));
+	WAKECODE_FIXUP(wakeup_sfmask, uint64_t, rdmsr(MSR_SF_MASK));
+
+	/* Build temporary page tables below realmode code. */
+	pt4 = (uint64_t *)acpi_wakeaddr;
+	pt3 = pt4 + (PAGE_SIZE) / sizeof(uint64_t);
+	pt2 = pt3 + (PAGE_SIZE) / sizeof(uint64_t);
+
+	/* Create the initial 1GB replicated page tables */
+	for (i = 0; i < 512; i++) {
+		/*
+		 * Each slot of the level 4 pages points
+		 * to the same level 3 page
+		 */
+		pt4[i] = (uint64_t)(sc->acpi_wakephys + PAGE_SIZE);
+		pt4[i] |= PG_V | PG_RW | PG_U;
+
+		/*
+		 * Each slot of the level 3 pages points
+		 * to the same level 2 page
+		 */
+		pt3[i] = (uint64_t)(sc->acpi_wakephys + (2 * PAGE_SIZE));
+		pt3[i] |= PG_V | PG_RW | PG_U;
+
+		/* The level 2 page slots are mapped with 2MB pages for 1GB. */
+		pt2[i] = i * (2 * 1024 * 1024);
+		pt2[i] |= PG_V | PG_RW | PG_PS | PG_U;
+	}
+
+	if (bootverbose)
+		device_printf(sc->acpi_dev, "wakeup code va %p pa %p\n",
+		    (void *)sc->acpi_wakeaddr, (void *)sc->acpi_wakephys);
 }

Copied: user/mav/ata/sys/amd64/acpica/genwakecode.sh (from r190503, head/sys/amd64/acpica/genwakecode.sh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/mav/ata/sys/amd64/acpica/genwakecode.sh	Sat Mar 28 11:29:07 2009	(r190504, copy of r190503, head/sys/amd64/acpica/genwakecode.sh)
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+#
+file2c -sx 'static char wakecode[] = {' '};' <acpi_wakecode.bin
+
+exit 0

Copied: user/mav/ata/sys/amd64/acpica/genwakedata.sh (from r190503, head/sys/amd64/acpica/genwakedata.sh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/mav/ata/sys/amd64/acpica/genwakedata.sh	Sat Mar 28 11:29:07 2009	(r190504, copy of r190503, head/sys/amd64/acpica/genwakedata.sh)
@@ -0,0 +1,9 @@
+#!/bin/sh
+# $FreeBSD$
+#
+nm -n --defined-only acpi_wakecode.o | while read offset dummy what
+do
+    echo "#define ${what}	0x${offset}"
+done
+
+exit 0

Modified: user/mav/ata/sys/amd64/amd64/amd64_mem.c
==============================================================================
--- user/mav/ata/sys/amd64/amd64/amd64_mem.c	Sat Mar 28 11:01:44 2009	(r190503)
+++ user/mav/ata/sys/amd64/amd64/amd64_mem.c	Sat Mar 28 11:29:07 2009	(r190504)
@@ -73,11 +73,13 @@ static void	amd64_mrinit(struct mem_rang
 static int	amd64_mrset(struct mem_range_softc *sc,
 		    struct mem_range_desc *mrd, int *arg);
 static void	amd64_mrAPinit(struct mem_range_softc *sc);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-user@FreeBSD.ORG  Sat Mar 28 19:09:31 2009
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2482F1065674;
	Sat, 28 Mar 2009 19:09:31 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 112FD8FC08;
	Sat, 28 Mar 2009 19:09:31 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2SJ9VPe010296;
	Sat, 28 Mar 2009 19:09:31 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2SJ9Uak010291;
	Sat, 28 Mar 2009 19:09:30 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200903281909.n2SJ9Uak010291@svn.freebsd.org>
From: Alexander Motin <mav@FreeBSD.org>
Date: Sat, 28 Mar 2009 19:09:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190509 - in user/mav/ata/sys/dev/ata: . chipsets
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 28 Mar 2009 19:09:32 -0000

Author: mav
Date: Sat Mar 28 19:09:30 2009
New Revision: 190509
URL: http://svn.freebsd.org/changeset/base/190509

Log:
  Add ch_suspend/ch_resume methods for PCI controllers and implement them
  for AHCI. Refactor AHCI channel initialization according to it.
  
  Add minimal checks for PMP registers operations errors. Proper error
  handling is still required.
  
  Add delay after PMP port hardreset, to let it complete. Softreset issued
  without delay does not completes successfully. This is a temporary hack
  until I find how to make it right.

Modified:
  user/mav/ata/sys/dev/ata/ata-pci.c
  user/mav/ata/sys/dev/ata/ata-pci.h
  user/mav/ata/sys/dev/ata/ata-sata.c
  user/mav/ata/sys/dev/ata/chipsets/ata-ahci.c
  user/mav/ata/sys/dev/ata/chipsets/ata-jmicron.c

Modified: user/mav/ata/sys/dev/ata/ata-pci.c
==============================================================================
--- user/mav/ata/sys/dev/ata/ata-pci.c	Sat Mar 28 17:36:56 2009	(r190508)
+++ user/mav/ata/sys/dev/ata/ata-pci.c	Sat Mar 28 19:09:30 2009	(r190509)
@@ -584,22 +584,35 @@ ata_pcichannel_detach(device_t dev)
 static int
 ata_pcichannel_suspend(device_t dev)
 {
+    struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
     struct ata_channel *ch = device_get_softc(dev);
+    int error;
 
     if (!ch->attached)
 	return (0);
 
-    return ata_suspend(dev);
+    if ((error = ata_suspend(dev)))
+	return (error);
+
+    if (ctlr->ch_suspend != NULL && (error = ctlr->ch_suspend(dev)))
+	return (error);
+
+    return (0);
 }
 
 static int
 ata_pcichannel_resume(device_t dev)
 {
+    struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
     struct ata_channel *ch = device_get_softc(dev);
+    int error;
 
     if (!ch->attached)
 	return (0);
 
+    if (ctlr->ch_resume != NULL && (error = ctlr->ch_resume(dev)))
+	return (error);
+
     return ata_resume(dev);
 }
 

Modified: user/mav/ata/sys/dev/ata/ata-pci.h
==============================================================================
--- user/mav/ata/sys/dev/ata/ata-pci.h	Sat Mar 28 17:36:56 2009	(r190508)
+++ user/mav/ata/sys/dev/ata/ata-pci.h	Sat Mar 28 19:09:30 2009	(r190509)
@@ -57,6 +57,8 @@ struct ata_pci_controller {
     int                 (*resume)(device_t);
     int                 (*ch_attach)(device_t);
     int                 (*ch_detach)(device_t);
+    int                 (*ch_suspend)(device_t);
+    int                 (*ch_resume)(device_t);
     int                 (*locking)(device_t, int);
     void                (*reset)(device_t);
     void                (*setmode)(device_t, int);
@@ -454,6 +456,8 @@ void ata_pm_identify(device_t dev);
 int ata_ahci_chipinit(device_t);
 int ata_ahci_ch_attach(device_t dev);
 int ata_ahci_ch_detach(device_t dev);
+int ata_ahci_ch_suspend(device_t dev);
+int ata_ahci_ch_resume(device_t dev);
 void ata_ahci_reset(device_t dev);
 int ata_marvell_edma_chipinit(device_t);
 int ata_sii_chipinit(device_t);

Modified: user/mav/ata/sys/dev/ata/ata-sata.c
==============================================================================
--- user/mav/ata/sys/dev/ata/ata-sata.c	Sat Mar 28 17:36:56 2009	(r190508)
+++ user/mav/ata/sys/dev/ata/ata-sata.c	Sat Mar 28 19:09:30 2009	(r190509)
@@ -130,7 +130,8 @@ ata_sata_connect(struct ata_channel *ch,
 
     /* wait up to 1 second for "connect well" */
     for (timeout = 0; timeout < 100 ; timeout++) {
-	ata_sata_scr_read(ch, port, ATA_SSTATUS, &status);
+	if (ata_sata_scr_read(ch, port, ATA_SSTATUS, &status))
+	    return (0);
 	if ((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN1 ||
 	    (status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN2)
 	    break;
@@ -172,27 +173,39 @@ ata_sata_phy_reset(device_t dev, int por
     uint32_t val;
 
     if (quick) {
-	ata_sata_scr_read(ch, port, ATA_SCONTROL, &val);
+	if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val))
+	    return (0);
 	if ((val & ATA_SC_DET_MASK) == ATA_SC_DET_IDLE)
 	    return ata_sata_connect(ch, port);
     }
 
+    if (bootverbose) {
+	if (port < 0) {
+	    device_printf(dev, "hardware reset ...\n");
+	} else {
+	    device_printf(dev, "p%d: hardware reset ...\n", port);
+	}
+    }
     for (retry = 0; retry < 10; retry++) {
 	for (loop = 0; loop < 10; loop++) {
-	    ata_sata_scr_write(ch, port, ATA_SCONTROL, ATA_SC_DET_RESET);
+	    if (ata_sata_scr_write(ch, port, ATA_SCONTROL, ATA_SC_DET_RESET))
+		return (0);
 	    ata_udelay(100);
-	    ata_sata_scr_read(ch, port, ATA_SCONTROL, &val);
+	    if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val))
+		return (0);
 	    if ((val & ATA_SC_DET_MASK) == ATA_SC_DET_RESET)
 		break;
 	}
 	ata_udelay(5000);
 	for (loop = 0; loop < 10; loop++) {
-	    ata_sata_scr_write(ch, port, ATA_SCONTROL,
+	    if (ata_sata_scr_write(ch, port, ATA_SCONTROL,
 					ATA_SC_DET_IDLE |
 					ATA_SC_IPM_DIS_PARTIAL |
-					ATA_SC_IPM_DIS_SLUMBER);
+					ATA_SC_IPM_DIS_SLUMBER))
+		return (0);
 	    ata_udelay(100);
-	    ata_sata_scr_read(ch, port, ATA_SCONTROL, &val);
+	    if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val))
+		return (0);
 	    if ((val & ATA_SC_DET_MASK) == 0)
 		return ata_sata_connect(ch, port);
 	}
@@ -306,7 +319,9 @@ ata_pm_identify(device_t dev)
     /* chip specific quirks */
     switch (pm_chipid) {
     case 0x37261095:
-	/* Some of these bogusly reports 6 ports */
+	/* This PM declares 6 ports, while only 5 of them are real.
+	 * Port 5 is enclosure management bridge port, which has implementation
+	 * problems, causing probe faults. Hide it for now. */
 	device_printf(dev, "SiI 3726 (rev=%x) Port Multiplier with %d (5) ports\n",
 		      pm_revision, pm_ports);
 	pm_ports = 5;
@@ -338,6 +353,13 @@ ata_pm_identify(device_t dev)
 	if (!ata_sata_phy_reset(dev, port, 1))
 	    continue;
 
+	/*
+	 * XXX: I have no idea how to properly wait for PMP port hardreset
+	 * completion. Without this delay soft reset does not completes
+	 * successfully.
+	 */
+	DELAY(1000000);
+
 	signature = ch->hw.softreset(dev, port);
 
 	if (bootverbose)

Modified: user/mav/ata/sys/dev/ata/chipsets/ata-ahci.c
==============================================================================
--- user/mav/ata/sys/dev/ata/chipsets/ata-ahci.c	Sat Mar 28 17:36:56 2009	(r190508)
+++ user/mav/ata/sys/dev/ata/chipsets/ata-ahci.c	Sat Mar 28 19:09:30 2009	(r190509)
@@ -59,10 +59,16 @@ static int ata_ahci_begin_transaction(st
 static int ata_ahci_end_transaction(struct ata_request *request);
 static int ata_ahci_pm_read(device_t dev, int port, int reg, u_int32_t *result);
 static int ata_ahci_pm_write(device_t dev, int port, int reg, u_int32_t result);
+static int ata_ahci_hardreset(device_t dev, int port, uint32_t *signature);
 static u_int32_t ata_ahci_softreset(device_t dev, int port);
 static void ata_ahci_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, int error);
 static int ata_ahci_setup_fis(struct ata_ahci_cmd_tab *ctp, struct ata_request *equest);
 static void ata_ahci_dmainit(device_t dev);
+static void ata_ahci_start(device_t dev);
+static void ata_ahci_stop(device_t dev);
+static void ata_ahci_clo(device_t dev);
+static void ata_ahci_start_fr(device_t dev);
+static void ata_ahci_stop_fr(device_t dev);
 
 /*
  * AHCI v1.x compliant SATA chipset support functions
@@ -131,6 +137,8 @@ ata_ahci_chipinit(device_t dev)
     ctlr->reset = ata_ahci_reset;
     ctlr->ch_attach = ata_ahci_ch_attach;
     ctlr->ch_detach = ata_ahci_ch_detach;
+    ctlr->ch_suspend = ata_ahci_ch_suspend;
+    ctlr->ch_resume = ata_ahci_ch_resume;
     ctlr->setmode = ata_sata_setmode;
     ctlr->suspend = ata_ahci_suspend;
     ctlr->resume = ata_ahci_ctlr_reset;
@@ -192,7 +200,6 @@ ata_ahci_suspend(device_t dev)
     return 0;
 }
 
-
 int
 ata_ahci_ch_attach(device_t dev)
 {
@@ -220,12 +227,22 @@ ata_ahci_ch_attach(device_t dev)
     ch->hw.pm_read = ata_ahci_pm_read;
     ch->hw.pm_write = ata_ahci_pm_write;
 
+    ata_ahci_ch_resume(dev);
     return 0;
 }
 
 int
 ata_ahci_ch_detach(device_t dev)
 {
+
+    ata_ahci_ch_suspend(dev);
+    ata_dmafini(dev);
+    return (0);
+}
+
+int
+ata_ahci_ch_suspend(device_t dev)
+{
     struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
     struct ata_channel *ch = device_get_softc(dev);
     int offset = ch->unit << 7;
@@ -233,6 +250,8 @@ ata_ahci_ch_detach(device_t dev)
     /* Disable port interrupts. */
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IE + offset, 0);
     /* Reset command register. */
+    ata_ahci_stop(dev);
+    ata_ahci_stop_fr(dev);
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset, 0);
 
     /* Allow everything including partial and slumber modes. */
@@ -243,7 +262,35 @@ ata_ahci_ch_detach(device_t dev)
     /* Disable PHY. */
     ATA_IDX_OUTL(ch, ATA_SCONTROL, ATA_SC_DET_DISABLE);
 
-    ata_dmafini(dev);
+    return (0);
+}
+
+int
+ata_ahci_ch_resume(device_t dev)
+{
+    struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
+    struct ata_channel *ch = device_get_softc(dev);
+    uint64_t work;
+    int offset = ch->unit << 7;
+
+    /* Disable port interrupts */
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IE + offset, 0);
+
+    /* setup work areas */
+    work = ch->dma.work_bus + ATA_AHCI_CL_OFFSET;
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLB + offset, work & 0xffffffff);
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLBU + offset, work >> 32);
+
+    work = ch->dma.work_bus + ATA_AHCI_FB_OFFSET;
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FB + offset, work & 0xffffffff); 
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBU + offset, work >> 32);
+
+    /* activate the channel and power/spin up device */
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset,
+	     (ATA_AHCI_P_CMD_ACTIVE | ATA_AHCI_P_CMD_POD | ATA_AHCI_P_CMD_SUD));
+    ata_ahci_start_fr(dev);
+    ata_ahci_start(dev);
+
     return (0);
 }
 
@@ -366,9 +413,6 @@ ata_ahci_begin_transaction(struct ata_re
 		 ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset) &
 		 ~ATA_AHCI_P_CMD_ATAPI);
 
-    /* set PM port to address */
-    //ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBS + offset, (port << 8) | 0x00000001);
-
     /* issue command to controller */
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CI + offset, (1 << request->tag));
     
@@ -465,9 +509,6 @@ ata_ahci_issue_cmd(device_t dev, u_int16
     clp->bytecount = 0;
     clp->cmd_table_phys = htole64(ch->dma.work_bus + ATA_AHCI_CT_OFFSET);
 
-    /* set PM port */
-    //ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBS + offset, (port << 8) | 0x00000001);
-
     /* issue command to controller */
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CI + offset, 1);
 
@@ -480,7 +521,7 @@ ata_ahci_issue_cmd(device_t dev, u_int16
 
     /* clear interrupts */
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IS + offset,
-	     ATA_INL(ctlr->r_res2, ATA_AHCI_P_IS + offset));
+	    ATA_INL(ctlr->r_res2, ATA_AHCI_P_IS + offset));
 
     if (timeout && (count >= timeout)) {
 	if (bootverbose) {
@@ -559,7 +600,7 @@ ata_ahci_stop(device_t dev)
     /* kill off all activity on this channel */
     cmd = ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset);
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset,
-	     cmd & ~(ATA_AHCI_P_CMD_FRE | ATA_AHCI_P_CMD_ST));
+	     cmd & ~ATA_AHCI_P_CMD_ST);
 
     /* XXX SOS this is not entirely wrong */
     timeout = 0;
@@ -617,10 +658,47 @@ ata_ahci_start(device_t dev)
     /* start operations on this channel */
     cmd = ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset);
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset,
-	     cmd | (ATA_AHCI_P_CMD_FRE | ATA_AHCI_P_CMD_ST) |
+	     cmd | ATA_AHCI_P_CMD_ST |
 	     (ch->devices & ATA_PORTMULTIPLIER ? ATA_AHCI_P_CMD_PMA : 0));
 }
 
+static void
+ata_ahci_stop_fr(device_t dev)
+{
+    struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
+    struct ata_channel *ch = device_get_softc(dev);
+    u_int32_t cmd;
+    int offset = ch->unit << 7;
+    int timeout;
+
+    /* kill off all activity on this channel */
+    cmd = ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset);
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset, cmd & ~ATA_AHCI_P_CMD_FRE);
+
+    timeout = 0;
+    do {
+	DELAY(1000);
+	if (timeout++ > 1000) {
+	    device_printf(dev, "stopping AHCI FR engine failed\n");
+	    break;
+	}
+    }
+    while (ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset) & ATA_AHCI_P_CMD_FR);
+}
+
+static void
+ata_ahci_start_fr(device_t dev)
+{
+    struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
+    struct ata_channel *ch = device_get_softc(dev);
+    u_int32_t cmd;
+    int offset = ch->unit << 7;
+
+    /* start FIS reception on this channel */
+    cmd = ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset);
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset, cmd | ATA_AHCI_P_CMD_FRE);
+}
+
 static int
 ata_ahci_wait_ready(device_t dev, int t)
 {
@@ -628,13 +706,14 @@ ata_ahci_wait_ready(device_t dev, int t)
     struct ata_channel *ch = device_get_softc(dev);
     int offset = ch->unit << 7;
     int timeout = 0;
+    uint32_t val;
 
-    while (ATA_INL(ctlr->r_res2, ATA_AHCI_P_TFD + offset) &
+    while ((val = ATA_INL(ctlr->r_res2, ATA_AHCI_P_TFD + offset)) &
 	(ATA_S_BUSY | ATA_S_DRQ)) {
 	    DELAY(1000);
 	    if (timeout++ > t) {
-		device_printf(dev, "port is not ready (timeout %dms)\n", t);
-		return (-1);
+		device_printf(dev, "port is not ready (timeout %dms) tfd = %08x\n", t, val);
+		return (EBUSY);
 	    }
     } 
     if (bootverbose)
@@ -642,6 +721,28 @@ ata_ahci_wait_ready(device_t dev, int t)
     return (0);
 }
 
+static int
+ata_ahci_hardreset(device_t dev, int port, uint32_t *signature)
+{
+    struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
+    struct ata_channel *ch = device_get_softc(dev);
+    int offset = ch->unit << 7;
+
+    *signature = 0xffffffff;
+    ata_ahci_stop(dev);
+    /* Reset port */
+    if (!ata_sata_phy_reset(dev, port, 0))
+	return (ENOENT);
+    /* Wait for clearing busy status. */
+    if (ata_ahci_wait_ready(dev, 10000)) {
+	device_printf(dev, "hardware reset timeout\n");
+	return (EBUSY);
+    }
+    *signature = ATA_INL(ctlr->r_res2, ATA_AHCI_P_SIG + offset);
+    ata_ahci_start(dev);
+    return (0);
+}
+
 static u_int32_t
 ata_ahci_softreset(device_t dev, int port)
 {
@@ -679,9 +780,9 @@ ata_ahci_softreset(device_t dev, int por
     ctp->cfis[1] = port & 0x0f;
     //ctp->cfis[7] = ATA_D_LBA | ATA_D_IBM;
     ctp->cfis[15] = ATA_A_4BIT;
-    ata_ahci_issue_cmd(dev, 0, 1000);
+    ata_ahci_issue_cmd(dev, 0, 3000);
 
-    if (ata_ahci_wait_ready(dev, 1000)) {
+    if (ata_ahci_wait_ready(dev, 0)) {
 	device_printf(dev, "software reset clear timeout\n");
 	return (-1);
     }
@@ -694,7 +795,6 @@ ata_ahci_reset(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
     struct ata_channel *ch = device_get_softc(dev);
-    u_int64_t work;
     u_int32_t signature;
     int offset = ch->unit << 7;
 
@@ -704,25 +804,7 @@ ata_ahci_reset(device_t dev)
     /* Disable port interrupts */
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IE + offset, 0);
 
-    /* setup work areas */
-    work = ch->dma.work_bus + ATA_AHCI_CL_OFFSET;
-    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLB + offset, work & 0xffffffff);
-    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CLBU + offset, work >> 32);
-
-    work = ch->dma.work_bus + ATA_AHCI_FB_OFFSET;
-    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FB + offset, work & 0xffffffff); 
-    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBU + offset, work >> 32);
-
-    /* activate the channel and power/spin up device */
-    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset,
-	     (ATA_AHCI_P_CMD_ACTIVE | ATA_AHCI_P_CMD_POD | ATA_AHCI_P_CMD_SUD));
-
-    ata_ahci_stop(dev);
-
-    /* enable FIS based switching */
-    //ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBS + offset, 0x00000003);
-
-    if (!ata_sata_phy_reset(dev, -1, 0)) {
+    if (ata_ahci_hardreset(dev, -1, &signature)) {
 	if (bootverbose)
 	    device_printf(dev, "AHCI reset done: phy reset found no device\n");
 	ch->devices = 0;
@@ -733,8 +815,6 @@ ata_ahci_reset(device_t dev)
 	return;
     }
 
-    ata_ahci_start(dev);
-
     /* enable wanted port interrupts */
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IE + offset,
 	     (ATA_AHCI_P_IX_CPD | ATA_AHCI_P_IX_TFE | ATA_AHCI_P_IX_HBF |
@@ -743,9 +823,6 @@ ata_ahci_reset(device_t dev)
 	      ATA_AHCI_P_IX_UF | ATA_AHCI_P_IX_SDB | ATA_AHCI_P_IX_DS |
 	      ATA_AHCI_P_IX_PS | ATA_AHCI_P_IX_DHR));
 
-    /* Wait for initial TFD from device. */
-    ata_ahci_wait_ready(dev, 10000);
-
     /* only probe for PortMultiplier if HW has support */
     if (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_SPM) {
 	signature = ata_ahci_softreset(dev, ATA_PM);

Modified: user/mav/ata/sys/dev/ata/chipsets/ata-jmicron.c
==============================================================================
--- user/mav/ata/sys/dev/ata/chipsets/ata-jmicron.c	Sat Mar 28 17:36:56 2009	(r190508)
+++ user/mav/ata/sys/dev/ata/chipsets/ata-jmicron.c	Sat Mar 28 19:09:30 2009	(r190509)
@@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$");
 static int ata_jmicron_chipinit(device_t dev);
 static int ata_jmicron_ch_attach(device_t dev);
 static int ata_jmicron_ch_detach(device_t dev);
+static int ata_jmicron_ch_suspend(device_t dev);
+static int ata_jmicron_ch_resume(device_t dev);
 static void ata_jmicron_reset(device_t dev);
 static void ata_jmicron_setmode(device_t dev, int mode);
 
@@ -127,6 +129,8 @@ ata_jmicron_chipinit(device_t dev)
 
 	ctlr->ch_attach = ata_jmicron_ch_attach;
 	ctlr->ch_detach = ata_jmicron_ch_detach;
+	ctlr->ch_suspend = ata_jmicron_ch_suspend;
+	ctlr->ch_resume = ata_jmicron_ch_resume;
 	ctlr->reset = ata_jmicron_reset;
 	ctlr->setmode = ata_jmicron_setmode;
 
@@ -173,6 +177,30 @@ ata_jmicron_ch_detach(device_t dev)
     return (error);
 }
 
+static int
+ata_jmicron_ch_suspend(device_t dev)
+{
+    struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
+    struct ata_channel *ch = device_get_softc(dev);
+    int error = 0;
+
+    if (ch->unit < ctlr->chip->cfg1)
+	error = ata_ahci_ch_suspend(dev);
+    return error;
+}
+
+static int
+ata_jmicron_ch_resume(device_t dev)
+{
+    struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
+    struct ata_channel *ch = device_get_softc(dev);
+    int error = 0;
+
+    if (ch->unit < ctlr->chip->cfg1)
+	error = ata_ahci_ch_resume(dev);
+    return (error);
+}
+
 static void
 ata_jmicron_reset(device_t dev)
 {