hotplug esata?

Anyone know if AHCI-compliant eSATA hotplug is supported under FreeBSD (or will be)?

I'm running 6.4-CURRENT on a system using AHCI. I'm able to see and mount my eSATA drive after reboot w/o problem, but hotplug would be very very handy (then I can lose the slow USB drive).

atacontrol init and list doesn't see the "new" device.

Any thoughts or future direction on this?
thanks!
-omar
 
Well, I've an e-sata hdd, too. When I plugged my harddisk, I have to do:
# atacontrol detach $right_ata_channel
# atacontrol attach $right_ata_channel

to get it recognised by the system.

I've also read that a
# atacontrol reinit $right_ata_channel
helps in some cases, but in my not.

I think it's worth a try. ;)
 
no luck

sadly no luck with any of the atacontrol commands. Rebooted and the esata drive showed up on the channel I was fiddling with. Verified AHCI is on in BIOS too.

Anyone have a method to determine if the AHCI support in my Intel chipset is deficient? or how much hotplug is supported in the 6.4 codebase?
 
piconf

Thanks, here's both. The dmesg doesn't include the eSATA drive but otherwise config is the same. The drive on the eSATA channel was showing up correctly after reboot as:

Dec 7 00:03:03 mine kernel: ad14: 953869MB <Hitachi HDS721010KLA330 GKAOAB0A> at ata7-master SATA300

=============
> pciconf -l
hostb0@pci0:0:0: class=0x060000 card=0x50448086 chip=0x29c08086 rev=0x02 hdr=0x00
pcib1@pci0:1:0: class=0x060400 card=0x50448086 chip=0x29c18086 rev=0x02 hdr=0x01
none0@pci0:3:0: class=0x078000 card=0x50448086 chip=0x29c48086 rev=0x02 hdr=0x00
em0@pci0:25:0: class=0x020000 card=0x00018086 chip=0x294c8086 rev=0x02 hdr=0x00
uhci0@pci0:26:0: class=0x0c0300 card=0x50448086 chip=0x29378086 rev=0x02 hdr=0x00
uhci1@pci0:26:1: class=0x0c0300 card=0x50448086 chip=0x29388086 rev=0x02 hdr=0x00
uhci2@pci0:26:2: class=0x0c0300 card=0x50448086 chip=0x29398086 rev=0x02 hdr=0x00
ehci0@pci0:26:7: class=0x0c0320 card=0x50448086 chip=0x293c8086 rev=0x02 hdr=0x00
pcm0@pci0:27:0: class=0x040300 card=0x30018086 chip=0x293e8086 rev=0x02 hdr=0x00
pcib2@pci0:28:0: class=0x060400 card=0x29408086 chip=0x29408086 rev=0x02 hdr=0x01
pcib3@pci0:28:1: class=0x060400 card=0x29428086 chip=0x29428086 rev=0x02 hdr=0x01
pcib4@pci0:28:2: class=0x060400 card=0x29448086 chip=0x29448086 rev=0x02 hdr=0x01
pcib5@pci0:28:3: class=0x060400 card=0x29468086 chip=0x29468086 rev=0x02 hdr=0x01
pcib6@pci0:28:4: class=0x060400 card=0x29488086 chip=0x29488086 rev=0x02 hdr=0x01
uhci3@pci0:29:0: class=0x0c0300 card=0x50448086 chip=0x29348086 rev=0x02 hdr=0x00
uhci4@pci0:29:1: class=0x0c0300 card=0x50448086 chip=0x29358086 rev=0x02 hdr=0x00
uhci5@pci0:29:2: class=0x0c0300 card=0x50448086 chip=0x29368086 rev=0x02 hdr=0x00
ehci1@pci0:29:7: class=0x0c0320 card=0x50448086 chip=0x293a8086 rev=0x02 hdr=0x00
pcib7@pci0:30:0: class=0x060401 card=0x50448086 chip=0x244e8086 rev=0x92 hdr=0x01
isab0@pci0:31:0: class=0x060100 card=0x50448086 chip=0x29168086 rev=0x02 hdr=0x00
atapci1@pci0:31:2: class=0x010601 card=0x50448086 chip=0x29228086 rev=0x02 hdr=0x00
none1@pci0:31:3: class=0x0c0500 card=0x50448086 chip=0x29308086 rev=0x02 hdr=0x00
nvidia0@pci1:0:0: class=0x030000 card=0x09101462 chip=0x040210de rev=0xa1 hdr=0x00
atapci0@pci3:0:0: class=0x01018f card=0x610111ab chip=0x610111ab rev=0xb2 hdr=0x00
none2@pci7:0:0: class=0x040100 card=0x00000000 chip=0x60051013 rev=0x01 hdr=0x00
skc0@pci7:2:0: class=0x020000 card=0x4b011186 chip=0x4b011186 rev=0x11 hdr=0x00
none3@pci7:3:0: class=0x0c0010 card=0x50448086 chip=0x8023104c rev=0x00 hdr=0x00
 
and here's dmesg.boot

======================================================
Copyright (c) 1992-2008 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 6.4-RELEASE #0: Sat Nov 29 15:33:06 EST 2008
root@mine.heedme.com:/usr/obj/usr/src/sys/MINE
ACPI APIC Table: <INTEL DP35DP >
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz (3017.67-MHz 686-class CPU)
Origin = "GenuineIntel" Id = 0x10676 Stepping = 6
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
Features2=0x8e3fd<SSE3,RSVD2,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,<b19>>
AMD Features=0x20100000<NX,LM>
AMD Features2=0x1<LAHF>
Cores per package: 2
real memory = 3484987392 (3323 MB)
avail memory = 3405291520 (3247 MB)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
cpu0 (BSP): APIC ID: 0
cpu1 (AP): APIC ID: 1
ioapic0: Changing APIC ID to 2
ioapic0 <Version 2.0> irqs 0-23 on motherboard
acpi0: <INTEL DP35DP> on motherboard
acpi0: Power Button (fixed)
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
cpu0: <ACPI CPU> on acpi0
acpi_perf0: <ACPI CPU Frequency Control> on cpu0
acpi_perf0: failed in PERF_STATUS attach
device_attach: acpi_perf0 attach returned 6
acpi_perf0: <ACPI CPU Frequency Control> on cpu0
acpi_perf0: failed in PERF_STATUS attach
device_attach: acpi_perf0 attach returned 6
acpi_throttle0: <ACPI CPU Throttling> on cpu0
cpu1: <ACPI CPU> on acpi0
acpi_perf1: <ACPI CPU Frequency Control> on cpu1
acpi_perf1: failed in PERF_STATUS attach
device_attach: acpi_perf1 attach returned 6
acpi_perf1: <ACPI CPU Frequency Control> on cpu1
acpi_perf1: failed in PERF_STATUS attach
device_attach: acpi_perf1 attach returned 6
acpi_throttle1: <ACPI CPU Throttling> on cpu1
acpi_throttle1: failed to attach P_CNT
device_attach: acpi_throttle1 attach returned 6
acpi_button0: <Sleep Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <ACPI PCI-PCI bridge> at device 1.0 on pci0
pci1: <ACPI PCI bus> on pcib1
nvidia0: <GeForce 8600 GT> port 0x3000-0x307f mem 0xe2000000-0xe2ffffff,0xd0000000-0xdfffffff,0xe0000000-0xe1ffffff irq 16 at device 0.0 on pci1
nvidia0: [GIANT-LOCKED]
pci0: <simple comms> at device 3.0 (no driver attached)
em0: <Intel(R) PRO/1000 Network Connection Version - 6.7.3> port 0x4400-0x441f mem 0xe3200000-0xe321ffff,0xe3224000-0xe3224fff irq 20 at device 25.0 on pci0
em0: Using MSI interrupt
em0: Ethernet address: 00:1c:c0:60:ed:b5
uhci0: <UHCI (generic) USB controller> port 0x40e0-0x40ff irq 18 at device 26.0 on pci0
uhci0: [GIANT-LOCKED]
usb0: <UHCI (generic) USB controller> on uhci0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhci1: <UHCI (generic) USB controller> port 0x40c0-0x40df irq 21 at device 26.1 on pci0
uhci1: [GIANT-LOCKED]
usb1: <UHCI (generic) USB controller> on uhci1
usb1: USB revision 1.0
uhub1: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
uhci2: <UHCI (generic) USB controller> port 0x40a0-0x40bf irq 17 at device 26.2 on pci0
uhci2: [GIANT-LOCKED]
usb2: <UHCI (generic) USB controller> on uhci2
usb2: USB revision 1.0
uhub2: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub2: 2 ports with 2 removable, self powered
ehci0: <EHCI (generic) USB 2.0 controller> mem 0xe3225c00-0xe3225fff irq 17 at device 26.7 on pci0
ehci0: [GIANT-LOCKED]
usb3: EHCI version 1.0
usb3: companion controllers, 2 ports each: usb0 usb1 usb2
usb3: <EHCI (generic) USB 2.0 controller> on ehci0
usb3: USB revision 2.0
uhub3: Intel EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub3: 6 ports with 6 removable, self powered
pcm0: <Intel 82801I High Definition Audio Controller> mem 0xe3220000-0xe3223fff irq 22 at device 27.0 on pci0
pcib2: <ACPI PCI-PCI bridge> at device 28.0 on pci0
pci2: <ACPI PCI bus> on pcib2
pcib3: <ACPI PCI-PCI bridge> at device 28.1 on pci0
pci3: <ACPI PCI bus> on pcib3
atapci0: <Marvell 88SX6101 UDMA133 controller> port 0x2018-0x201f,0x2024-0x2027,0x2010-0x2017,0x2020-0x2023,0x2000-0x200f mem 0xe3100000-0xe31001ff irq 17 at device 0.0 on pci3
ata2: <ATA channel 0> on atapci0
pcib4: <ACPI PCI-PCI bridge> at device 28.2 on pci0
pci4: <ACPI PCI bus> on pcib4
pcib5: <ACPI PCI-PCI bridge> at device 28.3 on pci0
pci5: <ACPI PCI bus> on pcib5
pcib6: <ACPI PCI-PCI bridge> at device 28.4 on pci0
pci6: <ACPI PCI bus> on pcib6
uhci3: <UHCI (generic) USB controller> port 0x4080-0x409f irq 23 at device 29.0 on pci0
uhci3: [GIANT-LOCKED]
usb4: <UHCI (generic) USB controller> on uhci3
usb4: USB revision 1.0
uhub4: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub4: 2 ports with 2 removable, self powered
uhci4: <UHCI (generic) USB controller> port 0x4060-0x407f irq 19 at device 29.1 on pci0
uhci4: [GIANT-LOCKED]
usb5: <UHCI (generic) USB controller> on uhci4
usb5: USB revision 1.0
uhub5: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub5: 2 ports with 2 removable, self powered
uhci5: <UHCI (generic) USB controller> port 0x4040-0x405f irq 18 at device 29.2 on pci0
uhci5: [GIANT-LOCKED]
usb6: <UHCI (generic) USB controller> on uhci5
usb6: USB revision 1.0
uhub6: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub6: 2 ports with 2 removable, self powered
ehci1: <EHCI (generic) USB 2.0 controller> mem 0xe3225800-0xe3225bff irq 23 at device 29.7 on pci0
ehci1: [GIANT-LOCKED]
usb7: EHCI version 1.0
usb7: companion controllers, 2 ports each: usb4 usb5 usb6
usb7: <EHCI (generic) USB 2.0 controller> on ehci1
usb7: USB revision 2.0
uhub7: Intel EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub7: 6 ports with 6 removable, self powered
pcib7: <ACPI PCI-PCI bridge> at device 30.0 on pci0
pci7: <ACPI PCI bus> on pcib7
pci7: <multimedia, audio> at device 0.0 (no driver attached)
skc0: <D-Link DGE-530T Gigabit Ethernet> port 0x1000-0x10ff mem 0xe3014000-0xe3017fff irq 18 at device 2.0 on pci7
skc0: DGE-530T Gigabit Ethernet Adapter rev. (0x9)
sk0: <Marvell Semiconductor, Inc. Yukon> on skc0
sk0: Ethernet address: 00:1c:f0:91:ca:6c
miibus0: <MII bus> on sk0
e1000phy0: <Marvell 88E1011 Gigabit PHY> on miibus0
e1000phy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX-FDX, auto
pci7: <serial bus, FireWire> at device 3.0 (no driver attached)
isab0: <PCI-ISA bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
atapci1: <Intel AHCI controller> port 0x4428-0x442f,0x4434-0x4437,0x4420-0x4427,0x4430-0x4433,0x4020-0x403f mem 0xe3225000-0xe32257ff irq 21 at device 31.2 on pci0
atapci1: AHCI Version 01.20 controller with 6 ports detected
ata3: <ATA channel 0> on atapci1
ata4: <ATA channel 1> on atapci1
ata5: <ATA channel 2> on atapci1
ata6: <ATA channel 3> on atapci1
ata7: <ATA channel 4> on atapci1
ata8: <ATA channel 5> on atapci1
pci0: <serial bus, SMBus> at device 31.3 (no driver attached)
sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
sio0: type 16550A
pmtimer0 on isa0
orm0: <ISA Option ROMs> at iomem 0xcf800-0xd07ff,0xd0800-0xd17ff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
ata0 at port 0x1f0-0x1f7,0x3f6 irq 14 on isa0
ata1 at port 0x170-0x177,0x376 irq 15 on isa0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
ppc0: parallel port not found.
sio1 at port 0x2f8-0x2ff irq 3 on isa0
sio1: type 16550A
ukbd0: Logitech USB Multimedia Keyboard, rev 1.10/0.70, addr 2, iclass 3/1
kbd1 at ukbd0
uhid0: Logitech USB Multimedia Keyboard, rev 1.10/0.70, addr 2, iclass 3/1
ums0: Logitech USB Receiver, rev 2.00/5.00, addr 2, iclass 3/1
ums0: 16 buttons and Z dir.
uhid1: Logitech USB Receiver, rev 2.00/5.00, addr 2, iclass 3/1
Timecounters tick every 1.000 msec
ipfw2 initialized, divert enabled, rule-based forwarding disabled, default to deny, logging unlimited
acd0: DVDROM <HL-DT-STDVD-ROM GDRH10N/0D04> at ata3-master SATA150
ad8: 476940MB <MAXTOR STM3500630AS 3.AAE> at ata4-master SATA150
ad10: 476940MB <Seagate ST3500630AS 3.AAK> at ata5-master SATA150
GEOM_MIRROR: Device mir0 created (id=2700746771).
GEOM_MIRROR: Device mir0: provider ad8 detected.
GEOM_MIRROR: Device mir0: provider ad10 detected.
GEOM_MIRROR: Device mir0: provider ad10 activated.
GEOM_MIRROR: Device mir0: provider ad8 activated.
GEOM_MIRROR: Device mir0: provider mirror/mir0 launched.
ad12: 953869MB <Hitachi HDS721010KLA330 GKAOAB0A> at ata6-master SATA300
ad16: 953869MB <Seagate ST31000340AS SD15> at ata8-master SATA300
pcm0: <HDA Codec: Sigmatel STAC9271D>
pcm0: <HDA Driver Revision: 20071129_0050>
SMP: AP CPU #1 Launched!
Trying to mount root from ufs:/dev/mirror/mir0s1a
sk0: link state changed to UP
 
HotPlug should work on your Intel AHCI controller.. 8.0-CURRENT has some changes in AHCI code. Can you boot last snapshot of FreeBSD 8.0-CURRENT and try plug/unplug your device? (It isn't necessary install it, you can only boot from CD).
 
butcher said:
HotPlug should work on your Intel AHCI controller.. 8.0-CURRENT has some changes in AHCI code. Can you boot last snapshot of FreeBSD 8.0-CURRENT and try plug/unplug your device? (It isn't necessary install it, you can only boot from CD).

I didn't have a chance to test under 8.0-CURRENT but I recently was able to try this under 7.1-RELEASE (vs my previous 6.x testing) and it seems to work now, yay!

I did noticed that the external unit needs to be physically disconnected (unplug cable, replug) for hotplug to notice its addition, probably something to do with current and eSATA standards, or perhaps this enclosure (an Antec MX-1).

To summarize, for FB-7.1:

- Attach external drive via eSATA port, drive turned off via enclosure power-switch.

- Power on enclosure. (no response, atacontrol sees nothing).

- Unplug esata cable, replug. (drive is recognized, atacontrol shows it normally)

-omar
 
s-tlk said:
Well, I've an e-sata hdd, too. When I plugged my harddisk, I have to do:
# atacontrol detach $right_ata_channel
# atacontrol attach $right_ata_channel

to get it recognised by the system.

I've also read that a
# atacontrol reinit $right_ata_channel
helps in some cases, but in my not.

I think it's worth a try. ;)
Thanks for the hint! Now I can connect up my backup hdd via esata for super fast backups using a HDD dock. To flesh it out a bit more for others:

  1. Determine which ata channel the device you want to remove is on. (When you do the following you will see a list of channels, I have included only the relevant one.)
    # atacontrol list
    Code:
    ATA channel 3:
         Master: ad12 <WDC WD2500JD-00HBC0/08.02D08> SATA revision 2.x
         Slave:         no device present
    Now, turn off/disconnect the drive.
    # atacontrol list
    Code:
    ATA channel 3:
         Master:        no device present
         Slave:         no device present
    This tells us that the drive we are concerned about is on ata channel 3.
  2. Get FreeBSD to be able to use the drive again.
    # atacontrol detach ata3
    # atacontrol attach ata3
If using ZFS and the pool is just this one drive, test that we can import it:
# zpool import
 
mav@ said:
8-STABLE includes much more featured driver ahci(4). Using it, all you need to do is to plug-in the drive.
Thanks for that. I've put the following in the /boot/loader.conf and rebooted the machine:
Code:
ahci_load="YES"
While the OS did detect the drive, now that I have powered it off and on again, it is not detected. I'm pretty sure that ahci is enabled in the bios as well. I'll check that.

dmesg output when I unplug:
Code:
(ada2:ahcich4:0:0:0): lost device
(ada2:ahcich4:0:0:0): Invalidating pack
(ada2:ahcich4:0:0:0): Synchronize cache failed
(ada2:ahcich4:0:0:0): removing device entry
When I plug it back in, there is no dmesg output.
 
How old is your system? 8.0-RELEASE didn't have full hot-plug support. It was implemented in 8-STABLE just 1-2 month ago. With older system you would need 'camcontrol reset X && camcontrol rescan X' on plug-in, where X is a bus number from `camcontrol devlist`.
 
mav@ said:
How old is your system? 8.0-RELEASE didn't have full hot-plug support. It was implemented in 8-STABLE just 1-2 month ago. With older system you would need 'camcontrol reset X && camcontrol rescan X' on plug-in, where X is a bus number from `camcontrol devlist`.
Ahah, thank you! I must be using 8.0-RELEASE, as your commands worked perfectly (I took a guess that the X would correspond to ataX from the above, which was correct.) I'm now in the process of learning the difference between STABLE and RELEASE, and deciding if I want to upgrade. Cheers!
 
Back
Top