Commit 214fd232 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linuxusb.bkbits.net/linus-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 0907edc2 92bde82b
...@@ -61,11 +61,7 @@ static int own = 0; ...@@ -61,11 +61,7 @@ static int own = 0;
static int i2c_debug=0; static int i2c_debug=0;
static struct iic_ite gpi; static struct iic_ite gpi;
#if (LINUX_VERSION_CODE < 0x020301)
static struct wait_queue *iic_wait = NULL;
#else
static wait_queue_head_t iic_wait; static wait_queue_head_t iic_wait;
#endif
static int iic_pending; static int iic_pending;
/* ----- global defines ----------------------------------------------- */ /* ----- global defines ----------------------------------------------- */
...@@ -236,9 +232,7 @@ static int __init iic_ite_init(void) ...@@ -236,9 +232,7 @@ static int __init iic_ite_init(void)
piic->iic_own = own; piic->iic_own = own;
iic_ite_data.data = (void *)piic; iic_ite_data.data = (void *)piic;
#if (LINUX_VERSION_CODE >= 0x020301)
init_waitqueue_head(&iic_wait); init_waitqueue_head(&iic_wait);
#endif
if (iic_hw_resrc_init() == 0) { if (iic_hw_resrc_init() == 0) {
if (i2c_iic_add_bus(&iic_ite_ops) < 0) if (i2c_iic_add_bus(&iic_ite_ops) < 0)
return -ENODEV; return -ENODEV;
......
...@@ -228,41 +228,25 @@ static void i2c_parport_detach (struct parport *port) ...@@ -228,41 +228,25 @@ static void i2c_parport_detach (struct parport *port)
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,4)
static struct parport_driver i2c_driver = { static struct parport_driver i2c_driver = {
"i2c-philips-par", "i2c-philips-par",
i2c_parport_attach, i2c_parport_attach,
i2c_parport_detach, i2c_parport_detach,
NULL NULL
}; };
#endif
int __init i2c_bitlp_init(void) int __init i2c_bitlp_init(void)
{ {
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,4)
struct parport *port;
#endif
printk(KERN_INFO "i2c-philips-par.o: i2c Philips parallel port adapter module version %s (%s)\n", I2C_VERSION, I2C_DATE); printk(KERN_INFO "i2c-philips-par.o: i2c Philips parallel port adapter module version %s (%s)\n", I2C_VERSION, I2C_DATE);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,4)
parport_register_driver(&i2c_driver); parport_register_driver(&i2c_driver);
#else
for (port = parport_enumerate(); port; port=port->next)
i2c_parport_attach(port);
#endif
return 0; return 0;
} }
void __exit i2c_bitlp_exit(void) void __exit i2c_bitlp_exit(void)
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,4)
parport_unregister_driver(&i2c_driver); parport_unregister_driver(&i2c_driver);
#else
struct parport *port;
for (port = parport_enumerate(); port; port=port->next)
i2c_parport_detach(port);
#endif
} }
MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
This driver puts entries in /proc/sys/dev/sensors for each I2C device This driver puts entries in /proc/sys/dev/sensors for each I2C device
*/ */
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -31,14 +30,10 @@ ...@@ -31,14 +30,10 @@
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <asm/uaccess.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-proc.h> #include <linux/i2c-proc.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/uaccess.h>
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
static int i2c_create_name(char **name, const char *prefix, static int i2c_create_name(char **name, const char *prefix,
struct i2c_adapter *adapter, int addr); struct i2c_adapter *adapter, int addr);
...@@ -56,7 +51,6 @@ static int i2c_sysctl_chips(ctl_table * table, int *name, int nlen, ...@@ -56,7 +51,6 @@ static int i2c_sysctl_chips(ctl_table * table, int *name, int nlen,
#define SENSORS_ENTRY_MAX 20 #define SENSORS_ENTRY_MAX 20
static struct ctl_table_header *i2c_entries[SENSORS_ENTRY_MAX]; static struct ctl_table_header *i2c_entries[SENSORS_ENTRY_MAX];
static unsigned short i2c_inodes[SENSORS_ENTRY_MAX];
static struct i2c_client *i2c_clients[SENSORS_ENTRY_MAX]; static struct i2c_client *i2c_clients[SENSORS_ENTRY_MAX];
...@@ -197,8 +191,6 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix, ...@@ -197,8 +191,6 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
return id; return id;
} }
#endif /* DEBUG */ #endif /* DEBUG */
i2c_inodes[id - 256] =
new_header->ctl_table->child->child->de->low_ino;
new_header->ctl_table->child->child->de->owner = controlling_mod; new_header->ctl_table->child->child->de->owner = controlling_mod;
return id; return id;
......
...@@ -58,6 +58,7 @@ obj-$(CONFIG_SCSI_AHA152X) += aha152x.o ...@@ -58,6 +58,7 @@ obj-$(CONFIG_SCSI_AHA152X) += aha152x.o
obj-$(CONFIG_SCSI_AHA1542) += aha1542.o obj-$(CONFIG_SCSI_AHA1542) += aha1542.o
obj-$(CONFIG_SCSI_AHA1740) += aha1740.o obj-$(CONFIG_SCSI_AHA1740) += aha1740.o
obj-$(CONFIG_SCSI_AIC7XXX) += aic7xxx/ obj-$(CONFIG_SCSI_AIC7XXX) += aic7xxx/
obj-$(CONFIG_SCSI_AIC79XX) += aic7xxx/
obj-$(CONFIG_SCSI_AACRAID) += aacraid/ obj-$(CONFIG_SCSI_AACRAID) += aacraid/
obj-$(CONFIG_SCSI_AIC7XXX_OLD) += aic7xxx_old.o obj-$(CONFIG_SCSI_AIC7XXX_OLD) += aic7xxx_old.o
obj-$(CONFIG_SCSI_IPS) += ips.o obj-$(CONFIG_SCSI_IPS) += ips.o
......
# #
# AIC79XX 2.5.X Kernel configuration File. # AIC79XX 2.5.X Kernel configuration File.
# $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic79xx#2 $ # $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic79xx#3 $
# #
config SCSI_AIC79XX config SCSI_AIC79XX
tristate "Adaptec AIC79xx U320 support" tristate "Adaptec AIC79xx U320 support"
...@@ -87,7 +87,7 @@ config AIC79XX_DEBUG_MASK ...@@ -87,7 +87,7 @@ config AIC79XX_DEBUG_MASK
config AIC79XX_REG_PRETTY_PRINT config AIC79XX_REG_PRETTY_PRINT
bool "Decode registers during diagnostics" bool "Decode registers during diagnostics"
depends on SCSI_AIC79XX && SCSI_AIC7XXX_BUILD_FIRMWARE depends on SCSI_AIC79XX
default y default y
help help
Compile in register value tables for the output of expanded register Compile in register value tables for the output of expanded register
......
# #
# AIC7XXX and AIC79XX 2.5.X Kernel configuration File. # AIC7XXX and AIC79XX 2.5.X Kernel configuration File.
# $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic7xxx#4 $ # $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic7xxx#5 $
# #
config SCSI_AIC7XXX config SCSI_AIC7XXX
tristate "Adaptec AIC7xxx Fast -> U160 support (New Driver)" tristate "Adaptec AIC7xxx Fast -> U160 support (New Driver)"
...@@ -92,7 +92,7 @@ config AIC7XXX_DEBUG_MASK ...@@ -92,7 +92,7 @@ config AIC7XXX_DEBUG_MASK
config AIC7XXX_REG_PRETTY_PRINT config AIC7XXX_REG_PRETTY_PRINT
bool "Decode registers during diagnostics" bool "Decode registers during diagnostics"
depends on SCSI_AIC7XXX && SCSI_AIC7XXX_BUILD_FIRMWARE depends on SCSI_AIC7XXX
default y default y
help help
Compile in register value tables for the output of expanded register Compile in register value tables for the output of expanded register
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7770_osm.c#11 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7770_osm.c#12 $
*/ */
#include "aic7xxx_osm.h" #include "aic7xxx_osm.h"
...@@ -61,8 +61,14 @@ aic7770_linux_probe(Scsi_Host_Template *template) ...@@ -61,8 +61,14 @@ aic7770_linux_probe(Scsi_Host_Template *template)
uint32_t eisa_id; uint32_t eisa_id;
size_t id_size; size_t id_size;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
if (check_region(eisaBase, AHC_EISA_IOSIZE) != 0) if (check_region(eisaBase, AHC_EISA_IOSIZE) != 0)
continue; continue;
request_region(eisaBase, AHC_EISA_IOSIZE, "aic7xxx");
#else
if (request_region(eisaBase, AHC_EISA_IOSIZE, "aic7xxx") != 0)
continue;
#endif
eisa_id = 0; eisa_id = 0;
id_size = sizeof(eisa_id); id_size = sizeof(eisa_id);
...@@ -72,6 +78,7 @@ aic7770_linux_probe(Scsi_Host_Template *template) ...@@ -72,6 +78,7 @@ aic7770_linux_probe(Scsi_Host_Template *template)
eisa_id |= inb(eisaBase + IDOFFSET + i) eisa_id |= inb(eisaBase + IDOFFSET + i)
<< ((id_size-i-1) * 8); << ((id_size-i-1) * 8);
} }
release_region(eisaBase, AHC_EISA_IOSIZE);
if (eisa_id & 0x80000000) if (eisa_id & 0x80000000)
continue; /* no EISA card in slot */ continue; /* no EISA card in slot */
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#147 $ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#148 $
* *
* $FreeBSD$ * $FreeBSD$
*/ */
...@@ -3416,8 +3416,10 @@ ahd_handle_message_phase(struct ahd_softc *ahd) ...@@ -3416,8 +3416,10 @@ ahd_handle_message_phase(struct ahd_softc *ahd)
*/ */
if (ahd->msgout_len != 0) { if (ahd->msgout_len != 0) {
#ifdef AHD_DEBUG #ifdef AHD_DEBUG
if ((ahd_debug & AHD_SHOW_MESSAGES) != 0) if ((ahd_debug & AHD_SHOW_MESSAGES) != 0) {
ahd_print_devinfo(ahd, &devinfo);
printf("Asserting ATN for response\n"); printf("Asserting ATN for response\n");
}
#endif #endif
ahd_assert_atn(ahd); ahd_assert_atn(ahd);
} }
...@@ -7521,8 +7523,7 @@ ahd_stat_timer(void *arg) ...@@ -7521,8 +7523,7 @@ ahd_stat_timer(void *arg)
"now %sabled. Cmds %d\n", "now %sabled. Cmds %d\n",
ahd_name(ahd), ahd_name(ahd),
(enint_coal & ENINT_COALESS) ? "en" : "dis", (enint_coal & ENINT_COALESS) ? "en" : "dis",
ahd->cmdcmplt_total, ahd->cmdcmplt_total);
ahd->cmdcmplt_counts[ahd->cmdcmplt_bucket]);
#endif #endif
} }
......
/* /*
* Adaptec AIC79xx device driver for Linux. * Adaptec AIC79xx device driver for Linux.
* *
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.c#100 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.c#103 $
* *
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Copyright (c) 1994-2000 Justin T. Gibbs. * Copyright (c) 1994-2000 Justin T. Gibbs.
...@@ -1339,7 +1339,7 @@ Scsi_Host_Template aic79xx_driver_template = { ...@@ -1339,7 +1339,7 @@ Scsi_Host_Template aic79xx_driver_template = {
*/ */
.max_sectors = 8192, .max_sectors = 8192,
#endif #endif
#if defined CONFIG_HIGHIO #if defined CONFIG_HIGHIO || LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
/* Assume RedHat Distribution with its different HIGHIO conventions. */ /* Assume RedHat Distribution with its different HIGHIO conventions. */
.can_dma_32 = 1, .can_dma_32 = 1,
...@@ -2486,8 +2486,25 @@ ahd_linux_dv_thread(void *data) ...@@ -2486,8 +2486,25 @@ ahd_linux_dv_thread(void *data)
printf("In DV Thread\n"); printf("In DV Thread\n");
#endif #endif
/*
* Don't care about any signals.
*/
siginitsetinv(&current->blocked, 0);
/*
* Complete thread creation.
*/
lock_kernel();
daemonize();
sprintf(current->comm, "ahd_dv_%d", ahd->unit);
unlock_kernel();
while (1) { while (1) {
down(&ahd->platform_data->dv_sem); /*
* Use down_interruptible() rather than down() to
* avoid inclusion in the load average.
*/
down_interruptible(&ahd->platform_data->dv_sem);
/* Check to see if we've been signaled to exit */ /* Check to see if we've been signaled to exit */
ahd_lock(ahd, &s); ahd_lock(ahd, &s);
...@@ -2510,7 +2527,7 @@ ahd_linux_dv_thread(void *data) ...@@ -2510,7 +2527,7 @@ ahd_linux_dv_thread(void *data)
while (LIST_FIRST(&ahd->pending_scbs) != NULL) { while (LIST_FIRST(&ahd->pending_scbs) != NULL) {
ahd->platform_data->flags |= AHD_DV_WAIT_SIMQ_EMPTY; ahd->platform_data->flags |= AHD_DV_WAIT_SIMQ_EMPTY;
ahd_unlock(ahd, &s); ahd_unlock(ahd, &s);
down(&ahd->platform_data->dv_sem); down_interruptible(&ahd->platform_data->dv_sem);
ahd_lock(ahd, &s); ahd_lock(ahd, &s);
} }
...@@ -2521,7 +2538,7 @@ ahd_linux_dv_thread(void *data) ...@@ -2521,7 +2538,7 @@ ahd_linux_dv_thread(void *data)
while (AHD_DV_SIMQ_FROZEN(ahd) == 0) { while (AHD_DV_SIMQ_FROZEN(ahd) == 0) {
ahd->platform_data->flags |= AHD_DV_WAIT_SIMQ_RELEASE; ahd->platform_data->flags |= AHD_DV_WAIT_SIMQ_RELEASE;
ahd_unlock(ahd, &s); ahd_unlock(ahd, &s);
down(&ahd->platform_data->dv_sem); down_interruptible(&ahd->platform_data->dv_sem);
ahd_lock(ahd, &s); ahd_lock(ahd, &s);
} }
ahd_unlock(ahd, &s); ahd_unlock(ahd, &s);
...@@ -2623,6 +2640,7 @@ ahd_linux_dv_target(struct ahd_softc *ahd, u_int target_offset) ...@@ -2623,6 +2640,7 @@ ahd_linux_dv_target(struct ahd_softc *ahd, u_int target_offset)
AHD_TRANS_GOAL, /*paused*/FALSE); AHD_TRANS_GOAL, /*paused*/FALSE);
ahd_unlock(ahd, &s); ahd_unlock(ahd, &s);
timeout = 10 * HZ; timeout = 10 * HZ;
targ->flags &= ~AHD_INQ_VALID;
/* FALLTHROUGH */ /* FALLTHROUGH */
case AHD_DV_STATE_INQ_VERIFY: case AHD_DV_STATE_INQ_VERIFY:
{ {
...@@ -2686,7 +2704,7 @@ ahd_linux_dv_target(struct ahd_softc *ahd, u_int target_offset) ...@@ -2686,7 +2704,7 @@ ahd_linux_dv_target(struct ahd_softc *ahd, u_int target_offset)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
ahd_unlock(ahd, &s); ahd_unlock(ahd, &s);
#endif #endif
down(&ahd->platform_data->dv_cmd_sem); down_interruptible(&ahd->platform_data->dv_cmd_sem);
/* /*
* Wait for the SIMQ to be released so that DV is the * Wait for the SIMQ to be released so that DV is the
* only reason the queue is frozen. * only reason the queue is frozen.
...@@ -2695,7 +2713,7 @@ ahd_linux_dv_target(struct ahd_softc *ahd, u_int target_offset) ...@@ -2695,7 +2713,7 @@ ahd_linux_dv_target(struct ahd_softc *ahd, u_int target_offset)
while (AHD_DV_SIMQ_FROZEN(ahd) == 0) { while (AHD_DV_SIMQ_FROZEN(ahd) == 0) {
ahd->platform_data->flags |= AHD_DV_WAIT_SIMQ_RELEASE; ahd->platform_data->flags |= AHD_DV_WAIT_SIMQ_RELEASE;
ahd_unlock(ahd, &s); ahd_unlock(ahd, &s);
down(&ahd->platform_data->dv_sem); down_interruptible(&ahd->platform_data->dv_sem);
ahd_lock(ahd, &s); ahd_lock(ahd, &s);
} }
ahd_unlock(ahd, &s); ahd_unlock(ahd, &s);
...@@ -2704,6 +2722,25 @@ ahd_linux_dv_target(struct ahd_softc *ahd, u_int target_offset) ...@@ -2704,6 +2722,25 @@ ahd_linux_dv_target(struct ahd_softc *ahd, u_int target_offset)
} }
out: out:
if ((targ->flags & AHD_INQ_VALID) != 0
&& ahd_linux_get_device(ahd, devinfo.channel - 'A',
devinfo.target, devinfo.lun,
/*alloc*/FALSE) == NULL) {
/*
* The DV state machine failed to configure this device.
* This is normal if DV is disabled. Since we have inquiry
* data, filter it and use the "optimistic" negotiation
* parameters found in the inquiry string.
*/
ahd_linux_filter_inquiry(ahd, &devinfo);
if ((targ->flags & (AHD_BASIC_DV|AHD_ENHANCED_DV)) != 0) {
ahd_print_devinfo(ahd, &devinfo);
printf("DV failed to configure device. "
"Please file a bug report against "
"this driver.\n");
}
}
if (cmd != NULL) if (cmd != NULL)
free(cmd, M_DEVBUF); free(cmd, M_DEVBUF);
...@@ -2789,24 +2826,21 @@ ahd_linux_dv_transition(struct ahd_softc *ahd, struct scsi_cmnd *cmd, ...@@ -2789,24 +2826,21 @@ ahd_linux_dv_transition(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
break; break;
} }
if (ahd_linux_user_dv_setting(ahd) == 0) { AHD_SET_DV_STATE(ahd, targ, targ->dv_state+1);
ahd_linux_filter_inquiry(ahd, devinfo); targ->flags |= AHD_INQ_VALID;
AHD_SET_DV_STATE(ahd, targ, AHD_DV_STATE_EXIT); if (ahd_linux_user_dv_setting(ahd) == 0)
break; break;
}
spi3data = targ->inq_data->spi3data; spi3data = targ->inq_data->spi3data;
switch (spi3data & SID_SPI_CLOCK_DT_ST) { switch (spi3data & SID_SPI_CLOCK_DT_ST) {
default: default:
case SID_SPI_CLOCK_ST: case SID_SPI_CLOCK_ST:
/* Assume only basic DV is supported. */ /* Assume only basic DV is supported. */
ahd_linux_filter_inquiry(ahd, devinfo); targ->flags |= AHD_BASIC_DV;
AHD_SET_DV_STATE(ahd, targ,
AHD_DV_STATE_INQ_VERIFY);
break; break;
case SID_SPI_CLOCK_DT: case SID_SPI_CLOCK_DT:
case SID_SPI_CLOCK_DT_ST: case SID_SPI_CLOCK_DT_ST:
AHD_SET_DV_STATE(ahd, targ, AHD_DV_STATE_REBD); targ->flags |= AHD_ENHANCED_DV;
break; break;
} }
break; break;
...@@ -2902,8 +2936,15 @@ ahd_linux_dv_transition(struct ahd_softc *ahd, struct scsi_cmnd *cmd, ...@@ -2902,8 +2936,15 @@ ahd_linux_dv_transition(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
case AHD_DV_STATE_TUR: case AHD_DV_STATE_TUR:
switch (status & SS_MASK) { switch (status & SS_MASK) {
case SS_NOP: case SS_NOP:
if ((targ->flags & AHD_BASIC_DV) != 0) {
ahd_linux_filter_inquiry(ahd, devinfo);
AHD_SET_DV_STATE(ahd, targ, AHD_SET_DV_STATE(ahd, targ,
AHD_DV_STATE_INQ_ASYNC); AHD_DV_STATE_INQ_VERIFY);
} else if ((targ->flags & AHD_ENHANCED_DV) != 0) {
AHD_SET_DV_STATE(ahd, targ, AHD_DV_STATE_REBD);
} else {
AHD_SET_DV_STATE(ahd, targ, AHD_DV_STATE_EXIT);
}
break; break;
case SS_RETRY: case SS_RETRY:
case SS_TUR: case SS_TUR:
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#96 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#99 $
* *
*/ */
#ifndef _AIC79XX_LINUX_H_ #ifndef _AIC79XX_LINUX_H_
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/smp_lock.h>
#include <linux/version.h> #include <linux/version.h>
#ifndef AHD_MODVERSION_FILE #ifndef AHD_MODVERSION_FILE
#define __NO_VERSION__ #define __NO_VERSION__
...@@ -287,7 +288,7 @@ ahd_scb_timer_reset(struct scb *scb, u_int usec) ...@@ -287,7 +288,7 @@ ahd_scb_timer_reset(struct scb *scb, u_int usec)
#include <linux/smp.h> #include <linux/smp.h>
#endif #endif
#define AIC79XX_DRIVER_VERSION "1.3.0.ALPHA5" #define AIC79XX_DRIVER_VERSION "1.3.0.ALPHA6"
/**************************** Front End Queues ********************************/ /**************************** Front End Queues ********************************/
/* /*
...@@ -424,16 +425,19 @@ struct ahd_linux_device { ...@@ -424,16 +425,19 @@ struct ahd_linux_device {
}; };
typedef enum { typedef enum {
AHD_DV_REQUIRED = 0x01 AHD_DV_REQUIRED = 0x01,
AHD_INQ_VALID = 0x02,
AHD_BASIC_DV = 0x04,
AHD_ENHANCED_DV = 0x08
} ahd_linux_targ_flags; } ahd_linux_targ_flags;
/* DV States */ /* DV States */
typedef enum { typedef enum {
AHD_DV_STATE_EXIT = 0, AHD_DV_STATE_EXIT = 0,
AHD_DV_STATE_INQ_SHORT_ASYNC, AHD_DV_STATE_INQ_SHORT_ASYNC,
AHD_DV_STATE_TUR,
AHD_DV_STATE_INQ_ASYNC, AHD_DV_STATE_INQ_ASYNC,
AHD_DV_STATE_INQ_ASYNC_VERIFY, AHD_DV_STATE_INQ_ASYNC_VERIFY,
AHD_DV_STATE_TUR,
AHD_DV_STATE_REBD, AHD_DV_STATE_REBD,
AHD_DV_STATE_INQ_VERIFY, AHD_DV_STATE_INQ_VERIFY,
AHD_DV_STATE_WEB, AHD_DV_STATE_WEB,
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#18 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#19 $
*/ */
#include "aic79xx_osm.h" #include "aic79xx_osm.h"
...@@ -240,10 +240,8 @@ ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, u_long *base, ...@@ -240,10 +240,8 @@ ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, u_long *base,
if (check_region(*base, 256) != 0 if (check_region(*base, 256) != 0
|| check_region(*base2, 256) != 0) || check_region(*base2, 256) != 0)
return (ENOMEM); return (ENOMEM);
else {
request_region(*base, 256, "aic79xx"); request_region(*base, 256, "aic79xx");
request_region(*base2, 256, "aic79xx"); request_region(*base2, 256, "aic79xx");
}
#else #else
if (request_region(*base, 256, "aic79xx") == 0) if (request_region(*base, 256, "aic79xx") == 0)
return (ENOMEM); return (ENOMEM);
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#104 $ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#105 $
* *
* $FreeBSD$ * $FreeBSD$
*/ */
...@@ -2772,9 +2772,12 @@ ahc_handle_message_phase(struct ahc_softc *ahc) ...@@ -2772,9 +2772,12 @@ ahc_handle_message_phase(struct ahc_softc *ahc)
*/ */
if (ahc->msgout_len != 0) { if (ahc->msgout_len != 0) {
#ifdef AHC_DEBUG #ifdef AHC_DEBUG
if ((ahc_debug & AHC_SHOW_MESSAGES) != 0) if ((ahc_debug & AHC_SHOW_MESSAGES) != 0) {
ahc_print_devinfo(ahc, &devinfo);
printf("Asserting ATN for response\n"); printf("Asserting ATN for response\n");
}
#endif #endif
ahc_assert_atn(ahc);
} }
} else } else
ahc->msgin_index++; ahc->msgin_index++;
......
/* /*
* Adaptec AIC7xxx device driver for Linux. * Adaptec AIC7xxx device driver for Linux.
* *
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#163 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#166 $
* *
* Copyright (c) 1994 John Aycock * Copyright (c) 1994 John Aycock
* The University of Calgary Department of Computer Science. * The University of Calgary Department of Computer Science.
...@@ -2336,8 +2336,25 @@ ahc_linux_dv_thread(void *data) ...@@ -2336,8 +2336,25 @@ ahc_linux_dv_thread(void *data)
printf("Launching DV Thread\n"); printf("Launching DV Thread\n");
#endif #endif
/*
* Don't care about any signals.
*/
siginitsetinv(&current->blocked, 0);
/*
* Complete thread creation.
*/
lock_kernel();
daemonize();
sprintf(current->comm, "ahc_dv_%d", ahc->unit);
unlock_kernel();
while (1) { while (1) {
down(&ahc->platform_data->dv_sem); /*
* Use down_interruptible() rather than down() to
* avoid inclusion in the load average.
*/
down_interruptible(&ahc->platform_data->dv_sem);
/* Check to see if we've been signaled to exit */ /* Check to see if we've been signaled to exit */
ahc_lock(ahc, &s); ahc_lock(ahc, &s);
...@@ -2360,7 +2377,7 @@ ahc_linux_dv_thread(void *data) ...@@ -2360,7 +2377,7 @@ ahc_linux_dv_thread(void *data)
while (LIST_FIRST(&ahc->pending_scbs) != NULL) { while (LIST_FIRST(&ahc->pending_scbs) != NULL) {
ahc->platform_data->flags |= AHC_DV_WAIT_SIMQ_EMPTY; ahc->platform_data->flags |= AHC_DV_WAIT_SIMQ_EMPTY;
ahc_unlock(ahc, &s); ahc_unlock(ahc, &s);
down(&ahc->platform_data->dv_sem); down_interruptible(&ahc->platform_data->dv_sem);
ahc_lock(ahc, &s); ahc_lock(ahc, &s);
} }
...@@ -2371,7 +2388,7 @@ ahc_linux_dv_thread(void *data) ...@@ -2371,7 +2388,7 @@ ahc_linux_dv_thread(void *data)
while (AHC_DV_SIMQ_FROZEN(ahc) == 0) { while (AHC_DV_SIMQ_FROZEN(ahc) == 0) {
ahc->platform_data->flags |= AHC_DV_WAIT_SIMQ_RELEASE; ahc->platform_data->flags |= AHC_DV_WAIT_SIMQ_RELEASE;
ahc_unlock(ahc, &s); ahc_unlock(ahc, &s);
down(&ahc->platform_data->dv_sem); down_interruptible(&ahc->platform_data->dv_sem);
ahc_lock(ahc, &s); ahc_lock(ahc, &s);
} }
ahc_unlock(ahc, &s); ahc_unlock(ahc, &s);
...@@ -2473,6 +2490,7 @@ ahc_linux_dv_target(struct ahc_softc *ahc, u_int target_offset) ...@@ -2473,6 +2490,7 @@ ahc_linux_dv_target(struct ahc_softc *ahc, u_int target_offset)
AHC_TRANS_GOAL, /*paused*/FALSE); AHC_TRANS_GOAL, /*paused*/FALSE);
ahc_unlock(ahc, &s); ahc_unlock(ahc, &s);
timeout = 10 * HZ; timeout = 10 * HZ;
targ->flags &= ~AHC_INQ_VALID;
/* FALLTHROUGH */ /* FALLTHROUGH */
case AHC_DV_STATE_INQ_VERIFY: case AHC_DV_STATE_INQ_VERIFY:
{ {
...@@ -2536,7 +2554,7 @@ ahc_linux_dv_target(struct ahc_softc *ahc, u_int target_offset) ...@@ -2536,7 +2554,7 @@ ahc_linux_dv_target(struct ahc_softc *ahc, u_int target_offset)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
ahc_unlock(ahc, &s); ahc_unlock(ahc, &s);
#endif #endif
down(&ahc->platform_data->dv_cmd_sem); down_interruptible(&ahc->platform_data->dv_cmd_sem);
/* /*
* Wait for the SIMQ to be released so that DV is the * Wait for the SIMQ to be released so that DV is the
* only reason the queue is frozen. * only reason the queue is frozen.
...@@ -2545,7 +2563,7 @@ ahc_linux_dv_target(struct ahc_softc *ahc, u_int target_offset) ...@@ -2545,7 +2563,7 @@ ahc_linux_dv_target(struct ahc_softc *ahc, u_int target_offset)
while (AHC_DV_SIMQ_FROZEN(ahc) == 0) { while (AHC_DV_SIMQ_FROZEN(ahc) == 0) {
ahc->platform_data->flags |= AHC_DV_WAIT_SIMQ_RELEASE; ahc->platform_data->flags |= AHC_DV_WAIT_SIMQ_RELEASE;
ahc_unlock(ahc, &s); ahc_unlock(ahc, &s);
down(&ahc->platform_data->dv_sem); down_interruptible(&ahc->platform_data->dv_sem);
ahc_lock(ahc, &s); ahc_lock(ahc, &s);
} }
ahc_unlock(ahc, &s); ahc_unlock(ahc, &s);
...@@ -2554,6 +2572,25 @@ ahc_linux_dv_target(struct ahc_softc *ahc, u_int target_offset) ...@@ -2554,6 +2572,25 @@ ahc_linux_dv_target(struct ahc_softc *ahc, u_int target_offset)
} }
out: out:
if ((targ->flags & AHC_INQ_VALID) != 0
&& ahc_linux_get_device(ahc, devinfo.channel - 'A',
devinfo.target, devinfo.lun,
/*alloc*/FALSE) == NULL) {
/*
* The DV state machine failed to configure this device.
* This is normal if DV is disabled. Since we have inquiry
* data, filter it and use the "optimistic" negotiation
* parameters found in the inquiry string.
*/
ahc_linux_filter_inquiry(ahc, &devinfo);
if ((targ->flags & (AHC_BASIC_DV|AHC_ENHANCED_DV)) != 0) {
ahc_print_devinfo(ahc, &devinfo);
printf("DV failed to configure device. "
"Please file a bug report against "
"this driver.\n");
}
}
if (cmd != NULL) if (cmd != NULL)
free(cmd, M_DEVBUF); free(cmd, M_DEVBUF);
...@@ -2639,24 +2676,21 @@ ahc_linux_dv_transition(struct ahc_softc *ahc, struct scsi_cmnd *cmd, ...@@ -2639,24 +2676,21 @@ ahc_linux_dv_transition(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
break; break;
} }
if (ahc_linux_user_dv_setting(ahc) == 0) { AHC_SET_DV_STATE(ahc, targ, targ->dv_state+1);
ahc_linux_filter_inquiry(ahc, devinfo); targ->flags |= AHC_INQ_VALID;
AHC_SET_DV_STATE(ahc, targ, AHC_DV_STATE_EXIT); if (ahc_linux_user_dv_setting(ahc) == 0)
break; break;
}
spi3data = targ->inq_data->spi3data; spi3data = targ->inq_data->spi3data;
switch (spi3data & SID_SPI_CLOCK_DT_ST) { switch (spi3data & SID_SPI_CLOCK_DT_ST) {
default: default:
case SID_SPI_CLOCK_ST: case SID_SPI_CLOCK_ST:
/* Assume only basic DV is supported. */ /* Assume only basic DV is supported. */
ahc_linux_filter_inquiry(ahc, devinfo); targ->flags |= AHC_BASIC_DV;
AHC_SET_DV_STATE(ahc, targ,
AHC_DV_STATE_INQ_VERIFY);
break; break;
case SID_SPI_CLOCK_DT: case SID_SPI_CLOCK_DT:
case SID_SPI_CLOCK_DT_ST: case SID_SPI_CLOCK_DT_ST:
AHC_SET_DV_STATE(ahc, targ, AHC_DV_STATE_REBD); targ->flags |= AHC_ENHANCED_DV;
break; break;
} }
break; break;
...@@ -2752,8 +2786,15 @@ ahc_linux_dv_transition(struct ahc_softc *ahc, struct scsi_cmnd *cmd, ...@@ -2752,8 +2786,15 @@ ahc_linux_dv_transition(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
case AHC_DV_STATE_TUR: case AHC_DV_STATE_TUR:
switch (status & SS_MASK) { switch (status & SS_MASK) {
case SS_NOP: case SS_NOP:
if ((targ->flags & AHC_BASIC_DV) != 0) {
ahc_linux_filter_inquiry(ahc, devinfo);
AHC_SET_DV_STATE(ahc, targ, AHC_SET_DV_STATE(ahc, targ,
AHC_DV_STATE_INQ_ASYNC); AHC_DV_STATE_INQ_VERIFY);
} else if ((targ->flags & AHC_ENHANCED_DV) != 0) {
AHC_SET_DV_STATE(ahc, targ, AHC_DV_STATE_REBD);
} else {
AHC_SET_DV_STATE(ahc, targ, AHC_DV_STATE_EXIT);
}
break; break;
case SS_RETRY: case SS_RETRY:
case SS_TUR: case SS_TUR:
...@@ -4373,6 +4414,17 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc, ...@@ -4373,6 +4414,17 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
memset(&cmd->sense_buffer[sense_size], 0, memset(&cmd->sense_buffer[sense_size], 0,
sizeof(cmd->sense_buffer) - sense_size); sizeof(cmd->sense_buffer) - sense_size);
cmd->result |= (DRIVER_SENSE << 24); cmd->result |= (DRIVER_SENSE << 24);
#ifdef AHC_DEBUG
if (ahc_debug & AHC_SHOW_SENSE) {
int i;
printf("Copied %d bytes of sense data:",
sense_size);
for (i = 0; i < sense_size; i++)
printf(" 0x%x", cmd->sense_buffer[i]);
printf("\n");
}
#endif
} }
break; break;
} }
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#111 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#114 $
* *
*/ */
#ifndef _AIC7XXX_LINUX_H_ #ifndef _AIC7XXX_LINUX_H_
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/smp_lock.h>
#include <linux/version.h> #include <linux/version.h>
#ifndef AHC_MODVERSION_FILE #ifndef AHC_MODVERSION_FILE
#define __NO_VERSION__ #define __NO_VERSION__
...@@ -300,7 +301,7 @@ ahc_scb_timer_reset(struct scb *scb, u_int usec) ...@@ -300,7 +301,7 @@ ahc_scb_timer_reset(struct scb *scb, u_int usec)
#include <linux/smp.h> #include <linux/smp.h>
#endif #endif
#define AIC7XXX_DRIVER_VERSION "6.2.24" #define AIC7XXX_DRIVER_VERSION "6.2.25"
/**************************** Front End Queues ********************************/ /**************************** Front End Queues ********************************/
/* /*
...@@ -437,16 +438,19 @@ struct ahc_linux_device { ...@@ -437,16 +438,19 @@ struct ahc_linux_device {
}; };
typedef enum { typedef enum {
AHC_DV_REQUIRED = 0x01 AHC_DV_REQUIRED = 0x01,
AHC_INQ_VALID = 0x02,
AHC_BASIC_DV = 0x04,
AHC_ENHANCED_DV = 0x08
} ahc_linux_targ_flags; } ahc_linux_targ_flags;
/* DV States */ /* DV States */
typedef enum { typedef enum {
AHC_DV_STATE_EXIT = 0, AHC_DV_STATE_EXIT = 0,
AHC_DV_STATE_INQ_SHORT_ASYNC, AHC_DV_STATE_INQ_SHORT_ASYNC,
AHC_DV_STATE_TUR,
AHC_DV_STATE_INQ_ASYNC, AHC_DV_STATE_INQ_ASYNC,
AHC_DV_STATE_INQ_ASYNC_VERIFY, AHC_DV_STATE_INQ_ASYNC_VERIFY,
AHC_DV_STATE_TUR,
AHC_DV_STATE_REBD, AHC_DV_STATE_REBD,
AHC_DV_STATE_INQ_VERIFY, AHC_DV_STATE_INQ_VERIFY,
AHC_DV_STATE_WEB, AHC_DV_STATE_WEB,
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#41 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#42 $
*/ */
#include "aic7xxx_osm.h" #include "aic7xxx_osm.h"
...@@ -232,7 +232,6 @@ ahc_linux_pci_reserve_io_region(struct ahc_softc *ahc, u_long *base) ...@@ -232,7 +232,6 @@ ahc_linux_pci_reserve_io_region(struct ahc_softc *ahc, u_long *base)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
if (check_region(*base, 256) != 0) if (check_region(*base, 256) != 0)
return (ENOMEM); return (ENOMEM);
else
request_region(*base, 256, "aic7xxx"); request_region(*base, 256, "aic7xxx");
#else #else
if (request_region(*base, 256, "aic7xxx") == 0) if (request_region(*base, 256, "aic7xxx") == 0)
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_symbol.c#23 $ * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_symbol.c#24 $
* *
* $FreeBSD$ * $FreeBSD$
*/ */
...@@ -546,7 +546,7 @@ symtable_dump(FILE *ofile, FILE *dfile) ...@@ -546,7 +546,7 @@ symtable_dump(FILE *ofile, FILE *dfile)
if (num_entries == 0) if (num_entries == 0)
aic_print_reg_dump_start(dfile, aic_print_reg_dump_start(dfile,
curnode); curnode);
else else if (dfile != NULL)
fputs(",\n", dfile); fputs(",\n", dfile);
num_entries++; num_entries++;
aic_print_reg_dump_entry(dfile, fieldnode); aic_print_reg_dump_entry(dfile, fieldnode);
......
...@@ -541,12 +541,18 @@ static struct asc_table_entry asc_table[] = { ...@@ -541,12 +541,18 @@ static struct asc_table_entry asc_table[] = {
"Rounded parameter") }, "Rounded parameter") },
/* DTL WRSOMCAE */{SST(0x39, 0x00, SS_RDEF, /* DTL WRSOMCAE */{SST(0x39, 0x00, SS_RDEF,
"Saving parameters not supported") }, "Saving parameters not supported") },
/* DTL WRSOM */{SST(0x3A, 0x00, SS_FATAL|ENXIO, /* DTL WRSOM */{SST(0x3A, 0x00, SS_NOP,
"Medium not present") }, "Medium not present") },
/* DT WR OM */{SST(0x3A, 0x01, SS_FATAL|ENXIO, /* DT WR OM */{SST(0x3A, 0x01, SS_NOP,
"Medium not present - tray closed") }, "Medium not present - tray closed") },
/* DT WR OM */{SST(0x3A, 0x02, SS_FATAL|ENXIO, /* DT WR OM */{SST(0x3A, 0x01, SS_NOP,
"Medium not present - tray open") }, "Medium not present - tray open") },
/* DT WR OM */{SST(0x3A, 0x03, SS_NOP,
"Medium not present - Loadable") },
/* DT WR OM */{SST(0x3A, 0x04, SS_NOP,
"Medium not present - medium auxiliary "
"memory accessible") },
/* DT WR OM */{SST(0x3A, 0xFF, SS_NOP, NULL) },/* Range 0x05->0xFF */
/* TL */{SST(0x3B, 0x00, SS_RDEF, /* TL */{SST(0x3B, 0x00, SS_RDEF,
"Sequential positioning error") }, "Sequential positioning error") },
/* T */{SST(0x3B, 0x01, SS_RDEF, /* T */{SST(0x3B, 0x01, SS_RDEF,
......
...@@ -827,12 +827,16 @@ extern const char *scsi_sense_key_text[]; ...@@ -827,12 +827,16 @@ extern const char *scsi_sense_key_text[];
/************************* Large Disk Handling ********************************/ /************************* Large Disk Handling ********************************/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
static __inline int aic_sector_div(u_long capacity, int heads, int sectors);
static __inline int static __inline int
aic_sector_div(u_long capacity, int heads, int sectors) aic_sector_div(u_long capacity, int heads, int sectors)
{ {
return (capacity / (heads * sectors)); return (capacity / (heads * sectors));
} }
#else #else
static __inline int aic_sector_div(sector_t capacity, int heads, int sectors);
static __inline int static __inline int
aic_sector_div(sector_t capacity, int heads, int sectors) aic_sector_div(sector_t capacity, int heads, int sectors)
{ {
......
...@@ -21,9 +21,8 @@ ...@@ -21,9 +21,8 @@
/* $Id: i2c-dev.h,v 1.11 2002/07/07 15:42:47 mds Exp $ */ /* $Id: i2c-dev.h,v 1.11 2002/07/07 15:42:47 mds Exp $ */
#ifndef I2C_DEV_H #ifndef _LINUX_I2C_DEV_H
#define I2C_DEV_H #define _LINUX_I2C_DEV_H
#include <linux/types.h> #include <linux/types.h>
#include <linux/i2c.h> #include <linux/i2c.h>
...@@ -45,174 +44,4 @@ struct i2c_rdwr_ioctl_data { ...@@ -45,174 +44,4 @@ struct i2c_rdwr_ioctl_data {
int nmsgs; /* number of i2c_msgs */ int nmsgs; /* number of i2c_msgs */
}; };
#ifndef __KERNEL__ #endif /* _LINUX_I2C_DEV_H */
#include <sys/ioctl.h>
static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command,
int size, union i2c_smbus_data *data)
{
struct i2c_smbus_ioctl_data args;
args.read_write = read_write;
args.command = command;
args.size = size;
args.data = data;
return ioctl(file,I2C_SMBUS,&args);
}
static inline __s32 i2c_smbus_write_quick(int file, __u8 value)
{
return i2c_smbus_access(file,value,0,I2C_SMBUS_QUICK,NULL);
}
static inline __s32 i2c_smbus_read_byte(int file)
{
union i2c_smbus_data data;
if (i2c_smbus_access(file,I2C_SMBUS_READ,0,I2C_SMBUS_BYTE,&data))
return -1;
else
return 0x0FF & data.byte;
}
static inline __s32 i2c_smbus_write_byte(int file, __u8 value)
{
return i2c_smbus_access(file,I2C_SMBUS_WRITE,value,
I2C_SMBUS_BYTE,NULL);
}
static inline __s32 i2c_smbus_read_byte_data(int file, __u8 command)
{
union i2c_smbus_data data;
if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
I2C_SMBUS_BYTE_DATA,&data))
return -1;
else
return 0x0FF & data.byte;
}
static inline __s32 i2c_smbus_write_byte_data(int file, __u8 command,
__u8 value)
{
union i2c_smbus_data data;
data.byte = value;
return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
I2C_SMBUS_BYTE_DATA, &data);
}
static inline __s32 i2c_smbus_read_word_data(int file, __u8 command)
{
union i2c_smbus_data data;
if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
I2C_SMBUS_WORD_DATA,&data))
return -1;
else
return 0x0FFFF & data.word;
}
static inline __s32 i2c_smbus_write_word_data(int file, __u8 command,
__u16 value)
{
union i2c_smbus_data data;
data.word = value;
return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
I2C_SMBUS_WORD_DATA, &data);
}
static inline __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value)
{
union i2c_smbus_data data;
data.word = value;
if (i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
I2C_SMBUS_PROC_CALL,&data))
return -1;
else
return 0x0FFFF & data.word;
}
/* Returns the number of read bytes */
static inline __s32 i2c_smbus_read_block_data(int file, __u8 command,
__u8 *values)
{
union i2c_smbus_data data;
int i;
if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
I2C_SMBUS_BLOCK_DATA,&data))
return -1;
else {
for (i = 1; i <= data.block[0]; i++)
values[i-1] = data.block[i];
return data.block[0];
}
}
static inline __s32 i2c_smbus_write_block_data(int file, __u8 command,
__u8 length, __u8 *values)
{
union i2c_smbus_data data;
int i;
if (length > 32)
length = 32;
for (i = 1; i <= length; i++)
data.block[i] = values[i-1];
data.block[0] = length;
return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
I2C_SMBUS_BLOCK_DATA, &data);
}
/* Returns the number of read bytes */
static inline __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command,
__u8 *values)
{
union i2c_smbus_data data;
int i;
if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
I2C_SMBUS_I2C_BLOCK_DATA,&data))
return -1;
else {
for (i = 1; i <= data.block[0]; i++)
values[i-1] = data.block[i];
return data.block[0];
}
}
static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command,
__u8 length, __u8 *values)
{
union i2c_smbus_data data;
int i;
if (length > 32)
length = 32;
for (i = 1; i <= length; i++)
data.block[i] = values[i-1];
data.block[0] = length;
return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
I2C_SMBUS_I2C_BLOCK_DATA, &data);
}
/* Returns the number of read bytes */
static inline __s32 i2c_smbus_block_process_call(int file, __u8 command,
__u8 length, __u8 *values)
{
union i2c_smbus_data data;
int i;
if (length > 32)
length = 32;
for (i = 1; i <= length; i++)
data.block[i] = values[i-1];
data.block[0] = length;
if (i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
I2C_SMBUS_BLOCK_PROC_CALL,&data))
return -1;
else {
for (i = 1; i <= data.block[0]; i++)
values[i-1] = data.block[i];
return data.block[0];
}
}
#endif /* ndef __KERNEL__ */
#endif
...@@ -25,31 +25,17 @@ ...@@ -25,31 +25,17 @@
/* $Id: i2c.h,v 1.59 2002/07/19 20:53:45 phil Exp $ */ /* $Id: i2c.h,v 1.59 2002/07/19 20:53:45 phil Exp $ */
#ifndef I2C_H #ifndef _LINUX_I2C_H
#define I2C_H #define _LINUX_I2C_H
#define I2C_DATE "20020719" #define I2C_DATE "20020719"
#define I2C_VERSION "2.6.4" #define I2C_VERSION "2.6.4"
#include <linux/i2c-id.h> /* id values of adapters et. al. */ #include <linux/i2c-id.h> /* id values of adapters et. al. */
#include <linux/types.h> #include <linux/types.h>
struct i2c_msg;
#ifdef __KERNEL__
/* --- Includes and compatibility declarations ------------------------ */
#include <linux/version.h>
#ifndef KERNEL_VERSION
#define KERNEL_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c))
#endif
#include <asm/page.h> /* for 2.2.xx */
#include <asm/semaphore.h>
#include <linux/config.h> #include <linux/config.h>
#include <asm/semaphore.h>
/* --- General options ------------------------------------------------ */ /* --- General options ------------------------------------------------ */
...@@ -59,6 +45,7 @@ struct i2c_msg; ...@@ -59,6 +45,7 @@ struct i2c_msg;
#define I2C_CLIENT_MAX 32 #define I2C_CLIENT_MAX 32
#define I2C_DUMMY_MAX 4 #define I2C_DUMMY_MAX 4
struct i2c_msg;
struct i2c_algorithm; struct i2c_algorithm;
struct i2c_adapter; struct i2c_adapter;
struct i2c_client; struct i2c_client;
...@@ -212,10 +199,6 @@ struct i2c_algorithm { ...@@ -212,10 +199,6 @@ struct i2c_algorithm {
u32 (*functionality) (struct i2c_adapter *); u32 (*functionality) (struct i2c_adapter *);
}; };
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)
struct proc_dir_entry;
#endif
/* /*
* i2c_adapter is the structure used to identify a physical i2c bus along * i2c_adapter is the structure used to identify a physical i2c bus along
* with the access algorithms necessary to access it. * with the access algorithms necessary to access it.
...@@ -250,9 +233,6 @@ struct i2c_adapter { ...@@ -250,9 +233,6 @@ struct i2c_adapter {
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
/* No need to set this when you initialize the adapter */ /* No need to set this when you initialize the adapter */
int inode; int inode;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)
struct proc_dir_entry *proc_entry;
#endif
#endif /* def CONFIG_PROC_FS */ #endif /* def CONFIG_PROC_FS */
}; };
...@@ -355,8 +335,6 @@ extern u32 i2c_get_functionality (struct i2c_adapter *adap); ...@@ -355,8 +335,6 @@ extern u32 i2c_get_functionality (struct i2c_adapter *adap);
/* Return 1 if adapter supports everything we need, 0 if not. */ /* Return 1 if adapter supports everything we need, 0 if not. */
extern int i2c_check_functionality (struct i2c_adapter *adap, u32 func); extern int i2c_check_functionality (struct i2c_adapter *adap, u32 func);
#endif /* __KERNEL__ */
/* /*
* I2C Message - used for pure i2c transaction, also from /dev interface * I2C Message - used for pure i2c transaction, also from /dev interface
*/ */
...@@ -506,8 +484,6 @@ union i2c_smbus_data { ...@@ -506,8 +484,6 @@ union i2c_smbus_data {
#define I2C_MAJOR 89 /* Device major number */ #define I2C_MAJOR 89 /* Device major number */
#ifdef __KERNEL__
# ifndef NULL # ifndef NULL
# define NULL ( (void *) 0 ) # define NULL ( (void *) 0 )
# endif # endif
...@@ -577,5 +553,4 @@ union i2c_smbus_data { ...@@ -577,5 +553,4 @@ union i2c_smbus_data {
#define i2c_is_isa_adapter(adapptr) \ #define i2c_is_isa_adapter(adapptr) \
((adapptr)->algo->id == I2C_ALGO_ISA) ((adapptr)->algo->id == I2C_ALGO_ISA)
#endif /* def __KERNEL__ */ #endif /* _LINUX_I2C_H */
#endif /* I2C_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment