# kernel source with adp94xx module

## karlson

Hey,

i'm having problems with my AIC-9410 SAS controller. I used live cd with adp94xx module to install gentoo, and tried to insert this module into my kernel sources, unfortunately, i can't compile it. I get all sorts of errors. So can anyone please share the kernel sources with adp94xx module inserted and compiling correctly ? 

Thanks.

----------

## didymos

How can we know what's wrong if you don't post any errors or tell us exactly what you have and have not done so far?

----------

## karlson

Thought i would save all of our time. Ok then .. 

I have installed gentoo from LiveCd for Adaptec. When booting got kernel panic that root can't mount on unknown block. So .. googled, and found that module that comes with kernel has something wrong with firmware so SAS drives (which I use) aren't recognized. So I downloaded adp94xx source from http://download.adaptec.com/sas/linux/adp94xx-1.0.8-6.src.tgz and folowing this little instructions 

```

cd <driver source directory>

mv Makefile Makefile.2_4

mv Makefile.2_6 Makefile

make -C /usr/src/linux M=`pwd`

The driver will be "adp94xx.ko".

To insert it into the kernel, do:

insmod adp94xx.ko

```

but when i try to make this module I get a lot of errors and warnings. 

```

livecd adp94xx # make -C /usr/src/linux M=`pwd`

make: Entering directory `/usr/src/linux-2.6.21-gentoo-r3'

  CC [M]  /home/drivers/adp94xx/adp94xx_osm.o

/home/drivers/adp94xx/adp94xx_osm.c:46:5: warning: "KDB_ENABLE" is not defined

In file included from /home/drivers/adp94xx/adp94xx_osm.c:49:

/home/drivers/adp94xx/adp94xx_osm.h:59:26: error: linux/config.h: No such file or directory

/home/drivers/adp94xx/adp94xx_osm.h:86:1: warning: "__packed" redefined

In file included from include/linux/compiler-gcc4.h:4,

                 from include/linux/compiler.h:42,

                 from include/asm/byteorder.h:5,

                 from /home/drivers/adp94xx/adp94xx_osm.h:48,

                 from /home/drivers/adp94xx/adp94xx_osm.c:49:

include/linux/compiler-gcc.h:30:1: warning: this is the location of the previous definition

In file included from /home/drivers/adp94xx/adp94xx_osm.c:49:

/home/drivers/adp94xx/adp94xx_osm.h:597: error: expected specifier-qualifier-list before 'Scsi_Device'

In file included from /home/drivers/adp94xx/adp94xx_osm.c:53:

/home/drivers/adp94xx/adp94xx_inline.h: In function 'asd_next_device_to_run':

/home/drivers/adp94xx/adp94xx_inline.h:773: error: 'struct asd_device' has no member named 'target'

In file included from /home/drivers/adp94xx/adp94xx_osm.c:53:

/home/drivers/adp94xx/adp94xx_inline.h:865:43: error: macro "INIT_WORK" passed 3 arguments, but takes just 2

/home/drivers/adp94xx/adp94xx_inline.h: In function 'asd_setup_dev_dpc_task':

/home/drivers/adp94xx/adp94xx_inline.h:865: error: 'INIT_WORK' undeclared (first use in this function)

/home/drivers/adp94xx/adp94xx_inline.h:865: error: (Each undeclared identifier is reported only once

/home/drivers/adp94xx/adp94xx_inline.h:865: error: for each function it appears in.)

/home/drivers/adp94xx/adp94xx_osm.c: At top level:

/home/drivers/adp94xx/adp94xx_osm.c:59: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'asd_sht'

/home/drivers/adp94xx/adp94xx_osm.c:89: error: expected ')' before string constant

/home/drivers/adp94xx/adp94xx_osm.c:126: error: expected ')' before '*' token

/home/drivers/adp94xx/adp94xx_osm.c:135: error: expected ')' before '*' token

/home/drivers/adp94xx/adp94xx_osm.c:136: error: expected ')' before '*' token

/home/drivers/adp94xx/adp94xx_osm.c:137: error: expected ')' before '*' token

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_check_device_queue':

/home/drivers/adp94xx/adp94xx_osm.c:429: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:432: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:705:5: warning: "KDB_ENABLE" is not defined

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_init':

/home/drivers/adp94xx/adp94xx_osm.c:709: warning: implicit declaration of function 'asd_detect'

/home/drivers/adp94xx/adp94xx_osm.c:709: error: 'asd_sht' undeclared (first use in this function)

/home/drivers/adp94xx/adp94xx_osm.c: At top level:

/home/drivers/adp94xx/adp94xx_osm.c:956: error: expected ')' before '*' token

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_register_host':

/home/drivers/adp94xx/adp94xx_osm.c:1083: error: 'asd_sht' undeclared (first use in this function)

/home/drivers/adp94xx/adp94xx_osm.c:1109: warning: implicit declaration of function 'scsi_assign_lock'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_alloc_device':

/home/drivers/adp94xx/adp94xx_osm.c:1208: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_free_device':

/home/drivers/adp94xx/adp94xx_osm.c:1245: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_flush_device_queue':

/home/drivers/adp94xx/adp94xx_osm.c:1360: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:1373: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:1398: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:1408: error: 'struct scsi_cmnd' has no member named 'sc_magic'

/home/drivers/adp94xx/adp94xx_osm.c:1423: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:1432: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:1496: error: 'struct scsi_cmnd' has no member named 'sc_magic'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_dev_timed_unfreeze':

/home/drivers/adp94xx/adp94xx_osm.c:1574: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:1586: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_timed_run_dev_queue':

/home/drivers/adp94xx/adp94xx_osm.c:1605: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:1611: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:1612: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_scb_done':

/home/drivers/adp94xx/adp94xx_osm.c:1774: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_handle_sas_status':

/home/drivers/adp94xx/adp94xx_osm.c:2041: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:2041: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_build_sas_scb':

/home/drivers/adp94xx/adp94xx_osm.c:2195: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_discovery_thread':

/home/drivers/adp94xx/adp94xx_osm.c:2285: error: 'PF_FREEZE' undeclared (first use in this function)

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_dev_intl_times_out':

/home/drivers/adp94xx/adp94xx_osm.c:2724: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_clear_device_io':

/home/drivers/adp94xx/adp94xx_osm.c:2769: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_destroy_device':

/home/drivers/adp94xx/adp94xx_osm.c:2804: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:2833: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:2851: error: 'struct asd_device' has no member named 'scsi_device'

/home/drivers/adp94xx/adp94xx_osm.c:2859: error: 'struct asd_device' has no member named 'scsi_device'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_get_os_platform_map_from_sasaddr':

/home/drivers/adp94xx/adp94xx_osm.c:3153: error: 'Scsi_Device' undeclared (first use in this function)

/home/drivers/adp94xx/adp94xx_osm.c:3153: error: 'scsi_device' undeclared (first use in this function)

/home/drivers/adp94xx/adp94xx_osm.c:3154: warning: ISO C90 forbids mixed declarations and code

/home/drivers/adp94xx/adp94xx_osm.c:3170: error: 'struct asd_device' has no member named 'scsi_device'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_get_sas_addr_from_platform_map':

/home/drivers/adp94xx/adp94xx_osm.c:3206: warning: comparison is always false due to limited range of data type

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_init_hw':

/home/drivers/adp94xx/adp94xx_osm.c:4513: warning: passing argument 2 of 'request_irq' from incompatible pointer type

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_queue':

/home/drivers/adp94xx/adp94xx_osm.c:4882: error: 'struct asd_device' has no member named 'scsi_device'

/home/drivers/adp94xx/adp94xx_osm.c:4890: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c: At top level:

/home/drivers/adp94xx/adp94xx_osm.c:5014: error: expected ')' before '*' token

/home/drivers/adp94xx/adp94xx_osm.c:5026: error: expected ')' before '*' token

/home/drivers/adp94xx/adp94xx_osm.c:5055: error: expected ')' before '*' token

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_get_user_tagdepth':

/home/drivers/adp94xx/adp94xx_osm.c:5135: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:5136: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_set_device_queue_depth':

/home/drivers/adp94xx/adp94xx_osm.c:5159: error: 'struct asd_device' has no member named 'scsi_device'

/home/drivers/adp94xx/adp94xx_osm.c:5160: error: 'struct asd_device' has no member named 'scsi_device'

/home/drivers/adp94xx/adp94xx_osm.c:5163: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c:5163: error: 'struct asd_device' has no member named 'target'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_set_tags':

/home/drivers/adp94xx/adp94xx_osm.c:5229: error: 'struct asd_device' has no member named 'scsi_device'

/home/drivers/adp94xx/adp94xx_osm.c:5232: error: 'struct asd_device' has no member named 'scsi_device'

/home/drivers/adp94xx/adp94xx_osm.c:5237: error: 'struct asd_device' has no member named 'scsi_device'

/home/drivers/adp94xx/adp94xx_osm.c:5248: error: 'struct asd_device' has no member named 'scsi_device'

/home/drivers/adp94xx/adp94xx_osm.c: In function 'asd_ehandler_thread':

/home/drivers/adp94xx/adp94xx_osm.c:5309: error: 'PF_FREEZE' undeclared (first use in this function)

/home/drivers/adp94xx/adp94xx_osm.c: At top level:

/home/drivers/adp94xx/adp94xx_osm.c:6162: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'asd_sht'

make[1]: *** [/home/drivers/adp94xx/adp94xx_osm.o] Error 1

make: *** [_module_/home/drivers/adp94xx] Error 2

make: Leaving directory `/usr/src/linux-2.6.21-gentoo-r3'

```

So i thought that someone might be using this Adaptec SAS controller (AIC-9410W) and has sucessfully compiled this driver into the kernel and can share sources with me. Or if u have a better solution I will hear it out.. 

Thanks in advance

----------

## didymos

Umm, this might help.  It's in linux-2.6.21-gentoo-r3:

 *Quote:*   

> 
> 
>  CONFIG_SCSI_AIC94XX:
> 
>    This driver supports Adaptec's SAS/SATA 3Gb/s 64 bit PCI-X
> ...

 

Or does that driver not work?

----------

## karlson

Well, that's the problem that it does work it finds the device and tries to detect the raid settings (as i imagine) but the errors about firmware or smthn. And that's it .. the device is recognized but drives are not. That happens with all livecd, but there is one livecd custom made with different module (adp94xx) and it works. Unfortunately when i try to build it into my kernel i get the following errors.

----------

## karlson

Ok guys, as much as I try i can't compile adp94xx into 2.6.21 kernel... getting compile errors ... 

maybe there is anyone who can share his kernel tree if it contains adp94xx module support?!

----------

## didymos

Well, it's not the kernel, or at least not the way you think.  The problem is the driver doesn't know jack about newer kernels, so it uses outdated macro forms, no-longer existing variables, undefined constants, etc.

----------

## karlson

Hmm, so i should try using older kernel ?

----------

## didymos

It's either that or update the source so it works with the kernel you want.

----------

## karlson

Ok i'll try to use older kernel first...  :Smile: 

----------

## karlson

Well, came back from my vacation and finally got it working. Using Genkernel and modified initramfs .. found the instructions here:

http://gentoo-wiki.com/HARDWARE_Adaptec_aic94xx_with_bootable_software_RAID1

The only thing as I use livecd there were a lot of stuff as modules .. so kernel compilation took long time and i've got lot's of stuff i don't need. So upon compiling throw out unneeded modules and than everything was ok .. 

thanks for the help and I hope this will be useful.

----------

