# aic7xxx

## akm76

I hate to kick the dead horse, but for the love of almighty can't find a clear answer *anywhere*.

How to build a working kernel with aic7xxx?

I have ubuntu hardy booting great from the card+ibm drive, never complained once.

But all my attempts to build a working kernel (sysrescue, gentoo-sources; genkernel, manual config based on the livecd /proc/configs)

fails miserably. It basically loads initrd _from the same drive_! but then does something that causes scsi domain validation and knocks out the drive completely (only powercycle helps). Not a faulty hardware, this old ubuntu booting flawlessly with no error messages is a proof.

There was some noise 5years ago about aic7xxx being broken/unbroken/replaced by new driver, but

please, PLEASE, someone tell me what was the end of the story!

----------

## audiodef

1. What is aic7xxx?

2. We know your machine works, as illustrated by being able to use Ubuntu. Perhaps you could tell us exactly at what step in the install process things go wrong for you.

----------

## akm76

aix7xxx is the driver for a family of adaptec scsi cards (160Ultra mostly). The one I got is a pretty basic pci ultra 160.

The only thing I was able to dig up is that driver went bad somewhere in early 2.6 kernel versions and I'm not sure it was ever stabilized after. Some bug reports I was able to find basically expired without being changed to "fixed".

My current kernel build iteration breaks after it successfully loads kernel from a drive attached to the same card, loads initrd, initialized card, but then issues something, (tried disabling bus scan and probe for ISA cards), that first makes the drive fail "domain validation check" and shortly after knocks it our completely, so that after simple reboot card cannot even detect drive in bios scan. Only powercycle brings the drive back. (Needless to say this should've been /dev/sda, hosting root partition, so in busybox I see all partitions for missing, and no way to mount root and continue)

So I suspect the driver does something unwholesome to the drive, but I'm not a scsi pro to trace the driver, I'm hoping somebody in the forum would recall what the solution was.

----------

## John R. Graham

I have working machines with this hardware. I'm at work and can't check my home configuration (which is where I use it), but I believe I just enabled Device Drivers / SCSI device support / SCSI low level drivers / Adaptec AIC7xxx Fast -> U160 support (New Driver). Since I'm just currently using that card to run my tape drives, I was able to build it as a module, but it's worked flawlessly for me. Are you by chance using the older "Adaptec AIC7xxx support (old driver)" driver instead?

I have some SCSI drives that I could try out, but I've generally found Adaptec to be one of the most reliable vendors in the Linux world.

By the way, it's not surprising that the load of the initrd works differently as that's done with different code: grub + BIOS. The kernel isn't involved at that point.

- John

----------

## akm76

yea, it's a nice piece of hardware and worked flawlessly for years under older kernels. Ubuntu hardy works like a charm on it.

I'm trying to use if with newer aic7xxx, not aic7xxx_old. Still hoping there might be a magic spell for kernel parameters that would just make it work..

----------

## John R. Graham

Just to make sure we're comparing apples to apples, I have this:

```
~ # lspci | grep SCSI

05:03.0 SCSI storage controller: Adaptec AHA-2940U/UW/D / AIC-7881U
```

Which definitely uses the aic7xxx driver. My kernel config (gentoo-sources-3.1.12) for the driver looks like this:

```
   <M>   Adaptec AIC7xxx Fast -> U160 support (New Driver)

   (32)    Maximum number of TCQ commands per device

   (5000)  Initial bus reset delay in milli-seconds

   [*]     Compile in Debugging Code

   (0)     Debug code enable mask (2047 for all debugging)

   [*]     Decode registers during diagnostics
```

Like I said, I'll try to get one of my U320 drives hooked up as I only have tape on that controller right now. It may take me a day or two, though.

- John

----------

## eccerr0r

I also have two machines with Adaptec U160 HA's working just fine with LVD U320/U160 disks, the aic7xxx seems to work fine with them...  They boot off the SCSI disk just fine.   These HA's have an external fast20 8-bit SCSI, internal fast20 8-bit, and a U160 HD68 internal connector, for comparison.

I do not use initrd but initrd is usually read from the same drive as the kernel...what's wrong with that?  Did you build your drivers into the kernel or loading them in the initrd?

I'll have to check what version of Linux I'm using on them, might be a regression ?

----------

## akm76

My lspci shows:

```
02:08.0 SCSI storage controller: Adaptec AIC-7879A U160/m (rev02)
```

Kernel config section exactly the same.

I was doing 3.0.21 from sysrescue, switched to 3.4.2-gentoo, building that now

----------

## eccerr0r

This machine works:

Linux kei 3.0.6-gentoo #1 Fri Oct 28 20:27:18 MDT 2011 i686 Intel(R) Celeron(TM) CPU 1200MHz GenuineIntel GNU/Linux

00:0a.0 SCSI storage controller: Adaptec AIC-7892A U160/m (rev 02)

Different controller it seems...

----------

## akm76

Got new kernel built, and it didn't solve it, still loading initrd and no root disk mount after, but I got a

dmesg log from busybox and here're the snippets (there's a whole lot of SCSI error stuff that mostly repeats over and over, I disabled most of the other things that I could)

```
ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 10

PCI: setting IRQ 10 as level-triggered

scsi2 : Adaptec AIC7XXX EISA/VLB/PCI SCSI HBA DRIVER, Rev 7.0

        <Adaptec 29160 Ultra160 SCSI adapter>

        aic7892: Ultra160 Wide Channel A, SCSI Id=7, 32/253 SCBs

scsi 2:0:0:0: Direct-Access     IBM      DDYS-T09170N     S80D PQ: 0 ANSI: 3

scsi2:A:0:0: Tagged Queuing enabled.  Depth 32

scsi target2:0:0: Beginning Domain Validation

scsi target2:0:0: wide asynchronous

scsi target2:0:0: FAST-80 WIDE SCSI 160.0 MB/s DT (12.5 ns, offset 63)

scsi: <fdomain> Detection failed (no card)

...

scsi: waiting for bus probes to complete ...

scsi 2:0:0:0: Attempting to queue an ABORT message

CDB: 0x3b 0xa 0x0 0x0 0x0 0x0 0x0 0x1 0x4f 0x0

scsi2: At time of recovery, card was not paused

>>>>>>>>>>>>>>>>>> Dump Card State Begins <<<<<<<<<<<<<<<<<

scsi2: Dumping Card State in Data-out phase, at SEQADDR 0x9f

...

aic7xxx_abort returns 0x2003

scsi 2:0:0:0: Attempting to queue a TARGET RESET message

CDB: 0x3b 0xa 0x0 0x0 0x0 0x0 0x0 0x1 0x4f 0x0

aic7xxx_dev_reset returns 0x2003

...

scsi 2:0:0:0: Attempting to queue an ABORT message

CDB: 0x0 0x0 0x0 0x0 0x0 0x0

scsi2: At time of recovery, card was not paused

>>>>>>>>>>>>>>>>>> Dump Card State Begins <<<<<<<<<<<<<<<<<

scsi2: Dumping Card State while idle, at SEQADDR 0x16c

...

<<<<<<<<<<<<<<<<< Dump Card State Ends >>>>>>>>>>>>>>>>>>

scsi 2:0:0:0: Unable to deliver message

aic7xxx_abort returns 0x2003

scsi 2:0:0:0: Attempting to queue a TARGET RESET message

CDB: 0x0 0x0 0x0 0x0 0x0 0x0

scsi2: At time of recovery, card was not paused

...

<<<<<<<<<<<<<<<<< Dump Card State Ends >>>>>>>>>>>>>>>>>>

scsi 2:0:0:0: Unable to deliver message

aic7xxx_dev_reset returns 0x2003

scsi 2:0:0:0: Device offlined - not ready after error recovery

scsi 2:0:0:0: Write Buffer failure 70000

scsi target2:0:0: Domain Validation detected failure, dropping back

scsi 2:0:0:0: Write Buffer failure 10000

scsi target2:0:0: Domain Validation detected failure, dropping back

...

scsi 2:0:0:0: Write Buffer failure 10000

scsi target2:0:0: Domain Validation Failure, dropping back to Asynchronous

scsi target2:0:0: Ending Domain Validation

scsi 2:0:2:0: Direct-Access     QUANTUM  ATLAS V  9 WLS   0201 PQ: 0 ANSI: 3

scsi2:A:2:0: Tagged Queuing enabled.  Depth 32

scsi target2:0:2: Beginning Domain Validation

scsi target2:0:2: wide asynchronous

scsi target2:0:2: FAST-80 WIDE SCSI 160.0 MB/s DT (12.5 ns, offset 63)

scsi target2:0:2: Ending Domain Validation

scsi 2:0:4:0: Direct-Access     QUANTUM  ATLAS V  9 WLS   0201 PQ: 0 ANSI: 3

scsi2:A:4:0: Tagged Queuing enabled.  Depth 32

scsi target2:0:4: Beginning Domain Validation

scsi target2:0:4: wide asynchronous

scsi target2:0:4: FAST-80 WIDE SCSI 160.0 MB/s DT (12.5 ns, offset 63)

...

sd 2:0:2:0: [sdb] 17783249 512-byte logical blocks: (9.10 GB/8.47 GiB)

sd 2:0:4:0: [sdc] 17783249 512-byte logical blocks: (9.10 GB/8.47 GiB)

sd 2:0:0:0: [sda] READ CAPACITY failed

sd 2:0:0:0: [sda]  Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK

sd 2:0:0:0: [sda] Sense not available.

sd 2:0:4:0: [sdc] Write Protect is off

sd 2:0:4:0: [sdc] Mode Sense: e3 00 10 08

sd 2:0:2:0: [sdb] Write Protect is off

sd 2:0:2:0: [sdb] Mode Sense: e3 00 10 08

sd 2:0:0:0: [sda] Write Protect is off

sd 2:0:0:0: [sda] Mode Sense: 00 00 00 00

sd 2:0:0:0: [sda] Asking for cache data failed

sd 2:0:0:0: [sda] Assuming drive cache: write through

sd 2:0:4:0: [sdc] Write cache: disabled, read cache: enabled, supports DPO and FUA

sd 2:0:2:0: [sdb] Write cache: disabled, read cache: enabled, supports DPO and FUA

sd 2:0:0:0: [sda] READ CAPACITY failed

sd 2:0:0:0: [sda]  Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK

sd 2:0:0:0: [sda] Sense not available.

sd 2:0:0:0: [sda] Asking for cache data failed

sd 2:0:0:0: [sda] Assuming drive cache: write through

sd 2:0:0:0: [sda] Attached SCSI disk

 sdc: sdc1

 sdb: sdb1

sd 2:0:4:0: [sdc] Attached SCSI disk

sd 2:0:2:0: [sdb] Attached SCSI disk
```

ACPI using IRQ 10 seems somehow relevant, cause that's what is assigned to scsi card by bios, I believe.

other than that, no revelations; I did try passing acpi=off to kernel.

----------

## wcg

The CONFIG_SCSI_79XX driver works for me with embedded 7899P controllers.

```

CONFIG_SCSI_79XX=y

CONFIG_79XX_CMDS_PER_DEVICE=32

CONFIG_79XX_RESET_DELAY_MS=5000

```

(Do what you want with the 79xx debug options, the device driver works

with and without them.)

The 79xx options are right below the AIC7XXX stuff in SCSI Transports.

AIC7XXX is also enabled in the same kernels, but I do not remember

if the 79XX driver depends on the AIC7XXX driver or if it was

a belt-and-suspenders configuration when I did not know which

driver would work. All drive controller options are built-in.

----------

## John R. Graham

Just for comparison,

```
[   14.396062] scsi7 : Adaptec AIC7XXX EISA/VLB/PCI SCSI HBA DRIVER, Rev 7.0

[   14.396065]         <Adaptec 2940 Ultra SCSI adapter>

[   14.396067]         aic7880: Ultra Wide Channel A, SCSI Id=7, 16/253 SCBs

[   14.396068] 

[   15.972714] scsi 7:0:6:0: Sequential-Access QUANTUM  SDLT320          5D5D PQ: 0 ANSI: 2

[   15.972722] scsi target7:0:6: Beginning Domain Validation

[   15.974859] scsi target7:0:6: wide asynchronous

[   15.976362] scsi target7:0:6: FAST-10 WIDE SCSI 20.0 MB/s ST (100 ns, offset 8)

[   15.977380] scsi target7:0:6: Domain Validation skipping write tests

[   15.977382] scsi target7:0:6: Ending Domain Validation
```

- John

----------

## eccerr0r

BTW, initrd is loaded by BIOS so it makes sense why this loads fine and the kernel can't make heads or tails off the disk connected to it.  Still some sort of driver issue...

You should be able to swipe the .config from the rescue CD or installer cd and start with that, since the installer CDs seem to boot the HBA correctly?

```
[    1.263908] ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 11

[    1.264877] PCI: setting IRQ 11 as level-triggered

[    1.264906] aic7xxx 0000:00:14.0: PCI INT A -> Link[LNKA] -> GSI 11 (level, low) -> IRQ 11

[    6.476086] scsi0 : Adaptec AIC7XXX EISA/VLB/PCI SCSI HBA DRIVER, Rev 7.0

[    6.476095]         <Adaptec 29160N Ultra160 SCSI adapter>

[    6.476102]         aic7892: Ultra160 Wide Channel A, SCSI Id=7, 32/253 SCBs

[    6.476110] 

[    6.480430] scsi 0:0:0:0: Direct-Access     SEAGATE  ST336704LC       HP00 PQ: 0 ANSI: 3

[    6.480635] scsi0:A:0:0: Tagged Queuing enabled.  Depth 32

[    6.480812] scsi target0:0:0: Beginning Domain Validation

[    6.485708] scsi target0:0:0: wide asynchronous

[    6.489506] scsi target0:0:0: FAST-80 WIDE SCSI 160.0 MB/s DT (12.5 ns, offset 63)

[    6.497174] scsi target0:0:0: Ending Domain Validation

[   10.091864] NCR53c406a: no available ports found

[   10.094182] sd 0:0:0:0: [sda] 71132960 512-byte logical blocks: (36.4 GB/33.9 GiB)

[   10.095567] pata_via 0000:00:07.1: version 0.3.4

[   10.096207] sd 0:0:0:0: [sda] Write Protect is off

[   10.096336] sd 0:0:0:0: [sda] Mode Sense: 9f 00 10 08

[   10.098085] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supplines 318-336

```

----------

## akm76

Well, livecd doesn't need to boot from sda, so it might bring it up late, whatnot.

I do use the running from livecd  /proc/.config as a start.

Unmodified it doesn't run either.

The thing that differs as far as I can tell, your dmesg has this:

```

[    1.264906] aic7xxx 0000:00:14.0: PCI INT A -> Link[LNKA] -> GSI 11 (level, low) -> IRQ 11 

```

while mine doesn't. I wonder if that's important.

----------

## John R. Graham

Although this probably isn't it, can you try adding "noapic" to your kernel parameters in grub.conf?

- John

----------

## akm76

It works!

Thanks guys!

I've no single cause to blame, just kept trimming kernel config until it booted.

----------

