FreeBSD: Suspend/Resume fully functional in FreeBSD 8.2 AMD64


My system runs PC-BSD 8.2, with a FreeBSD 8.2 under the hood. One requirement for resume is to have the usb stack compiled as modules. But it’s not sufficient enough, my Thinkpad R60 resumes but usb ports are down, no power at all.

The solution overcome reading this thread:

http://www.bsdforen.de/showthread.php?t=24823

I’m very grateful to this thread and to Yamagi, the author. For first time in the ACPI era one of my thinkpads is able to suspend/resume without any problem!!!!

Now my configuration, most of it copied from Yamagi :)

Kernel:

———————————————————————————–

CPU
machine amd64
cpu HAMMER
ident SCREW
options SMP# Options
options SCHED_ULE
options INET
options INET6
options IPSEC
options SCTP
options KBD_INSTALL_CDEV
options PREEMPTION
options KTRACE
options AUDIT
options PRINTF_BUFR_SIZE=128
options FLOWTABLE
options MAC

# Debug
options STACK
options HWPMC_HOOKS

# Dateisysteme

# UFS2

options SOFTUPDATES
options UFS_ACL
options UFS_DIRHASH
options UFS_GJOURNAL
options UFS_EXTATTR
options UFS_EXTATTR_AUTOSTART
options QUOTA

# Compat
options COMPAT_FREEBSD4
options COMPAT_FREEBSD5
options COMPAT_FREEBSD6
options COMPAT_FREEBSD7
options COMPAT_43TTY
options COMPAT_FREEBSD32
options _KPOSIX_PRIORITY_SCHEDULING
options SYSVSHM
options SYSVMSG
options SYSVSEM
options P1003_1B_SEMAPHORES

# Hardware — Video
device vga
device splash

# Hardware — Console

device sc
options SC_PIXEL_MODE

# Hardware — Network
device loop
device ether
device bpf

# Hardware — Pseudodevices
device pty

# Hardware — Keyboard
device atkbdc
device atkbd
device psm

# Hardware — Controller
device isa
device eisa
device pci
device acpi

# ALTQ

options ALTQ
options ALTQ_CBQ
options ALTQ_RED
options ALTQ_RIO
options ALTQ_HFSC
options ALTQ_CDNR
options ALTQ_PRIQ
options ALTQ_NOPCC

# Crypto for IPSEC
device crypto

# Kein reboot bei strg-alt-entf
#options SC_DISABLE_REBOOT

———————————————————————————–

/boot/loader.conf:

———————————————————————————–
# Loader
# ——
autoboot_delay=”3″# System
# ——

# Kein Strom fuer Geraete ohne Treiber
hw.pci.do_power_nodriver=3

# Kein Throtteling (braucht Strom und blockiert C2)
hint.acpi_throttle.0.disabled=1

# p4tcc ist ein Intel-Relikt aus Netburstzeiten
hint.p4tcc.0.disabled=1
hint.p4tcc.1.disabled=1

# APIC Timers blockieren C3
hint.apic.0.clock=0

# Keine dedizierte Realtime-Clock. Spart 128 Interrupts
# pro Sekunde, hat hier aber kaum Auswirkungen. Daf”ur
# Nebenwirkungen:
# – Tendenziell springende Uhr, die sehr seltsame
#   Effekte hat. U.a. blockiertes PAM.
# – Blockierende Maus
# – 100% CPU Last kann das System blockieren
#hint.atrtc.0.clock=0

# 100 Ticks reichen aus und sind stromsparender als 1000
kern.hz=100

# Unhoerbar schlechtere Tonqualitaet und leichte Latenz, aber weniger Strom
hint.pcm.0.buffersize=65536
hint.pcm.1.buffersize=65536
hw.snd.feeder_buffersize=65536
hw.snd.latency=7

# Agressives Powermanagement fuer SATA
hint.ahcich.0.pm_level=5
hint.ahcich.1.pm_level=5

# Soundkarte
hint.hdac.0.cad0.nid22.config=”as=1 seq=15 device=Headphones”
hint.hdac.0.cad0.nid26.config=”as=1 seq=0 device=Line-Out”

# Equalizer
hint.pcm.0.eq=1

# Treiber
# ——-

# ACPI
acpi_load=”YES”
acpi_ibm_load=”YES”

# Partitionstypen
geom_part_bsd_load=”YES”
geom_part_mbr_load=”YES”
geom_part_gpt_load=”YES”

# Label
geom_label_load=”YES”

# GELI
geom_eli_load=”YES”

# Random
random_load=”YES”

# Load geom support
geom_journal_load=”YES”
geom_uzip_load=”YES”
geom_mirror_load=”YES”
geom_eli_load=”YES”

# Zlib
zlib_load=”YES”

# ATA
ahci_load=”YES”

# X11 Kram
mem_load=”YES”
io_load=”YES”

# SCSI
cam_load=”YES”
atapicam_load=”YES”

# Firewire
firewire_load=”YES”

# NFS
nfsclient_load=”YES”
nfs_common_load=”YES”

# Netzwerk
miibus_load=”YES”
if_bge_load=”YES”

# SMBus
smbus_load=”YES”
ichsmb_load=”YES”

# CPUFreq
cpufreq_load=”YES”

# Sound
sound_load=”YES”
snd_hda_load=”YES”

# CPU-Device
cpuctl_load=”YES”

# USB
usb_load=”YES”
ehci_load=”YES”
uhci_load=”YES”
ums_load=”YES”
u3g_load=”YES”
umass_load=”YES”
ukbd_load=”YES”

# Linux
linux_load=”YES”

# Keyboard
kbdmux_load=”YES”

# Bruecke
if_bridge_load=”YES”
bridgestp_load=”YES”

# Tap
if_tap_load=”YES”

# Temperatursensoren
coretemp_load=”YES”

# Tun
if_tun_load=”YES”

# Wlan
wlan_load=”YES”
wlan_tkip_load=”YES”
wlan_amrr_load=”YES”
wlan_wep_load=”YES”
wlan_ccmp_load=”YES”

# Intel WLAN
#if_iwn_load=”YES”
if_wpi_load=”YES”

# DRM
agp_load=”YES”
drm_load=”YES”
i915_load=”YES”

# ProcFS
pseudofs_load=”YES”
procfs_load=”YES”

# UFS
ufs_load=”YES”

# Kernel RPC
krpc_load=”YES”

# VirtualBox
vboxdrv_load=”YES”

# FUSE
fuse_load=”YES”

# MSDOSFS
msdosfs_load=”YES”
msdosfs_iconv_load=”YES”

# CD9660
cd9660_load=”YES”
cd9660_iconv_load=”YES”

# Mono
mono_load=”YES”

# Cardbus
cbb_load=”YES”
exca_load=”YES”

# VESA
vesa_load=”YES”
dpms_load=”YES”

# Kartenleser
sdhci_load=”YES”

# Watchdog
ichwd_load=”YES”

# Netgraph
netgraph_load=”YES”

# Bluetooth
ng_ubt_load=”YES”
ng_hci_load=”YES”
ng_bluetooth_load=”YES”

# CUSE
cuse4bsd_load=”YES”

sem_load=”YES”
———————————————————————————–

 

/boot/device.hints: 

———————————————————————————–
# $FreeBSD$
hint.fdc.0.at=”isa”
hint.fdc.0.port=”0x3F0″
hint.fdc.0.irq=”6″
hint.fdc.0.drq=”2″
hint.fd.0.at=”fdc0″
hint.fd.0.drive=”0″
hint.fd.1.at=”fdc0″
hint.fd.1.drive=”1″
hint.atkbdc.0.at=”isa”
hint.atkbdc.0.port=”0x060″
hint.atkbd.0.at=”atkbdc”
hint.atkbd.0.irq=”1″
hint.psm.0.at=”atkbdc”
hint.psm.0.irq=”12″
hint.sc.0.at=”isa”
hint.sc.0.flags=”0x100″
hint.uart.0.at=”isa”
hint.uart.0.port=”0x3F8″
hint.uart.0.flags=”0x10″
hint.uart.0.irq=”4″
hint.uart.1.at=”isa”
hint.uart.1.port=”0x2F8″
hint.uart.1.irq=”3″
hint.ppc.0.at=”isa”
hint.ppc.0.irq=”7″
hint.atrtc.0.at=”isa”
hint.atrtc.0.port=”0x70″
hint.atrtc.0.irq=”8″
hint.psm.0.flags=”0x1000″#Jes
#Synaptics touchpad
hw.psm.synaptics_support=1
———————————————————————————–

/etc/rc.suspend (extract):

———————————————————————————–
. . .
# If a device driver has problems suspending, try unloading it before
# suspend and reloading it on resume.  Example:
# kldunload usb# WPA
/usr/sbin/wpa_cli terminate

# Kill webcamd
pkill webcamd

# Shutdown moused
/etc/rc.d/moused stop

# If a device driver has problems suspending, try unloading it before
# suspend and reloading it on resume.  Example:
kldunload firewire
kldunload ehci
kldunload uhci
#–
kldunload umass
kldunload u3g
#–
kldunload usb
kldunload if_wpi
. . .
———————————————————————————–

/etc/rc.resume (extract):

———————————————————————————–
. . .
# If a device driver has problems resuming, try unloading it before
# suspend and reloading it on resume.  Example:
# kldload usb# Start moused
/etc/rc.d/moused start

# If a device driver has problems resuming, try unloading it before
# suspend and reloading it on resume.  Example:
kldload firewire
kldload usb
kldload uhci
kldload ehci
kldload if_wpi
#–
kldload u3g
kldload umass
#–

#JES
#This is because after resume hald consumes too much cpu
/usr/local/etc/rc.d/hald restart
#Disable APM in disk
/sbin/camcontrol cmd ada0 -a “EF 85 00 00 00 00 00 00 00 00 00 00″

#Restart moused
#/etc/rc.d/moused restart

#Restart wpa_supplicant
/etc/wpa.sh
. . .
———————————————————————————–

To start/restart Wifi I use a custom script:

/etc/wpa.sh———————————————————————————–
#!/bin/shpkill wpa_supplicant
pkill wpa_supplicant
pkill wpa_supplicant

rm /var/run/wpa_supplicant/wlan0.pid

/usr/sbin/wpa_supplicant -s -B -i wlan0 -c /etc/wpa_supplicant.conf -D bsd -P /var/run/wpa_supplicant /wlan0.pid
———————————————————————————–


About jjjesss

I'm a guy interested in technology, bsd fan and concerned about the world around.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s