AHC(4)

πŸ’– AHC πŸ’– β€” the Adaptec VL/ISA/PCI SCSI host adapter driver

okay bestie, sit down, grab a snack πŸ“ β€” this is the man page for ahc(4), from the Kernel Interfaces Manual, and it's genuinely iconic. it's giving "vintage SCSI realness" and i am obsessed.


✨ NAME ✨

ahc β€” the Adaptec VL/ISA/PCI SCSI host adapter driver. that's the whole vibe. πŸ’…


🌸 SYNOPSIS 🌸

so like, you've got two ways to get this driver living in your system. option one: bake it straight into the kernel. drop these lines into your kernel configuration file:

device scbus
device ahc

For one or more PCI cards:
device pci

To allow PCI adapters to use memory mapped I/O if enabled:
options AHC_ALLOW_MEMIO

To configure one or more controllers to assume the target role:
options AHC_TMODE_ENABLE <bitmask of units>

and option two, the lowkey easier one: load it as a module at boot time, by putting these lines in loader.conf(5):

ahc_load="YES"
ahc_isa_load="YES"
ahc_pci_load="YES"

slay. pick your fighter. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

this driver gives you access to the SCSI bus(es) hanging off the Adaptec AIC77xx and AIC78xx host adapter chips. periodt.

driver features include, and i quote the energy: support for twin and wide busses, fast, ultra or ultra2 synchronous transfers depending on controller type, tagged queueing, SCB paging, and target mode. like?? the range.

πŸ’… Memory mapped I/O

memory mapped I/O can be turned on for PCI devices with the AHC_ALLOW_MEMIO configuration option. and ngl, memory mapped I/O is more efficient than the alternative, programmed I/O. most PCI BIOSes will map devices so that either technique for communicating with the card is available.

but β€” and this is the plot twist 😭 β€” in some cases, usually when the PCI device is sitting behind a PCI->PCI bridge, the BIOS may fail to properly initialize the chip for memory mapped I/O. the typical symptom of this problem is a system hang if memory mapped I/O is attempted. scary. but most modern motherboards perform the initialization correctly and work fine with this option enabled, so it's usually fine bestie.

πŸ‘‘ Target mode

individual controllers may be configured to operate in the target role through the AHC_TMODE_ENABLE configuration option. the value you assign should be a bitmap of all units where target mode is desired.

  • a value of 0x25 would enable target mode on units 0, 2, and 5.
  • a value of 0x8a enables it for units 1, 3, and 7.

math is mathing. 🌈

⭐ Per target configuration

per target configuration performed in the SCSI-Select menu, accessible at boot, is honored by this driver. this includes:

  • synchronous/asynchronous transfers
  • maximum synchronous negotiation rate
  • wide transfers
  • disconnection
  • the host adapter's SCSI ID

for systems that store non-volatile settings in a system specific manner rather than a serial eeprom directly connected to the aic7xxx controller, the BIOS must be enabled for the driver to access this information. this restriction applies to many chip-down motherboard configurations. iykyk.

πŸ”₯ The chip comparison table (yes it's a table, no i can't use a table)

performance and feature sets vary throughout the aic7xxx product line, because of course they do. here's the comparison of the different chips supported by the ahc driver. note: wide and twin channel features, although always supported by a particular chip, may be disabled in a particular motherboard or card design. rude but true.

Chip      MIPS  Bus     MaxSync  MaxWidth  SCBs  Features
aic7770   10    VL      10MHz    16Bit     4     1
aic7850   10    PCI/32  10MHz    8Bit      3
aic7860   10    PCI/32  20MHz    8Bit      3
aic7870   10    PCI/32  10MHz    16Bit     16
aic7880   10    PCI/32  20MHz    16Bit     16
aic7890   20    PCI/32  40MHz    16Bit     16    3 4 5 6 7 8
aic7891   20    PCI/64  40MHz    16Bit     16    3 4 5 6 7 8
aic7892   20    PCI/64  80MHz    16Bit     16    3 4 5 6 7 8
aic7895   15    PCI/32  20MHz    16Bit     16    2 3 4 5
aic7895C  15    PCI/32  20MHz    16Bit     16    2 3 4 5 8
aic7896   20    PCI/32  40MHz    16Bit     16    2 3 4 5 6 7 8
aic7897   20    PCI/64  40MHz    16Bit     16    2 3 4 5 6 7 8
aic7899   20    PCI/64  80MHz    16Bit     16    2 3 4 5 6 7 8

and here's the key to those little feature numbers, bestie, don't skip them:

  1. Multiplexed Twin Channel Device β€” One controller servicing two busses.
  2. Multi-function Twin Channel Device β€” Two controllers on one chip.
  3. Command Channel Secondary DMA Engine β€” Allows scatter gather list and SCB prefetch.
  4. 64 Byte SCB Support β€” SCSI CDB is embedded in the SCB to eliminate an extra DMA.
  5. Block Move Instruction Support β€” Doubles the speed of certain sequencer operations.
  6. β€˜Bayonet’ style Scatter Gather Engine β€” Improves S/G prefetch performance.
  7. Queuing Registers β€” Allows queueing of new transactions without pausing the sequencer.
  8. Multiple Target IDs β€” Allows the controller to respond to selection as a target on multiple SCSI IDs.

number 8 is literally main character energy. multiple target IDs?? we love a multitasker. πŸ’œ


πŸŽ€ HARDWARE πŸŽ€

the ahc driver supports the following SCSI host adapter chips and SCSI controller cards. prepare yourself, it's a long list and honestly it ate:

  • Adaptec AIC7770 host adapter chip
  • Adaptec AIC7850 host adapter chip
  • Adaptec AIC7860 host adapter chip
  • Adaptec AIC7870 host adapter chip
  • Adaptec AIC7880 host adapter chip
  • Adaptec AIC7890 host adapter chip
  • Adaptec AIC7891 host adapter chip
  • Adaptec AIC7892 host adapter chip
  • Adaptec AIC7895 host adapter chip
  • Adaptec AIC7896 host adapter chip
  • Adaptec AIC7897 host adapter chip
  • Adaptec AIC7899 host adapter chip
  • Adaptec 274X(W)
  • Adaptec 274X(T)
  • Adaptec 2910
  • Adaptec 2915
  • Adaptec 2920C
  • Adaptec 2930C
  • Adaptec 2930U2
  • Adaptec 2940
  • Adaptec 2940J
  • Adaptec 2940N
  • Adaptec 2940U
  • Adaptec 2940AU
  • Adaptec 2940UW
  • Adaptec 2940UW Dual
  • Adaptec 2940UW Pro
  • Adaptec 2940U2W
  • Adaptec 2940U2B
  • Adaptec 2950U2W
  • Adaptec 2950U2B
  • Adaptec 19160B
  • Adaptec 29160B
  • Adaptec 29160N
  • Adaptec 3940
  • Adaptec 3940U
  • Adaptec 3940AU
  • Adaptec 3940UW
  • Adaptec 3940AUW
  • Adaptec 3940U2W
  • Adaptec 3950U2
  • Adaptec 3960
  • Adaptec 39160
  • Adaptec 3985
  • Adaptec 4944UW
  • Many motherboards with on-board SCSI support

the last one is the sneaky icon honestly. "many motherboards" β€” vague, mysterious, powerful. 🧚


🌈 SCSI CONTROL BLOCKS (SCBs) 🌈

okay this is the lore section and it's actually so good.

every transaction sent to a device on the SCSI bus is assigned a β€˜SCSI Control Block’ (SCB). the SCB contains all of the information required by the controller to process a transaction. the chip feature table above lists the number of SCBs that can be stored in on-chip memory.

all chips with model numbers greater than or equal to 7870 allow for the on chip SCB space to be augmented with external SRAM up to a maximum of 255 SCBs. very few Adaptec controller configurations have external SRAM though, so don't get too excited.

πŸ’€ the SCB paging situation

if external SRAM is not available, SCBs are a limited resource. using the SCBs in a straight forward manner would only allow the driver to handle as many concurrent transactions as there are physical SCBs. and to fully utilize the SCSI bus and the devices on it, you need much more concurrency.

the solution? SCB Paging β€” a concept similar to memory paging. it's giving "we invented virtual memory but for SCSI" and honestly, genius.

here's how it works, bestie: SCB paging takes advantage of the fact that devices usually disconnect from the SCSI bus for long periods of time without talking to the controller. the SCBs for disconnected transactions are only of use to the controller when the transfer is resumed.

so when the host queues another transaction for the controller to execute, the controller firmware will use a free SCB if one is available. otherwise, the state of the most recently disconnected (and therefore most likely to stay disconnected) SCB is saved, via dma, to host memory, and the local SCB reused to start the new transaction.

this allows the controller to queue up to 255 transactions regardless of the amount of SCB space. πŸ’…

and because the local SCB space serves as a cache for disconnected transactions, the more SCB space available, the less host bus traffic consumed saving and restoring SCB data. it's a whole economy. economics. we love it here.


🫢 SEE ALSO 🫢

the whole friend group. go read them too. ✨


⭐ HISTORY ⭐

the ahc driver appeared in FreeBSD 2.0. an elder. a legend. respect the elders. πŸ‘‘


πŸ’œ AUTHORS πŸ’œ

the ahc driver, the AIC7xxx sequencer-code assembler, and the firmware running on the aic7xxx chips was written by Justin T. Gibbs. thank you king, this entire manpage is your legacy. 🫑


😭 BUGS 😭

okay so, the not-so-slay parts. buckle up.

  • some Quantum drives (at least the Empire 2100 and 1080s) will not run on an AIC7870 Rev B in synchronous mode at 10MHz. controllers with this problem have a 42 MHz clock crystal on them and run slightly above 10MHz. this confuses the drive and hangs the bus. πŸ’€ setting a maximum synchronous negotiation rate of 8MHz in the SCSI-Select utility will allow normal operation.
  • although the Ultra2 and Ultra160 products have sufficient instruction ram space to support both the initiator and target roles concurrently, this configuration is disabled in favor of allowing the target role to respond on multiple target ids. a method for configuring dual role mode should be provided. (complaint noted, valid.)
  • Tagged Queuing is not supported in target mode. just... not a thing. no cap.
  • Reselection in target mode fails to function correctly on all high voltage differential boards as shipped by Adaptec. information on how to modify HVD board to work correctly in target mode is available from Adaptec. so like, ask them, not us. πŸ™ˆ

reminder bestie: none of these are your fault, the hardware is just dramatic sometimes. πŸŽ€

and that's the whole page! this little beauty came from the Debian crew and it's dated February 15, 2017 β€” so it's vintage, it's archived, and it's still out here explaining SCSI to whoever needs it. take care of your controllers, they're doing their best πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from