diff options
Diffstat (limited to 'drivers')
195 files changed, 5215 insertions, 6550 deletions
diff --git a/drivers/Makefile b/drivers/Makefile index 2503f7b9..fceb71a 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -56,6 +56,7 @@ obj-$(CONFIG_MAC) += macintosh/ obj-$(CONFIG_ATA_OVER_ETH) += block/aoe/ obj-$(CONFIG_PARIDE) += block/paride/ obj-$(CONFIG_TC) += tc/ +obj-$(CONFIG_UWB) += uwb/ obj-$(CONFIG_USB) += usb/ obj-$(CONFIG_USB_MUSB_HDRC) += usb/musb/ obj-$(CONFIG_PCI) += usb/ @@ -101,4 +102,3 @@ obj-$(CONFIG_SSB) += ssb/ obj-$(CONFIG_VIRTIO) += virtio/ obj-$(CONFIG_REGULATOR) += regulator/ obj-$(CONFIG_STAGING) += staging/ -obj-$(CONFIG_UWB) += uwb/ diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 9d568d4..cb046c3 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -262,6 +262,7 @@ static int acpi_lid_send_state(struct acpi_button *button) return -ENODEV; /* input layer checks if event is redundant */ input_report_switch(button->input, SW_LID, !state); + input_sync(button->input); return 0; } @@ -285,8 +286,8 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) input_report_key(input, keycode, 1); input_sync(input); input_report_key(input, keycode, 0); + input_sync(input); } - input_sync(input); acpi_bus_generate_proc_event(button->device, event, ++button->pushed); diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index dc98f7a..dbcf260 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -38,7 +38,10 @@ #include <asm/uaccess.h> #endif + +#ifdef CONFIG_X86 #include <asm/cpufeature.h> +#endif #include <acpi/acpi_bus.h> #include <acpi/processor.h> @@ -360,11 +363,13 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr) * the BIOS is older than the CPU and does not know its frequencies */ update_bios: +#ifdef CONFIG_X86 if (ACPI_SUCCESS(acpi_get_handle(pr->handle, "_PPC", &handle))){ if(boot_cpu_has(X86_FEATURE_EST)) printk(KERN_WARNING FW_BUG "BIOS needs update for CPU " "frequency support\n"); } +#endif return result; } diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 26571ba..80c0868 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c @@ -163,6 +163,8 @@ static void acpi_pm_end(void) acpi_target_sleep_state = ACPI_STATE_S0; acpi_sleep_tts_switch(acpi_target_sleep_state); } +#else /* !CONFIG_ACPI_SLEEP */ +#define acpi_target_sleep_state ACPI_STATE_S0 #endif /* CONFIG_ACPI_SLEEP */ #ifdef CONFIG_SUSPEND diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index 2a632f8..66aac06 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c @@ -371,6 +371,7 @@ static void bt_poll_rfkill(struct input_polled_dev *poll_dev) RFKILL_STATE_HARD_BLOCKED); input_report_switch(poll_dev->input, SW_RFKILL_ALL, new_rfk_state); + input_sync(poll_dev->input); } } @@ -842,6 +843,7 @@ static int __init toshiba_acpi_init(void) set_bit(EV_SW, toshiba_acpi.poll_dev->input->evbit); set_bit(SW_RFKILL_ALL, toshiba_acpi.poll_dev->input->swbit); input_report_switch(toshiba_acpi.poll_dev->input, SW_RFKILL_ALL, TRUE); + input_sync(toshiba_acpi.poll_dev->input); ret = input_register_polled_device(toshiba_acpi.poll_dev); if (ret) { diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index aeadd00..a67b8e7 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -49,6 +49,17 @@ #define DRV_NAME "ahci" #define DRV_VERSION "3.0" +/* Enclosure Management Control */ +#define EM_CTRL_MSG_TYPE 0x000f0000 + +/* Enclosure Management LED Message Type */ +#define EM_MSG_LED_HBA_PORT 0x0000000f +#define EM_MSG_LED_PMP_SLOT 0x0000ff00 +#define EM_MSG_LED_VALUE 0xffff0000 +#define EM_MSG_LED_VALUE_ACTIVITY 0x00070000 +#define EM_MSG_LED_VALUE_OFF 0xfff80000 +#define EM_MSG_LED_VALUE_ON 0x00010000 + static int ahci_skip_host_reset; module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); @@ -588,6 +599,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ + /* Promise */ + { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ + /* Generic, PCI class code for AHCI */ { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, @@ -1220,18 +1234,20 @@ static void ahci_sw_activity_blink(unsigned long arg) struct ahci_em_priv *emp = &pp->em_priv[link->pmp]; unsigned long led_message = emp->led_state; u32 activity_led_state; + unsigned long flags; - led_message &= 0xffff0000; + led_message &= EM_MSG_LED_VALUE; led_message |= ap->port_no | (link->pmp << 8); /* check to see if we've had activity. If so, * toggle state of LED and reset timer. If not, * turn LED to desired idle state. */ + spin_lock_irqsave(ap->lock, flags); if (emp->saved_activity != emp->activity) { emp->saved_activity = emp->activity; /* get the current LED state */ - activity_led_state = led_message & 0x00010000; + activity_led_state = led_message & EM_MSG_LED_VALUE_ON; if (activity_led_state) activity_led_state = 0; @@ -1239,17 +1255,18 @@ static void ahci_sw_activity_blink(unsigned long arg) activity_led_state = 1; /* clear old state */ - led_message &= 0xfff8ffff; + led_message &= ~EM_MSG_LED_VALUE_ACTIVITY; /* toggle state */ led_message |= (activity_led_state << 16); mod_timer(&emp->timer, jiffies + msecs_to_jiffies(100)); } else { /* switch to idle */ - led_message &= 0xfff8ffff; + led_message &= ~EM_MSG_LED_VALUE_ACTIVITY; if (emp->blink_policy == BLINK_OFF) led_message |= (1 << 16); } + spin_unlock_irqrestore(ap->lock, flags); ahci_transmit_led_message(ap, led_message, 4); } @@ -1294,7 +1311,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, struct ahci_em_priv *emp; /* get the slot number from the message */ - pmp = (state & 0x0000ff00) >> 8; + pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8; if (pmp < MAX_SLOTS) emp = &pp->em_priv[pmp]; else @@ -1319,7 +1336,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, message[0] |= (4 << 8); /* ignore 0:4 of byte zero, fill in port info yourself */ - message[1] = ((state & 0xfffffff0) | ap->port_no); + message[1] = ((state & ~EM_MSG_LED_HBA_PORT) | ap->port_no); /* write message to EM_LOC */ writel(message[0], mmio + hpriv->em_loc); @@ -1362,7 +1379,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, state = simple_strtoul(buf, NULL, 0); /* get the slot number from the message */ - pmp = (state & 0x0000ff00) >> 8; + pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8; if (pmp < MAX_SLOTS) emp = &pp->em_priv[pmp]; else @@ -1373,7 +1390,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, * activity led through em_message */ if (emp->blink_policy) - state &= 0xfff8ffff; + state &= ~EM_MSG_LED_VALUE_ACTIVITY; return ahci_transmit_led_message(ap, state, size); } @@ -1392,16 +1409,16 @@ static ssize_t ahci_activity_store(struct ata_device *dev, enum sw_activity val) link->flags &= ~(ATA_LFLAG_SW_ACTIVITY); /* set the LED to OFF */ - port_led_state &= 0xfff80000; + port_led_state &= EM_MSG_LED_VALUE_OFF; port_led_state |= (ap->port_no | (link->pmp << 8)); ahci_transmit_led_message(ap, port_led_state, 4); } else { link->flags |= ATA_LFLAG_SW_ACTIVITY; if (val == BLINK_OFF) { /* set LED to ON for idle */ - port_led_state &= 0xfff80000; + port_led_state &= EM_MSG_LED_VALUE_OFF; port_led_state |= (ap->port_no | (link->pmp << 8)); - port_led_state |= 0x00010000; /* check this */ + port_led_state |= EM_MSG_LED_VALUE_ON; /* check this */ ahci_transmit_led_message(ap, port_led_state, 4); } } @@ -2612,7 +2629,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) u32 em_loc = readl(mmio + HOST_EM_LOC); u32 em_ctl = readl(mmio + HOST_EM_CTL); - messages = (em_ctl & 0x000f0000) >> 16; + messages = (em_ctl & EM_CTRL_MSG_TYPE) >> 16; /* we only support LED message type right now */ if ((messages & 0x01) && (ahci_em_messages == 1)) { diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 75a406f..5c33767 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c @@ -1,6 +1,6 @@ /* * ata_generic.c - Generic PATA/SATA controller driver. - * Copyright 2005 Red Hat Inc <alan@redhat.com>, all rights reserved. + * Copyright 2005 Red Hat Inc, all rights reserved. * * Elements from ide/pci/generic.c * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index e9e32ed..52dc2d8 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c @@ -14,7 +14,7 @@ * * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> - * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> + * Copyright (C) 2003 Red Hat Inc * * * This program is free software; you can redistribute it and/or modify diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index bbb3cae..2ff633c 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -1713,8 +1713,6 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, else tag = 0; - if (test_and_set_bit(tag, &ap->qc_allocated)) - BUG(); qc = __ata_qc_from_tag(ap, tag); qc->tag = tag; @@ -4158,29 +4156,33 @@ static int cable_is_40wire(struct ata_port *ap) struct ata_link *link; struct ata_device *dev; - /* If the controller thinks we are 40 wire, we are */ + /* If the controller thinks we are 40 wire, we are. */ if (ap->cbl == ATA_CBL_PATA40) return 1; - /* If the controller thinks we are 80 wire, we are */ + + /* If the controller thinks we are 80 wire, we are. */ if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA) return 0; - /* If the system is known to be 40 wire short cable (eg laptop), - then we allow 80 wire modes even if the drive isn't sure */ + + /* If the system is known to be 40 wire short cable (eg + * laptop), then we allow 80 wire modes even if the drive + * isn't sure. + */ if (ap->cbl == ATA_CBL_PATA40_SHORT) return 0; - /* If the controller doesn't know we scan - - - Note: We look for all 40 wire detects at this point. - Any 80 wire detect is taken to be 80 wire cable - because - - In many setups only the one drive (slave if present) - will give a valid detect - - If you have a non detect capable drive you don't - want it to colour the choice - */ + + /* If the controller doesn't know, we scan. + * + * Note: We look for all 40 wire detects at this point. Any + * 80 wire detect is taken to be 80 wire cable because + * - in many setups only the one drive (slave if present) will + * give a valid detect + * - if you have a non detect capable drive you don't want it + * to colour the choice + */ ata_port_for_each_link(link, ap) { ata_link_for_each_dev(dev, link) { - if (!ata_is_40wire(dev)) + if (ata_dev_enabled(dev) && !ata_is_40wire(dev)) return 0; } } @@ -4553,54 +4555,28 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) } /** - * ata_qc_new - Request an available ATA command, for queueing - * @ap: Port associated with device @dev - * @dev: Device from whom we request an available command structure - * - * LOCKING: - * None. - */ - -static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) -{ - struct ata_queued_cmd *qc = NULL; - unsigned int i; - - /* no command while frozen */ - if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) - return NULL; - - /* the last tag is reserved for internal command. */ - for (i = 0; i < ATA_MAX_QUEUE - 1; i++) - if (!test_and_set_bit(i, &ap->qc_allocated)) { - qc = __ata_qc_from_tag(ap, i); - break; - } - - if (qc) - qc->tag = i; - - return qc; -} - -/** * ata_qc_new_init - Request an available ATA command, and initialize it * @dev: Device from whom we request an available command structure + * @tag: command tag * * LOCKING: * None. */ -struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev) +struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag) { struct ata_port *ap = dev->link->ap; struct ata_queued_cmd *qc; - qc = ata_qc_new(ap); + if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) + return NULL; + + qc = __ata_qc_from_tag(ap, tag); if (qc) { qc->scsicmd = NULL; qc->ap = ap; qc->dev = dev; + qc->tag = tag; ata_qc_reinit(qc); } @@ -4608,31 +4584,6 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev) return qc; } -/** - * ata_qc_free - free unused ata_queued_cmd - * @qc: Command to complete - * - * Designed to free unused ata_queued_cmd object - * in case something prevents using it. - * - * LOCKING: - * spin_lock_irqsave(host lock) - */ -void ata_qc_free(struct ata_queued_cmd *qc) -{ - struct ata_port *ap = qc->ap; - unsigned int tag; - - WARN_ON(qc == NULL); /* ata_qc_from_tag _might_ return NULL */ - - qc->flags = 0; - tag = qc->tag; - if (likely(ata_tag_valid(tag))) { - qc->tag = ATA_TAG_POISON; - clear_bit(tag, &ap->qc_allocated); - } -} - void __ata_qc_complete(struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 5d687d7..8077bdf 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -603,6 +603,9 @@ void ata_scsi_error(struct Scsi_Host *host) ata_link_for_each_dev(dev, link) { int devno = dev->devno; + if (!ata_dev_enabled(dev)) + continue; + ehc->saved_xfer_mode[devno] = dev->xfer_mode; if (ata_ncq_enabled(dev)) ehc->saved_ncq_enabled |= 1 << devno; @@ -1161,6 +1164,7 @@ void ata_eh_detach_dev(struct ata_device *dev) { struct ata_link *link = dev->link; struct ata_port *ap = link->ap; + struct ata_eh_context *ehc = &link->eh_context; unsigned long flags; ata_dev_disable(dev); @@ -1174,9 +1178,11 @@ void ata_eh_detach_dev(struct ata_device *dev) ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; } - /* clear per-dev EH actions */ + /* clear per-dev EH info */ ata_eh_clear_action(link, dev, &link->eh_info, ATA_EH_PERDEV_MASK); ata_eh_clear_action(link, dev, &link->eh_context.i, ATA_EH_PERDEV_MASK); + ehc->saved_xfer_mode[dev->devno] = 0; + ehc->saved_ncq_enabled &= ~(1 << dev->devno); spin_unlock_irqrestore(ap->lock, flags); } @@ -2787,6 +2793,9 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) /* if data transfer is verified, clear DUBIOUS_XFER on ering top */ ata_link_for_each_dev(dev, link) { + if (!ata_dev_enabled(dev)) + continue; + if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { struct ata_ering_entry *ent; @@ -2808,6 +2817,9 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno]; u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); + if (!ata_dev_enabled(dev)) + continue; + if (dev->xfer_mode != saved_xfer_mode || ata_ncq_enabled(dev) != saved_ncq) dev->flags |= ATA_DFLAG_DUBIOUS_XFER; diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 5d312dc..bbb30d8 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -708,7 +708,11 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, { struct ata_queued_cmd *qc; - qc = ata_qc_new_init(dev); + if (cmd->request->tag != -1) + qc = ata_qc_new_init(dev, cmd->request->tag); + else + qc = ata_qc_new_init(dev, 0); + if (qc) { qc->scsicmd = cmd; qc->scsidone = done; @@ -1103,7 +1107,17 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); depth = min(ATA_MAX_QUEUE - 1, depth); - scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth); + + /* + * If this device is behind a port multiplier, we have + * to share the tag map between all devices on that PMP. + * Set up the shared tag map here and we get automatic. + */ + if (dev->link->ap->pmp_link) + scsi_init_shared_tag_map(sdev->host, ATA_MAX_QUEUE - 1); + + scsi_set_tag_type(sdev, MSG_SIMPLE_TAG); + scsi_activate_tcq(sdev, depth); } return 0; @@ -1943,6 +1957,11 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) hdr[1] |= (1 << 7); memcpy(rbuf, hdr, sizeof(hdr)); + + /* if ncq, set tags supported */ + if (ata_id_has_ncq(args->id)) + rbuf[7] |= (1 << 1); + memcpy(&rbuf[8], "ATA ", 8); ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4); diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index fe2839e..d3831d3 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h @@ -74,7 +74,7 @@ extern struct ata_link *ata_dev_phys_link(struct ata_device *dev); extern void ata_force_cbl(struct ata_port *ap); extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); -extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); +extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag); extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, u64 block, u32 n_block, unsigned int tf_flags, unsigned int tag); @@ -103,7 +103,6 @@ extern int ata_dev_configure(struct ata_device *dev); extern int sata_down_spd_limit(struct ata_link *link); extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); extern void ata_sg_clean(struct ata_queued_cmd *qc); -extern void ata_qc_free(struct ata_queued_cmd *qc); extern void ata_qc_issue(struct ata_queued_cmd *qc); extern void __ata_qc_complete(struct ata_queued_cmd *qc); extern int atapi_check_dma(struct ata_queued_cmd *qc); @@ -119,6 +118,22 @@ extern struct ata_port *ata_port_alloc(struct ata_host *host); extern void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy); extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm); +/** + * ata_qc_free - free unused ata_queued_cmd + * @qc: Command to complete + * + * Designed to free unused ata_queued_cmd object + * in case something prevents using it. + * + * LOCKING: + * spin_lock_irqsave(host lock) + */ +static inline void ata_qc_free(struct ata_queued_cmd *qc) +{ + qc->flags = 0; + qc->tag = ATA_TAG_POISON; +} + /* libata-acpi.c */ #ifdef CONFIG_ATA_ACPI extern void ata_acpi_associate_sata_port(struct ata_port *ap); diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index eb919c1..e2e332d 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c @@ -1,7 +1,7 @@ /* * ACPI PATA driver * - * (c) 2007 Red Hat <alan@redhat.com> + * (c) 2007 Red Hat */ #include <linux/kernel.h> diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index 5ca70fa..73c466e 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c @@ -1,7 +1,6 @@ /* * pata_ali.c - ALI 15x3 PATA for new ATA layer * (C) 2005 Red Hat Inc - * Alan Cox <alan@redhat.com> * * based in part upon * linux/drivers/ide/pci/alim15x3.c Version 0.17 2003/01/02 diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index 57dd00f..0ec9c7d 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c @@ -1,7 +1,6 @@ /* * pata_amd.c - AMD PATA for new ATA layer * (C) 2005-2006 Red Hat Inc - * Alan Cox <alan@redhat.com> * * Based on pata-sil680. Errata information is taken from data sheets * and the amd74xx.c driver by Vojtech Pavlik. Nvidia SATA devices are diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c index 0f513bc..6b3092c 100644 --- a/drivers/ata/pata_artop.c +++ b/drivers/ata/pata_artop.c @@ -1,7 +1,7 @@ /* * pata_artop.c - ARTOP ATA controller driver * - * (C) 2006 Red Hat <alan@redhat.com> + * (C) 2006 Red Hat * (C) 2007 Bartlomiej Zolnierkiewicz * * Based in part on drivers/ide/pci/aec62xx.c diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index e8a0d99..0e2cde8 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c @@ -1,7 +1,6 @@ /* * pata_atiixp.c - ATI PATA for new ATA layer * (C) 2005 Red Hat Inc - * Alan Cox <alan@redhat.com> * * Based on * diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c index 2de30b9..34a3942 100644 --- a/drivers/ata/pata_cmd640.c +++ b/drivers/ata/pata_cmd640.c @@ -1,7 +1,6 @@ /* * pata_cmd640.c - CMD640 PCI PATA for new ATA layer * (C) 2007 Red Hat Inc - * Alan Cox <alan@redhat.com> * * Based upon * linux/drivers/ide/pci/cmd640.c Version 1.02 Sep 01, 1996 diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index ddd09b7..3167d8f 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c @@ -1,7 +1,7 @@ /* * pata_cmd64x.c - CMD64x PATA for new ATA layer * (C) 2005 Red Hat Inc - * Alan Cox <alan@redhat.com> + * Alan Cox <alan@lxorguk.ukuu.org.uk> * * Based upon * linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002 diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index 0c4b271..bba4533 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c @@ -1,7 +1,6 @@ /* * pata-cs5530.c - CS5530 PATA for new ATA layer * (C) 2005 Red Hat Inc - * Alan Cox <alan@redhat.com> * * based upon cs5530.c by Mark Lord. * diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c index f1b6556..1b2d4a0 100644 --- a/drivers/ata/pata_cs5535.c +++ b/drivers/ata/pata_cs5535.c @@ -1,7 +1,7 @@ /* * pata-cs5535.c - CS5535 PATA for new ATA layer * (C) 2005-2006 Red Hat Inc - * Alan Cox <alan@redhat.com> + * Alan Cox <alan@lxorguk.ukuu.org.uk> * * based upon cs5535.c from AMD <Jens.Altmann@amd.com> as cleaned up and * made readable and Linux style by Wolfgang Zuleger <wolfgang.zuleger@gmx.de diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c index 2ff6260..d546425 100644 --- a/drivers/ata/pata_cypress.c +++ b/drivers/ata/pata_cypress.c @@ -1,7 +1,7 @@ /* * pata_cypress.c - Cypress PATA for new ATA layer * (C) 2006 Red Hat Inc - * Alan Cox <alan@redhat.com> + * Alan Cox * * Based heavily on * linux/drivers/ide/pci/cy82c693.c Version 0.40 Sep. 10, 2002 diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c index 9fba829..ac6392e 100644 --- a/drivers/ata/pata_efar.c +++ b/drivers/ata/pata_efar.c @@ -1,7 +1,7 @@ /* * pata_efar.c - EFAR PIIX clone controller driver * - * (C) 2005 Red Hat <alan@redhat.com> + * (C) 2005 Red Hat * * Some parts based on ata_piix.c by Jeff Garzik and others. * diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c index 6a111ba..15cdb91 100644 --- a/drivers/ata/pata_isapnp.c +++ b/drivers/ata/pata_isapnp.c @@ -1,7 +1,7 @@ /* * pata-isapnp.c - ISA PnP PATA controller driver. - * Copyright 2005/2006 Red Hat Inc <alan@redhat.com>, all rights reserved. + * Copyright 2005/2006 Red Hat Inc, all rights reserved. * * Based in part on ide-pnp.c by Andrey Panin <pazke@donpac.ru> */ diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 0221c9a..860ede5 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c @@ -1,7 +1,7 @@ /* * pata_it821x.c - IT821x PATA for new ATA layer * (C) 2005 Red Hat Inc - * Alan Cox <alan@redhat.com> + * Alan Cox <alan@lxorguk.ukuu.org.uk> * (C) 2007 Bartlomiej Zolnierkiewicz * * based upon @@ -10,7 +10,7 @@ * * linux/drivers/ide/pci/it821x.c Version 0.09 December 2004 * - * Copyright (C) 2004 Red Hat <alan@redhat.com> + * Copyright (C) 2004 Red Hat * * May be copied or modified under the terms of the GNU General Public License * Based in part on the ITE vendor provided SCSI driver. @@ -557,9 +557,8 @@ static unsigned int it821x_read_id(struct ata_device *adev, if (strstr(model_num, "Integrated Technology Express")) { /* Set feature bits the firmware neglects */ id[49] |= 0x0300; /* LBA, DMA */ - id[82] |= 0x0400; /* LBA48 */ id[83] &= 0x7FFF; - id[83] |= 0x4000; /* Word 83 is valid */ + id[83] |= 0x4400; /* Word 83 is valid and LBA48 */ id[86] |= 0x0400; /* LBA48 on */ id[ATA_ID_MAJOR_VER] |= 0x1F; } diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 73b7596..38cf1ab 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c @@ -4,7 +4,7 @@ * driven by AHCI in the usual configuration although * this driver can handle other setups if we need it. * - * (c) 2006 Red Hat <alan@redhat.com> + * (c) 2006 Red Hat */ #include <linux/kernel.h> diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index bc037ff..930c220 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c @@ -1,6 +1,6 @@ /* * pata-legacy.c - Legacy port PATA/SATA controller driver. - * Copyright 2005/2006 Red Hat <alan@redhat.com>, all rights reserved. + * Copyright 2005/2006 Red Hat, all rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c index 0d87eec..76e399b 100644 --- a/drivers/ata/pata_marvell.c +++ b/drivers/ata/pata_marvell.c @@ -5,7 +5,7 @@ * isn't making full use of the device functionality but it is * easy to get working. * - * (c) 2006 Red Hat <alan@redhat.com> + * (c) 2006 Red Hat */ #include <linux/kernel.h> diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c index 7d7e3fd..7c8faa4 100644 --- a/drivers/ata/pata_mpiix.c +++ b/drivers/ata/pata_mpiix.c @@ -1,7 +1,7 @@ /* * pata_mpiix.c - Intel MPIIX PATA for new ATA layer * (C) 2005-2006 Red Hat Inc - * Alan Cox <alan@redhat.com> + * Alan Cox <alan@lxorguk.ukuu.org.uk> * * The MPIIX is different enough to the PIIX4 and friends that we give it * a separate driver. The old ide/pci code handles this by just not tuning diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c index d9719c8..9dc05e1 100644 --- a/drivers/ata/pata_netcell.c +++ b/drivers/ata/pata_netcell.c @@ -1,7 +1,7 @@ /* * pata_netcell.c - Netcell PATA driver * - * (c) 2006 Red Hat <alan@redhat.com> + * (c) 2006 Red Hat */ #include <linux/kernel.h> diff --git a/drivers/ata/pata_ninja32.c b/drivers/ata/pata_ninja32.c index 565e67c..4e466ea 100644 --- a/drivers/ata/pata_ninja32.c +++ b/drivers/ata/pata_ninja32.c @@ -1,7 +1,6 @@ /* * pata_ninja32.c - Ninja32 PATA for new ATA layer * (C) 2007 Red Hat Inc - * Alan Cox <alan@redhat.com> * * Note: The controller like many controllers has shared timings for * PIO and DMA. We thus flip to the DMA timings in dma_start and flip back @@ -45,7 +44,7 @@ #include <linux/libata.h> #define DRV_NAME "pata_ninja32" -#define DRV_VERSION "0.0.1" +#define DRV_VERSION "0.1.1" /** @@ -89,6 +88,17 @@ static struct ata_port_operations ninja32_port_ops = { .set_piomode = ninja32_set_piomode, }; +static void ninja32_program(void __iomem *base) +{ + iowrite8(0x05, base + 0x01); /* Enable interrupt lines */ + iowrite8(0xBE, base + 0x02); /* Burst, ?? setup */ + iowrite8(0x01, base + 0x03); /* Unknown */ + iowrite8(0x20, base + 0x04); /* WAIT0 */ + iowrite8(0x8f, base + 0x05); /* Unknown */ + iowrite8(0xa4, base + 0x1c); /* Unknown */ + iowrite8(0x83, base + 0x1d); /* BMDMA control: WAIT0 */ +} + static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) { struct ata_host *host; @@ -134,18 +144,28 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) ap->ioaddr.bmdma_addr = base; ata_sff_std_ports(&ap->ioaddr); - iowrite8(0x05, base + 0x01); /* Enable interrupt lines */ - iowrite8(0xBE, base + 0x02); /* Burst, ?? setup */ - iowrite8(0x01, base + 0x03); /* Unknown */ - iowrite8(0x20, base + 0x04); /* WAIT0 */ - iowrite8(0x8f, base + 0x05); /* Unknown */ - iowrite8(0xa4, base + 0x1c); /* Unknown */ - iowrite8(0x83, base + 0x1d); /* BMDMA control: WAIT0 */ + ninja32_program(base); /* FIXME: Should we disable them at remove ? */ return ata_host_activate(host, dev->irq, ata_sff_interrupt, IRQF_SHARED, &ninja32_sht); } +#ifdef CONFIG_PM + +static int ninja32_reinit_one(struct pci_dev *pdev) +{ + struct ata_host *host = dev_get_drvdata(&pdev->dev); + int rc; + + rc = ata_pci_device_do_resume(pdev); + if (rc) + return rc; + ninja32_program(host->iomap[0]); + ata_host_resume(host); + return 0; +} +#endif + static const struct pci_device_id ninja32[] = { { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, @@ -156,7 +176,11 @@ static struct pci_driver ninja32_pci_driver = { .name = DRV_NAME, .id_table = ninja32, .probe = ninja32_init_one, - .remove = ata_pci_remove_one + .remove = ata_pci_remove_one, +#ifdef CONFIG_PM + .suspend = ata_pci_device_suspend, + .resume = ninja32_reinit_one, +#endif }; static int __init ninja32_init(void) diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c index be756b7..40d411c 100644 --- a/drivers/ata/pata_ns87410.c +++ b/drivers/ata/pata_ns87410.c @@ -1,7 +1,6 @@ /* * pata_ns87410.c - National Semiconductor 87410 PATA for new ATA layer * (C) 2006 Red Hat Inc - * Alan Cox <alan@redhat.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c index e0aa7ea..89bf5f8 100644 --- a/drivers/ata/pata_ns87415.c +++ b/drivers/ata/pata_ns87415.c @@ -1,7 +1,7 @@ /* * pata_ns87415.c - NS87415 (non PARISC) PATA * - * (C) 2005 Red Hat <alan@redhat.com> + * (C) 2005 Red Hat <alan@lxorguk.ukuu.org.uk> * * This is a fairly generic MWDMA controller. It has some limitations * as it requires timing reloads on PIO/DMA transitions but it is otherwise diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c index df64f24..c0dbc46 100644 --- a/drivers/ata/pata_oldpiix.c +++ b/drivers/ata/pata_oldpiix.c @@ -1,7 +1,7 @@ /* * pata_oldpiix.c - Intel PATA/SATA controllers * - * (C) 2005 Red Hat <alan@redhat.com> + * (C) 2005 Red Hat * * Some parts based on ata_piix.c by Jeff Garzik and others. * diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c index fb2cf66..e4fa4d5 100644 --- a/drivers/ata/pata_opti.c +++ b/drivers/ata/pata_opti.c @@ -1,7 +1,6 @@ /* * pata_opti.c - ATI PATA for new ATA layer * (C) 2005 Red Hat Inc - * Alan Cox <alan@redhat.com> * * Based on * linux/drivers/ide/pci/opti621.c Version 0.7 Sept 10, 2002 diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c index 4cd7444..93bb6e9 100644 --- a/drivers/ata/pata_optidma.c +++ b/drivers/ata/pata_optidma.c @@ -1,7 +1,6 @@ /* * pata_optidma.c - Opti DMA PATA for new ATA layer * (C) 2006 Red Hat Inc - * Alan Cox <alan@redhat.com> * * The Opti DMA controllers are related to the older PIO PCI controllers * and indeed the VLB ones. The main differences are that the timing diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 02b596b..271cb64 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c @@ -1,6 +1,6 @@ /* * pata_pcmcia.c - PCMCIA PATA controller driver. - * Copyright 2005-2006 Red Hat Inc <alan@redhat.com>, all rights reserved. + * Copyright 2005-2006 Red Hat Inc, all rights reserved. * PCMCIA ident update Copyright 2006 Marcin Juszkiewicz * <openembedded@hrw.one.pl> * diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c index d267306..799a6a0 100644 --- a/drivers/ata/pata_pdc202xx_old.c +++ b/drivers/ata/pata_pdc202xx_old.c @@ -1,7 +1,7 @@ /* * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer * (C) 2005 Red Hat Inc - * Alan Cox <alan@redhat.com> + * Alan Cox <alan@lxorguk.ukuu.org.uk> * (C) 2007 Bartlomiej Zolnierkiewicz * * Based in part on linux/drivers/ide/pci/pdc202xx_old.c diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index 8f65ad6..77e4e3b 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c @@ -5,7 +5,7 @@ * * Based on pata_pcmcia: * - * Copyright 2005-2006 Red Hat Inc <alan@redhat.com>, all rights reserved. + * Copyright 2005-2006 Red Hat Inc, all rights reserved. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c index 63b7a1c..3080f37 100644 --- a/drivers/ata/pata_qdi.c +++ b/drivers/ata/pata_qdi.c @@ -1,6 +1,6 @@ /* * pata_qdi.c - QDI VLB ATA controllers - * (C) 2006 Red Hat <alan@redhat.com> + * (C) 2006 Red Hat * * This driver mostly exists as a proof of concept for non PCI devices under * libata. While the QDI6580 was 'neat' in 1993 it is no longer terribly diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c index 1c0d9fa..0b0aa45 100644 --- a/drivers/ata/pata_radisys.c +++ b/drivers/ata/pata_radisys.c @@ -1,7 +1,7 @@ /* * pata_radisys.c - Intel PATA/SATA controllers * - * (C) 2006 Red Hat <alan@redhat.com> + * (C) 2006 Red Hat <alan@lxorguk.ukuu.org.uk> * * Some parts based on ata_piix.c by Jeff Garzik and others. * diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index 0278fd2..9a4bdca 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c @@ -1,5 +1,5 @@ /* - * New ATA layer SC1200 driver Alan Cox <alan@redhat.com> + * New ATA layer SC1200 driver Alan Cox <alan@lxorguk.ukuu.org.uk> * * TODO: Mode selection filtering * TODO: Can't enable second channel until ATA core has serialize diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index 16673d1..cf3707e 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c @@ -8,7 +8,7 @@ * Copyright 2003-2005 Jeff Garzik * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> - * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> + * Copyright (C) 2003 Red Hat Inc * * and drivers/ata/ahci.c: * Copyright 2004-2005 Red Hat, Inc. diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c index ffd26d0..72e41c9 100644 --- a/drivers/ata/pata_serverworks.c +++ b/drivers/ata/pata_serverworks.c @@ -1,7 +1,6 @@ /* * pata_serverworks.c - Serverworks PATA for new ATA layer * (C) 2005 Red Hat Inc - * Alan Cox <alan@redhat.com> * * based upon * diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index a598bb3..83580a5 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c @@ -1,7 +1,6 @@ /* * pata_sil680.c - SIL680 PATA for new ATA layer * (C) 2005 Red Hat Inc - * Alan Cox <alan@redhat.com> * * based upon * diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index 26345d7..d342366 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c @@ -1,7 +1,7 @@ /* * pata_sis.c - SiS ATA driver * - * (C) 2005 Red Hat <alan@redhat.com> + * (C) 2005 Red Hat * (C) 2007 Bartlomiej Zolnierkiewicz * * Based upon linux/drivers/ide/pci/sis5513.c diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c index 69877bd..1b0e7b6 100644 --- a/drivers/ata/pata_sl82c105.c +++ b/drivers/ata/pata_sl82c105.c @@ -1,7 +1,6 @@ /* * pata_sl82c105.c - SL82C105 PATA for new ATA layer * (C) 2005 Red Hat Inc - * Alan Cox <alan@redhat.com> * * Based in part on linux/drivers/ide/pci/sl82c105.c * SL82C105/Winbond 553 IDE driver diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c index b181261..ef95975 100644 --- a/drivers/ata/pata_triflex.c +++ b/drivers/ata/pata_triflex.c @@ -1,7 +1,7 @@ /* * pata_triflex.c - Compaq PATA for new ATA layer * (C) 2005 Red Hat Inc - * Alan Cox <alan@redhat.com> + * Alan Cox <alan@lxorguk.ukuu.org.uk> * * based upon * diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 8fdb2ce..681169c 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c @@ -1,7 +1,6 @@ /* * pata_via.c - VIA PATA for new ATA layer * (C) 2005-2006 Red Hat Inc - * Alan Cox <alan@redhat.com> * * Documentation * Most chipset documentation available under NDA only diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c index a7606b0..319e164 100644 --- a/drivers/ata/pata_winbond.c +++ b/drivers/ata/pata_winbond.c @@ -1,6 +1,6 @@ /* * pata_winbond.c - Winbond VLB ATA controllers - * (C) 2006 Red Hat <alan@redhat.com> + * (C) 2006 Red Hat * * Support for the Winbond 83759A when operating in advanced mode. * Multichip mode is not currently supported. diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 4621807..ccee930 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c @@ -1329,6 +1329,11 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) } } + /* Set max read request size to 4096. This slightly increases + * write throughput for pci-e variants. + */ + pcie_set_readrq(pdev, 4096); + sil24_init_controller(host); pci_set_master(pdev); diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c index 58630cc..cda6c7c 100644 --- a/drivers/bluetooth/btsdio.c +++ b/drivers/bluetooth/btsdio.c @@ -152,7 +152,7 @@ static int btsdio_rx_packet(struct btsdio_data *data) err = sdio_readsb(data->func, skb->data, REG_RDAT, len - 4); if (err < 0) { - kfree(skb); + kfree_skb(skb); return err; } diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 98821f9..b97aebd 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c @@ -2071,12 +2071,13 @@ module_init(rs_init) module_exit(rs_exit) +#if defined(CONFIG_SERIAL_CONSOLE) && !defined(MODULE) + /* * ------------------------------------------------------------ * Serial console driver * ------------------------------------------------------------ */ -#ifdef CONFIG_SERIAL_CONSOLE static void amiga_serial_putc(char c) { @@ -2130,6 +2131,7 @@ static int __init amiserial_console_init(void) return 0; } console_initcall(amiserial_console_init); -#endif + +#endif /* CONFIG_SERIAL_CONSOLE && !MODULE */ MODULE_LICENSE("GPL"); diff --git a/drivers/char/hw_random/amd-rng.c b/drivers/char/hw_random/amd-rng.c index c422e87..cd0ba51 100644 --- a/drivers/char/hw_random/amd-rng.c +++ b/drivers/char/hw_random/amd-rng.c @@ -11,7 +11,7 @@ * derived from * * Hardware driver for the AMD 768 Random Number Generator (RNG) - * (c) Copyright 2001 Red Hat Inc <alan@redhat.com> + * (c) Copyright 2001 Red Hat Inc * * derived from * diff --git a/drivers/char/hw_random/geode-rng.c b/drivers/char/hw_random/geode-rng.c index fed4ef5..64d513f6 100644 --- a/drivers/char/hw_random/geode-rng.c +++ b/drivers/char/hw_random/geode-rng.c @@ -11,7 +11,7 @@ * derived from * * Hardware driver for the AMD 768 Random Number Generator (RNG) - * (c) Copyright 2001 Red Hat Inc <alan@redhat.com> + * (c) Copyright 2001 Red Hat Inc * * derived from * diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c index 8a2fce0..5dcbe60 100644 --- a/drivers/char/hw_random/intel-rng.c +++ b/drivers/char/hw_random/intel-rng.c @@ -11,7 +11,7 @@ * derived from * * Hardware driver for the AMD 768 Random Number Generator (RNG) - * (c) Copyright 2001 Red Hat Inc <alan@redhat.com> + * (c) Copyright 2001 Red Hat Inc * * derived from * diff --git a/drivers/char/hw_random/via-rng.c b/drivers/char/hw_random/via-rng.c index 128202e..4e9573c 100644 --- a/drivers/char/hw_random/via-rng.c +++ b/drivers/char/hw_random/via-rng.c @@ -11,7 +11,7 @@ * derived from * * Hardware driver for the AMD 768 Random Number Generator (RNG) - * (c) Copyright 2001 Red Hat Inc <alan@redhat.com> + * (c) Copyright 2001 Red Hat Inc * * derived from * diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index 43b8cef..b0438c4 100644 --- a/drivers/dma/ioat_dma.c +++ b/drivers/dma/ioat_dma.c @@ -33,6 +33,7 @@ #include <linux/delay.h> #include <linux/dma-mapping.h> #include <linux/workqueue.h> +#include <linux/i7300_idle.h> #include "ioatdma.h" #include "ioatdma_registers.h" #include "ioatdma_hw.h" @@ -171,8 +172,10 @@ static int ioat_dma_enumerate_channels(struct ioatdma_device *device) xfercap_scale = readb(device->reg_base + IOAT_XFERCAP_OFFSET); xfercap = (xfercap_scale == 0 ? -1 : (1UL << xfercap_scale)); -#if CONFIG_I7300_IDLE_IOAT_CHANNEL - device->common.chancnt--; +#ifdef CONFIG_I7300_IDLE_IOAT_CHANNEL + if (i7300_idle_platform_probe(NULL, NULL) == 0) { + device->common.chancnt--; + } #endif for (i = 0; i < device->common.chancnt; i++) { ioat_chan = kzalloc(sizeof(*ioat_chan), GFP_KERNEL); diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c index 251416f..8e16bfb 100644 --- a/drivers/firewire/fw-ohci.c +++ b/drivers/firewire/fw-ohci.c @@ -476,6 +476,7 @@ static int ar_context_add_page(struct ar_context *ctx) if (ab == NULL) return -ENOMEM; + ab->next = NULL; memset(&ab->descriptor, 0, sizeof(ab->descriptor)); ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE | DESCRIPTOR_STATUS | @@ -496,6 +497,21 @@ static int ar_context_add_page(struct ar_context *ctx) return 0; } +static void ar_context_release(struct ar_context *ctx) +{ + struct ar_buffer *ab, *ab_next; + size_t offset; + dma_addr_t ab_bus; + + for (ab = ctx->current_buffer; ab; ab = ab_next) { + ab_next = ab->next; + offset = offsetof(struct ar_buffer, data); + ab_bus = le32_to_cpu(ab->descriptor.data_address) - offset; + dma_free_coherent(ctx->ohci->card.device, PAGE_SIZE, + ab, ab_bus); + } +} + #if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) #define cond_le32_to_cpu(v) \ (ohci->old_uninorth ? (__force __u32)(v) : le32_to_cpu(v)) @@ -2349,8 +2365,8 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) ohci = kzalloc(sizeof(*ohci), GFP_KERNEL); if (ohci == NULL) { - fw_error("Could not malloc fw_ohci data.\n"); - return -ENOMEM; + err = -ENOMEM; + goto fail; } fw_card_initialize(&ohci->card, &ohci_driver, &dev->dev); @@ -2359,7 +2375,7 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) err = pci_enable_device(dev); if (err) { - fw_error("Failed to enable OHCI hardware.\n"); + fw_error("Failed to enable OHCI hardware\n"); goto fail_free; } @@ -2427,9 +2443,8 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) ohci->ir_context_list = kzalloc(size, GFP_KERNEL); if (ohci->it_context_list == NULL || ohci->ir_context_list == NULL) { - fw_error("Out of memory for it/ir contexts.\n"); err = -ENOMEM; - goto fail_registers; + goto fail_contexts; } /* self-id dma buffer allocation */ @@ -2438,9 +2453,8 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) &ohci->self_id_bus, GFP_KERNEL); if (ohci->self_id_cpu == NULL) { - fw_error("Out of memory for self ID buffer.\n"); err = -ENOMEM; - goto fail_registers; + goto fail_contexts; } bus_options = reg_read(ohci, OHCI1394_BusOptions); @@ -2460,9 +2474,13 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) fail_self_id: dma_free_coherent(ohci->card.device, SELF_ID_BUF_SIZE, ohci->self_id_cpu, ohci->self_id_bus); - fail_registers: - kfree(ohci->it_context_list); + fail_contexts: kfree(ohci->ir_context_list); + kfree(ohci->it_context_list); + context_release(&ohci->at_response_ctx); + context_release(&ohci->at_request_ctx); + ar_context_release(&ohci->ar_response_ctx); + ar_context_release(&ohci->ar_request_ctx); pci_iounmap(dev, ohci->registers); fail_iomem: pci_release_region(dev, 0); @@ -2471,6 +2489,9 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) fail_free: kfree(&ohci->card); ohci_pmac_off(dev); + fail: + if (err == -ENOMEM) + fw_error("Out of memory\n"); return err; } @@ -2491,8 +2512,19 @@ static void pci_remove(struct pci_dev *dev) software_reset(ohci); free_irq(dev->irq, ohci); + + if (ohci->next_config_rom && ohci->next_config_rom != ohci->config_rom) + dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, + ohci->next_config_rom, ohci->next_config_rom_bus); + if (ohci->config_rom) + dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, + ohci->config_rom, ohci->config_rom_bus); dma_free_coherent(ohci->card.device, SELF_ID_BUF_SIZE, ohci->self_id_cpu, ohci->self_id_bus); + ar_context_release(&ohci->ar_request_ctx); + ar_context_release(&ohci->ar_response_ctx); + context_release(&ohci->at_request_ctx); + context_release(&ohci->at_response_ctx); kfree(ohci->it_context_list); kfree(ohci->ir_context_list); pci_iounmap(dev, ohci->registers); diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index ef0b9b4..d334cac 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c @@ -173,6 +173,9 @@ struct sbp2_target { int blocked; /* ditto */ }; +/* Impossible login_id, to detect logout attempt before successful login */ +#define INVALID_LOGIN_ID 0x10000 + /* * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be * provided in the config rom. Most devices do provide a value, which @@ -788,9 +791,20 @@ static void sbp2_release_target(struct kref *kref) scsi_remove_device(sdev); scsi_device_put(sdev); } - sbp2_send_management_orb(lu, tgt->node_id, lu->generation, - SBP2_LOGOUT_REQUEST, lu->login_id, NULL); - + if (lu->login_id != INVALID_LOGIN_ID) { + int generation, node_id; + /* + * tgt->node_id may be obsolete here if we failed + * during initial login or after a bus reset where + * the topology changed. + */ + generation = device->generation; + smp_rmb(); /* node_id vs. generation */ + node_id = device->node_id; + sbp2_send_management_orb(lu, node_id, generation, + SBP2_LOGOUT_REQUEST, + lu->login_id, NULL); + } fw_core_remove_address_handler(&lu->address_handler); list_del(&lu->link); kfree(lu); @@ -805,19 +819,20 @@ static void sbp2_release_target(struct kref *kref) static struct workqueue_struct *sbp2_wq; +static void sbp2_target_put(struct sbp2_target *tgt) +{ + kref_put(&tgt->kref, sbp2_release_target); +} + /* * Always get the target's kref when scheduling work on one its units. * Each workqueue job is responsible to call sbp2_target_put() upon return. */ static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay) { - if (queue_delayed_work(sbp2_wq, &lu->work, delay)) - kref_get(&lu->tgt->kref); -} - -static void sbp2_target_put(struct sbp2_target *tgt) -{ - kref_put(&tgt->kref, sbp2_release_target); + kref_get(&lu->tgt->kref); + if (!queue_delayed_work(sbp2_wq, &lu->work, delay)) + sbp2_target_put(lu->tgt); } /* @@ -978,6 +993,7 @@ static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) lu->tgt = tgt; lu->lun = lun_entry & 0xffff; + lu->login_id = INVALID_LOGIN_ID; lu->retries = 0; lu->has_sdev = false; lu->blocked = false; @@ -1147,7 +1163,7 @@ static int sbp2_probe(struct device *dev) /* Do the login in a workqueue so we can easily reschedule retries. */ list_for_each_entry(lu, &tgt->lu_list, link) - sbp2_queue_work(lu, 0); + sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5)); return 0; fail_tgt_put: diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c index c1b8107..5e204713 100644 --- a/drivers/firewire/fw-topology.c +++ b/drivers/firewire/fw-topology.c @@ -413,7 +413,7 @@ static void update_tree(struct fw_card *card, struct fw_node *root) { struct list_head list0, list1; - struct fw_node *node0, *node1; + struct fw_node *node0, *node1, *next1; int i, event; INIT_LIST_HEAD(&list0); @@ -485,7 +485,9 @@ update_tree(struct fw_card *card, struct fw_node *root) } node0 = fw_node(node0->link.next); - node1 = fw_node(node1->link.next); + next1 = fw_node(node1->link.next); + fw_node_put(node1); + node1 = next1; } } diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index 027f58ce..aed7dbb 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h @@ -248,7 +248,7 @@ struct fw_card { struct fw_node *local_node; struct fw_node *root_node; struct fw_node *irm_node; - int color; + u8 color; /* must be u8 to match the definition in struct fw_node */ int gap_count; bool beta_repeaters_present; diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index f5999a9..b4fd8ca 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -247,7 +247,6 @@ config HID_SUNPLUS config THRUSTMASTER_FF tristate "ThrustMaster devices support" - default m depends on USB_HID select INPUT_FF_MEMLESS help @@ -256,7 +255,6 @@ config THRUSTMASTER_FF config ZEROPLUS_FF tristate "Zeroplus based game controller support" - default m depends on USB_HID select INPUT_FF_MEMLESS help diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index fd7f896..c6ab4ba 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c @@ -312,13 +312,6 @@ static int apple_probe(struct hid_device *hdev, unsigned int connect_mask = HID_CONNECT_DEFAULT; int ret; - /* return something else or move to hid layer? device will reside - allocated */ - if (id->bus == BUS_USB && (quirks & APPLE_IGNORE_MOUSE) && - to_usb_interface(hdev->dev.parent)->cur_altsetting-> - desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE) - return -ENODEV; - asc = kzalloc(sizeof(*asc), GFP_KERNEL); if (asc == NULL) { dev_err(&hdev->dev, "can't alloc apple descriptor\n"); @@ -367,38 +360,32 @@ static const struct hid_device_id apple_devices[] = { .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, + APPLE_ISO_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, + APPLE_ISO_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, + APPLE_RDESC_JIS }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, + APPLE_ISO_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS}, + APPLE_RDESC_JIS }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI), .driver_data = APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO), @@ -406,14 +393,12 @@ static const struct hid_device_id apple_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS), .driver_data = APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, + APPLE_RDESC_JIS }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), @@ -422,25 +407,21 @@ static const struct hid_device_id apple_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), - .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO), - .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD | - APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS), - .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI), - .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), - .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD | - APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS), - .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | - APPLE_IGNORE_MOUSE }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, /* Apple wireless Mighty Mouse */ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c), diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 721a36d..743e6f8 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1264,6 +1264,7 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, + { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, @@ -1275,8 +1276,6 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, - { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_LX3) }, - { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_V150) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, @@ -1295,6 +1294,7 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, + { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, @@ -1406,6 +1406,7 @@ static const struct hid_device_id hid_ignore_list[] = { { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)}, + { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM2)}, { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, @@ -1541,6 +1542,40 @@ static const struct hid_device_id hid_ignore_list[] = { { } }; +/** + * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer + * + * There are composite devices for which we want to ignore only a certain + * interface. This is a list of devices for which only the mouse interface will + * be ignored. This allows a dedicated driver to take care of the interface. + */ +static const struct hid_device_id hid_mouse_ignore_list[] = { + /* appletouch driver */ + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, + { } +}; + static bool hid_ignore(struct hid_device *hdev) { switch (hdev->vendor) { @@ -1557,6 +1592,10 @@ static bool hid_ignore(struct hid_device *hdev) break; } + if (hdev->type == HID_TYPE_USBMOUSE && + hid_match_id(hdev, hid_mouse_ignore_list)) + return true; + return !!hid_match_id(hdev, hid_ignore_list); } diff --git a/drivers/hid/hid-gyration.c b/drivers/hid/hid-gyration.c index ac5120f..04a0afe 100644 --- a/drivers/hid/hid-gyration.c +++ b/drivers/hid/hid-gyration.c @@ -4,9 +4,9 @@ * Copyright (c) 1999 Andreas Gal * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc - * Copyright (c) 2006-2007 Jiri Kosina * Copyright (c) 2007 Paul Walmsley * Copyright (c) 2008 Jiri Slaby + * Copyright (c) 2006-2008 Jiri Kosina */ /* @@ -40,6 +40,7 @@ static int gyration_input_mapping(struct hid_device *hdev, struct hid_input *hi, case 0x025: gy_map_key_clear(KEY_PVR); break; case 0x046: gy_map_key_clear(KEY_MEDIA); break; case 0x047: gy_map_key_clear(KEY_MP3); break; + case 0x048: gy_map_key_clear(KEY_MEDIA); break; case 0x049: gy_map_key_clear(KEY_CAMERA); break; case 0x04a: gy_map_key_clear(KEY_VIDEO); break; @@ -68,6 +69,7 @@ static int gyration_event(struct hid_device *hdev, struct hid_field *field, static const struct hid_device_id gyration_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, + { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, { } }; MODULE_DEVICE_TABLE(hid, gyration_devices); diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index d9a1ba9..a0d6a6c 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -89,6 +89,7 @@ #define USB_VENDOR_ID_ASUS 0x0b05 #define USB_DEVICE_ID_ASUS_LCM 0x1726 +#define USB_DEVICE_ID_ASUS_LCM2 0x175b #define USB_VENDOR_ID_ATEN 0x0557 #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 @@ -236,6 +237,7 @@ #define USB_VENDOR_ID_GYRATION 0x0c16 #define USB_DEVICE_ID_GYRATION_REMOTE 0x0002 +#define USB_DEVICE_ID_GYRATION_REMOTE_2 0x0003 #define USB_VENDOR_ID_HAPP 0x078b #define USB_DEVICE_ID_UGCI_DRIVING 0x0010 @@ -268,8 +270,6 @@ #define USB_DEVICE_ID_LD_MACHINETEST 0x2040 #define USB_VENDOR_ID_LOGITECH 0x046d -#define USB_DEVICE_ID_LOGITECH_LX3 0xc044 -#define USB_DEVICE_ID_LOGITECH_V150 0xc047 #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f @@ -350,6 +350,7 @@ #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 #define USB_VENDOR_ID_SONY 0x054c +#define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 #define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c index 406d8c8..2bae340 100644 --- a/drivers/hid/hid-lg.c +++ b/drivers/hid/hid-lg.c @@ -287,11 +287,6 @@ static const struct hid_device_id lg_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500), .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP }, - { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_LX3), - .driver_data = LG_INVERT_HWHEEL }, - { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_V150), - .driver_data = LG_INVERT_HWHEEL }, - { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D), .driver_data = LG_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL), diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 3af8095..86e563b 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -4,9 +4,9 @@ * Copyright (c) 1999 Andreas Gal * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc - * Copyright (c) 2006-2007 Jiri Kosina * Copyright (c) 2007 Paul Walmsley * Copyright (c) 2008 Jiri Slaby + * Copyright (c) 2006-2008 Jiri Kosina */ /* @@ -23,6 +23,26 @@ #include "hid-ids.h" +#define VAIO_RDESC_CONSTANT 0x0001 + +struct sony_sc { + unsigned long quirks; +}; + +/* Sony Vaio VGX has wrongly mouse pointer declared as constant */ +static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) +{ + struct sony_sc *sc = hid_get_drvdata(hdev); + + if ((sc->quirks & VAIO_RDESC_CONSTANT) && + rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) { + dev_info(&hdev->dev, "Fixing up Sony Vaio VGX report " + "descriptor\n"); + rdesc[55] = 0x06; + } +} + /* * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller * to "operational". Without this, the ps3 controller will not report any @@ -56,6 +76,17 @@ static int sony_set_operational(struct hid_device *hdev) static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) { int ret; + unsigned long quirks = id->driver_data; + struct sony_sc *sc; + + sc = kzalloc(sizeof(*sc), GFP_KERNEL); + if (sc == NULL) { + dev_err(&hdev->dev, "can't alloc apple descriptor\n"); + return -ENOMEM; + } + + sc->quirks = quirks; + hid_set_drvdata(hdev, sc); ret = hid_parse(hdev); if (ret) { @@ -78,11 +109,20 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) err_stop: hid_hw_stop(hdev); err_free: + kfree(sc); return ret; } +static void sony_remove(struct hid_device *hdev) +{ + hid_hw_stop(hdev); + kfree(hid_get_drvdata(hdev)); +} + static const struct hid_device_id sony_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, + { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE), + .driver_data = VAIO_RDESC_CONSTANT }, { } }; MODULE_DEVICE_TABLE(hid, sony_devices); @@ -91,6 +131,8 @@ static struct hid_driver sony_driver = { .name = "sony", .id_table = sony_devices, .probe = sony_probe, + .remove = sony_remove, + .report_fixup = sony_report_fixup, }; static int sony_init(void) diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index af3edb9..894d52e 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -264,6 +264,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, default: ret = -ENOTTY; } + unlock_kernel(); return ret; } @@ -403,7 +404,7 @@ out: return result; } -void __exit hidraw_exit(void) +void hidraw_exit(void) { dev_t dev_id = MKDEV(hidraw_major, 0); diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 705a43c..42bdd83 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -972,6 +972,9 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) hid->vendor = le16_to_cpu(dev->descriptor.idVendor); hid->product = le16_to_cpu(dev->descriptor.idProduct); hid->name[0] = 0; + if (intf->cur_altsetting->desc.bInterfaceProtocol == + USB_INTERFACE_PROTOCOL_MOUSE) + hid->type = HID_TYPE_USBMOUSE; if (dev->manufacturer) strlcpy(hid->name, dev->manufacturer, sizeof(hid->name)); diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index babd65d..3ac3207 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -436,8 +436,7 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd, if (copy_to_user(user_arg, uref, sizeof(*uref))) goto fault; - kfree(uref_multi); - return 0; + goto goodreturn; default: if (cmd != HIDIOCGUSAGE && diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index d9e7a49..70bb854 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c @@ -178,7 +178,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "+3.3V", 10, 0, 20, 1, 0 }, { "5VSB", 11, 0, 30, 1, 0 }, { "CPU", 24, 1, 1, 1, 0 }, - { "System ", 25, 1, 1, 1, 0 }, + { "System", 25, 1, 1, 1, 0 }, { "PWM", 26, 1, 1, 1, 0 }, { "CPU Fan", 32, 2, 60, 1, 0 }, { "NB Fan", 33, 2, 60, 1, 0 }, @@ -200,7 +200,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "+3.3V", 10, 0, 20, 1, 0 }, { "5VSB", 11, 0, 30, 1, 0 }, { "CPU", 24, 1, 1, 1, 0 }, - { "System ", 25, 1, 1, 1, 0 }, + { "System", 25, 1, 1, 1, 0 }, { "PWM1", 26, 1, 1, 1, 0 }, { "PWM2", 27, 1, 1, 1, 0 }, { "PWM3", 28, 1, 1, 1, 0 }, @@ -229,7 +229,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "+3.3V", 10, 0, 20, 1, 0 }, { "5VSB", 11, 0, 30, 1, 0 }, { "CPU", 24, 1, 1, 1, 0 }, - { "System ", 25, 1, 1, 1, 0 }, + { "System", 25, 1, 1, 1, 0 }, { "PWM", 26, 1, 1, 1, 0 }, { "CPU Fan", 32, 2, 60, 1, 0 }, { "NB Fan", 33, 2, 60, 1, 0 }, @@ -250,7 +250,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "+3.3V", 10, 0, 20, 1, 0 }, { "5VSB", 11, 0, 30, 1, 0 }, { "CPU", 24, 1, 1, 1, 0 }, - { "System ", 25, 1, 1, 1, 0 }, + { "System", 25, 1, 1, 1, 0 }, { "PWM", 26, 1, 1, 1, 0 }, { "CPU Fan", 32, 2, 60, 1, 0 }, { "NB Fan", 33, 2, 60, 1, 0 }, @@ -342,7 +342,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "+3.3V", 10, 0, 20, 1, 0 }, { "5VSB", 11, 0, 30, 1, 0 }, { "CPU", 24, 1, 1, 1, 0 }, - { "System ", 25, 1, 1, 1, 0 }, + { "System", 25, 1, 1, 1, 0 }, { "PWM1", 26, 1, 1, 1, 0 }, { "PWM2", 27, 1, 1, 1, 0 }, { "PWM3", 28, 1, 1, 1, 0 }, @@ -371,7 +371,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "+3.3V", 10, 0, 20, 1, 0 }, { "5VSB", 11, 0, 30, 1, 0 }, { "CPU", 24, 1, 1, 1, 0 }, - { "System ", 25, 1, 1, 1, 0 }, + { "System", 25, 1, 1, 1, 0 }, { "PWM", 26, 1, 1, 1, 0 }, { "CPU Fan", 32, 2, 60, 1, 0 }, { "NB Fan", 33, 2, 60, 1, 0 }, @@ -402,7 +402,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0016, NULL /* AW9D-MAX, need DMI string */, { + { 0x0016, "AW9D-MAX (Intel i975-ICH7)", { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 }, @@ -416,7 +416,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "+3.3V", 10, 0, 20, 1, 0 }, { "5VSB", 11, 0, 30, 1, 0 }, { "CPU", 24, 1, 1, 1, 0 }, - { "System ", 25, 1, 1, 1, 0 }, + { "System", 25, 1, 1, 1, 0 }, { "PWM1", 26, 1, 1, 1, 0 }, { "PWM2", 27, 1, 1, 1, 0 }, { "PWM3", 28, 1, 1, 1, 0 }, @@ -446,7 +446,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "ATX +3.3V", 10, 0, 20, 1, 0 }, { "ATX 5VSB", 11, 0, 30, 1, 0 }, { "CPU", 24, 1, 1, 1, 0 }, - { "System ", 26, 1, 1, 1, 0 }, + { "System", 26, 1, 1, 1, 0 }, { "PWM", 27, 1, 1, 1, 0 }, { "CPU FAN", 32, 2, 60, 1, 0 }, { "SYS FAN", 34, 2, 60, 1, 0 }, @@ -469,7 +469,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "+3.3V", 10, 0, 20, 1, 0 }, { "5VSB", 11, 0, 30, 1, 0 }, { "CPU", 24, 1, 1, 1, 0 }, - { "System ", 25, 1, 1, 1, 0 }, + { "System", 25, 1, 1, 1, 0 }, { "PWM Phase1", 26, 1, 1, 1, 0 }, { "PWM Phase2", 27, 1, 1, 1, 0 }, { "PWM Phase3", 28, 1, 1, 1, 0 }, @@ -487,7 +487,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "DDR2", 13, 0, 20, 1, 0 }, { "DDR2 VTT", 14, 0, 10, 1, 0 }, { "CPU VTT", 3, 0, 20, 1, 0 }, - { "NB 1.2V ", 4, 0, 10, 1, 0 }, + { "NB 1.2V", 4, 0, 10, 1, 0 }, { "SB 1.5V", 6, 0, 10, 1, 0 }, { "HyperTransport", 5, 0, 10, 1, 0 }, { "ATX +12V (24-Pin)", 12, 0, 60, 1, 0 }, @@ -496,7 +496,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "ATX +3.3V", 10, 0, 20, 1, 0 }, { "ATX 5VSB", 11, 0, 30, 1, 0 }, { "CPU", 24, 1, 1, 1, 0 }, - { "System ", 25, 1, 1, 1, 0 }, + { "System", 25, 1, 1, 1, 0 }, { "PWM Phase1", 26, 1, 1, 1, 0 }, { "PWM Phase2", 27, 1, 1, 1, 0 }, { "PWM Phase3", 28, 1, 1, 1, 0 }, @@ -523,8 +523,8 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "+3.3V", 10, 0, 20, 1, 0 }, { "5VSB", 11, 0, 30, 1, 0 }, { "CPU", 24, 1, 1, 1, 0 }, - { "System ", 25, 1, 1, 1, 0 }, - { "PWM ", 26, 1, 1, 1, 0 }, + { "System", 25, 1, 1, 1, 0 }, + { "PWM", 26, 1, 1, 1, 0 }, { "PWM Phase2", 27, 1, 1, 1, 0 }, { "PWM Phase3", 28, 1, 1, 1, 0 }, { "PWM Phase4", 29, 1, 1, 1, 0 }, @@ -947,7 +947,7 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) if (!abituguru3_motherboards[i].dmi_name) { printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was " "not detected using DMI. Please send the output of " - "\"dmidecode\" to the abituguru3 maintainer" + "\"dmidecode\" to the abituguru3 maintainer " "(see MAINTAINERS)\n"); } #endif diff --git a/drivers/hwmon/adt7473.c b/drivers/hwmon/adt7473.c index 3a0b631..b9a8ea3 100644 --- a/drivers/hwmon/adt7473.c +++ b/drivers/hwmon/adt7473.c @@ -319,35 +319,24 @@ out: } /* - * On this chip, voltages are given as a count of steps between a minimum - * and maximum voltage, not a direct voltage. + * Conversions */ -static const int volt_convert_table[][2] = { - {2997, 3}, - {4395, 4}, + +/* IN are scaled acording to built-in resistors */ +static const int adt7473_scaling[] = { /* .001 Volts */ + 2250, 3300 }; +#define SCALE(val, from, to) (((val) * (to) + ((from) / 2)) / (from)) static int decode_volt(int volt_index, u8 raw) { - int cmax = volt_convert_table[volt_index][0]; - int cmin = volt_convert_table[volt_index][1]; - return ((raw * (cmax - cmin)) / 255) + cmin; + return SCALE(raw, 192, adt7473_scaling[volt_index]); } static u8 encode_volt(int volt_index, int cooked) { - int cmax = volt_convert_table[volt_index][0]; - int cmin = volt_convert_table[volt_index][1]; - u8 x; - - if (cooked > cmax) - cooked = cmax; - else if (cooked < cmin) - cooked = cmin; - - x = ((cooked - cmin) * 255) / (cmax - cmin); - - return x; + int raw = SCALE(cooked, adt7473_scaling[volt_index], 192); + return SENSORS_LIMIT(raw, 0, 255); } static ssize_t show_volt_min(struct device *dev, diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c index c54eff9..bfc2961 100644 --- a/drivers/hwmon/hwmon-vid.c +++ b/drivers/hwmon/hwmon-vid.c @@ -180,6 +180,7 @@ static struct vrm_model vrm_models[] = { {X86_VENDOR_AMD, 0x6, ANY, ANY, 90}, /* Athlon Duron etc */ {X86_VENDOR_AMD, 0xF, 0x3F, ANY, 24}, /* Athlon 64, Opteron */ {X86_VENDOR_AMD, 0xF, ANY, ANY, 25}, /* NPT family 0Fh */ + {X86_VENDOR_AMD, 0x10, ANY, ANY, 25}, /* NPT family 10h */ {X86_VENDOR_INTEL, 0x6, 0x9, ANY, 13}, /* Pentium M (130 nm) */ {X86_VENDOR_INTEL, 0x6, 0xB, ANY, 85}, /* Tualatin */ {X86_VENDOR_INTEL, 0x6, 0xD, ANY, 13}, /* Pentium M (90 nm) */ diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 3edeebc..96a7018 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -12,9 +12,9 @@ * made by National Semiconductor. Both have an increased remote * temperature measurement accuracy (1 degree), and the LM99 * additionally shifts remote temperatures (measured and limits) by 16 - * degrees, which allows for higher temperatures measurement. The - * driver doesn't handle it since it can be done easily in user-space. + * degrees, which allows for higher temperatures measurement. * Note that there is no way to differentiate between both chips. + * When device is auto-detected, the driver will assume an LM99. * * This driver also supports the LM86, another sensor chip made by * National Semiconductor. It is exactly similar to the LM90 except it @@ -169,8 +169,8 @@ static const struct i2c_device_id lm90_id[] = { { "adt7461", adt7461 }, { "lm90", lm90 }, { "lm86", lm86 }, - { "lm89", lm99 }, - { "lm99", lm99 }, /* Missing temperature offset */ + { "lm89", lm86 }, + { "lm99", lm99 }, { "max6646", max6646 }, { "max6647", max6646 }, { "max6649", max6646 }, @@ -366,6 +366,10 @@ static ssize_t show_temp8(struct device *dev, struct device_attribute *devattr, else temp = temp_from_s8(data->temp8[attr->index]); + /* +16 degrees offset for temp2 for the LM99 */ + if (data->kind == lm99 && attr->index == 3) + temp += 16000; + return sprintf(buf, "%d\n", temp); } @@ -385,6 +389,10 @@ static ssize_t set_temp8(struct device *dev, struct device_attribute *devattr, long val = simple_strtol(buf, NULL, 10); int nr = attr->index; + /* +16 degrees offset for temp2 for the LM99 */ + if (data->kind == lm99 && attr->index == 3) + val -= 16000; + mutex_lock(&data->update_lock); if (data->kind == adt7461) data->temp8[nr] = temp_to_u8_adt7461(data, val); @@ -411,6 +419,10 @@ static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr, else temp = temp_from_s16(data->temp11[attr->index]); + /* +16 degrees offset for temp2 for the LM99 */ + if (data->kind == lm99 && attr->index <= 2) + temp += 16000; + return sprintf(buf, "%d\n", temp); } @@ -432,6 +444,10 @@ static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, long val = simple_strtol(buf, NULL, 10); int nr = attr->index; + /* +16 degrees offset for temp2 for the LM99 */ + if (data->kind == lm99 && attr->index <= 2) + val -= 16000; + mutex_lock(&data->update_lock); if (data->kind == adt7461) data->temp11[nr] = temp_to_u16_adt7461(data, val); @@ -461,9 +477,15 @@ static ssize_t show_temphyst(struct device *dev, struct device_attribute *devatt if (data->kind == adt7461) temp = temp_from_u8_adt7461(data, data->temp8[attr->index]); + else if (data->kind == max6646) + temp = temp_from_u8(data->temp8[attr->index]); else temp = temp_from_s8(data->temp8[attr->index]); + /* +16 degrees offset for temp2 for the LM99 */ + if (data->kind == lm99 && attr->index == 3) + temp += 16000; + return sprintf(buf, "%d\n", temp - temp_from_s8(data->temp_hyst)); } @@ -473,12 +495,19 @@ static ssize_t set_temphyst(struct device *dev, struct device_attribute *dummy, struct i2c_client *client = to_i2c_client(dev); struct lm90_data *data = i2c_get_clientdata(client); long val = simple_strtol(buf, NULL, 10); - long hyst; + int temp; mutex_lock(&data->update_lock); - hyst = temp_from_s8(data->temp8[2]) - val; + if (data->kind == adt7461) + temp = temp_from_u8_adt7461(data, data->temp8[2]); + else if (data->kind == max6646) + temp = temp_from_u8(data->temp8[2]); + else + temp = temp_from_s8(data->temp8[2]); + + data->temp_hyst = hyst_to_reg(temp - val); i2c_smbus_write_byte_data(client, LM90_REG_W_TCRIT_HYST, - hyst_to_reg(hyst)); + data->temp_hyst); mutex_unlock(&data->update_lock); return count; } @@ -682,6 +711,15 @@ static int lm90_detect(struct i2c_client *new_client, int kind, } else if ((chip_id & 0xF0) == 0x30) { /* LM89/LM99 */ kind = lm99; + dev_info(&adapter->dev, + "Assuming LM99 chip at " + "0x%02x\n", address); + dev_info(&adapter->dev, + "If it is an LM89, pass " + "force_lm86=%d,0x%02x when " + "loading the lm90 driver\n", + i2c_adapter_id(adapter), + address); } else if (address == 0x4C && (chip_id & 0xF0) == 0x10) { /* LM86 */ diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index d4d1b85..fc12bd4 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c @@ -1968,7 +1968,7 @@ exit: return res; } -static void __exit +static void w83781d_isa_unregister(void) { if (pdev) { @@ -2017,7 +2017,7 @@ w83781d_isa_register(void) return 0; } -static void __exit +static void w83781d_isa_unregister(void) { } diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index a820ca6..6d74017 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -720,6 +720,16 @@ config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ default "128" depends on BLK_DEV_IDE_AU1XXX +config BLK_DEV_IDE_TX4938 + tristate "TX4938 internal IDE support" + depends on SOC_TX4938 + select IDE_TIMINGS + +config BLK_DEV_IDE_TX4939 + tristate "TX4939 internal IDE support" + depends on SOC_TX4939 + select BLK_DEV_IDEDMA_SFF + config IDE_ARM tristate "ARM IDE support" depends on ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK) diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index 9cf92ac..7818d40 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile @@ -68,7 +68,6 @@ obj-$(CONFIG_BLK_DEV_VIA82CXXX) += via82cxxx.o # Must appear at the end of the block obj-$(CONFIG_BLK_DEV_GENERIC) += ide-pci-generic.o -ide-pci-generic-y += generic.o obj-$(CONFIG_IDEPCI_PCIBUS_ORDER) += ide-scan-pci.o @@ -111,3 +110,6 @@ obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o obj-$(CONFIG_BLK_DEV_PALMCHIP_BK3710) += palm_bk3710.o obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o + +obj-$(CONFIG_BLK_DEV_IDE_TX4938) += tx4938ide.o +obj-$(CONFIG_BLK_DEV_IDE_TX4939) += tx4939ide.o diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index 76bdc9a..2d84801 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c @@ -690,9 +690,9 @@ static int __init icside_init(void) return ecard_register_driver(&icside_driver); } -static void __exit icside_exit(void); +static void __exit icside_exit(void) { - ecard_unregister_driver(&icside_driver); + ecard_remove_driver(&icside_driver); } MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 133afd0..48b5eda 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1966,6 +1966,7 @@ static const struct cd_list_entry ide_cd_quirks_list[] = { { "Optiarc DVD RW AD-5200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, { "Optiarc DVD RW AD-7200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, { "Optiarc DVD RW AD-7543A", NULL, IDE_AFLAG_NO_AUTOCLOSE }, + { "TEAC CD-ROM CD-224E", NULL, IDE_AFLAG_NO_AUTOCLOSE }, { NULL, NULL, 0 } }; diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 223750c..e5adebe 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -600,6 +600,7 @@ static int ide_disk_check(ide_drive_t *drive, const char *s) static void ide_disk_setup(ide_drive_t *drive) { struct ide_disk_obj *idkp = drive->driver_data; + struct request_queue *q = drive->queue; ide_hwif_t *hwif = drive->hwif; u16 *id = drive->id; char *m = (char *)&id[ATA_ID_PROD]; @@ -626,11 +627,14 @@ static void ide_disk_setup(ide_drive_t *drive) if (max_s > hwif->rqsize) max_s = hwif->rqsize; - blk_queue_max_sectors(drive->queue, max_s); + blk_queue_max_sectors(q, max_s); } printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, - drive->queue->max_sectors / 2); + q->max_sectors / 2); + + if (ata_id_is_ssd(id) || ata_id_is_cfa(id)) + queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); /* calculate drive capacity, and select LBA if possible */ ide_disk_get_capacity(drive); diff --git a/drivers/ide/generic.c b/drivers/ide/ide-pci-generic.c index 474f96a..474f96a 100644 --- a/drivers/ide/generic.c +++ b/drivers/ide/ide-pci-generic.c diff --git a/drivers/ide/rapide.c b/drivers/ide/rapide.c index 78d27d9..d5003ca 100644 --- a/drivers/ide/rapide.c +++ b/drivers/ide/rapide.c @@ -11,7 +11,7 @@ #include <asm/ecard.h> -static struct const ide_port_info rapide_port_info = { +static const struct ide_port_info rapide_port_info = { .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, }; @@ -97,7 +97,7 @@ static int __init rapide_init(void) static void __exit rapide_exit(void) { - ecard_unregister_driver(&rapide_driver); + ecard_remove_driver(&rapide_driver); } MODULE_LICENSE("GPL"); diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index 49f163a..f26aa5d 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c @@ -536,10 +536,6 @@ static u8 scc_udma_filter(ide_drive_t *drive) static int setup_mmio_scc (struct pci_dev *dev, const char *name) { - unsigned long ctl_base = pci_resource_start(dev, 0); - unsigned long dma_base = pci_resource_start(dev, 1); - unsigned long ctl_size = pci_resource_len(dev, 0); - unsigned long dma_size = pci_resource_len(dev, 1); void __iomem *ctl_addr; void __iomem *dma_addr; int i, ret; @@ -557,10 +553,12 @@ static int setup_mmio_scc (struct pci_dev *dev, const char *name) return ret; } - if ((ctl_addr = ioremap(ctl_base, ctl_size)) == NULL) + ctl_addr = pci_ioremap_bar(dev, 0); + if (!ctl_addr) goto fail_0; - if ((dma_addr = ioremap(dma_base, dma_size)) == NULL) + dma_addr = pci_ioremap_bar(dev, 1); + if (!dma_addr) goto fail_1; pci_set_master(dev); diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c index 8af9b23..7defa0a 100644 --- a/drivers/ide/sgiioc4.c +++ b/drivers/ide/sgiioc4.c @@ -567,14 +567,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) unsigned long cmd_base, irqport; unsigned long bar0, cmd_phys_base, ctl; void __iomem *virt_base; - struct ide_host *host; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; - struct ide_port_info d = sgiioc4_port_info; int rc; /* Get the CmdBlk and CtrlBlk Base Registers */ bar0 = pci_resource_start(dev, 0); - virt_base = ioremap(bar0, pci_resource_len(dev, 0)); + virt_base = pci_ioremap_bar(dev, 0); if (virt_base == NULL) { printk(KERN_ERR "%s: Unable to remap BAR 0 address: 0x%lx\n", DRV_NAME, bar0); @@ -590,7 +588,8 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) printk(KERN_ERR "%s %s -- ERROR: addresses 0x%08lx to 0x%08lx " "already in use\n", DRV_NAME, pci_name(dev), cmd_phys_base, cmd_phys_base + IOC4_CMD_CTL_BLK_SIZE); - return -EBUSY; + rc = -EBUSY; + goto req_mem_rgn_err; } /* Initialize the IO registers */ @@ -603,21 +602,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) /* Initializing chipset IRQ Registers */ writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); - host = ide_host_alloc(&d, hws); - if (host == NULL) { - rc = -ENOMEM; - goto err; - } - - rc = ide_host_register(host, &d, hws); - if (rc) - goto err_free; + rc = ide_host_add(&sgiioc4_port_info, hws, NULL); + if (!rc) + return 0; - return 0; -err_free: - ide_host_free(host); -err: release_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE); +req_mem_rgn_err: iounmap(virt_base); return rc; } diff --git a/drivers/ide/siimage.c b/drivers/ide/siimage.c index eb4faf9..c3107df 100644 --- a/drivers/ide/siimage.c +++ b/drivers/ide/siimage.c @@ -784,7 +784,7 @@ static int __devinit siimage_init_one(struct pci_dev *dev, printk(KERN_WARNING DRV_NAME " %s: MMIO ports not " "available\n", pci_name(dev)); } else { - ioaddr = ioremap(bar5, barsize); + ioaddr = pci_ioremap_bar(dev, 5); if (ioaddr == NULL) release_mem_region(bar5, barsize); } diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c new file mode 100644 index 0000000..fa660f9 --- /dev/null +++ b/drivers/ide/tx4938ide.c @@ -0,0 +1,310 @@ +/* + * TX4938 internal IDE driver + * Based on tx4939ide.c. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * (C) Copyright TOSHIBA CORPORATION 2005-2007 + */ + +#include <linux/module.h> +#include <linux/types.h> +#include <linux/ide.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/io.h> +#include <asm/txx9/tx4938.h> + +static void tx4938ide_tune_ebusc(unsigned int ebus_ch, + unsigned int gbus_clock, + u8 pio) +{ + struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio); + u64 cr = __raw_readq(&tx4938_ebuscptr->cr[ebus_ch]); + unsigned int sp = (cr >> 4) & 3; + unsigned int clock = gbus_clock / (4 - sp); + unsigned int cycle = 1000000000 / clock; + unsigned int wt, shwt; + + /* Minimum DIOx- active time */ + wt = DIV_ROUND_UP(t->act8b, cycle) - 2; + /* IORDY setup time: 35ns */ + wt = max(wt, DIV_ROUND_UP(35, cycle)); + /* actual wait-cycle is max(wt & ~1, 1) */ + if (wt > 2 && (wt & 1)) + wt++; + wt &= ~1; + /* Address-valid to DIOR/DIOW setup */ + shwt = DIV_ROUND_UP(t->setup, cycle); + + pr_debug("tx4938ide: ebus %d, bus cycle %dns, WT %d, SHWT %d\n", + ebus_ch, cycle, wt, shwt); + + __raw_writeq((cr & ~(0x3f007ull)) | (wt << 12) | shwt, + &tx4938_ebuscptr->cr[ebus_ch]); +} + +static void tx4938ide_set_pio_mode(ide_drive_t *drive, const u8 pio) +{ + ide_hwif_t *hwif = drive->hwif; + struct tx4938ide_platform_info *pdata = hwif->dev->platform_data; + u8 safe = pio; + ide_drive_t *pair; + + pair = ide_get_pair_dev(drive); + if (pair) + safe = min(safe, ide_get_best_pio_mode(pair, 255, 5)); + tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, safe); +} + +#ifdef __BIG_ENDIAN + +/* custom iops (independent from SWAP_IO_SPACE) */ +static u8 tx4938ide_inb(unsigned long port) +{ + return __raw_readb((void __iomem *)port); +} + +static void tx4938ide_outb(u8 value, unsigned long port) +{ + __raw_writeb(value, (void __iomem *)port); +} + +static void tx4938ide_tf_load(ide_drive_t *drive, ide_task_t *task) +{ + ide_hwif_t *hwif = drive->hwif; + struct ide_io_ports *io_ports = &hwif->io_ports; + struct ide_taskfile *tf = &task->tf; + u8 HIHI = task->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; + + if (task->tf_flags & IDE_TFLAG_FLAGGED) + HIHI = 0xFF; + + if (task->tf_flags & IDE_TFLAG_OUT_DATA) { + u16 data = (tf->hob_data << 8) | tf->data; + + /* no endian swap */ + __raw_writew(data, (void __iomem *)io_ports->data_addr); + } + + if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) + tx4938ide_outb(tf->hob_feature, io_ports->feature_addr); + if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) + tx4938ide_outb(tf->hob_nsect, io_ports->nsect_addr); + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) + tx4938ide_outb(tf->hob_lbal, io_ports->lbal_addr); + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) + tx4938ide_outb(tf->hob_lbam, io_ports->lbam_addr); + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) + tx4938ide_outb(tf->hob_lbah, io_ports->lbah_addr); + + if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) + tx4938ide_outb(tf->feature, io_ports->feature_addr); + if (task->tf_flags & IDE_TFLAG_OUT_NSECT) + tx4938ide_outb(tf->nsect, io_ports->nsect_addr); + if (task->tf_flags & IDE_TFLAG_OUT_LBAL) + tx4938ide_outb(tf->lbal, io_ports->lbal_addr); + if (task->tf_flags & IDE_TFLAG_OUT_LBAM) + tx4938ide_outb(tf->lbam, io_ports->lbam_addr); + if (task->tf_flags & IDE_TFLAG_OUT_LBAH) + tx4938ide_outb(tf->lbah, io_ports->lbah_addr); + + if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) + tx4938ide_outb((tf->device & HIHI) | drive->select, + io_ports->device_addr); +} + +static void tx4938ide_tf_read(ide_drive_t *drive, ide_task_t *task) +{ + ide_hwif_t *hwif = drive->hwif; + struct ide_io_ports *io_ports = &hwif->io_ports; + struct ide_taskfile *tf = &task->tf; + + if (task->tf_flags & IDE_TFLAG_IN_DATA) { + u16 data; + + /* no endian swap */ + data = __raw_readw((void __iomem *)io_ports->data_addr); + tf->data = data & 0xff; + tf->hob_data = (data >> 8) & 0xff; + } + + /* be sure we're looking at the low order bits */ + tx4938ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); + + if (task->tf_flags & IDE_TFLAG_IN_FEATURE) + tf->feature = tx4938ide_inb(io_ports->feature_addr); + if (task->tf_flags & IDE_TFLAG_IN_NSECT) + tf->nsect = tx4938ide_inb(io_ports->nsect_addr); + if (task->tf_flags & IDE_TFLAG_IN_LBAL) + tf->lbal = tx4938ide_inb(io_ports->lbal_addr); + if (task->tf_flags & IDE_TFLAG_IN_LBAM) + tf->lbam = tx4938ide_inb(io_ports->lbam_addr); + if (task->tf_flags & IDE_TFLAG_IN_LBAH) + tf->lbah = tx4938ide_inb(io_ports->lbah_addr); + if (task->tf_flags & IDE_TFLAG_IN_DEVICE) + tf->device = tx4938ide_inb(io_ports->device_addr); + + if (task->tf_flags & IDE_TFLAG_LBA48) { + tx4938ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); + + if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) + tf->hob_feature = + tx4938ide_inb(io_ports->feature_addr); + if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) + tf->hob_nsect = tx4938ide_inb(io_ports->nsect_addr); + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) + tf->hob_lbal = tx4938ide_inb(io_ports->lbal_addr); + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) + tf->hob_lbam = tx4938ide_inb(io_ports->lbam_addr); + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) + tf->hob_lbah = tx4938ide_inb(io_ports->lbah_addr); + } +} + +static void tx4938ide_input_data_swap(ide_drive_t *drive, struct request *rq, + void *buf, unsigned int len) +{ + unsigned long port = drive->hwif->io_ports.data_addr; + unsigned short *ptr = buf; + unsigned int count = (len + 1) / 2; + + while (count--) + *ptr++ = cpu_to_le16(__raw_readw((void __iomem *)port)); + __ide_flush_dcache_range((unsigned long)buf, count * 2); +} + +static void tx4938ide_output_data_swap(ide_drive_t *drive, struct request *rq, + void *buf, unsigned int len) +{ + unsigned long port = drive->hwif->io_ports.data_addr; + unsigned short *ptr = buf; + unsigned int count = (len + 1) / 2; + + while (count--) { + __raw_writew(le16_to_cpu(*ptr), (void __iomem *)port); + ptr++; + } + __ide_flush_dcache_range((unsigned long)buf, count * 2); +} + +static const struct ide_tp_ops tx4938ide_tp_ops = { + .exec_command = ide_exec_command, + .read_status = ide_read_status, + .read_altstatus = ide_read_altstatus, + .read_sff_dma_status = ide_read_sff_dma_status, + + .set_irq = ide_set_irq, + + .tf_load = tx4938ide_tf_load, + .tf_read = tx4938ide_tf_read, + + .input_data = tx4938ide_input_data_swap, + .output_data = tx4938ide_output_data_swap, +}; + +#endif /* __BIG_ENDIAN */ + +static const struct ide_port_ops tx4938ide_port_ops = { + .set_pio_mode = tx4938ide_set_pio_mode, +}; + +static const struct ide_port_info tx4938ide_port_info __initdata = { + .port_ops = &tx4938ide_port_ops, +#ifdef __BIG_ENDIAN + .tp_ops = &tx4938ide_tp_ops, +#endif + .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, + .pio_mask = ATA_PIO5, +}; + +static int __init tx4938ide_probe(struct platform_device *pdev) +{ + hw_regs_t hw; + hw_regs_t *hws[] = { &hw, NULL, NULL, NULL }; + struct ide_host *host; + struct resource *res; + struct tx4938ide_platform_info *pdata = pdev->dev.platform_data; + int irq, ret, i; + unsigned long mapbase; + struct ide_port_info d = tx4938ide_port_info; + + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return -ENODEV; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + + if (!devm_request_mem_region(&pdev->dev, res->start, + res->end - res->start + 1, "tx4938ide")) + return -EBUSY; + mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start, + res->end - res->start + 1); + if (!mapbase) + return -EBUSY; + + memset(&hw, 0, sizeof(hw)); + if (pdata->ioport_shift) { + unsigned long port = mapbase; + + hw.io_ports_array[0] = port; +#ifdef __BIG_ENDIAN + port++; +#endif + for (i = 1; i <= 7; i++) + hw.io_ports_array[i] = + port + (i << pdata->ioport_shift); + hw.io_ports.ctl_addr = + port + 0x10000 + (6 << pdata->ioport_shift); + } else + ide_std_init_ports(&hw, mapbase, mapbase + 0x10006); + hw.irq = irq; + hw.dev = &pdev->dev; + + pr_info("TX4938 IDE interface (base %#lx, irq %d)\n", mapbase, hw.irq); + if (pdata->gbus_clock) + tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, 0); + else + d.port_ops = NULL; + ret = ide_host_add(&d, hws, &host); + if (ret) + return ret; + platform_set_drvdata(pdev, host); + return 0; +} + +static int __exit tx4938ide_remove(struct platform_device *pdev) +{ + struct ide_host *host = platform_get_drvdata(pdev); + + ide_host_remove(host); + return 0; +} + +static struct platform_driver tx4938ide_driver = { + .driver = { + .name = "tx4938ide", + .owner = THIS_MODULE, + }, + .remove = __exit_p(tx4938ide_remove), +}; + +static int __init tx4938ide_init(void) +{ + return platform_driver_probe(&tx4938ide_driver, tx4938ide_probe); +} + +static void __exit tx4938ide_exit(void) +{ + platform_driver_unregister(&tx4938ide_driver); +} + +module_init(tx4938ide_init); +module_exit(tx4938ide_exit); + +MODULE_DESCRIPTION("TX4938 internal IDE driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:tx4938ide"); diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c new file mode 100644 index 0000000..bafb7d1 --- /dev/null +++ b/drivers/ide/tx4939ide.c @@ -0,0 +1,754 @@ +/* + * TX4939 internal IDE driver + * Based on RBTX49xx patch from CELF patch archive. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * (C) Copyright TOSHIBA CORPORATION 2005-2007 + */ + +#include <linux/module.h> +#include <linux/types.h> +#include <linux/ide.h> +#include <linux/init.h> +#include <linux/delay.h> +#include <linux/platform_device.h> +#include <linux/io.h> +#include <linux/scatterlist.h> + +#define MODNAME "tx4939ide" + +/* ATA Shadow Registers (8-bit except for Data which is 16-bit) */ +#define TX4939IDE_Data 0x000 +#define TX4939IDE_Error_Feature 0x001 +#define TX4939IDE_Sec 0x002 +#define TX4939IDE_LBA0 0x003 +#define TX4939IDE_LBA1 0x004 +#define TX4939IDE_LBA2 0x005 +#define TX4939IDE_DevHead 0x006 +#define TX4939IDE_Stat_Cmd 0x007 +#define TX4939IDE_AltStat_DevCtl 0x402 +/* H/W DMA Registers */ +#define TX4939IDE_DMA_Cmd 0x800 /* 8-bit */ +#define TX4939IDE_DMA_Stat 0x802 /* 8-bit */ +#define TX4939IDE_PRD_Ptr 0x804 /* 32-bit */ +/* ATA100 CORE Registers (16-bit) */ +#define TX4939IDE_Sys_Ctl 0xc00 +#define TX4939IDE_Xfer_Cnt_1 0xc08 +#define TX4939IDE_Xfer_Cnt_2 0xc0a +#define TX4939IDE_Sec_Cnt 0xc10 +#define TX4939IDE_Start_Lo_Addr 0xc18 +#define TX4939IDE_Start_Up_Addr 0xc20 +#define TX4939IDE_Add_Ctl 0xc28 +#define TX4939IDE_Lo_Burst_Cnt 0xc30 +#define TX4939IDE_Up_Burst_Cnt 0xc38 +#define TX4939IDE_PIO_Addr 0xc88 +#define TX4939IDE_H_Rst_Tim 0xc90 +#define TX4939IDE_Int_Ctl 0xc98 +#define TX4939IDE_Pkt_Cmd 0xcb8 +#define TX4939IDE_Bxfer_Cnt_Hi 0xcc0 +#define TX4939IDE_Bxfer_Cnt_Lo 0xcc8 +#define TX4939IDE_Dev_TErr 0xcd0 +#define TX4939IDE_Pkt_Xfer_Ctl 0xcd8 +#define TX4939IDE_Start_TAddr 0xce0 + +/* bits for Int_Ctl */ +#define TX4939IDE_INT_ADDRERR 0x80 +#define TX4939IDE_INT_REACHMUL 0x40 +#define TX4939IDE_INT_DEVTIMING 0x20 +#define TX4939IDE_INT_UDMATERM 0x10 +#define TX4939IDE_INT_TIMER 0x08 +#define TX4939IDE_INT_BUSERR 0x04 +#define TX4939IDE_INT_XFEREND 0x02 +#define TX4939IDE_INT_HOST 0x01 + +#define TX4939IDE_IGNORE_INTS \ + (TX4939IDE_INT_ADDRERR | TX4939IDE_INT_REACHMUL | \ + TX4939IDE_INT_DEVTIMING | TX4939IDE_INT_UDMATERM | \ + TX4939IDE_INT_TIMER | TX4939IDE_INT_XFEREND) + +#ifdef __BIG_ENDIAN +#define tx4939ide_swizzlel(a) ((a) ^ 4) +#define tx4939ide_swizzlew(a) ((a) ^ 6) +#define tx4939ide_swizzleb(a) ((a) ^ 7) +#else +#define tx4939ide_swizzlel(a) (a) +#define tx4939ide_swizzlew(a) (a) +#define tx4939ide_swizzleb(a) (a) +#endif + +static u16 tx4939ide_readw(void __iomem *base, u32 reg) +{ + return __raw_readw(base + tx4939ide_swizzlew(reg)); +} +static u8 tx4939ide_readb(void __iomem *base, u32 reg) +{ + return __raw_readb(base + tx4939ide_swizzleb(reg)); +} +static void tx4939ide_writel(u32 val, void __iomem *base, u32 reg) +{ + __raw_writel(val, base + tx4939ide_swizzlel(reg)); +} +static void tx4939ide_writew(u16 val, void __iomem *base, u32 reg) +{ + __raw_writew(val, base + tx4939ide_swizzlew(reg)); +} +static void tx4939ide_writeb(u8 val, void __iomem *base, u32 reg) +{ + __raw_writeb(val, base + tx4939ide_swizzleb(reg)); +} + +#define TX4939IDE_BASE(hwif) ((void __iomem *)(hwif)->extra_base) + +static void tx4939ide_set_pio_mode(ide_drive_t *drive, const u8 pio) +{ + ide_hwif_t *hwif = drive->hwif; + int is_slave = drive->dn; + u32 mask, val; + u8 safe = pio; + ide_drive_t *pair; + + pair = ide_get_pair_dev(drive); + if (pair) + safe = min(safe, ide_get_best_pio_mode(pair, 255, 4)); + /* + * Update Command Transfer Mode for master/slave and Data + * Transfer Mode for this drive. + */ + mask = is_slave ? 0x07f00000 : 0x000007f0; + val = ((safe << 8) | (pio << 4)) << (is_slave ? 16 : 0); + hwif->select_data = (hwif->select_data & ~mask) | val; + /* tx4939ide_tf_load_fixup() will set the Sys_Ctl register */ +} + +static void tx4939ide_set_dma_mode(ide_drive_t *drive, const u8 mode) +{ + ide_hwif_t *hwif = drive->hwif; + u32 mask, val; + + /* Update Data Transfer Mode for this drive. */ + if (mode >= XFER_UDMA_0) + val = mode - XFER_UDMA_0 + 8; + else + val = mode - XFER_MW_DMA_0 + 5; + if (drive->dn) { + mask = 0x00f00000; + val <<= 20; + } else { + mask = 0x000000f0; + val <<= 4; + } + hwif->select_data = (hwif->select_data & ~mask) | val; + /* tx4939ide_tf_load_fixup() will set the Sys_Ctl register */ +} + +static u16 tx4939ide_check_error_ints(ide_hwif_t *hwif) +{ + void __iomem *base = TX4939IDE_BASE(hwif); + u16 ctl = tx4939ide_readw(base, TX4939IDE_Int_Ctl); + + if (ctl & TX4939IDE_INT_BUSERR) { + /* reset FIFO */ + u16 sysctl = tx4939ide_readw(base, TX4939IDE_Sys_Ctl); + + tx4939ide_writew(sysctl | 0x4000, base, TX4939IDE_Sys_Ctl); + mmiowb(); + /* wait 12GBUSCLK (typ. 60ns @ GBUS200MHz, max 270ns) */ + ndelay(270); + tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); + } + if (ctl & (TX4939IDE_INT_ADDRERR | + TX4939IDE_INT_DEVTIMING | TX4939IDE_INT_BUSERR)) + pr_err("%s: Error interrupt %#x (%s%s%s )\n", + hwif->name, ctl, + ctl & TX4939IDE_INT_ADDRERR ? " Address-Error" : "", + ctl & TX4939IDE_INT_DEVTIMING ? " DEV-Timing" : "", + ctl & TX4939IDE_INT_BUSERR ? " Bus-Error" : ""); + return ctl; +} + +static void tx4939ide_clear_irq(ide_drive_t *drive) +{ + ide_hwif_t *hwif; + void __iomem *base; + u16 ctl; + + /* + * tx4939ide_dma_test_irq() and tx4939ide_dma_end() do all job + * for DMA case. + */ + if (drive->waiting_for_dma) + return; + hwif = drive->hwif; + base = TX4939IDE_BASE(hwif); + ctl = tx4939ide_check_error_ints(hwif); + tx4939ide_writew(ctl, base, TX4939IDE_Int_Ctl); +} + +static u8 tx4939ide_cable_detect(ide_hwif_t *hwif) +{ + void __iomem *base = TX4939IDE_BASE(hwif); + + return tx4939ide_readw(base, TX4939IDE_Sys_Ctl) & 0x2000 ? + ATA_CBL_PATA40 : ATA_CBL_PATA80; +} + +#ifdef __BIG_ENDIAN +static void tx4939ide_dma_host_set(ide_drive_t *drive, int on) +{ + ide_hwif_t *hwif = drive->hwif; + u8 unit = drive->dn; + void __iomem *base = TX4939IDE_BASE(hwif); + u8 dma_stat = tx4939ide_readb(base, TX4939IDE_DMA_Stat); + + if (on) + dma_stat |= (1 << (5 + unit)); + else + dma_stat &= ~(1 << (5 + unit)); + + tx4939ide_writeb(dma_stat, base, TX4939IDE_DMA_Stat); +} +#else +#define tx4939ide_dma_host_set ide_dma_host_set +#endif + +static u8 tx4939ide_clear_dma_status(void __iomem *base) +{ + u8 dma_stat; + + /* read DMA status for INTR & ERROR flags */ + dma_stat = tx4939ide_readb(base, TX4939IDE_DMA_Stat); + /* clear INTR & ERROR flags */ + tx4939ide_writeb(dma_stat | ATA_DMA_INTR | ATA_DMA_ERR, base, + TX4939IDE_DMA_Stat); + /* recover intmask cleared by writing to bit2 of DMA_Stat */ + tx4939ide_writew(TX4939IDE_IGNORE_INTS << 8, base, TX4939IDE_Int_Ctl); + return dma_stat; +} + +#ifdef __BIG_ENDIAN +/* custom ide_build_dmatable to handle swapped layout */ +static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq) +{ + ide_hwif_t *hwif = drive->hwif; + u32 *table = (u32 *)hwif->dmatable_cpu; + unsigned int count = 0; + int i; + struct scatterlist *sg; + + hwif->sg_nents = ide_build_sglist(drive, rq); + if (hwif->sg_nents == 0) + return 0; + + for_each_sg(hwif->sg_table, sg, hwif->sg_nents, i) { + u32 cur_addr, cur_len, bcount; + + cur_addr = sg_dma_address(sg); + cur_len = sg_dma_len(sg); + + /* + * Fill in the DMA table, without crossing any 64kB boundaries. + */ + + while (cur_len) { + if (count++ >= PRD_ENTRIES) + goto use_pio_instead; + + bcount = 0x10000 - (cur_addr & 0xffff); + if (bcount > cur_len) + bcount = cur_len; + *table++ = bcount & 0xffff; + *table++ = cur_addr; + cur_addr += bcount; + cur_len -= bcount; + } + } + + if (count) { + *(table - 2) |= 0x80000000; + return count; + } + +use_pio_instead: + printk(KERN_ERR "%s: %s\n", drive->name, + count ? "DMA table too small" : "empty DMA table?"); + + ide_destroy_dmatable(drive); + + return 0; /* revert to PIO for this request */ +} +#else +#define tx4939ide_build_dmatable ide_build_dmatable +#endif + +static int tx4939ide_dma_setup(ide_drive_t *drive) +{ + ide_hwif_t *hwif = drive->hwif; + void __iomem *base = TX4939IDE_BASE(hwif); + struct request *rq = hwif->hwgroup->rq; + u8 reading; + int nent; + + if (rq_data_dir(rq)) + reading = 0; + else + reading = ATA_DMA_WR; + + /* fall back to PIO! */ + nent = tx4939ide_build_dmatable(drive, rq); + if (!nent) { + ide_map_sg(drive, rq); + return 1; + } + + /* PRD table */ + tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr); + + /* specify r/w */ + tx4939ide_writeb(reading, base, TX4939IDE_DMA_Cmd); + + /* clear INTR & ERROR flags */ + tx4939ide_clear_dma_status(base); + + drive->waiting_for_dma = 1; + + tx4939ide_writew(SECTOR_SIZE / 2, base, drive->dn ? + TX4939IDE_Xfer_Cnt_2 : TX4939IDE_Xfer_Cnt_1); + tx4939ide_writew(rq->nr_sectors, base, TX4939IDE_Sec_Cnt); + return 0; +} + +static int tx4939ide_dma_end(ide_drive_t *drive) +{ + ide_hwif_t *hwif = drive->hwif; + u8 dma_stat, dma_cmd; + void __iomem *base = TX4939IDE_BASE(hwif); + u16 ctl = tx4939ide_readw(base, TX4939IDE_Int_Ctl); + + drive->waiting_for_dma = 0; + + /* get DMA command mode */ + dma_cmd = tx4939ide_readb(base, TX4939IDE_DMA_Cmd); + /* stop DMA */ + tx4939ide_writeb(dma_cmd & ~ATA_DMA_START, base, TX4939IDE_DMA_Cmd); + + /* read and clear the INTR & ERROR bits */ + dma_stat = tx4939ide_clear_dma_status(base); + + /* purge DMA mappings */ + ide_destroy_dmatable(drive); + /* verify good DMA status */ + wmb(); + + if ((dma_stat & (ATA_DMA_INTR | ATA_DMA_ERR | ATA_DMA_ACTIVE)) == 0 && + (ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) == + (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) + /* INT_IDE lost... bug? */ + return 0; + return ((dma_stat & (ATA_DMA_INTR | ATA_DMA_ERR | ATA_DMA_ACTIVE)) != + ATA_DMA_INTR) ? 0x10 | dma_stat : 0; +} + +/* returns 1 if DMA IRQ issued, 0 otherwise */ +static int tx4939ide_dma_test_irq(ide_drive_t *drive) +{ + ide_hwif_t *hwif = drive->hwif; + void __iomem *base = TX4939IDE_BASE(hwif); + u16 ctl, ide_int; + u8 dma_stat, stat; + int found = 0; + + ctl = tx4939ide_check_error_ints(hwif); + ide_int = ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST); + switch (ide_int) { + case TX4939IDE_INT_HOST: + /* On error, XFEREND might not be asserted. */ + stat = tx4939ide_readb(base, TX4939IDE_AltStat_DevCtl); + if ((stat & (ATA_BUSY | ATA_DRQ | ATA_ERR)) == ATA_ERR) + found = 1; + else + /* Wait for XFEREND (Mask HOST and unmask XFEREND) */ + ctl &= ~TX4939IDE_INT_XFEREND << 8; + ctl |= ide_int << 8; + break; + case TX4939IDE_INT_HOST | TX4939IDE_INT_XFEREND: + dma_stat = tx4939ide_readb(base, TX4939IDE_DMA_Stat); + if (!(dma_stat & ATA_DMA_INTR)) + pr_warning("%s: weird interrupt status. " + "DMA_Stat %#02x int_ctl %#04x\n", + hwif->name, dma_stat, ctl); + found = 1; + break; + } + /* + * Do not clear XFEREND, HOST now. They will be cleared by + * clearing bit2 of DMA_Stat. + */ + ctl &= ~ide_int; + tx4939ide_writew(ctl, base, TX4939IDE_Int_Ctl); + return found; +} + +static void tx4939ide_init_hwif(ide_hwif_t *hwif) +{ + void __iomem *base = TX4939IDE_BASE(hwif); + + /* Soft Reset */ + tx4939ide_writew(0x8000, base, TX4939IDE_Sys_Ctl); + mmiowb(); + /* at least 20 GBUSCLK (typ. 100ns @ GBUS200MHz, max 450ns) */ + ndelay(450); + tx4939ide_writew(0x0000, base, TX4939IDE_Sys_Ctl); + /* mask some interrupts and clear all interrupts */ + tx4939ide_writew((TX4939IDE_IGNORE_INTS << 8) | 0xff, base, + TX4939IDE_Int_Ctl); + + tx4939ide_writew(0x0008, base, TX4939IDE_Lo_Burst_Cnt); + tx4939ide_writew(0, base, TX4939IDE_Up_Burst_Cnt); +} + +static int tx4939ide_init_dma(ide_hwif_t *hwif, const struct ide_port_info *d) +{ + hwif->dma_base = + hwif->extra_base + tx4939ide_swizzleb(TX4939IDE_DMA_Cmd); + /* + * Note that we cannot use ATA_DMA_TABLE_OFS, ATA_DMA_STATUS + * for big endian. + */ + return ide_allocate_dma_engine(hwif); +} + +static void tx4939ide_tf_load_fixup(ide_drive_t *drive, ide_task_t *task) +{ + ide_hwif_t *hwif = drive->hwif; + void __iomem *base = TX4939IDE_BASE(hwif); + u16 sysctl = hwif->select_data >> (drive->dn ? 16 : 0); + + /* + * Fix ATA100 CORE System Control Register. (The write to the + * Device/Head register may write wrong data to the System + * Control Register) + * While Sys_Ctl is written here, selectproc is not needed. + */ + tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); +} + +#ifdef __BIG_ENDIAN + +static u8 tx4939ide_read_sff_dma_status(ide_hwif_t *hwif) +{ + void __iomem *base = TX4939IDE_BASE(hwif); + + return tx4939ide_readb(base, TX4939IDE_DMA_Stat); +} + +/* custom iops (independent from SWAP_IO_SPACE) */ +static u8 tx4939ide_inb(unsigned long port) +{ + return __raw_readb((void __iomem *)port); +} + +static void tx4939ide_outb(u8 value, unsigned long port) +{ + __raw_writeb(value, (void __iomem *)port); +} + +static void tx4939ide_tf_load(ide_drive_t *drive, ide_task_t *task) +{ + ide_hwif_t *hwif = drive->hwif; + struct ide_io_ports *io_ports = &hwif->io_ports; + struct ide_taskfile *tf = &task->tf; + u8 HIHI = task->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; + + if (task->tf_flags & IDE_TFLAG_FLAGGED) + HIHI = 0xFF; + + if (task->tf_flags & IDE_TFLAG_OUT_DATA) { + u16 data = (tf->hob_data << 8) | tf->data; + + /* no endian swap */ + __raw_writew(data, (void __iomem *)io_ports->data_addr); + } + + if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) + tx4939ide_outb(tf->hob_feature, io_ports->feature_addr); + if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) + tx4939ide_outb(tf->hob_nsect, io_ports->nsect_addr); + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) + tx4939ide_outb(tf->hob_lbal, io_ports->lbal_addr); + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) + tx4939ide_outb(tf->hob_lbam, io_ports->lbam_addr); + if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) + tx4939ide_outb(tf->hob_lbah, io_ports->lbah_addr); + + if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) + tx4939ide_outb(tf->feature, io_ports->feature_addr); + if (task->tf_flags & IDE_TFLAG_OUT_NSECT) + tx4939ide_outb(tf->nsect, io_ports->nsect_addr); + if (task->tf_flags & IDE_TFLAG_OUT_LBAL) + tx4939ide_outb(tf->lbal, io_ports->lbal_addr); + if (task->tf_flags & IDE_TFLAG_OUT_LBAM) + tx4939ide_outb(tf->lbam, io_ports->lbam_addr); + if (task->tf_flags & IDE_TFLAG_OUT_LBAH) + tx4939ide_outb(tf->lbah, io_ports->lbah_addr); + + if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) { + tx4939ide_outb((tf->device & HIHI) | drive->select, + io_ports->device_addr); + tx4939ide_tf_load_fixup(drive, task); + } +} + +static void tx4939ide_tf_read(ide_drive_t *drive, ide_task_t *task) +{ + ide_hwif_t *hwif = drive->hwif; + struct ide_io_ports *io_ports = &hwif->io_ports; + struct ide_taskfile *tf = &task->tf; + + if (task->tf_flags & IDE_TFLAG_IN_DATA) { + u16 data; + + /* no endian swap */ + data = __raw_readw((void __iomem *)io_ports->data_addr); + tf->data = data & 0xff; + tf->hob_data = (data >> 8) & 0xff; + } + + /* be sure we're looking at the low order bits */ + tx4939ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); + + if (task->tf_flags & IDE_TFLAG_IN_FEATURE) + tf->feature = tx4939ide_inb(io_ports->feature_addr); + if (task->tf_flags & IDE_TFLAG_IN_NSECT) + tf->nsect = tx4939ide_inb(io_ports->nsect_addr); + if (task->tf_flags & IDE_TFLAG_IN_LBAL) + tf->lbal = tx4939ide_inb(io_ports->lbal_addr); + if (task->tf_flags & IDE_TFLAG_IN_LBAM) + tf->lbam = tx4939ide_inb(io_ports->lbam_addr); + if (task->tf_flags & IDE_TFLAG_IN_LBAH) + tf->lbah = tx4939ide_inb(io_ports->lbah_addr); + if (task->tf_flags & IDE_TFLAG_IN_DEVICE) + tf->device = tx4939ide_inb(io_ports->device_addr); + + if (task->tf_flags & IDE_TFLAG_LBA48) { + tx4939ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); + + if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) + tf->hob_feature = + tx4939ide_inb(io_ports->feature_addr); + if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) + tf->hob_nsect = tx4939ide_inb(io_ports->nsect_addr); + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) + tf->hob_lbal = tx4939ide_inb(io_ports->lbal_addr); + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) + tf->hob_lbam = tx4939ide_inb(io_ports->lbam_addr); + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) + tf->hob_lbah = tx4939ide_inb(io_ports->lbah_addr); + } +} + +static void tx4939ide_input_data_swap(ide_drive_t *drive, struct request *rq, + void *buf, unsigned int len) +{ + unsigned long port = drive->hwif->io_ports.data_addr; + unsigned short *ptr = buf; + unsigned int count = (len + 1) / 2; + + while (count--) + *ptr++ = cpu_to_le16(__raw_readw((void __iomem *)port)); + __ide_flush_dcache_range((unsigned long)buf, count * 2); +} + +static void tx4939ide_output_data_swap(ide_drive_t *drive, struct request *rq, + void *buf, unsigned int len) +{ + unsigned long port = drive->hwif->io_ports.data_addr; + unsigned short *ptr = buf; + unsigned int count = (len + 1) / 2; + + while (count--) { + __raw_writew(le16_to_cpu(*ptr), (void __iomem *)port); + ptr++; + } + __ide_flush_dcache_range((unsigned long)buf, count * 2); +} + +static const struct ide_tp_ops tx4939ide_tp_ops = { + .exec_command = ide_exec_command, + .read_status = ide_read_status, + .read_altstatus = ide_read_altstatus, + .read_sff_dma_status = tx4939ide_read_sff_dma_status, + + .set_irq = ide_set_irq, + + .tf_load = tx4939ide_tf_load, + .tf_read = tx4939ide_tf_read, + + .input_data = tx4939ide_input_data_swap, + .output_data = tx4939ide_output_data_swap, +}; + +#else /* __LITTLE_ENDIAN */ + +static void tx4939ide_tf_load(ide_drive_t *drive, ide_task_t *task) +{ + ide_tf_load(drive, task); + if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) + tx4939ide_tf_load_fixup(drive, task); +} + +static const struct ide_tp_ops tx4939ide_tp_ops = { + .exec_command = ide_exec_command, + .read_status = ide_read_status, + .read_altstatus = ide_read_altstatus, + .read_sff_dma_status = ide_read_sff_dma_status, + + .set_irq = ide_set_irq, + + .tf_load = tx4939ide_tf_load, + .tf_read = ide_tf_read, + + .input_data = ide_input_data, + .output_data = ide_output_data, +}; + +#endif /* __LITTLE_ENDIAN */ + +static const struct ide_port_ops tx4939ide_port_ops = { + .set_pio_mode = tx4939ide_set_pio_mode, + .set_dma_mode = tx4939ide_set_dma_mode, + .clear_irq = tx4939ide_clear_irq, + .cable_detect = tx4939ide_cable_detect, +}; + +static const struct ide_dma_ops tx4939ide_dma_ops = { + .dma_host_set = tx4939ide_dma_host_set, + .dma_setup = tx4939ide_dma_setup, + .dma_exec_cmd = ide_dma_exec_cmd, + .dma_start = ide_dma_start, + .dma_end = tx4939ide_dma_end, + .dma_test_irq = tx4939ide_dma_test_irq, + .dma_lost_irq = ide_dma_lost_irq, + .dma_timeout = ide_dma_timeout, +}; + +static const struct ide_port_info tx4939ide_port_info __initdata = { + .init_hwif = tx4939ide_init_hwif, + .init_dma = tx4939ide_init_dma, + .port_ops = &tx4939ide_port_ops, + .dma_ops = &tx4939ide_dma_ops, + .tp_ops = &tx4939ide_tp_ops, + .host_flags = IDE_HFLAG_MMIO, + .pio_mask = ATA_PIO4, + .mwdma_mask = ATA_MWDMA2, + .udma_mask = ATA_UDMA5, +}; + +static int __init tx4939ide_probe(struct platform_device *pdev) +{ + hw_regs_t hw; + hw_regs_t *hws[] = { &hw, NULL, NULL, NULL }; + struct ide_host *host; + struct resource *res; + int irq, ret; + unsigned long mapbase; + + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return -ENODEV; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + + if (!devm_request_mem_region(&pdev->dev, res->start, + res->end - res->start + 1, "tx4938ide")) + return -EBUSY; + mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start, + res->end - res->start + 1); + if (!mapbase) + return -EBUSY; + memset(&hw, 0, sizeof(hw)); + hw.io_ports.data_addr = + mapbase + tx4939ide_swizzlew(TX4939IDE_Data); + hw.io_ports.error_addr = + mapbase + tx4939ide_swizzleb(TX4939IDE_Error_Feature); + hw.io_ports.nsect_addr = + mapbase + tx4939ide_swizzleb(TX4939IDE_Sec); + hw.io_ports.lbal_addr = + mapbase + tx4939ide_swizzleb(TX4939IDE_LBA0); + hw.io_ports.lbam_addr = + mapbase + tx4939ide_swizzleb(TX4939IDE_LBA1); + hw.io_ports.lbah_addr = + mapbase + tx4939ide_swizzleb(TX4939IDE_LBA2); + hw.io_ports.device_addr = + mapbase + tx4939ide_swizzleb(TX4939IDE_DevHead); + hw.io_ports.command_addr = + mapbase + tx4939ide_swizzleb(TX4939IDE_Stat_Cmd); + hw.io_ports.ctl_addr = + mapbase + tx4939ide_swizzleb(TX4939IDE_AltStat_DevCtl); + hw.irq = irq; + hw.dev = &pdev->dev; + + pr_info("TX4939 IDE interface (base %#lx, irq %d)\n", mapbase, irq); + host = ide_host_alloc(&tx4939ide_port_info, hws); + if (!host) + return -ENOMEM; + /* use extra_base for base address of the all registers */ + host->ports[0]->extra_base = mapbase; + ret = ide_host_register(host, &tx4939ide_port_info, hws); + if (ret) { + ide_host_free(host); + return ret; + } + platform_set_drvdata(pdev, host); + return 0; +} + +static int __exit tx4939ide_remove(struct platform_device *pdev) +{ + struct ide_host *host = platform_get_drvdata(pdev); + + ide_host_remove(host); + return 0; +} + +#ifdef CONFIG_PM +static int tx4939ide_resume(struct platform_device *dev) +{ + struct ide_host *host = platform_get_drvdata(dev); + ide_hwif_t *hwif = host->ports[0]; + + tx4939ide_init_hwif(hwif); + return 0; +} +#else +#define tx4939ide_resume NULL +#endif + +static struct platform_driver tx4939ide_driver = { + .driver = { + .name = MODNAME, + .owner = THIS_MODULE, + }, + .remove = __exit_p(tx4939ide_remove), + .resume = tx4939ide_resume, +}; + +static int __init tx4939ide_init(void) +{ + return platform_driver_probe(&tx4939ide_driver, tx4939ide_probe); +} + +static void __exit tx4939ide_exit(void) +{ + platform_driver_unregister(&tx4939ide_driver); +} + +module_init(tx4939ide_init); +module_exit(tx4939ide_exit); + +MODULE_DESCRIPTION("TX4939 internal IDE driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:tx4939ide"); diff --git a/drivers/idle/Kconfig b/drivers/idle/Kconfig index f5b26dd..108264d 100644 --- a/drivers/idle/Kconfig +++ b/drivers/idle/Kconfig @@ -5,12 +5,13 @@ config I7300_IDLE_IOAT_CHANNEL bool config I7300_IDLE - tristate "Intel chipset idle power saving driver" + tristate "Intel chipset idle memory power saving driver" select I7300_IDLE_IOAT_CHANNEL - depends on X86_64 + depends on X86_64 && EXPERIMENTAL help - Enable idle power savings with certain Intel server chipsets. - The chipset must have I/O AT support, such as the Intel 7300. - The power savings depends on the type and quantity of DRAM devices. + Enable memory power savings when idle with certain Intel server + chipsets. The chipset must have I/O AT support, such as the + Intel 7300. The power savings depends on the type and quantity of + DRAM devices. endmenu diff --git a/drivers/idle/i7300_idle.c b/drivers/idle/i7300_idle.c index 59d1bbc..fb176f6 100644 --- a/drivers/idle/i7300_idle.c +++ b/drivers/idle/i7300_idle.c @@ -25,6 +25,7 @@ #include <linux/delay.h> #include <linux/debugfs.h> #include <linux/stop_machine.h> +#include <linux/i7300_idle.h> #include <asm/idle.h> @@ -34,6 +35,8 @@ #define I7300_IDLE_DRIVER_VERSION "1.55" #define I7300_PRINT "i7300_idle:" +#define MAX_STOP_RETRIES 10 + static int debug; module_param_named(debug, debug, uint, 0644); MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); @@ -46,12 +49,12 @@ MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); * 0 = No throttling * 1 = Throttle when > 4 activations per eval window (Maximum throttling) * 2 = Throttle when > 8 activations - * 168 = Throttle when > 168 activations (Minimum throttling) + * 168 = Throttle when > 672 activations (Minimum throttling) */ -#define MAX_THRTLWLIMIT 168 -static uint i7300_idle_thrtlowlm = 1; -module_param_named(thrtlwlimit, i7300_idle_thrtlowlm, uint, 0644); -MODULE_PARM_DESC(thrtlwlimit, +#define MAX_THROTTLE_LOW_LIMIT 168 +static uint throttle_low_limit = 1; +module_param_named(throttle_low_limit, throttle_low_limit, uint, 0644); +MODULE_PARM_DESC(throttle_low_limit, "Value for THRTLOWLM activation field " "(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)"); @@ -110,9 +113,9 @@ static int i7300_idle_ioat_start(void) static void i7300_idle_ioat_stop(void) { int i; - u8 sts; + u64 sts; - for (i = 0; i < 5; i++) { + for (i = 0; i < MAX_STOP_RETRIES; i++) { writeb(IOAT_CHANCMD_RESET, ioat_chanbase + IOAT1_CHANCMD_OFFSET); @@ -126,9 +129,10 @@ static void i7300_idle_ioat_stop(void) } - if (i == 5) - dprintk("failed to suspend+reset I/O AT after 5 retries\n"); - + if (i == MAX_STOP_RETRIES) { + dprintk("failed to stop I/O AT after %d retries\n", + MAX_STOP_RETRIES); + } } /* Test I/O AT by copying 1024 byte from 2k to 1k */ @@ -275,7 +279,7 @@ static void __exit i7300_idle_ioat_exit(void) i7300_idle_ioat_stop(); /* Wait for a while for the channel to halt before releasing */ - for (i = 0; i < 10; i++) { + for (i = 0; i < MAX_STOP_RETRIES; i++) { writeb(IOAT_CHANCMD_RESET, ioat_chanbase + IOAT1_CHANCMD_OFFSET); @@ -389,9 +393,9 @@ static void i7300_idle_start(void) new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT; pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl); - limit = i7300_idle_thrtlowlm; - if (unlikely(limit > MAX_THRTLWLIMIT)) - limit = MAX_THRTLWLIMIT; + limit = throttle_low_limit; + if (unlikely(limit > MAX_THROTTLE_LOW_LIMIT)) + limit = MAX_THROTTLE_LOW_LIMIT; pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit); @@ -440,7 +444,7 @@ static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val, static ktime_t idle_begin_time; static int time_init = 1; - if (!i7300_idle_thrtlowlm) + if (!throttle_low_limit) return 0; if (unlikely(time_init)) { @@ -505,77 +509,8 @@ static struct notifier_block i7300_idle_nb = { .notifier_call = i7300_idle_notifier, }; -/* - * I/O AT controls (PCI bus 0 device 8 function 0) - * DIMM controls (PCI bus 0 device 16 function 1) - */ -#define IOAT_BUS 0 -#define IOAT_DEVFN PCI_DEVFN(8, 0) -#define MEMCTL_BUS 0 -#define MEMCTL_DEVFN PCI_DEVFN(16, 1) - -struct fbd_ioat { - unsigned int vendor; - unsigned int ioat_dev; -}; - -/* - * The i5000 chip-set has the same hooks as the i7300 - * but support is disabled by default because this driver - * has not been validated on that platform. - */ -#define SUPPORT_I5000 0 - -static const struct fbd_ioat fbd_ioat_list[] = { - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB}, -#if SUPPORT_I5000 - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT}, -#endif - {0, 0} -}; - -/* table of devices that work with this driver */ -static const struct pci_device_id pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_FBD_CNB) }, -#if SUPPORT_I5000 - { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) }, -#endif - { } /* Terminating entry */ -}; - MODULE_DEVICE_TABLE(pci, pci_tbl); -/* Check for known platforms with I/O-AT */ -static int __init i7300_idle_platform_probe(void) -{ - int i; - - fbd_dev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN); - if (!fbd_dev) - return -ENODEV; - - for (i = 0; pci_tbl[i].vendor != 0; i++) { - if (fbd_dev->vendor == pci_tbl[i].vendor && - fbd_dev->device == pci_tbl[i].device) { - break; - } - } - if (pci_tbl[i].vendor == 0) - return -ENODEV; - - ioat_dev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN); - if (!ioat_dev) - return -ENODEV; - - for (i = 0; fbd_ioat_list[i].vendor != 0; i++) { - if (ioat_dev->vendor == fbd_ioat_list[i].vendor && - ioat_dev->device == fbd_ioat_list[i].ioat_dev) { - return 0; - } - } - return -ENODEV; -} - int stats_open_generic(struct inode *inode, struct file *fp) { fp->private_data = inode->i_private; @@ -617,7 +552,7 @@ static int __init i7300_idle_init(void) cpus_clear(idle_cpumask); total_us = 0; - if (i7300_idle_platform_probe()) + if (i7300_idle_platform_probe(&fbd_dev, &ioat_dev)) return -ENODEV; if (i7300_idle_thrt_save()) diff --git a/drivers/input/misc/sgi_btns.c b/drivers/input/misc/sgi_btns.c index ce238f5..be3a15f 100644 --- a/drivers/input/misc/sgi_btns.c +++ b/drivers/input/misc/sgi_btns.c @@ -174,5 +174,6 @@ static void __exit sgi_buttons_exit(void) platform_driver_unregister(&sgi_buttons_driver); } +MODULE_LICENSE("GPL"); module_init(sgi_buttons_init); module_exit(sgi_buttons_exit); diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index f488b68..4e99342 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig @@ -25,8 +25,8 @@ config MOUSE_PS2 mice with wheels and extra buttons, Microsoft, Logitech or Genius compatible. - Synaptics TouchPad users might be interested in a specialized - XFree86 driver at: + Synaptics, ALPS or Elantech TouchPad users might be interested + in a specialized Xorg/XFree86 driver at: <http://w1.894.telia.com/~u89404340/touchpad/index.html> and a new version of GPM at: <http://www.geocities.com/dt_or/gpm/gpm.html> @@ -87,6 +87,27 @@ config MOUSE_PS2_TRACKPOINT If unsure, say Y. +config MOUSE_PS2_ELANTECH + bool "Elantech PS/2 protocol extension" + depends on MOUSE_PS2 + help + Say Y here if you have an Elantech PS/2 touchpad connected + to your system. + + Note that if you enable this driver you will need an updated + X.org Synaptics driver that does not require ABS_PRESSURE + reports from the touchpad (i.e. post 1.5.0 version). You can + grab a patch for the driver here: + + http://userweb.kernel.org/~dtor/synaptics-no-abspressure.patch + + If unsure, say N. + + This driver exposes some configuration registers via sysfs + entries. For further information, + see <file:Documentation/input/elantech.txt>. + + config MOUSE_PS2_TOUCHKIT bool "eGalax TouchKit PS/2 protocol extension" depends on MOUSE_PS2 diff --git a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile index 8e6e690..96f1dd8 100644 --- a/drivers/input/mouse/Makefile +++ b/drivers/input/mouse/Makefile @@ -21,6 +21,7 @@ obj-$(CONFIG_MOUSE_GPIO) += gpio_mouse.o psmouse-objs := psmouse-base.o synaptics.o psmouse-$(CONFIG_MOUSE_PS2_ALPS) += alps.o +psmouse-$(CONFIG_MOUSE_PS2_ELANTECH) += elantech.o psmouse-$(CONFIG_MOUSE_PS2_OLPC) += hgpk.o psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += logips2pp.o psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK) += lifebook.o diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c new file mode 100644 index 0000000..b9a25d5 --- /dev/null +++ b/drivers/input/mouse/elantech.c @@ -0,0 +1,674 @@ +/* + * Elantech Touchpad driver (v5) + * + * Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * Trademarks are the property of their respective owners. + */ + +#include <linux/delay.h> +#include <linux/module.h> +#include <linux/input.h> +#include <linux/serio.h> +#include <linux/libps2.h> +#include "psmouse.h" +#include "elantech.h" + +#define elantech_debug(format, arg...) \ + do { \ + if (etd->debug) \ + printk(KERN_DEBUG format, ##arg); \ + } while (0) + +/* + * Send a Synaptics style sliced query command + */ +static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, + unsigned char *param) +{ + if (psmouse_sliced_command(psmouse, c) || + ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) { + pr_err("elantech.c: synaptics_send_cmd query 0x%02x failed.\n", c); + return -1; + } + + return 0; +} + +/* + * A retrying version of ps2_command + */ +static int elantech_ps2_command(struct psmouse *psmouse, + unsigned char *param, int command) +{ + struct ps2dev *ps2dev = &psmouse->ps2dev; + struct elantech_data *etd = psmouse->private; + int rc; + int tries = ETP_PS2_COMMAND_TRIES; + + do { + rc = ps2_command(ps2dev, param, command); + if (rc == 0) + break; + tries--; + elantech_debug("elantech.c: retrying ps2 command 0x%02x (%d).\n", + command, tries); + msleep(ETP_PS2_COMMAND_DELAY); + } while (tries > 0); + + if (rc) + pr_err("elantech.c: ps2 command 0x%02x failed.\n", command); + + return rc; +} + +/* + * Send an Elantech style special command to read a value from a register + */ +static int elantech_read_reg(struct psmouse *psmouse, unsigned char reg, + unsigned char *val) +{ + struct elantech_data *etd = psmouse->private; + unsigned char param[3]; + int rc = 0; + + if (reg < 0x10 || reg > 0x26) + return -1; + + if (reg > 0x11 && reg < 0x20) + return -1; + + switch (etd->hw_version) { + case 1: + if (psmouse_sliced_command(psmouse, ETP_REGISTER_READ) || + psmouse_sliced_command(psmouse, reg) || + ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) { + rc = -1; + } + break; + + case 2: + if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || + elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READ) || + elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || + elantech_ps2_command(psmouse, NULL, reg) || + elantech_ps2_command(psmouse, param, PSMOUSE_CMD_GETINFO)) { + rc = -1; + } + break; + } + + if (rc) + pr_err("elantech.c: failed to read register 0x%02x.\n", reg); + else + *val = param[0]; + + return rc; +} + +/* + * Send an Elantech style special command to write a register with a value + */ +static int elantech_write_reg(struct psmouse *psmouse, unsigned char reg, + unsigned char val) +{ + struct elantech_data *etd = psmouse->private; + int rc = 0; + + if (reg < 0x10 || reg > 0x26) + return -1; + + if (reg > 0x11 && reg < 0x20) + return -1; + + switch (etd->hw_version) { + case 1: + if (psmouse_sliced_command(psmouse, ETP_REGISTER_WRITE) || + psmouse_sliced_command(psmouse, reg) || + psmouse_sliced_command(psmouse, val) || + ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11)) { + rc = -1; + } + break; + + case 2: + if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || + elantech_ps2_command(psmouse, NULL, ETP_REGISTER_WRITE) || + elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || + elantech_ps2_command(psmouse, NULL, reg) || + elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || + elantech_ps2_command(psmouse, NULL, val) || + elantech_ps2_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) { + rc = -1; + } + break; + } + + if (rc) + pr_err("elantech.c: failed to write register 0x%02x with value 0x%02x.\n", + reg, val); + + return rc; +} + +/* + * Dump a complete mouse movement packet to the syslog + */ +static void elantech_packet_dump(unsigned char *packet, int size) +{ + int i; + + printk(KERN_DEBUG "elantech.c: PS/2 packet ["); + for (i = 0; i < size; i++) + printk("%s0x%02x ", (i) ? ", " : " ", packet[i]); + printk("]\n"); +} + +/* + * Interpret complete data packets and report absolute mode input events for + * hardware version 1. (4 byte packets) + */ +static void elantech_report_absolute_v1(struct psmouse *psmouse) +{ + struct input_dev *dev = psmouse->dev; + struct elantech_data *etd = psmouse->private; + unsigned char *packet = psmouse->packet; + int fingers; + + if (etd->fw_version_maj == 0x01) { + /* byte 0: D U p1 p2 1 p3 R L + byte 1: f 0 th tw x9 x8 y9 y8 */ + fingers = ((packet[1] & 0x80) >> 7) + + ((packet[1] & 0x30) >> 4); + } else { + /* byte 0: n1 n0 p2 p1 1 p3 R L + byte 1: 0 0 0 0 x9 x8 y9 y8 */ + fingers = (packet[0] & 0xc0) >> 6; + } + + input_report_key(dev, BTN_TOUCH, fingers != 0); + + /* byte 2: x7 x6 x5 x4 x3 x2 x1 x0 + byte 3: y7 y6 y5 y4 y3 y2 y1 y0 */ + if (fingers) { + input_report_abs(dev, ABS_X, + ((packet[1] & 0x0c) << 6) | packet[2]); + input_report_abs(dev, ABS_Y, ETP_YMAX_V1 - + (((packet[1] & 0x03) << 8) | packet[3])); + } + + input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); + input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2); + input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3); + input_report_key(dev, BTN_LEFT, packet[0] & 0x01); + input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); + + if ((etd->fw_version_maj == 0x01) && + (etd->capabilities & ETP_CAP_HAS_ROCKER)) { + /* rocker up */ + input_report_key(dev, BTN_FORWARD, packet[0] & 0x40); + /* rocker down */ + input_report_key(dev, BTN_BACK, packet[0] & 0x80); + } + + input_sync(dev); +} + +/* + * Interpret complete data packets and report absolute mode input events for + * hardware version 2. (6 byte packets) + */ +static void elantech_report_absolute_v2(struct psmouse *psmouse) +{ + struct input_dev *dev = psmouse->dev; + unsigned char *packet = psmouse->packet; + int fingers, x1, y1, x2, y2; + + /* byte 0: n1 n0 . . . . R L */ + fingers = (packet[0] & 0xc0) >> 6; + input_report_key(dev, BTN_TOUCH, fingers != 0); + + switch (fingers) { + case 1: + /* byte 1: x15 x14 x13 x12 x11 x10 x9 x8 + byte 2: x7 x6 x5 x4 x4 x2 x1 x0 */ + input_report_abs(dev, ABS_X, (packet[1] << 8) | packet[2]); + /* byte 4: y15 y14 y13 y12 y11 y10 y8 y8 + byte 5: y7 y6 y5 y4 y3 y2 y1 y0 */ + input_report_abs(dev, ABS_Y, ETP_YMAX_V2 - + ((packet[4] << 8) | packet[5])); + break; + + case 2: + /* The coordinate of each finger is reported separately with + a lower resolution for two finger touches */ + /* byte 0: . . ay8 ax8 . . . . + byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0 */ + x1 = ((packet[0] & 0x10) << 4) | packet[1]; + /* byte 2: ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0 */ + y1 = ETP_2FT_YMAX - (((packet[0] & 0x20) << 3) | packet[2]); + /* byte 3: . . by8 bx8 . . . . + byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0 */ + x2 = ((packet[3] & 0x10) << 4) | packet[4]; + /* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */ + y2 = ETP_2FT_YMAX - (((packet[3] & 0x20) << 3) | packet[5]); + /* For compatibility with the X Synaptics driver scale up one + coordinate and report as ordinary mouse movent */ + input_report_abs(dev, ABS_X, x1 << 2); + input_report_abs(dev, ABS_Y, y1 << 2); + /* For compatibility with the proprietary X Elantech driver + report both coordinates as hat coordinates */ + input_report_abs(dev, ABS_HAT0X, x1); + input_report_abs(dev, ABS_HAT0Y, y1); + input_report_abs(dev, ABS_HAT1X, x2); + input_report_abs(dev, ABS_HAT1Y, y2); + break; + } + + input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); + input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2); + input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3); + input_report_key(dev, BTN_LEFT, packet[0] & 0x01); + input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); + + input_sync(dev); +} + +static int elantech_check_parity_v1(struct psmouse *psmouse) +{ + struct elantech_data *etd = psmouse->private; + unsigned char *packet = psmouse->packet; + unsigned char p1, p2, p3; + + /* Parity bits are placed differently */ + if (etd->fw_version_maj == 0x01) { + /* byte 0: D U p1 p2 1 p3 R L */ + p1 = (packet[0] & 0x20) >> 5; + p2 = (packet[0] & 0x10) >> 4; + } else { + /* byte 0: n1 n0 p2 p1 1 p3 R L */ + p1 = (packet[0] & 0x10) >> 4; + p2 = (packet[0] & 0x20) >> 5; + } + + p3 = (packet[0] & 0x04) >> 2; + + return etd->parity[packet[1]] == p1 && + etd->parity[packet[2]] == p2 && + etd->parity[packet[3]] == p3; +} + +/* + * Process byte stream from mouse and handle complete packets + */ +static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse) +{ + struct elantech_data *etd = psmouse->private; + + if (psmouse->pktcnt < psmouse->pktsize) + return PSMOUSE_GOOD_DATA; + + if (etd->debug > 1) + elantech_packet_dump(psmouse->packet, psmouse->pktsize); + + switch (etd->hw_version) { + case 1: + if (etd->paritycheck && !elantech_check_parity_v1(psmouse)) + return PSMOUSE_BAD_DATA; + + elantech_report_absolute_v1(psmouse); + break; + + case 2: + /* We don't know how to check parity in protocol v2 */ + elantech_report_absolute_v2(psmouse); + break; + } + + return PSMOUSE_FULL_PACKET; +} + +/* + * Put the touchpad into absolute mode + */ +static int elantech_set_absolute_mode(struct psmouse *psmouse) +{ + struct elantech_data *etd = psmouse->private; + unsigned char val; + int tries = ETP_READ_BACK_TRIES; + int rc = 0; + + switch (etd->hw_version) { + case 1: + etd->reg_10 = 0x16; + etd->reg_11 = 0x8f; + if (elantech_write_reg(psmouse, 0x10, etd->reg_10) || + elantech_write_reg(psmouse, 0x11, etd->reg_11)) { + rc = -1; + } + break; + + case 2: + /* Windows driver values */ + etd->reg_10 = 0x54; + etd->reg_11 = 0x88; /* 0x8a */ + etd->reg_21 = 0x60; /* 0x00 */ + if (elantech_write_reg(psmouse, 0x10, etd->reg_10) || + elantech_write_reg(psmouse, 0x11, etd->reg_11) || + elantech_write_reg(psmouse, 0x21, etd->reg_21)) { + rc = -1; + break; + } + /* + * Read back reg 0x10. The touchpad is probably initalising + * and not ready until we read back the value we just wrote. + */ + do { + rc = elantech_read_reg(psmouse, 0x10, &val); + if (rc == 0) + break; + tries--; + elantech_debug("elantech.c: retrying read (%d).\n", + tries); + msleep(ETP_READ_BACK_DELAY); + } while (tries > 0); + if (rc) + pr_err("elantech.c: failed to read back register 0x10.\n"); + break; + } + + if (rc) + pr_err("elantech.c: failed to initialise registers.\n"); + + return rc; +} + +/* + * Set the appropriate event bits for the input subsystem + */ +static void elantech_set_input_params(struct psmouse *psmouse) +{ + struct input_dev *dev = psmouse->dev; + struct elantech_data *etd = psmouse->private; + + __set_bit(EV_KEY, dev->evbit); + __set_bit(EV_ABS, dev->evbit); + + __set_bit(BTN_LEFT, dev->keybit); + __set_bit(BTN_RIGHT, dev->keybit); + + __set_bit(BTN_TOUCH, dev->keybit); + __set_bit(BTN_TOOL_FINGER, dev->keybit); + __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); + __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); + + switch (etd->hw_version) { + case 1: + /* Rocker button */ + if ((etd->fw_version_maj == 0x01) && + (etd->capabilities & ETP_CAP_HAS_ROCKER)) { + __set_bit(BTN_FORWARD, dev->keybit); + __set_bit(BTN_BACK, dev->keybit); + } + input_set_abs_params(dev, ABS_X, ETP_XMIN_V1, ETP_XMAX_V1, 0, 0); + input_set_abs_params(dev, ABS_Y, ETP_YMIN_V1, ETP_YMAX_V1, 0, 0); + break; + + case 2: + input_set_abs_params(dev, ABS_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0); + input_set_abs_params(dev, ABS_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0); + input_set_abs_params(dev, ABS_HAT0X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0); + input_set_abs_params(dev, ABS_HAT0Y, ETP_2FT_YMIN, ETP_2FT_YMAX, 0, 0); + input_set_abs_params(dev, ABS_HAT1X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0); + input_set_abs_params(dev, ABS_HAT1Y, ETP_2FT_YMIN, ETP_2FT_YMAX, 0, 0); + break; + } +} + +struct elantech_attr_data { + size_t field_offset; + unsigned char reg; +}; + +/* + * Display a register value by reading a sysfs entry + */ +static ssize_t elantech_show_int_attr(struct psmouse *psmouse, void *data, + char *buf) +{ + struct elantech_data *etd = psmouse->private; + struct elantech_attr_data *attr = data; + unsigned char *reg = (unsigned char *) etd + attr->field_offset; + int rc = 0; + + if (attr->reg) + rc = elantech_read_reg(psmouse, attr->reg, reg); + + return sprintf(buf, "0x%02x\n", (attr->reg && rc) ? -1 : *reg); +} + +/* + * Write a register value by writing a sysfs entry + */ +static ssize_t elantech_set_int_attr(struct psmouse *psmouse, + void *data, const char *buf, size_t count) +{ + struct elantech_data *etd = psmouse->private; + struct elantech_attr_data *attr = data; + unsigned char *reg = (unsigned char *) etd + attr->field_offset; + unsigned long value; + int err; + + err = strict_strtoul(buf, 16, &value); + if (err) + return err; + + if (value > 0xff) + return -EINVAL; + + /* Do we need to preserve some bits for version 2 hardware too? */ + if (etd->hw_version == 1) { + if (attr->reg == 0x10) + /* Force absolute mode always on */ + value |= ETP_R10_ABSOLUTE_MODE; + else if (attr->reg == 0x11) + /* Force 4 byte mode always on */ + value |= ETP_R11_4_BYTE_MODE; + } + + if (!attr->reg || elantech_write_reg(psmouse, attr->reg, value) == 0) + *reg = value; + + return count; +} + +#define ELANTECH_INT_ATTR(_name, _register) \ + static struct elantech_attr_data elantech_attr_##_name = { \ + .field_offset = offsetof(struct elantech_data, _name), \ + .reg = _register, \ + }; \ + PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \ + &elantech_attr_##_name, \ + elantech_show_int_attr, \ + elantech_set_int_attr) + +ELANTECH_INT_ATTR(reg_10, 0x10); +ELANTECH_INT_ATTR(reg_11, 0x11); +ELANTECH_INT_ATTR(reg_20, 0x20); +ELANTECH_INT_ATTR(reg_21, 0x21); +ELANTECH_INT_ATTR(reg_22, 0x22); +ELANTECH_INT_ATTR(reg_23, 0x23); +ELANTECH_INT_ATTR(reg_24, 0x24); +ELANTECH_INT_ATTR(reg_25, 0x25); +ELANTECH_INT_ATTR(reg_26, 0x26); +ELANTECH_INT_ATTR(debug, 0); +ELANTECH_INT_ATTR(paritycheck, 0); + +static struct attribute *elantech_attrs[] = { + &psmouse_attr_reg_10.dattr.attr, + &psmouse_attr_reg_11.dattr.attr, + &psmouse_attr_reg_20.dattr.attr, + &psmouse_attr_reg_21.dattr.attr, + &psmouse_attr_reg_22.dattr.attr, + &psmouse_attr_reg_23.dattr.attr, + &psmouse_attr_reg_24.dattr.attr, + &psmouse_attr_reg_25.dattr.attr, + &psmouse_attr_reg_26.dattr.attr, + &psmouse_attr_debug.dattr.attr, + &psmouse_attr_paritycheck.dattr.attr, + NULL +}; + +static struct attribute_group elantech_attr_group = { + .attrs = elantech_attrs, +}; + +/* + * Use magic knock to detect Elantech touchpad + */ +int elantech_detect(struct psmouse *psmouse, int set_properties) +{ + struct ps2dev *ps2dev = &psmouse->ps2dev; + unsigned char param[3]; + + ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); + + if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) || + ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || + ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || + ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || + ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) { + pr_err("elantech.c: sending Elantech magic knock failed.\n"); + return -1; + } + + /* + * Report this in case there are Elantech models that use a different + * set of magic numbers + */ + if (param[0] != 0x3c || param[1] != 0x03 || param[2] != 0xc8) { + pr_info("elantech.c: unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n", + param[0], param[1], param[2]); + return -1; + } + + if (set_properties) { + psmouse->vendor = "Elantech"; + psmouse->name = "Touchpad"; + } + + return 0; +} + +/* + * Clean up sysfs entries when disconnecting + */ +static void elantech_disconnect(struct psmouse *psmouse) +{ + sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, + &elantech_attr_group); + kfree(psmouse->private); + psmouse->private = NULL; +} + +/* + * Put the touchpad back into absolute mode when reconnecting + */ +static int elantech_reconnect(struct psmouse *psmouse) +{ + if (elantech_detect(psmouse, 0)) + return -1; + + if (elantech_set_absolute_mode(psmouse)) { + pr_err("elantech.c: failed to put touchpad back into absolute mode.\n"); + return -1; + } + + return 0; +} + +/* + * Initialize the touchpad and create sysfs entries + */ +int elantech_init(struct psmouse *psmouse) +{ + struct elantech_data *etd; + int i, error; + unsigned char param[3]; + + etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL); + psmouse->private = etd; + if (!etd) + return -1; + + etd->parity[0] = 1; + for (i = 1; i < 256; i++) + etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; + + /* + * Find out what version hardware this is + */ + if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) { + pr_err("elantech.c: failed to query firmware version.\n"); + goto init_fail; + } + pr_info("elantech.c: Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n", + param[0], param[1], param[2]); + etd->fw_version_maj = param[0]; + etd->fw_version_min = param[2]; + + /* + * Assume every version greater than this is new EeePC style + * hardware with 6 byte packets + */ + if (etd->fw_version_maj >= 0x02 && etd->fw_version_min >= 0x30) { + etd->hw_version = 2; + /* For now show extra debug information */ + etd->debug = 1; + /* Don't know how to do parity checking for version 2 */ + etd->paritycheck = 0; + } else { + etd->hw_version = 1; + etd->paritycheck = 1; + } + pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d\n", + etd->hw_version, etd->fw_version_maj, etd->fw_version_min); + + if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, param)) { + pr_err("elantech.c: failed to query capabilities.\n"); + goto init_fail; + } + pr_info("elantech.c: Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n", + param[0], param[1], param[2]); + etd->capabilities = param[0]; + + if (elantech_set_absolute_mode(psmouse)) { + pr_err("elantech.c: failed to put touchpad into absolute mode.\n"); + goto init_fail; + } + + elantech_set_input_params(psmouse); + + error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj, + &elantech_attr_group); + if (error) { + pr_err("elantech.c: failed to create sysfs attributes, error: %d.\n", + error); + goto init_fail; + } + + psmouse->protocol_handler = elantech_process_byte; + psmouse->disconnect = elantech_disconnect; + psmouse->reconnect = elantech_reconnect; + psmouse->pktsize = etd->hw_version == 2 ? 6 : 4; + + return 0; + + init_fail: + kfree(etd); + return -1; +} diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h new file mode 100644 index 0000000..bee282b --- /dev/null +++ b/drivers/input/mouse/elantech.h @@ -0,0 +1,124 @@ +/* + * Elantech Touchpad driver (v5) + * + * Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * Trademarks are the property of their respective owners. + */ + +#ifndef _ELANTECH_H +#define _ELANTECH_H + +/* + * Command values for Synaptics style queries + */ +#define ETP_FW_VERSION_QUERY 0x01 +#define ETP_CAPABILITIES_QUERY 0x02 + +/* + * Command values for register reading or writing + */ +#define ETP_REGISTER_READ 0x10 +#define ETP_REGISTER_WRITE 0x11 + +/* + * Hardware version 2 custom PS/2 command value + */ +#define ETP_PS2_CUSTOM_COMMAND 0xf8 + +/* + * Times to retry a ps2_command and millisecond delay between tries + */ +#define ETP_PS2_COMMAND_TRIES 3 +#define ETP_PS2_COMMAND_DELAY 500 + +/* + * Times to try to read back a register and millisecond delay between tries + */ +#define ETP_READ_BACK_TRIES 5 +#define ETP_READ_BACK_DELAY 2000 + +/* + * Register bitmasks for hardware version 1 + */ +#define ETP_R10_ABSOLUTE_MODE 0x04 +#define ETP_R11_4_BYTE_MODE 0x02 + +/* + * Capability bitmasks + */ +#define ETP_CAP_HAS_ROCKER 0x04 + +/* + * One hard to find application note states that X axis range is 0 to 576 + * and Y axis range is 0 to 384 for harware version 1. + * Edge fuzz might be necessary because of bezel around the touchpad + */ +#define ETP_EDGE_FUZZ_V1 32 + +#define ETP_XMIN_V1 ( 0 + ETP_EDGE_FUZZ_V1) +#define ETP_XMAX_V1 (576 - ETP_EDGE_FUZZ_V1) +#define ETP_YMIN_V1 ( 0 + ETP_EDGE_FUZZ_V1) +#define ETP_YMAX_V1 (384 - ETP_EDGE_FUZZ_V1) + +/* + * It seems the resolution for hardware version 2 doubled. + * Hence the X and Y ranges are doubled too. + * The bezel around the pad also appears to be smaller + */ +#define ETP_EDGE_FUZZ_V2 8 + +#define ETP_XMIN_V2 ( 0 + ETP_EDGE_FUZZ_V2) +#define ETP_XMAX_V2 (1152 - ETP_EDGE_FUZZ_V2) +#define ETP_YMIN_V2 ( 0 + ETP_EDGE_FUZZ_V2) +#define ETP_YMAX_V2 ( 768 - ETP_EDGE_FUZZ_V2) + +/* + * For two finger touches the coordinate of each finger gets reported + * separately but with reduced resolution. + */ +#define ETP_2FT_FUZZ 4 + +#define ETP_2FT_XMIN ( 0 + ETP_2FT_FUZZ) +#define ETP_2FT_XMAX (288 - ETP_2FT_FUZZ) +#define ETP_2FT_YMIN ( 0 + ETP_2FT_FUZZ) +#define ETP_2FT_YMAX (192 - ETP_2FT_FUZZ) + +struct elantech_data { + unsigned char reg_10; + unsigned char reg_11; + unsigned char reg_20; + unsigned char reg_21; + unsigned char reg_22; + unsigned char reg_23; + unsigned char reg_24; + unsigned char reg_25; + unsigned char reg_26; + unsigned char debug; + unsigned char capabilities; + unsigned char fw_version_maj; + unsigned char fw_version_min; + unsigned char hw_version; + unsigned char paritycheck; + unsigned char parity[256]; +}; + +#ifdef CONFIG_MOUSE_PS2_ELANTECH +int elantech_detect(struct psmouse *psmouse, int set_properties); +int elantech_init(struct psmouse *psmouse); +#else +static inline int elantech_detect(struct psmouse *psmouse, int set_properties) +{ + return -ENOSYS; +} +static inline int elantech_init(struct psmouse *psmouse) +{ + return -ENOSYS; +} +#endif /* CONFIG_MOUSE_PS2_ELANTECH */ + +#endif diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 126e977..f8f86de 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -29,6 +29,7 @@ #include "lifebook.h" #include "trackpoint.h" #include "touchkit_ps2.h" +#include "elantech.h" #define DRIVER_DESC "PS/2 mouse driver" @@ -650,6 +651,19 @@ static int psmouse_extensions(struct psmouse *psmouse, max_proto = PSMOUSE_IMEX; } +/* + * Try Elantech touchpad. + */ + if (max_proto > PSMOUSE_IMEX && + elantech_detect(psmouse, set_properties) == 0) { + if (!set_properties || elantech_init(psmouse) == 0) + return PSMOUSE_ELANTECH; +/* + * Init failed, try basic relative protocols + */ + max_proto = PSMOUSE_IMEX; + } + if (max_proto > PSMOUSE_IMEX) { if (genius_detect(psmouse, set_properties) == 0) return PSMOUSE_GENPS; @@ -789,6 +803,15 @@ static const struct psmouse_protocol psmouse_protocols[] = { .detect = hgpk_detect, }, #endif +#ifdef CONFIG_MOUSE_PS2_ELANTECH + { + .type = PSMOUSE_ELANTECH, + .name = "ETPS/2", + .alias = "elantech", + .detect = elantech_detect, + .init = elantech_init, + }, + #endif { .type = PSMOUSE_CORTRON, .name = "CortronPS/2", diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index 8b608a1..54ed267 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h @@ -90,6 +90,7 @@ enum psmouse_type { PSMOUSE_TOUCHKIT_PS2, PSMOUSE_CORTRON, PSMOUSE_HGPK, + PSMOUSE_ELANTECH, PSMOUSE_AUTO /* This one should always be last */ }; diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index a321aea..eec375c 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h @@ -135,6 +135,14 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { DMI_MATCH(DMI_PRODUCT_VERSION, "5a"), }, }, + { + .ident = "Blue FB5601", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "blue"), + DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"), + DMI_MATCH(DMI_PRODUCT_VERSION, "M606"), + }, + }, { } }; diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 8317fde..3d1ab8f 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -42,8 +42,9 @@ config TOUCHSCREEN_BITSY module will be called h3600_ts_input. config TOUCHSCREEN_CORGI - tristate "SharpSL (Corgi and Spitz series) touchscreen driver" + tristate "SharpSL (Corgi and Spitz series) touchscreen driver (DEPRECATED)" depends on PXA_SHARPSL + select CORGI_SSP_DEPRECATED default y help Say Y here to enable the driver for the touchscreen on the @@ -54,6 +55,9 @@ config TOUCHSCREEN_CORGI To compile this driver as a module, choose M here: the module will be called corgi_ts. + NOTE: this driver is deprecated, try enable SPI and generic + ADS7846-based touchscreen driver. + config TOUCHSCREEN_FUJITSU tristate "Fujitsu serial touchscreen" select SERIO diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index c7ff1e1..e7fb7d2 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -113,11 +113,12 @@ config LEDS_GPIO outputs. To be useful the particular board must have LEDs and they must be connected to the GPIO lines. -config LEDS_CM_X270 - tristate "LED Support for the CM-X270 LEDs" - depends on LEDS_CLASS && MACH_ARMCORE +config LEDS_HP_DISK + tristate "LED Support for disk protection LED on HP notebooks" + depends on LEDS_CLASS && ACPI help - This option enables support for the CM-X270 LEDs. + This option enable support for disk protection LED, found on + newer HP notebooks. config LEDS_CLEVO_MAIL tristate "Mail LED on Clevo notebook (EXPERIMENTAL)" @@ -157,6 +158,13 @@ config LEDS_PCA955X LED driver chips accessed via the I2C bus. Supported devices include PCA9550, PCA9551, PCA9552, and PCA9553. +config LEDS_DA903X + tristate "LED Support for DA9030/DA9034 PMIC" + depends on LEDS_CLASS && PMIC_DA903X + help + This option enables support for on-chip LED drivers found + on Dialog Semiconductor DA9030/DA9034 PMICs. + comment "LED Triggers" config LEDS_TRIGGERS @@ -193,6 +201,15 @@ config LEDS_TRIGGER_HEARTBEAT load average. If unsure, say Y. +config LEDS_TRIGGER_BACKLIGHT + tristate "LED backlight Trigger" + depends on LEDS_TRIGGERS + help + This allows LEDs to be controlled as a backlight device: they + turn off and on when the display is blanked and unblanked. + + If unsure, say N. + config LEDS_TRIGGER_DEFAULT_ON tristate "LED Default ON Trigger" depends on LEDS_TRIGGERS diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index eb186c3..e1967a2 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -17,14 +17,16 @@ obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o obj-$(CONFIG_LEDS_PCA9532) += leds-pca9532.o obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o -obj-$(CONFIG_LEDS_CM_X270) += leds-cm-x270.o obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o obj-$(CONFIG_LEDS_FSG) += leds-fsg.o obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o +obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o +obj-$(CONFIG_LEDS_HP_DISK) += leds-hp-disk.o # LED Triggers obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o +obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index ee74ee7..6c4a326 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -34,14 +34,11 @@ static ssize_t led_brightness_show(struct device *dev, struct device_attribute *attr, char *buf) { struct led_classdev *led_cdev = dev_get_drvdata(dev); - ssize_t ret = 0; /* no lock needed for this */ led_update_brightness(led_cdev); - sprintf(buf, "%u\n", led_cdev->brightness); - ret = strlen(buf) + 1; - return ret; + return sprintf(buf, "%u\n", led_cdev->brightness); } static ssize_t led_brightness_store(struct device *dev, @@ -113,6 +110,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) if (rc) goto err_out; +#ifdef CONFIG_LEDS_TRIGGERS + init_rwsem(&led_cdev->trigger_lock); +#endif /* add to the list of leds */ down_write(&leds_list_lock); list_add_tail(&led_cdev->node, &leds_list); @@ -121,8 +121,6 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) led_update_brightness(led_cdev); #ifdef CONFIG_LEDS_TRIGGERS - init_rwsem(&led_cdev->trigger_lock); - rc = device_create_file(led_cdev->dev, &dev_attr_trigger); if (rc) goto err_out_led_list; @@ -147,7 +145,7 @@ err_out: EXPORT_SYMBOL_GPL(led_classdev_register); /** - * __led_classdev_unregister - unregisters a object of led_properties class. + * led_classdev_unregister - unregisters a object of led_properties class. * @led_cdev: the led device to unregister * * Unregisters a previously registered via led_classdev_register object. diff --git a/drivers/leds/leds-ams-delta.c b/drivers/leds/leds-ams-delta.c index 32c98b2..1bd590b 100644 --- a/drivers/leds/leds-ams-delta.c +++ b/drivers/leds/leds-ams-delta.c @@ -107,27 +107,27 @@ static int ams_delta_led_resume(struct platform_device *dev) static int ams_delta_led_probe(struct platform_device *pdev) { - int i; - int ret; + int i, ret; - for (i = ret = 0; ret >= 0 && i < ARRAY_SIZE(ams_delta_leds); i++) { + for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i++) { ret = led_classdev_register(&pdev->dev, &ams_delta_leds[i].cdev); + if (ret < 0) + goto fail; } - if (ret < 0 && i > 1) { - for (i = i - 2; i >= 0; i--) - led_classdev_unregister(&ams_delta_leds[i].cdev); - } - - return ret; + return 0; +fail: + while (--i >= 0) + led_classdev_unregister(&ams_delta_leds[i].cdev); + return ret; } static int ams_delta_led_remove(struct platform_device *pdev) { int i; - for (i = ARRAY_SIZE(ams_delta_leds) - 1; i >= 0; i--) + for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i--) led_classdev_unregister(&ams_delta_leds[i].cdev); return 0; diff --git a/drivers/leds/leds-cm-x270.c b/drivers/leds/leds-cm-x270.c deleted file mode 100644 index 836a43d..0000000 --- a/drivers/leds/leds-cm-x270.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * drivers/leds/leds-cm-x270.c - * - * Copyright 2007 CompuLab Ltd. - * Author: Mike Rapoport <mike@compulab.co.il> - * - * Based on leds-corgi.c - * Author: Richard Purdie <rpurdie@openedhand.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/platform_device.h> -#include <linux/leds.h> - -#include <mach/hardware.h> -#include <mach/pxa-regs.h> - -#define GPIO_RED_LED (93) -#define GPIO_GREEN_LED (94) - -static void cmx270_red_set(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - GPCR(GPIO_RED_LED) = GPIO_bit(GPIO_RED_LED); - else - GPSR(GPIO_RED_LED) = GPIO_bit(GPIO_RED_LED); -} - -static void cmx270_green_set(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - GPCR(GPIO_GREEN_LED) = GPIO_bit(GPIO_GREEN_LED); - else - GPSR(GPIO_GREEN_LED) = GPIO_bit(GPIO_GREEN_LED); -} - -static struct led_classdev cmx270_red_led = { - .name = "cm-x270:red", - .default_trigger = "nand-disk", - .brightness_set = cmx270_red_set, -}; - -static struct led_classdev cmx270_green_led = { - .name = "cm-x270:green", - .default_trigger = "heartbeat", - .brightness_set = cmx270_green_set, -}; - -#ifdef CONFIG_PM -static int cmx270led_suspend(struct platform_device *dev, pm_message_t state) -{ - led_classdev_suspend(&cmx270_red_led); - led_classdev_suspend(&cmx270_green_led); - return 0; -} - -static int cmx270led_resume(struct platform_device *dev) -{ - led_classdev_resume(&cmx270_red_led); - led_classdev_resume(&cmx270_green_led); - return 0; -} -#endif - -static int cmx270led_probe(struct platform_device *pdev) -{ - int ret; - - ret = led_classdev_register(&pdev->dev, &cmx270_red_led); - if (ret < 0) - return ret; - - ret = led_classdev_register(&pdev->dev, &cmx270_green_led); - if (ret < 0) - led_classdev_unregister(&cmx270_red_led); - - return ret; -} - -static int cmx270led_remove(struct platform_device *pdev) -{ - led_classdev_unregister(&cmx270_red_led); - led_classdev_unregister(&cmx270_green_led); - return 0; -} - -static struct platform_driver cmx270led_driver = { - .probe = cmx270led_probe, - .remove = cmx270led_remove, -#ifdef CONFIG_PM - .suspend = cmx270led_suspend, - .resume = cmx270led_resume, -#endif - .driver = { - .name = "cm-x270-led", - .owner = THIS_MODULE, - }, -}; - -static int __init cmx270led_init(void) -{ - return platform_driver_register(&cmx270led_driver); -} - -static void __exit cmx270led_exit(void) -{ - platform_driver_unregister(&cmx270led_driver); -} - -module_init(cmx270led_init); -module_exit(cmx270led_exit); - -MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>"); -MODULE_DESCRIPTION("CM-x270 LED driver"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:cm-x270-led"); diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c new file mode 100644 index 0000000..2768c69 --- /dev/null +++ b/drivers/leds/leds-da903x.c @@ -0,0 +1,176 @@ +/* + * LEDs driver for Dialog Semiconductor DA9030/DA9034 + * + * Copyright (C) 2008 Compulab, Ltd. + * Mike Rapoport <mike@compulab.co.il> + * + * Copyright (C) 2006-2008 Marvell International Ltd. + * Eric Miao <eric.miao@marvell.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/leds.h> +#include <linux/workqueue.h> +#include <linux/mfd/da903x.h> + +#define DA9030_LED1_CONTROL 0x20 +#define DA9030_LED2_CONTROL 0x21 +#define DA9030_LED3_CONTROL 0x22 +#define DA9030_LED4_CONTROL 0x23 +#define DA9030_LEDPC_CONTROL 0x24 +#define DA9030_MISC_CONTROL_A 0x26 /* Vibrator Control */ + +#define DA9034_LED1_CONTROL 0x35 +#define DA9034_LED2_CONTROL 0x36 +#define DA9034_VIBRA 0x40 + +struct da903x_led { + struct led_classdev cdev; + struct work_struct work; + struct device *master; + enum led_brightness new_brightness; + int id; + int flags; +}; + +#define DA9030_LED_OFFSET(id) ((id) - DA9030_ID_LED_1) +#define DA9034_LED_OFFSET(id) ((id) - DA9034_ID_LED_1) + +static void da903x_led_work(struct work_struct *work) +{ + struct da903x_led *led = container_of(work, struct da903x_led, work); + uint8_t val; + int offset; + + switch (led->id) { + case DA9030_ID_LED_1: + case DA9030_ID_LED_2: + case DA9030_ID_LED_3: + case DA9030_ID_LED_4: + case DA9030_ID_LED_PC: + offset = DA9030_LED_OFFSET(led->id); + val = led->flags & ~0x87; + val |= (led->new_brightness) ? 0x80 : 0; /* EN bit */ + val |= (led->new_brightness >> 5) & 0x7; /* PWM<2:0> */ + da903x_write(led->master, DA9030_LED1_CONTROL + offset, val); + break; + case DA9030_ID_VIBRA: + val = led->flags & ~0x80; + val |= (led->new_brightness) ? 0x80 : 0; /* EN bit */ + da903x_write(led->master, DA9030_MISC_CONTROL_A, val); + break; + case DA9034_ID_LED_1: + case DA9034_ID_LED_2: + offset = DA9034_LED_OFFSET(led->id); + val = (led->new_brightness * 0x5f / LED_FULL) & 0x7f; + val |= (led->flags & DA9034_LED_RAMP) ? 0x80 : 0; + da903x_write(led->master, DA9034_LED1_CONTROL + offset, val); + break; + case DA9034_ID_VIBRA: + val = led->new_brightness & 0xfe; + da903x_write(led->master, DA9034_VIBRA, val); + break; + } +} + +static void da903x_led_set(struct led_classdev *led_cdev, + enum led_brightness value) +{ + struct da903x_led *led; + + led = container_of(led_cdev, struct da903x_led, cdev); + led->new_brightness = value; + schedule_work(&led->work); +} + +static int __devinit da903x_led_probe(struct platform_device *pdev) +{ + struct led_info *pdata = pdev->dev.platform_data; + struct da903x_led *led; + int id, ret; + + if (pdata == NULL) + return 0; + + id = pdev->id; + + if (!((id >= DA9030_ID_LED_1 && id <= DA9030_ID_VIBRA) || + (id >= DA9034_ID_LED_1 && id <= DA9034_ID_VIBRA))) { + dev_err(&pdev->dev, "invalid LED ID (%d) specified\n", id); + return -EINVAL; + } + + led = kzalloc(sizeof(struct da903x_led), GFP_KERNEL); + if (led == NULL) { + dev_err(&pdev->dev, "failed to alloc memory for LED%d\n", id); + return -ENOMEM; + } + + led->cdev.name = pdata->name; + led->cdev.default_trigger = pdata->default_trigger; + led->cdev.brightness_set = da903x_led_set; + led->cdev.brightness = LED_OFF; + + led->id = id; + led->flags = pdata->flags; + led->master = pdev->dev.parent; + led->new_brightness = LED_OFF; + + INIT_WORK(&led->work, da903x_led_work); + + ret = led_classdev_register(led->master, &led->cdev); + if (ret) { + dev_err(&pdev->dev, "failed to register LED %d\n", id); + goto err; + } + + platform_set_drvdata(pdev, led); + return 0; + +err: + kfree(led); + return ret; +} + +static int __devexit da903x_led_remove(struct platform_device *pdev) +{ + struct da903x_led *led = platform_get_drvdata(pdev); + + led_classdev_unregister(&led->cdev); + kfree(led); + return 0; +} + +static struct platform_driver da903x_led_driver = { + .driver = { + .name = "da903x-led", + .owner = THIS_MODULE, + }, + .probe = da903x_led_probe, + .remove = __devexit_p(da903x_led_remove), +}; + +static int __init da903x_led_init(void) +{ + return platform_driver_register(&da903x_led_driver); +} +module_init(da903x_led_init); + +static void __exit da903x_led_exit(void) +{ + platform_driver_unregister(&da903x_led_driver); +} +module_exit(da903x_led_exit); + +MODULE_DESCRIPTION("LEDs driver for Dialog Semiconductor DA9030/DA9034"); +MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>" + "Mike Rapoport <mike@compulab.co.il>"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:da903x-led"); diff --git a/drivers/leds/leds-hp-disk.c b/drivers/leds/leds-hp-disk.c new file mode 100644 index 0000000..74645ab --- /dev/null +++ b/drivers/leds/leds-hp-disk.c @@ -0,0 +1,156 @@ +/* + * leds-hp-disk.c - driver for HP "hard disk protection" LED + * + * Copyright (C) 2008 Pavel Machek + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/dmi.h> +#include <linux/module.h> +#include <linux/types.h> +#include <linux/platform_device.h> +#include <linux/interrupt.h> +#include <linux/input.h> +#include <linux/kthread.h> +#include <linux/version.h> +#include <linux/leds.h> +#include <acpi/acpi_drivers.h> + +#define DRIVER_NAME "leds-hp-disk" +#define ACPI_MDPS_CLASS "led" + +/* For automatic insertion of the module */ +static struct acpi_device_id hpled_device_ids[] = { + {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */ + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, hpled_device_ids); + +struct acpi_hpled { + struct acpi_device *device; /* The ACPI device */ +}; + +static struct acpi_hpled adev; + +static acpi_status hpled_acpi_write(acpi_handle handle, int reg) +{ + unsigned long long ret; /* Not used when writing */ + union acpi_object in_obj[1]; + struct acpi_object_list args = { 1, in_obj }; + + in_obj[0].type = ACPI_TYPE_INTEGER; + in_obj[0].integer.value = reg; + + return acpi_evaluate_integer(handle, "ALED", &args, &ret); +} + +static void hpled_set(struct led_classdev *led_cdev, + enum led_brightness value) +{ + hpled_acpi_write(adev.device->handle, !!value); +} + +static struct led_classdev hpled_led = { + .name = "hp:red:hddprotection", + .default_trigger = "heartbeat", + .brightness_set = hpled_set, +}; + +#ifdef CONFIG_PM +static int hpled_suspend(struct acpi_device *dev, pm_message_t state) +{ + led_classdev_suspend(&hpled_led); + return 0; +} + +static int hpled_resume(struct acpi_device *dev) +{ + led_classdev_resume(&hpled_led); + return 0; +} +#else +#define hpled_suspend NULL +#define hpled_resume NULL +#endif + +static int hpled_add(struct acpi_device *device) +{ + int ret; + + if (!device) + return -EINVAL; + + adev.device = device; + strcpy(acpi_device_name(device), DRIVER_NAME); + strcpy(acpi_device_class(device), ACPI_MDPS_CLASS); + device->driver_data = &adev; + + ret = led_classdev_register(NULL, &hpled_led); + return ret; +} + +static int hpled_remove(struct acpi_device *device, int type) +{ + if (!device) + return -EINVAL; + + led_classdev_unregister(&hpled_led); + return 0; +} + + + +static struct acpi_driver leds_hp_driver = { + .name = DRIVER_NAME, + .class = ACPI_MDPS_CLASS, + .ids = hpled_device_ids, + .ops = { + .add = hpled_add, + .remove = hpled_remove, + .suspend = hpled_suspend, + .resume = hpled_resume, + } +}; + +static int __init hpled_init_module(void) +{ + int ret; + + if (acpi_disabled) + return -ENODEV; + + ret = acpi_bus_register_driver(&leds_hp_driver); + if (ret < 0) + return ret; + + printk(KERN_INFO DRIVER_NAME " driver loaded.\n"); + + return 0; +} + +static void __exit hpled_exit_module(void) +{ + acpi_bus_unregister_driver(&leds_hp_driver); +} + +MODULE_DESCRIPTION("Driver for HP disk protection LED"); +MODULE_AUTHOR("Pavel Machek <pavel@suse.cz>"); +MODULE_LICENSE("GPL"); + +module_init(hpled_init_module); +module_exit(hpled_exit_module); diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c index f508729..4e2d1a4 100644 --- a/drivers/leds/leds-pca955x.c +++ b/drivers/leds/leds-pca955x.c @@ -226,7 +226,7 @@ static void pca955x_led_work(struct work_struct *work) pca955x_write_ls(pca955x->client, chip_ls, ls); } -void pca955x_led_set(struct led_classdev *led_cdev, enum led_brightness value) +static void pca955x_led_set(struct led_classdev *led_cdev, enum led_brightness value) { struct pca955x_led *pca955x; diff --git a/drivers/leds/leds-wrap.c b/drivers/leds/leds-wrap.c index 7ac61a7..2f3aa87f 100644 --- a/drivers/leds/leds-wrap.c +++ b/drivers/leds/leds-wrap.c @@ -53,8 +53,9 @@ static void wrap_extra_led_set(struct led_classdev *led_cdev, } static struct led_classdev wrap_power_led = { - .name = "wrap::power", - .brightness_set = wrap_power_led_set, + .name = "wrap::power", + .brightness_set = wrap_power_led_set, + .default_trigger = "default-on", }; static struct led_classdev wrap_error_led = { diff --git a/drivers/leds/ledtrig-backlight.c b/drivers/leds/ledtrig-backlight.c new file mode 100644 index 0000000..d3dfcfb --- /dev/null +++ b/drivers/leds/ledtrig-backlight.c @@ -0,0 +1,110 @@ +/* + * Backlight emulation LED trigger + * + * Copyright 2008 (C) Rodolfo Giometti <giometti@linux.it> + * Copyright 2008 (C) Eurotech S.p.A. <info@eurotech.it> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/fb.h> +#include <linux/leds.h> +#include "leds.h" + +#define BLANK 1 +#define UNBLANK 0 + +struct bl_trig_notifier { + struct led_classdev *led; + int brightness; + int old_status; + struct notifier_block notifier; +}; + +static int fb_notifier_callback(struct notifier_block *p, + unsigned long event, void *data) +{ + struct bl_trig_notifier *n = container_of(p, + struct bl_trig_notifier, notifier); + struct led_classdev *led = n->led; + struct fb_event *fb_event = data; + int *blank = fb_event->data; + + switch (event) { + case FB_EVENT_BLANK : + if (*blank && n->old_status == UNBLANK) { + n->brightness = led->brightness; + led_set_brightness(led, LED_OFF); + n->old_status = BLANK; + } else if (!*blank && n->old_status == BLANK) { + led_set_brightness(led, n->brightness); + n->old_status = UNBLANK; + } + break; + } + + return 0; +} + +static void bl_trig_activate(struct led_classdev *led) +{ + int ret; + + struct bl_trig_notifier *n; + + n = kzalloc(sizeof(struct bl_trig_notifier), GFP_KERNEL); + led->trigger_data = n; + if (!n) { + dev_err(led->dev, "unable to allocate backlight trigger\n"); + return; + } + + n->led = led; + n->brightness = led->brightness; + n->old_status = UNBLANK; + n->notifier.notifier_call = fb_notifier_callback; + + ret = fb_register_client(&n->notifier); + if (ret) + dev_err(led->dev, "unable to register backlight trigger\n"); +} + +static void bl_trig_deactivate(struct led_classdev *led) +{ + struct bl_trig_notifier *n = + (struct bl_trig_notifier *) led->trigger_data; + + if (n) { + fb_unregister_client(&n->notifier); + kfree(n); + } +} + +static struct led_trigger bl_led_trigger = { + .name = "backlight", + .activate = bl_trig_activate, + .deactivate = bl_trig_deactivate +}; + +static int __init bl_trig_init(void) +{ + return led_trigger_register(&bl_led_trigger); +} + +static void __exit bl_trig_exit(void) +{ + led_trigger_unregister(&bl_led_trigger); +} + +module_init(bl_trig_init); +module_exit(bl_trig_exit); + +MODULE_AUTHOR("Rodolfo Giometti <giometti@linux.it>"); +MODULE_DESCRIPTION("Backlight emulation LED trigger"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c index 5c99f4f..db68196 100644 --- a/drivers/leds/ledtrig-timer.c +++ b/drivers/leds/ledtrig-timer.c @@ -70,9 +70,7 @@ static ssize_t led_delay_on_show(struct device *dev, struct led_classdev *led_cdev = dev_get_drvdata(dev); struct timer_trig_data *timer_data = led_cdev->trigger_data; - sprintf(buf, "%lu\n", timer_data->delay_on); - - return strlen(buf) + 1; + return sprintf(buf, "%lu\n", timer_data->delay_on); } static ssize_t led_delay_on_store(struct device *dev, @@ -116,9 +114,7 @@ static ssize_t led_delay_off_show(struct device *dev, struct led_classdev *led_cdev = dev_get_drvdata(dev); struct timer_trig_data *timer_data = led_cdev->trigger_data; - sprintf(buf, "%lu\n", timer_data->delay_off); - - return strlen(buf) + 1; + return sprintf(buf, "%lu\n", timer_data->delay_off); } static ssize_t led_delay_off_store(struct device *dev, diff --git a/drivers/md/md.c b/drivers/md/md.c index c1a837c..b4162f6 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -222,6 +222,9 @@ static void mddev_put(mddev_t *mddev) list_del(&mddev->all_mddevs); spin_unlock(&all_mddevs_lock); blk_cleanup_queue(mddev->queue); + if (mddev->sysfs_state) + sysfs_put(mddev->sysfs_state); + mddev->sysfs_state = NULL; kobject_put(&mddev->kobj); } else spin_unlock(&all_mddevs_lock); @@ -1459,6 +1462,8 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) kobject_del(&rdev->kobj); goto fail; } + rdev->sysfs_state = sysfs_get_dirent(rdev->kobj.sd, "state"); + list_add_rcu(&rdev->same_set, &mddev->disks); bd_claim_by_disk(rdev->bdev, rdev->bdev->bd_holder, mddev->gendisk); return 0; @@ -1488,7 +1493,8 @@ static void unbind_rdev_from_array(mdk_rdev_t * rdev) printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); rdev->mddev = NULL; sysfs_remove_link(&rdev->kobj, "block"); - + sysfs_put(rdev->sysfs_state); + rdev->sysfs_state = NULL; /* We need to delay this, otherwise we can deadlock when * writing to 'remove' to "dev/state". We also need * to delay it due to rcu usage. @@ -1923,8 +1929,8 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len) err = 0; } - if (!err) - sysfs_notify(&rdev->kobj, NULL, "state"); + if (!err && rdev->sysfs_state) + sysfs_notify_dirent(rdev->sysfs_state); return err ? err : len; } static struct rdev_sysfs_entry rdev_state = @@ -2019,7 +2025,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) rdev->raid_disk = -1; return err; } else - sysfs_notify(&rdev->kobj, NULL, "state"); + sysfs_notify_dirent(rdev->sysfs_state); sprintf(nm, "rd%d", rdev->raid_disk); if (sysfs_create_link(&rdev->mddev->kobj, &rdev->kobj, nm)) printk(KERN_WARNING @@ -2036,7 +2042,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) clear_bit(Faulty, &rdev->flags); clear_bit(WriteMostly, &rdev->flags); set_bit(In_sync, &rdev->flags); - sysfs_notify(&rdev->kobj, NULL, "state"); + sysfs_notify_dirent(rdev->sysfs_state); } return len; } @@ -2770,7 +2776,7 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len) if (err) return err; else { - sysfs_notify(&mddev->kobj, NULL, "array_state"); + sysfs_notify_dirent(mddev->sysfs_state); return len; } } @@ -3457,6 +3463,11 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) disk->fops = &md_fops; disk->private_data = mddev; disk->queue = mddev->queue; + /* Allow extended partitions. This makes the + * 'mdp' device redundant, but we can really + * remove it now. + */ + disk->flags |= GENHD_FL_EXT_DEVT; add_disk(disk); mddev->gendisk = disk; error = kobject_init_and_add(&mddev->kobj, &md_ktype, @@ -3465,8 +3476,10 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) if (error) printk(KERN_WARNING "md: cannot register %s/md - name in use\n", disk->disk_name); - else + else { kobject_uevent(&mddev->kobj, KOBJ_ADD); + mddev->sysfs_state = sysfs_get_dirent(mddev->kobj.sd, "array_state"); + } return NULL; } @@ -3477,7 +3490,7 @@ static void md_safemode_timeout(unsigned long data) if (!atomic_read(&mddev->writes_pending)) { mddev->safemode = 1; if (mddev->external) - set_bit(MD_NOTIFY_ARRAY_STATE, &mddev->flags); + sysfs_notify_dirent(mddev->sysfs_state); } md_wakeup_thread(mddev->thread); } @@ -3578,7 +3591,7 @@ static int do_md_run(mddev_t * mddev) return -EINVAL; } } - sysfs_notify(&rdev->kobj, NULL, "state"); + sysfs_notify_dirent(rdev->sysfs_state); } md_probe(mddev->unit, NULL, NULL); @@ -3740,7 +3753,7 @@ static int do_md_run(mddev_t * mddev) mddev->changed = 1; md_new_event(mddev); - sysfs_notify(&mddev->kobj, NULL, "array_state"); + sysfs_notify_dirent(mddev->sysfs_state); sysfs_notify(&mddev->kobj, NULL, "sync_action"); sysfs_notify(&mddev->kobj, NULL, "degraded"); kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); @@ -3767,7 +3780,7 @@ static int restart_array(mddev_t *mddev) set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); md_wakeup_thread(mddev->thread); md_wakeup_thread(mddev->sync_thread); - sysfs_notify(&mddev->kobj, NULL, "array_state"); + sysfs_notify_dirent(mddev->sysfs_state); return 0; } @@ -3847,7 +3860,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) module_put(mddev->pers->owner); mddev->pers = NULL; /* tell userspace to handle 'inactive' */ - sysfs_notify(&mddev->kobj, NULL, "array_state"); + sysfs_notify_dirent(mddev->sysfs_state); set_capacity(disk, 0); mddev->changed = 1; @@ -3933,7 +3946,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) mdname(mddev)); err = 0; md_new_event(mddev); - sysfs_notify(&mddev->kobj, NULL, "array_state"); + sysfs_notify_dirent(mddev->sysfs_state); out: return err; } @@ -4297,7 +4310,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) if (err) export_rdev(rdev); else - sysfs_notify(&rdev->kobj, NULL, "state"); + sysfs_notify_dirent(rdev->sysfs_state); md_update_sb(mddev, 1); if (mddev->degraded) @@ -4938,7 +4951,7 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, if (_IOC_TYPE(cmd) == MD_MAJOR && mddev->ro && mddev->pers) { if (mddev->ro == 2) { mddev->ro = 0; - sysfs_notify(&mddev->kobj, NULL, "array_state"); + sysfs_notify_dirent(mddev->sysfs_state); set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); md_wakeup_thread(mddev->thread); } else { @@ -5612,7 +5625,7 @@ void md_write_start(mddev_t *mddev, struct bio *bi) spin_unlock_irq(&mddev->write_lock); } if (did_change) - sysfs_notify(&mddev->kobj, NULL, "array_state"); + sysfs_notify_dirent(mddev->sysfs_state); wait_event(mddev->sb_wait, !test_bit(MD_CHANGE_CLEAN, &mddev->flags) && !test_bit(MD_CHANGE_PENDING, &mddev->flags)); @@ -5655,7 +5668,7 @@ int md_allow_write(mddev_t *mddev) mddev->safemode = 1; spin_unlock_irq(&mddev->write_lock); md_update_sb(mddev, 0); - sysfs_notify(&mddev->kobj, NULL, "array_state"); + sysfs_notify_dirent(mddev->sysfs_state); } else spin_unlock_irq(&mddev->write_lock); @@ -6048,9 +6061,6 @@ void md_check_recovery(mddev_t *mddev) if (mddev->bitmap) bitmap_daemon_work(mddev->bitmap); - if (test_and_clear_bit(MD_NOTIFY_ARRAY_STATE, &mddev->flags)) - sysfs_notify(&mddev->kobj, NULL, "array_state"); - if (mddev->ro) return; @@ -6103,7 +6113,7 @@ void md_check_recovery(mddev_t *mddev) mddev->safemode = 0; spin_unlock_irq(&mddev->write_lock); if (did_change) - sysfs_notify(&mddev->kobj, NULL, "array_state"); + sysfs_notify_dirent(mddev->sysfs_state); } if (mddev->flags) @@ -6111,7 +6121,7 @@ void md_check_recovery(mddev_t *mddev) rdev_for_each(rdev, rtmp, mddev) if (test_and_clear_bit(StateChanged, &rdev->flags)) - sysfs_notify(&rdev->kobj, NULL, "state"); + sysfs_notify_dirent(rdev->sysfs_state); if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) && @@ -6221,7 +6231,7 @@ void md_check_recovery(mddev_t *mddev) void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev) { - sysfs_notify(&rdev->kobj, NULL, "state"); + sysfs_notify_dirent(rdev->sysfs_state); wait_event_timeout(rdev->blocked_wait, !test_bit(Blocked, &rdev->flags), msecs_to_jiffies(5000)); diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 9f9354f..d62fd4f 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -1760,10 +1760,9 @@ mptscsih_get_tm_timeout(MPT_ADAPTER *ioc) case FC: return 40; case SAS: - return 10; case SPI: default: - return 2; + return 10; } } diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 5a79d2d..b550267 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -103,8 +103,20 @@ config MFD_TC6393XB help Support for Toshiba Mobile IO Controller TC6393XB +config PMIC_DA903X + bool "Dialog Semiconductor DA9030/DA9034 PMIC Support" + depends on I2C=y + help + Say yes here to support for Dialog Semiconductor DA9030 (a.k.a + ARAVA) and DA9034 (a.k.a MICCO), these are Power Management IC + usually found on PXA processors-based platforms. This includes + the I2C driver and the core APIs _only_, you have to select + individual components like LCD backlight, voltage regulators, + LEDs and battery-charger under the corresponding menus. + config MFD_WM8400 tristate "Support Wolfson Microelectronics WM8400" + depends on I2C help Support for the Wolfson Microelecronics WM8400 PMIC and audio CODEC. This driver adds provides common support for accessing diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 0acefe8..9a5ad8a 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -30,3 +30,5 @@ ifeq ($(CONFIG_SA1100_ASSABET),y) obj-$(CONFIG_MCP_UCB1200) += ucb1x00-assabet.o endif obj-$(CONFIG_UCB1400_CORE) += ucb1400_core.o + +obj-$(CONFIG_PMIC_DA903X) += da903x.o
\ No newline at end of file diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 85fa40a..9ba1f0b 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c @@ -1836,10 +1836,9 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) if (pdev->vendor == PCI_VENDOR_ID_REALTEK && pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pdev->revision < 0x20) { - dev_err(&pdev->dev, - "This (id %04x:%04x rev %02x) is not an 8139C+ compatible chip\n", + dev_info(&pdev->dev, + "This (id %04x:%04x rev %02x) is not an 8139C+ compatible chip, use 8139too\n", pdev->vendor, pdev->device, pdev->revision); - dev_err(&pdev->dev, "Try the \"8139too\" driver instead.\n"); return -ENODEV; } diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 0daf8c1..63f906b 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c @@ -946,10 +946,9 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev, if (pdev->vendor == PCI_VENDOR_ID_REALTEK && pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pdev->revision >= 0x20) { dev_info(&pdev->dev, - "This (id %04x:%04x rev %02x) is an enhanced 8139C+ chip\n", + "This (id %04x:%04x rev %02x) is an enhanced 8139C+ chip, use 8139cp\n", pdev->vendor, pdev->device, pdev->revision); - dev_info(&pdev->dev, - "Use the \"8139cp\" driver for improved performance and stability.\n"); + return -ENODEV; } if (pdev->vendor == PCI_VENDOR_ID_REALTEK && diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 0b71ebc..f749b40 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -894,7 +894,7 @@ config SMC91X select CRC32 select MII depends on ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || \ - SOC_AU1X00 || BLACKFIN || MN10300 + MIPS || BLACKFIN || MN10300 help This is a driver for SMC's 91x series of Ethernet chipsets, including the SMC91C94 and the SMC91C111. Say Y if you want it @@ -966,7 +966,7 @@ config SMC911X tristate "SMSC LAN911[5678] support" select CRC32 select MII - depends on ARCH_PXA || SUPERH + depends on ARM || SUPERH help This is a driver for SMSC's LAN911x series of Ethernet chipsets including the new LAN9115, LAN9116, LAN9117, and LAN9118. @@ -2009,6 +2009,11 @@ config IGB_LRO If in doubt, say N. +config IGB_DCA + bool "Enable DCA" + default y + depends on IGB && DCA && !(IGB=y && DCA=m) + source "drivers/net/ixp2000/Kconfig" config MYRI_SBUS diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c index 4207d6e..9a314d8 100644 --- a/drivers/net/ax88796.c +++ b/drivers/net/ax88796.c @@ -838,12 +838,12 @@ static int ax_probe(struct platform_device *pdev) /* find the platform resources */ - dev->irq = platform_get_irq(pdev, 0); - if (dev->irq < 0) { + ret = platform_get_irq(pdev, 0); + if (ret < 0) { dev_err(&pdev->dev, "no IRQ specified\n"); - ret = -ENXIO; goto exit_mem; } + dev->irq = ret; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res == NULL) { diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 8e2be24..832739f 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1341,18 +1341,24 @@ static int bond_compute_features(struct bonding *bond) int i; features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES); - features |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | - NETIF_F_GSO_MASK | NETIF_F_NO_CSUM; + features |= NETIF_F_GSO_MASK | NETIF_F_NO_CSUM; + + if (!bond->first_slave) + goto done; + + features &= ~NETIF_F_ONE_FOR_ALL; bond_for_each_slave(bond, slave, i) { - features = netdev_compute_features(features, - slave->dev->features); + features = netdev_increment_features(features, + slave->dev->features, + NETIF_F_ONE_FOR_ALL); if (slave->dev->hard_header_len > max_hard_header_len) max_hard_header_len = slave->dev->hard_header_len; } +done: features |= (bond_dev->features & BOND_VLAN_FEATURES); - bond_dev->features = features; + bond_dev->features = netdev_fix_features(features, NULL); bond_dev->hard_header_len = max_hard_header_len; return 0; diff --git a/drivers/net/cxgb3/l2t.c b/drivers/net/cxgb3/l2t.c index 4407ac9..ff1611f 100644 --- a/drivers/net/cxgb3/l2t.c +++ b/drivers/net/cxgb3/l2t.c @@ -431,6 +431,7 @@ struct l2t_data *t3_init_l2t(unsigned int l2t_capacity) for (i = 0; i < l2t_capacity; ++i) { d->l2tab[i].idx = i; d->l2tab[i].state = L2T_STATE_UNUSED; + __skb_queue_head_init(&d->l2tab[i].arpq); spin_lock_init(&d->l2tab[i].lock); atomic_set(&d->l2tab[i].refcnt, 0); } diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index f42c23f..5a9083e 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c @@ -47,15 +47,6 @@ #define CARDNAME "dm9000" #define DRV_VERSION "1.31" -#ifdef CONFIG_BLACKFIN -#define readsb insb -#define readsw insw -#define readsl insl -#define writesb outsb -#define writesw outsw -#define writesl outsl -#endif - /* * Transmit timeout, default 5 seconds. */ diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 5524271..82dd1a8 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h @@ -40,7 +40,7 @@ #include <asm/io.h> #define DRV_NAME "ehea" -#define DRV_VERSION "EHEA_0093" +#define DRV_VERSION "EHEA_0094" /* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1 diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index b70c531..422fcb9 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -2863,7 +2863,7 @@ static void ehea_rereg_mrs(struct work_struct *work) struct ehea_adapter *adapter; mutex_lock(&dlpar_mem_lock); - ehea_info("LPAR memory enlarged - re-initializing driver"); + ehea_info("LPAR memory changed - re-initializing driver"); list_for_each_entry(adapter, &adapter_list, list) if (adapter->active_ports) { @@ -2900,13 +2900,6 @@ static void ehea_rereg_mrs(struct work_struct *work) } } - ehea_destroy_busmap(); - ret = ehea_create_busmap(); - if (ret) { - ehea_error("creating ehea busmap failed"); - goto out; - } - clear_bit(__EHEA_STOP_XFER, &ehea_driver_flags); list_for_each_entry(adapter, &adapter_list, list) @@ -3519,9 +3512,21 @@ void ehea_crash_handler(void) static int ehea_mem_notifier(struct notifier_block *nb, unsigned long action, void *data) { + struct memory_notify *arg = data; switch (action) { - case MEM_OFFLINE: - ehea_info("memory has been removed"); + case MEM_CANCEL_OFFLINE: + ehea_info("memory offlining canceled"); + /* Readd canceled memory block */ + case MEM_ONLINE: + ehea_info("memory is going online"); + if (ehea_add_sect_bmap(arg->start_pfn, arg->nr_pages)) + return NOTIFY_BAD; + ehea_rereg_mrs(NULL); + break; + case MEM_GOING_OFFLINE: + ehea_info("memory is going offline"); + if (ehea_rem_sect_bmap(arg->start_pfn, arg->nr_pages)) + return NOTIFY_BAD; ehea_rereg_mrs(NULL); break; default: diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c index db8a925..9b61dc9 100644 --- a/drivers/net/ehea/ehea_qmr.c +++ b/drivers/net/ehea/ehea_qmr.c @@ -567,7 +567,7 @@ static inline int ehea_calc_index(unsigned long i, unsigned long s) static inline int ehea_init_top_bmap(struct ehea_top_bmap *ehea_top_bmap, int dir) { - if(!ehea_top_bmap->dir[dir]) { + if (!ehea_top_bmap->dir[dir]) { ehea_top_bmap->dir[dir] = kzalloc(sizeof(struct ehea_dir_bmap), GFP_KERNEL); if (!ehea_top_bmap->dir[dir]) @@ -578,7 +578,7 @@ static inline int ehea_init_top_bmap(struct ehea_top_bmap *ehea_top_bmap, static inline int ehea_init_bmap(struct ehea_bmap *ehea_bmap, int top, int dir) { - if(!ehea_bmap->top[top]) { + if (!ehea_bmap->top[top]) { ehea_bmap->top[top] = kzalloc(sizeof(struct ehea_top_bmap), GFP_KERNEL); if (!ehea_bmap->top[top]) @@ -587,53 +587,124 @@ static inline int ehea_init_bmap(struct ehea_bmap *ehea_bmap, int top, int dir) return ehea_init_top_bmap(ehea_bmap->top[top], dir); } -static int ehea_create_busmap_callback(unsigned long pfn, - unsigned long nr_pages, void *arg) -{ - unsigned long i, mr_len, start_section, end_section; - start_section = (pfn * PAGE_SIZE) / EHEA_SECTSIZE; - end_section = start_section + ((nr_pages * PAGE_SIZE) / EHEA_SECTSIZE); - mr_len = *(unsigned long *)arg; +static DEFINE_MUTEX(ehea_busmap_mutex); +static unsigned long ehea_mr_len; - if (!ehea_bmap) - ehea_bmap = kzalloc(sizeof(struct ehea_bmap), GFP_KERNEL); - if (!ehea_bmap) - return -ENOMEM; +#define EHEA_BUSMAP_ADD_SECT 1 +#define EHEA_BUSMAP_REM_SECT 0 - for (i = start_section; i < end_section; i++) { - int ret; - int top, dir, idx; - u64 vaddr; +static void ehea_rebuild_busmap(void) +{ + u64 vaddr = EHEA_BUSMAP_START; + int top, dir, idx; + + for (top = 0; top < EHEA_MAP_ENTRIES; top++) { + struct ehea_top_bmap *ehea_top; + int valid_dir_entries = 0; - top = ehea_calc_index(i, EHEA_TOP_INDEX_SHIFT); - dir = ehea_calc_index(i, EHEA_DIR_INDEX_SHIFT); + if (!ehea_bmap->top[top]) + continue; + ehea_top = ehea_bmap->top[top]; + for (dir = 0; dir < EHEA_MAP_ENTRIES; dir++) { + struct ehea_dir_bmap *ehea_dir; + int valid_entries = 0; - ret = ehea_init_bmap(ehea_bmap, top, dir); - if(ret) - return ret; + if (!ehea_top->dir[dir]) + continue; + valid_dir_entries++; + ehea_dir = ehea_top->dir[dir]; + for (idx = 0; idx < EHEA_MAP_ENTRIES; idx++) { + if (!ehea_dir->ent[idx]) + continue; + valid_entries++; + ehea_dir->ent[idx] = vaddr; + vaddr += EHEA_SECTSIZE; + } + if (!valid_entries) { + ehea_top->dir[dir] = NULL; + kfree(ehea_dir); + } + } + if (!valid_dir_entries) { + ehea_bmap->top[top] = NULL; + kfree(ehea_top); + } + } +} - idx = i & EHEA_INDEX_MASK; - vaddr = EHEA_BUSMAP_START + mr_len + i * EHEA_SECTSIZE; +static int ehea_update_busmap(unsigned long pfn, unsigned long pgnum, int add) +{ + unsigned long i, start_section, end_section; - ehea_bmap->top[top]->dir[dir]->ent[idx] = vaddr; + if (!ehea_bmap) { + ehea_bmap = kzalloc(sizeof(struct ehea_bmap), GFP_KERNEL); + if (!ehea_bmap) + return -ENOMEM; } - mr_len += nr_pages * PAGE_SIZE; - *(unsigned long *)arg = mr_len; + start_section = (pfn * PAGE_SIZE) / EHEA_SECTSIZE; + end_section = start_section + ((pgnum * PAGE_SIZE) / EHEA_SECTSIZE); + /* Mark entries as valid or invalid only; address is assigned later */ + for (i = start_section; i < end_section; i++) { + u64 flag; + int top = ehea_calc_index(i, EHEA_TOP_INDEX_SHIFT); + int dir = ehea_calc_index(i, EHEA_DIR_INDEX_SHIFT); + int idx = i & EHEA_INDEX_MASK; + + if (add) { + int ret = ehea_init_bmap(ehea_bmap, top, dir); + if (ret) + return ret; + flag = 1; /* valid */ + ehea_mr_len += EHEA_SECTSIZE; + } else { + if (!ehea_bmap->top[top]) + continue; + if (!ehea_bmap->top[top]->dir[dir]) + continue; + flag = 0; /* invalid */ + ehea_mr_len -= EHEA_SECTSIZE; + } + ehea_bmap->top[top]->dir[dir]->ent[idx] = flag; + } + ehea_rebuild_busmap(); /* Assign contiguous addresses for mr */ return 0; } -static unsigned long ehea_mr_len; +int ehea_add_sect_bmap(unsigned long pfn, unsigned long nr_pages) +{ + int ret; -static DEFINE_MUTEX(ehea_busmap_mutex); + mutex_lock(&ehea_busmap_mutex); + ret = ehea_update_busmap(pfn, nr_pages, EHEA_BUSMAP_ADD_SECT); + mutex_unlock(&ehea_busmap_mutex); + return ret; +} + +int ehea_rem_sect_bmap(unsigned long pfn, unsigned long nr_pages) +{ + int ret; + + mutex_lock(&ehea_busmap_mutex); + ret = ehea_update_busmap(pfn, nr_pages, EHEA_BUSMAP_REM_SECT); + mutex_unlock(&ehea_busmap_mutex); + return ret; +} + +static int ehea_create_busmap_callback(unsigned long pfn, + unsigned long nr_pages, void *arg) +{ + return ehea_update_busmap(pfn, nr_pages, EHEA_BUSMAP_ADD_SECT); +} int ehea_create_busmap(void) { int ret; + mutex_lock(&ehea_busmap_mutex); ehea_mr_len = 0; - ret = walk_memory_resource(0, 1ULL << MAX_PHYSMEM_BITS, &ehea_mr_len, + ret = walk_memory_resource(0, 1ULL << MAX_PHYSMEM_BITS, NULL, ehea_create_busmap_callback); mutex_unlock(&ehea_busmap_mutex); return ret; diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h index 0bb6f92..1e58dc0 100644 --- a/drivers/net/ehea/ehea_qmr.h +++ b/drivers/net/ehea/ehea_qmr.h @@ -378,6 +378,8 @@ int ehea_rem_mr(struct ehea_mr *mr); void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle); +int ehea_add_sect_bmap(unsigned long pfn, unsigned long nr_pages); +int ehea_rem_sect_bmap(unsigned long pfn, unsigned long nr_pages); int ehea_create_busmap(void); void ehea_destroy_busmap(void); u64 ehea_map_vaddr(void *caddr); diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index 4e4f683..aec3b97 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c @@ -401,6 +401,21 @@ static int mpc52xx_fec_hard_start_xmit(struct sk_buff *skb, struct net_device *d return 0; } +#ifdef CONFIG_NET_POLL_CONTROLLER +static void mpc52xx_fec_poll_controller(struct net_device *dev) +{ + struct mpc52xx_fec_priv *priv = netdev_priv(dev); + + disable_irq(priv->t_irq); + mpc52xx_fec_tx_interrupt(priv->t_irq, dev); + enable_irq(priv->t_irq); + disable_irq(priv->r_irq); + mpc52xx_fec_rx_interrupt(priv->r_irq, dev); + enable_irq(priv->r_irq); +} +#endif + + /* This handles BestComm transmit task interrupts */ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id) @@ -926,6 +941,9 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) ndev->tx_timeout = mpc52xx_fec_tx_timeout; ndev->watchdog_timeo = FEC_WATCHDOG_TIMEOUT; ndev->base_addr = mem.start; +#ifdef CONFIG_NET_POLL_CONTROLLER + ndev->poll_controller = mpc52xx_fec_poll_controller; +#endif priv->t_irq = priv->r_irq = ndev->irq = NO_IRQ; /* IRQ are free for now */ diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index b5bb7ae..64b2011 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -161,7 +161,7 @@ static int gfar_probe(struct platform_device *pdev) struct gfar_private *priv = NULL; struct gianfar_platform_data *einfo; struct resource *r; - int err = 0; + int err = 0, irq; DECLARE_MAC_BUF(mac); einfo = (struct gianfar_platform_data *) pdev->dev.platform_data; @@ -187,15 +187,25 @@ static int gfar_probe(struct platform_device *pdev) /* fill out IRQ fields */ if (einfo->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) { - priv->interruptTransmit = platform_get_irq_byname(pdev, "tx"); - priv->interruptReceive = platform_get_irq_byname(pdev, "rx"); - priv->interruptError = platform_get_irq_byname(pdev, "error"); - if (priv->interruptTransmit < 0 || priv->interruptReceive < 0 || priv->interruptError < 0) + irq = platform_get_irq_byname(pdev, "tx"); + if (irq < 0) + goto regs_fail; + priv->interruptTransmit = irq; + + irq = platform_get_irq_byname(pdev, "rx"); + if (irq < 0) + goto regs_fail; + priv->interruptReceive = irq; + + irq = platform_get_irq_byname(pdev, "error"); + if (irq < 0) goto regs_fail; + priv->interruptError = irq; } else { - priv->interruptTransmit = platform_get_irq(pdev, 0); - if (priv->interruptTransmit < 0) + irq = platform_get_irq(pdev, 0); + if (irq < 0) goto regs_fail; + priv->interruptTransmit = irq; } /* get a pointer to the register memory */ diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 93d02ef..1f397cd 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c @@ -38,10 +38,11 @@ #include <linux/ethtool.h> #include <linux/if_vlan.h> #include <linux/pci.h> +#include <linux/pci-aspm.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/if_ether.h> -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA #include <linux/dca.h> #endif #include "igb.h" @@ -106,11 +107,11 @@ static irqreturn_t igb_msix_other(int irq, void *); static irqreturn_t igb_msix_rx(int irq, void *); static irqreturn_t igb_msix_tx(int irq, void *); static int igb_clean_rx_ring_msix(struct napi_struct *, int); -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA static void igb_update_rx_dca(struct igb_ring *); static void igb_update_tx_dca(struct igb_ring *); static void igb_setup_dca(struct igb_adapter *); -#endif /* CONFIG_DCA */ +#endif /* CONFIG_IGB_DCA */ static bool igb_clean_tx_irq(struct igb_ring *); static int igb_poll(struct napi_struct *, int); static bool igb_clean_rx_irq_adv(struct igb_ring *, int *, int); @@ -131,7 +132,7 @@ static int igb_suspend(struct pci_dev *, pm_message_t); static int igb_resume(struct pci_dev *); #endif static void igb_shutdown(struct pci_dev *); -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA static int igb_notify_dca(struct notifier_block *, unsigned long, void *); static struct notifier_block dca_notifier = { .notifier_call = igb_notify_dca, @@ -207,7 +208,7 @@ static int __init igb_init_module(void) global_quad_port_a = 0; ret = pci_register_driver(&igb_driver); -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA dca_register_notify(&dca_notifier); #endif return ret; @@ -223,7 +224,7 @@ module_init(igb_init_module); **/ static void __exit igb_exit_module(void) { -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA dca_unregister_notify(&dca_notifier); #endif pci_unregister_driver(&igb_driver); @@ -966,10 +967,11 @@ static int __devinit igb_probe(struct pci_dev *pdev, struct net_device *netdev; struct igb_adapter *adapter; struct e1000_hw *hw; + struct pci_dev *us_dev; const struct e1000_info *ei = igb_info_tbl[ent->driver_data]; unsigned long mmio_start, mmio_len; - int i, err, pci_using_dac; - u16 eeprom_data = 0; + int i, err, pci_using_dac, pos; + u16 eeprom_data = 0, state = 0; u16 eeprom_apme_mask = IGB_EEPROM_APME; u32 part_num; int bars, need_ioport; @@ -1004,6 +1006,28 @@ static int __devinit igb_probe(struct pci_dev *pdev, } } + /* 82575 requires that the pci-e link partner disable the L0s state */ + switch (pdev->device) { + case E1000_DEV_ID_82575EB_COPPER: + case E1000_DEV_ID_82575EB_FIBER_SERDES: + case E1000_DEV_ID_82575GB_QUAD_COPPER: + us_dev = pdev->bus->self; + pos = pci_find_capability(us_dev, PCI_CAP_ID_EXP); + if (pos) { + pci_read_config_word(us_dev, pos + PCI_EXP_LNKCTL, + &state); + state &= ~PCIE_LINK_STATE_L0S; + pci_write_config_word(us_dev, pos + PCI_EXP_LNKCTL, + state); + printk(KERN_INFO "Disabling ASPM L0s upstream switch " + "port %x:%x.%x\n", us_dev->bus->number, + PCI_SLOT(us_dev->devfn), + PCI_FUNC(us_dev->devfn)); + } + default: + break; + } + err = pci_request_selected_regions(pdev, bars, igb_driver_name); if (err) goto err_pci_reg; @@ -1237,7 +1261,7 @@ static int __devinit igb_probe(struct pci_dev *pdev, if (err) goto err_register; -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA if ((adapter->flags & IGB_FLAG_HAS_DCA) && (dca_add_requester(&pdev->dev) == 0)) { adapter->flags |= IGB_FLAG_DCA_ENABLED; @@ -1311,7 +1335,7 @@ static void __devexit igb_remove(struct pci_dev *pdev) { struct net_device *netdev = pci_get_drvdata(pdev); struct igb_adapter *adapter = netdev_priv(netdev); -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA struct e1000_hw *hw = &adapter->hw; #endif @@ -1323,7 +1347,7 @@ static void __devexit igb_remove(struct pci_dev *pdev) flush_scheduled_work(); -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA if (adapter->flags & IGB_FLAG_DCA_ENABLED) { dev_info(&pdev->dev, "DCA disabled\n"); dca_remove_requester(&pdev->dev); @@ -3271,7 +3295,7 @@ static irqreturn_t igb_msix_tx(int irq, void *data) struct igb_adapter *adapter = tx_ring->adapter; struct e1000_hw *hw = &adapter->hw; -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA if (adapter->flags & IGB_FLAG_DCA_ENABLED) igb_update_tx_dca(tx_ring); #endif @@ -3323,14 +3347,14 @@ static irqreturn_t igb_msix_rx(int irq, void *data) if (netif_rx_schedule_prep(adapter->netdev, &rx_ring->napi)) __netif_rx_schedule(adapter->netdev, &rx_ring->napi); -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA if (adapter->flags & IGB_FLAG_DCA_ENABLED) igb_update_rx_dca(rx_ring); #endif return IRQ_HANDLED; } -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA static void igb_update_rx_dca(struct igb_ring *rx_ring) { u32 dca_rxctrl; @@ -3450,7 +3474,7 @@ static int igb_notify_dca(struct notifier_block *nb, unsigned long event, return ret_val ? NOTIFY_BAD : NOTIFY_DONE; } -#endif /* CONFIG_DCA */ +#endif /* CONFIG_IGB_DCA */ /** * igb_intr_msi - Interrupt Handler @@ -3529,13 +3553,13 @@ static int igb_poll(struct napi_struct *napi, int budget) int tx_clean_complete, work_done = 0; /* this poll routine only supports one tx and one rx queue */ -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA if (adapter->flags & IGB_FLAG_DCA_ENABLED) igb_update_tx_dca(&adapter->tx_ring[0]); #endif tx_clean_complete = igb_clean_tx_irq(&adapter->tx_ring[0]); -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA if (adapter->flags & IGB_FLAG_DCA_ENABLED) igb_update_rx_dca(&adapter->rx_ring[0]); #endif @@ -3563,7 +3587,7 @@ static int igb_clean_rx_ring_msix(struct napi_struct *napi, int budget) struct net_device *netdev = adapter->netdev; int work_done = 0; -#ifdef CONFIG_DCA +#ifdef CONFIG_IGB_DCA if (adapter->flags & IGB_FLAG_DCA_ENABLED) igb_update_rx_dca(rx_ring); #endif diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index a9aebad..b1556b2 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c @@ -75,7 +75,7 @@ #include "myri10ge_mcp.h" #include "myri10ge_mcp_gen_header.h" -#define MYRI10GE_VERSION_STR "1.4.3-1.369" +#define MYRI10GE_VERSION_STR "1.4.3-1.371" MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); MODULE_AUTHOR("Maintainer: help@myri.com"); @@ -2497,6 +2497,10 @@ static int myri10ge_open(struct net_device *dev) return 0; abort_with_rings: + while (slice) { + slice--; + napi_disable(&mgp->ss[slice].napi); + } for (i = 0; i < mgp->num_slices; i++) myri10ge_free_rings(&mgp->ss[i]); diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index 38116f9..ba2e1c5b 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h @@ -1375,7 +1375,6 @@ struct ql_adapter { spinlock_t adapter_lock; spinlock_t hw_lock; spinlock_t stats_lock; - spinlock_t legacy_lock; /* used for maintaining legacy intr sync */ /* PCI Bus Relative Register Addresses */ void __iomem *reg_base; @@ -1399,8 +1398,6 @@ struct ql_adapter { struct msix_entry *msi_x_entry; struct intr_context intr_context[MAX_RX_RINGS]; - int (*legacy_check) (struct ql_adapter *); - int tx_ring_count; /* One per online CPU. */ u32 rss_ring_first_cq_id;/* index of first inbound (rss) rx_ring */ u32 rss_ring_count; /* One per online CPU. */ @@ -1502,7 +1499,7 @@ void ql_mpi_work(struct work_struct *work); void ql_mpi_reset_work(struct work_struct *work); int ql_wait_reg_rdy(struct ql_adapter *qdev, u32 reg, u32 bit, u32 ebit); void ql_queue_asic_error(struct ql_adapter *qdev); -void ql_enable_completion_interrupt(struct ql_adapter *qdev, u32 intr); +u32 ql_enable_completion_interrupt(struct ql_adapter *qdev, u32 intr); void ql_set_ethtool_ops(struct net_device *ndev); int ql_read_xgmac_reg64(struct ql_adapter *qdev, u32 reg, u64 *data); diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 4b2caa6..b83a9c9 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c @@ -577,41 +577,53 @@ static void ql_disable_interrupts(struct ql_adapter *qdev) * incremented everytime we queue a worker and decremented everytime * a worker finishes. Once it hits zero we enable the interrupt. */ -void ql_enable_completion_interrupt(struct ql_adapter *qdev, u32 intr) +u32 ql_enable_completion_interrupt(struct ql_adapter *qdev, u32 intr) { - if (likely(test_bit(QL_MSIX_ENABLED, &qdev->flags))) + u32 var = 0; + unsigned long hw_flags = 0; + struct intr_context *ctx = qdev->intr_context + intr; + + if (likely(test_bit(QL_MSIX_ENABLED, &qdev->flags) && intr)) { + /* Always enable if we're MSIX multi interrupts and + * it's not the default (zeroeth) interrupt. + */ ql_write32(qdev, INTR_EN, - qdev->intr_context[intr].intr_en_mask); - else { - if (qdev->legacy_check) - spin_lock(&qdev->legacy_lock); - if (atomic_dec_and_test(&qdev->intr_context[intr].irq_cnt)) { - QPRINTK(qdev, INTR, ERR, "Enabling interrupt %d.\n", - intr); - ql_write32(qdev, INTR_EN, - qdev->intr_context[intr].intr_en_mask); - } else { - QPRINTK(qdev, INTR, ERR, - "Skip enable, other queue(s) are active.\n"); - } - if (qdev->legacy_check) - spin_unlock(&qdev->legacy_lock); + ctx->intr_en_mask); + var = ql_read32(qdev, STS); + return var; } + + spin_lock_irqsave(&qdev->hw_lock, hw_flags); + if (atomic_dec_and_test(&ctx->irq_cnt)) { + ql_write32(qdev, INTR_EN, + ctx->intr_en_mask); + var = ql_read32(qdev, STS); + } + spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); + return var; } static u32 ql_disable_completion_interrupt(struct ql_adapter *qdev, u32 intr) { u32 var = 0; + unsigned long hw_flags; + struct intr_context *ctx; - if (likely(test_bit(QL_MSIX_ENABLED, &qdev->flags))) - goto exit; - else if (!atomic_read(&qdev->intr_context[intr].irq_cnt)) { + /* HW disables for us if we're MSIX multi interrupts and + * it's not the default (zeroeth) interrupt. + */ + if (likely(test_bit(QL_MSIX_ENABLED, &qdev->flags) && intr)) + return 0; + + ctx = qdev->intr_context + intr; + spin_lock_irqsave(&qdev->hw_lock, hw_flags); + if (!atomic_read(&ctx->irq_cnt)) { ql_write32(qdev, INTR_EN, - qdev->intr_context[intr].intr_dis_mask); + ctx->intr_dis_mask); var = ql_read32(qdev, STS); } - atomic_inc(&qdev->intr_context[intr].irq_cnt); -exit: + atomic_inc(&ctx->irq_cnt); + spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); return var; } @@ -623,7 +635,9 @@ static void ql_enable_all_completion_interrupts(struct ql_adapter *qdev) * and enables only if the result is zero. * So we precharge it here. */ - atomic_set(&qdev->intr_context[i].irq_cnt, 1); + if (unlikely(!test_bit(QL_MSIX_ENABLED, &qdev->flags) || + i == 0)) + atomic_set(&qdev->intr_context[i].irq_cnt, 1); ql_enable_completion_interrupt(qdev, i); } @@ -1725,19 +1739,6 @@ static irqreturn_t qlge_msix_rx_isr(int irq, void *dev_id) return IRQ_HANDLED; } -/* We check here to see if we're already handling a legacy - * interrupt. If we are, then it must belong to another - * chip with which we're sharing the interrupt line. - */ -int ql_legacy_check(struct ql_adapter *qdev) -{ - int err; - spin_lock(&qdev->legacy_lock); - err = atomic_read(&qdev->intr_context[0].irq_cnt); - spin_unlock(&qdev->legacy_lock); - return err; -} - /* This handles a fatal error, MPI activity, and the default * rx_ring in an MSI-X multiple vector environment. * In MSI/Legacy environment it also process the rest of @@ -1752,12 +1753,15 @@ static irqreturn_t qlge_isr(int irq, void *dev_id) int i; int work_done = 0; - if (qdev->legacy_check && qdev->legacy_check(qdev)) { - QPRINTK(qdev, INTR, INFO, "Already busy, not our interrupt.\n"); - return IRQ_NONE; /* Not our interrupt */ + spin_lock(&qdev->hw_lock); + if (atomic_read(&qdev->intr_context[0].irq_cnt)) { + QPRINTK(qdev, INTR, DEBUG, "Shared Interrupt, Not ours!\n"); + spin_unlock(&qdev->hw_lock); + return IRQ_NONE; } + spin_unlock(&qdev->hw_lock); - var = ql_read32(qdev, STS); + var = ql_disable_completion_interrupt(qdev, intr_context->intr); /* * Check for fatal error. @@ -1823,6 +1827,7 @@ static irqreturn_t qlge_isr(int irq, void *dev_id) } } } + ql_enable_completion_interrupt(qdev, intr_context->intr); return work_done ? IRQ_HANDLED : IRQ_NONE; } @@ -2701,8 +2706,6 @@ msi: } } irq_type = LEG_IRQ; - spin_lock_init(&qdev->legacy_lock); - qdev->legacy_check = ql_legacy_check; QPRINTK(qdev, IFUP, DEBUG, "Running with legacy interrupts.\n"); } diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index c821da2..4b7cb38 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -81,6 +81,10 @@ static const int multicast_filter_limit = 32; #define RTL8169_TX_TIMEOUT (6*HZ) #define RTL8169_PHY_TIMEOUT (10*HZ) +#define RTL_EEPROM_SIG cpu_to_le32(0x8129) +#define RTL_EEPROM_SIG_MASK cpu_to_le32(0xffff) +#define RTL_EEPROM_SIG_ADDR 0x0000 + /* write/read MMIO register */ #define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg)) #define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg)) @@ -1911,74 +1915,6 @@ static void rtl_disable_msi(struct pci_dev *pdev, struct rtl8169_private *tp) } } -static int rtl_eeprom_read(struct pci_dev *pdev, int cap, int addr, __le32 *val) -{ - int ret, count = 100; - u16 status = 0; - u32 value; - - ret = pci_write_config_word(pdev, cap + PCI_VPD_ADDR, addr); - if (ret < 0) - return ret; - - do { - udelay(10); - ret = pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &status); - if (ret < 0) - return ret; - } while (!(status & PCI_VPD_ADDR_F) && --count); - - if (!(status & PCI_VPD_ADDR_F)) - return -ETIMEDOUT; - - ret = pci_read_config_dword(pdev, cap + PCI_VPD_DATA, &value); - if (ret < 0) - return ret; - - *val = cpu_to_le32(value); - - return 0; -} - -static void rtl_init_mac_address(struct rtl8169_private *tp, - void __iomem *ioaddr) -{ - struct pci_dev *pdev = tp->pci_dev; - u8 cfg1; - int vpd_cap; - u8 mac[8]; - DECLARE_MAC_BUF(buf); - - cfg1 = RTL_R8(Config1); - if (!(cfg1 & VPD)) { - dprintk("VPD access not enabled, enabling\n"); - RTL_W8(Cfg9346, Cfg9346_Unlock); - RTL_W8(Config1, cfg1 | VPD); - RTL_W8(Cfg9346, Cfg9346_Lock); - } - - vpd_cap = pci_find_capability(pdev, PCI_CAP_ID_VPD); - if (!vpd_cap) - return; - - /* MAC address is stored in EEPROM at offset 0x0e - * Realtek says: "The VPD address does not have to be a DWORD-aligned - * address as defined in the PCI 2.2 Specifications, but the VPD data - * is always consecutive 4-byte data starting from the VPD address - * specified." - */ - if (rtl_eeprom_read(pdev, vpd_cap, 0x000e, (__le32*)&mac[0]) < 0 || - rtl_eeprom_read(pdev, vpd_cap, 0x0012, (__le32*)&mac[4]) < 0) { - dprintk("Reading MAC address from EEPROM failed\n"); - return; - } - - dprintk("MAC address found in EEPROM: %s\n", print_mac(buf, mac)); - - /* Write MAC address */ - rtl_rar_set(tp, mac); -} - static int __devinit rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -2156,8 +2092,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) tp->mmio_addr = ioaddr; - rtl_init_mac_address(tp, ioaddr); - /* Get MAC address */ for (i = 0; i < MAC_ADDR_LEN; i++) dev->dev_addr[i] = RTL_R8(MAC0 + i); diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index 3fe0176..e6e3bf5 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c @@ -317,6 +317,7 @@ static struct mii_chip_info { unsigned int type; u32 feature; } mii_chip_table[] = { + { "Atheros PHY AR8012", { 0x004d, 0xd020 }, LAN, 0 }, { "Broadcom PHY BCM5461", { 0x0020, 0x60c0 }, LAN, F_PHY_BCM5461 }, { "Broadcom PHY AC131", { 0x0143, 0xbc70 }, LAN, 0 }, { "Agere PHY ET1101B", { 0x0282, 0xf010 }, LAN, 0 }, diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 8aa7460..f59c777 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -155,23 +155,17 @@ static void PRINT_PKT(u_char *buf, int length) /* this enables an interrupt in the interrupt mask register */ #define SMC_ENABLE_INT(lp, x) do { \ unsigned int __mask; \ - unsigned long __flags; \ - spin_lock_irqsave(&lp->lock, __flags); \ __mask = SMC_GET_INT_EN((lp)); \ __mask |= (x); \ SMC_SET_INT_EN((lp), __mask); \ - spin_unlock_irqrestore(&lp->lock, __flags); \ } while (0) /* this disables an interrupt from the interrupt mask register */ #define SMC_DISABLE_INT(lp, x) do { \ unsigned int __mask; \ - unsigned long __flags; \ - spin_lock_irqsave(&lp->lock, __flags); \ __mask = SMC_GET_INT_EN((lp)); \ __mask &= ~(x); \ SMC_SET_INT_EN((lp), __mask); \ - spin_unlock_irqrestore(&lp->lock, __flags); \ } while (0) /* @@ -180,7 +174,7 @@ static void PRINT_PKT(u_char *buf, int length) static void smc911x_reset(struct net_device *dev) { struct smc911x_local *lp = netdev_priv(dev); - unsigned int reg, timeout=0, resets=1; + unsigned int reg, timeout=0, resets=1, irq_cfg; unsigned long flags; DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __func__); @@ -252,7 +246,12 @@ static void smc911x_reset(struct net_device *dev) * Deassert IRQ for 1*10us for edge type interrupts * and drive IRQ pin push-pull */ - SMC_SET_IRQ_CFG(lp, (1 << 24) | INT_CFG_IRQ_EN_ | INT_CFG_IRQ_TYPE_); + irq_cfg = (1 << 24) | INT_CFG_IRQ_EN_ | INT_CFG_IRQ_TYPE_; +#ifdef SMC_DYNAMIC_BUS_CONFIG + if (lp->cfg.irq_polarity) + irq_cfg |= INT_CFG_IRQ_POL_; +#endif + SMC_SET_IRQ_CFG(lp, irq_cfg); /* clear anything saved */ if (lp->pending_tx_skb != NULL) { @@ -274,6 +273,8 @@ static void smc911x_enable(struct net_device *dev) DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __func__); + spin_lock_irqsave(&lp->lock, flags); + SMC_SET_MAC_ADDR(lp, dev->dev_addr); /* Enable TX */ @@ -286,12 +287,10 @@ static void smc911x_enable(struct net_device *dev) SMC_SET_FIFO_TSL(lp, 64); SMC_SET_GPT_CFG(lp, GPT_CFG_TIMER_EN_ | 10000); - spin_lock_irqsave(&lp->lock, flags); SMC_GET_MAC_CR(lp, cr); cr |= MAC_CR_TXEN_ | MAC_CR_HBDIS_; SMC_SET_MAC_CR(lp, cr); SMC_SET_TX_CFG(lp, TX_CFG_TX_ON_); - spin_unlock_irqrestore(&lp->lock, flags); /* Add 2 byte padding to start of packets */ SMC_SET_RX_CFG(lp, (2<<8) & RX_CFG_RXDOFF_); @@ -300,9 +299,7 @@ static void smc911x_enable(struct net_device *dev) if (cr & MAC_CR_RXEN_) DBG(SMC_DEBUG_RX, "%s: Receiver already enabled\n", dev->name); - spin_lock_irqsave(&lp->lock, flags); SMC_SET_MAC_CR(lp, cr | MAC_CR_RXEN_); - spin_unlock_irqrestore(&lp->lock, flags); /* Interrupt on every received packet */ SMC_SET_FIFO_RSA(lp, 0x01); @@ -318,6 +315,8 @@ static void smc911x_enable(struct net_device *dev) mask|=INT_EN_RDFO_EN_; } SMC_ENABLE_INT(lp, mask); + + spin_unlock_irqrestore(&lp->lock, flags); } /* @@ -458,7 +457,6 @@ static void smc911x_hardware_send_pkt(struct net_device *dev) struct sk_buff *skb; unsigned int cmdA, cmdB, len; unsigned char *buf; - unsigned long flags; DBG(SMC_DEBUG_FUNC | SMC_DEBUG_TX, "%s: --> %s\n", dev->name, __func__); BUG_ON(lp->pending_tx_skb == NULL); @@ -503,11 +501,9 @@ static void smc911x_hardware_send_pkt(struct net_device *dev) dev->trans_start = jiffies; dev_kfree_skb(skb); #endif - spin_lock_irqsave(&lp->lock, flags); if (!lp->tx_throttle) { netif_wake_queue(dev); } - spin_unlock_irqrestore(&lp->lock, flags); SMC_ENABLE_INT(lp, INT_EN_TDFA_EN_ | INT_EN_TSFL_EN_); } @@ -526,6 +522,8 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) DBG(SMC_DEBUG_FUNC | SMC_DEBUG_TX, "%s: --> %s\n", dev->name, __func__); + spin_lock_irqsave(&lp->lock, flags); + BUG_ON(lp->pending_tx_skb != NULL); free = SMC_GET_TX_FIFO_INF(lp) & TX_FIFO_INF_TDFREE_; @@ -535,12 +533,10 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) if (free <= SMC911X_TX_FIFO_LOW_THRESHOLD) { DBG(SMC_DEBUG_TX, "%s: Disabling data flow due to low FIFO space (%d)\n", dev->name, free); - spin_lock_irqsave(&lp->lock, flags); /* Reenable when at least 1 packet of size MTU present */ SMC_SET_FIFO_TDA(lp, (SMC911X_TX_FIFO_LOW_THRESHOLD)/64); lp->tx_throttle = 1; netif_stop_queue(dev); - spin_unlock_irqrestore(&lp->lock, flags); } /* Drop packets when we run out of space in TX FIFO @@ -556,6 +552,7 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) lp->pending_tx_skb = NULL; dev->stats.tx_errors++; dev->stats.tx_dropped++; + spin_unlock_irqrestore(&lp->lock, flags); dev_kfree_skb(skb); return 0; } @@ -565,7 +562,6 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) /* If the DMA is already running then defer this packet Tx until * the DMA IRQ starts it */ - spin_lock_irqsave(&lp->lock, flags); if (lp->txdma_active) { DBG(SMC_DEBUG_TX | SMC_DEBUG_DMA, "%s: Tx DMA running, deferring packet\n", dev->name); lp->pending_tx_skb = skb; @@ -576,11 +572,11 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) DBG(SMC_DEBUG_TX | SMC_DEBUG_DMA, "%s: Activating Tx DMA\n", dev->name); lp->txdma_active = 1; } - spin_unlock_irqrestore(&lp->lock, flags); } #endif lp->pending_tx_skb = skb; smc911x_hardware_send_pkt(dev); + spin_unlock_irqrestore(&lp->lock, flags); return 0; } @@ -1242,7 +1238,7 @@ smc911x_rx_dma_irq(int dma, void *data) netif_rx(skb); spin_lock_irqsave(&lp->lock, flags); - pkts = (SMC_GET_RX_FIFO_INF() & RX_FIFO_INF_RXSUSED_) >> 16; + pkts = (SMC_GET_RX_FIFO_INF(lp) & RX_FIFO_INF_RXSUSED_) >> 16; if (pkts != 0) { smc911x_rcv(dev); }else { @@ -2054,7 +2050,7 @@ err_out: */ static int smc911x_drv_probe(struct platform_device *pdev) { - struct smc91x_platdata *pd = pdev->dev.platform_data; + struct smc911x_platdata *pd = pdev->dev.platform_data; struct net_device *ndev; struct resource *res; struct smc911x_local *lp; diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h index bf6240f..cc7d85b 100644 --- a/drivers/net/smc911x.h +++ b/drivers/net/smc911x.h @@ -50,6 +50,10 @@ #define SMC_DYNAMIC_BUS_CONFIG #endif +#ifdef SMC_USE_PXA_DMA +#define SMC_USE_DMA +#endif + /* store this information for the driver.. */ struct smc911x_local { /* @@ -196,8 +200,6 @@ static inline void SMC_outsl(struct smc911x_local *lp, int reg, #ifdef SMC_USE_PXA_DMA -#define SMC_USE_DMA - /* * Define the request and free functions * These are unfortunately architecture specific as no generic allocation diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index 9b95c40..0f1d6bd 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c @@ -340,9 +340,9 @@ static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp) } /* Interrupt handling */ -static int ath5k_init(struct ath5k_softc *sc); +static int ath5k_init(struct ath5k_softc *sc, bool is_resume); static int ath5k_stop_locked(struct ath5k_softc *sc); -static int ath5k_stop_hw(struct ath5k_softc *sc); +static int ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend); static irqreturn_t ath5k_intr(int irq, void *dev_id); static void ath5k_tasklet_reset(unsigned long data); @@ -646,7 +646,7 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state) ath5k_led_off(sc); - ath5k_stop_hw(sc); + ath5k_stop_hw(sc, true); free_irq(pdev->irq, sc); pci_save_state(pdev); @@ -683,7 +683,7 @@ ath5k_pci_resume(struct pci_dev *pdev) goto err_no_irq; } - err = ath5k_init(sc); + err = ath5k_init(sc, true); if (err) goto err_irq; ath5k_led_enable(sc); @@ -2200,12 +2200,17 @@ ath5k_beacon_config(struct ath5k_softc *sc) \********************/ static int -ath5k_init(struct ath5k_softc *sc) +ath5k_init(struct ath5k_softc *sc, bool is_resume) { int ret; mutex_lock(&sc->lock); + if (is_resume && !test_bit(ATH_STAT_STARTED, sc->status)) + goto out_ok; + + __clear_bit(ATH_STAT_STARTED, sc->status); + ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "mode %d\n", sc->opmode); /* @@ -2230,12 +2235,15 @@ ath5k_init(struct ath5k_softc *sc) if (ret) goto done; + __set_bit(ATH_STAT_STARTED, sc->status); + /* Set ack to be sent at low bit-rates */ ath5k_hw_set_ack_bitrate_high(sc->ah, false); mod_timer(&sc->calib_tim, round_jiffies(jiffies + msecs_to_jiffies(ath5k_calinterval * 1000))); +out_ok: ret = 0; done: mmiowb(); @@ -2290,7 +2298,7 @@ ath5k_stop_locked(struct ath5k_softc *sc) * stop is preempted). */ static int -ath5k_stop_hw(struct ath5k_softc *sc) +ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend) { int ret; @@ -2321,6 +2329,9 @@ ath5k_stop_hw(struct ath5k_softc *sc) } } ath5k_txbuf_free(sc, sc->bbuf); + if (!is_suspend) + __clear_bit(ATH_STAT_STARTED, sc->status); + mmiowb(); mutex_unlock(&sc->lock); @@ -2718,12 +2729,12 @@ ath5k_reset_wake(struct ath5k_softc *sc) static int ath5k_start(struct ieee80211_hw *hw) { - return ath5k_init(hw->priv); + return ath5k_init(hw->priv, false); } static void ath5k_stop(struct ieee80211_hw *hw) { - ath5k_stop_hw(hw->priv); + ath5k_stop_hw(hw->priv, false); } static int ath5k_add_interface(struct ieee80211_hw *hw, diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h index 9d0b728..06d1054 100644 --- a/drivers/net/wireless/ath5k/base.h +++ b/drivers/net/wireless/ath5k/base.h @@ -128,11 +128,12 @@ struct ath5k_softc { size_t desc_len; /* size of TX/RX descriptors */ u16 cachelsz; /* cache line size */ - DECLARE_BITMAP(status, 4); + DECLARE_BITMAP(status, 5); #define ATH_STAT_INVALID 0 /* disable hardware accesses */ #define ATH_STAT_MRRETRY 1 /* multi-rate retry support */ #define ATH_STAT_PROMISC 2 #define ATH_STAT_LEDSOFT 3 /* enable LED gpio status */ +#define ATH_STAT_STARTED 4 /* opened & irqs enabled */ unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */ unsigned int curmode; /* current phy mode */ diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index 5749f22..079e6aa 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c @@ -328,7 +328,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv, lbs_deb_rx("rx err: frame received with bad length\n"); priv->stats.rx_length_errors++; ret = -EINVAL; - kfree(skb); + kfree_skb(skb); goto done; } diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 5090477..e0512e4 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c @@ -433,7 +433,7 @@ struct fw_info { const static struct fw_info orinoco_fw[] = { { "", "agere_sta_fw.bin", "agere_ap_fw.bin", 0x00390000, 1000 }, { "", "prism_sta_fw.bin", "prism_ap_fw.bin", 0, 1024 }, - { "symbol_sp24t_prim_fw", "symbol_sp24t_sec_fw", "", 0x00003100, 0x100 } + { "symbol_sp24t_prim_fw", "symbol_sp24t_sec_fw", "", 0x00003100, 512 } }; /* Structure used to access fields in FW @@ -458,7 +458,7 @@ orinoco_dl_firmware(struct orinoco_private *priv, int ap) { /* Plug Data Area (PDA) */ - __le16 pda[512] = { 0 }; + __le16 *pda; hermes_t *hw = &priv->hw; const struct firmware *fw_entry; @@ -467,7 +467,11 @@ orinoco_dl_firmware(struct orinoco_private *priv, const unsigned char *end; const char *firmware; struct net_device *dev = priv->ndev; - int err; + int err = 0; + + pda = kzalloc(fw->pda_size, GFP_KERNEL); + if (!pda) + return -ENOMEM; if (ap) firmware = fw->ap_fw; @@ -478,17 +482,17 @@ orinoco_dl_firmware(struct orinoco_private *priv, dev->name, firmware); /* Read current plug data */ - err = hermes_read_pda(hw, pda, fw->pda_addr, - min_t(u16, fw->pda_size, sizeof(pda)), 0); + err = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 0); printk(KERN_DEBUG "%s: Read PDA returned %d\n", dev->name, err); if (err) - return err; + goto free; err = request_firmware(&fw_entry, firmware, priv->dev); if (err) { printk(KERN_ERR "%s: Cannot find firmware %s\n", dev->name, firmware); - return -ENOENT; + err = -ENOENT; + goto free; } hdr = (const struct orinoco_fw_header *) fw_entry->data; @@ -532,6 +536,9 @@ orinoco_dl_firmware(struct orinoco_private *priv, abort: release_firmware(fw_entry); + +free: + kfree(pda); return err; } @@ -549,12 +556,12 @@ symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw, int secondary) { hermes_t *hw = &priv->hw; - int ret; + int ret = 0; const unsigned char *ptr; const unsigned char *first_block; /* Plug Data Area (PDA) */ - __le16 pda[256]; + __le16 *pda = NULL; /* Binary block begins after the 0x1A marker */ ptr = image; @@ -563,28 +570,33 @@ symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw, /* Read the PDA from EEPROM */ if (secondary) { - ret = hermes_read_pda(hw, pda, fw->pda_addr, sizeof(pda), 1); + pda = kzalloc(fw->pda_size, GFP_KERNEL); + if (!pda) + return -ENOMEM; + + ret = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 1); if (ret) - return ret; + goto free; } /* Stop the firmware, so that it can be safely rewritten */ if (priv->stop_fw) { ret = priv->stop_fw(priv, 1); if (ret) - return ret; + goto free; } /* Program the adapter with new firmware */ ret = hermes_program(hw, first_block, end); if (ret) - return ret; + goto free; /* Write the PDA to the adapter */ if (secondary) { size_t len = hermes_blocks_length(first_block); ptr = first_block + len; ret = hermes_apply_pda(hw, ptr, pda); + kfree(pda); if (ret) return ret; } @@ -608,6 +620,10 @@ symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw, return -ENODEV; return 0; + +free: + kfree(pda); + return ret; } diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index 117c7d3..2d022f8 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c @@ -306,8 +306,8 @@ static int p54_convert_rev1(struct ieee80211_hw *dev, return 0; } -static const char *p54_rf_chips[] = { "NULL", "Indigo?", "Duette", - "Frisbee", "Xbow", "Longbow" }; +static const char *p54_rf_chips[] = { "NULL", "Duette3", "Duette2", + "Frisbee", "Xbow", "Longbow", "NULL", "NULL" }; static int p54_init_xbow_synth(struct ieee80211_hw *dev); static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) @@ -319,6 +319,7 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) void *tmp; int err; u8 *end = (u8 *)eeprom + len; + u16 synth; DECLARE_MAC_BUF(mac); wrap = (struct eeprom_pda_wrap *) eeprom; @@ -400,8 +401,8 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) tmp = entry->data; while ((u8 *)tmp < entry->data + data_len) { struct bootrec_exp_if *exp_if = tmp; - if (le16_to_cpu(exp_if->if_id) == 0xF) - priv->rxhw = le16_to_cpu(exp_if->variant) & 0x07; + if (le16_to_cpu(exp_if->if_id) == 0xf) + synth = le16_to_cpu(exp_if->variant); tmp += sizeof(struct bootrec_exp_if); } break; @@ -427,22 +428,13 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) goto err; } - switch (priv->rxhw) { - case 4: /* XBow */ + priv->rxhw = synth & 0x07; + if (priv->rxhw == 4) p54_init_xbow_synth(dev); - case 1: /* Indigo? */ - case 2: /* Duette */ - dev->wiphy->bands[IEEE80211_BAND_5GHZ] = &band_5GHz; - case 3: /* Frisbee */ - case 5: /* Longbow */ + if (!(synth & 0x40)) dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band_2GHz; - break; - default: - printk(KERN_ERR "%s: unsupported RF-Chip\n", - wiphy_name(dev->wiphy)); - err = -EINVAL; - goto err; - } + if (!(synth & 0x80)) + dev->wiphy->bands[IEEE80211_BAND_5GHZ] = &band_5GHz; if (!is_valid_ether_addr(dev->wiphy->perm_addr)) { u8 perm_addr[ETH_ALEN]; diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 4b47f4e..af3bfe2 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -3,7 +3,8 @@ # obj-y += access.o bus.o probe.o remove.o pci.o quirks.o slot.o \ - pci-driver.o search.o pci-sysfs.o rom.o setup-res.o + pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \ + irq.o obj-$(CONFIG_PROC_FS) += proc.o # Build PCI Express stuff if needed diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c index b291ee6..881fdd2 100644 --- a/drivers/pci/hotplug/acpiphp_ibm.c +++ b/drivers/pci/hotplug/acpiphp_ibm.c @@ -204,7 +204,7 @@ static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status) err("APLS evaluation failed: 0x%08x\n", stat); return -ENODEV; } else if (!rc) { - err("APLS method failed: 0x%08lx\n", rc); + err("APLS method failed: 0x%08llx\n", rc); return -ERANGE; } return 0; diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index 724d42c..8514c3a 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c @@ -433,7 +433,7 @@ static int ctrl_slot_setup(struct controller *ctrl, slot->number, ctrl->slot_device_offset, slot_number); result = pci_hp_register(hotplug_slot, - ctrl->pci_dev->subordinate, + ctrl->pci_dev->bus, slot->device, name); if (result) { diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index a4817a841..b2801a7 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h @@ -188,7 +188,7 @@ static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) return slot; } - ctrl_err(ctrl, "%s: slot (device=0x%x) not found\n", __func__, device); + ctrl_err(ctrl, "Slot (device=0x%02x) not found\n", device); return NULL; } diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 62be1b5..4b23bc3 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c @@ -184,7 +184,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) { struct slot *slot = hotplug_slot->private; - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", __func__, hotplug_slot_name(hotplug_slot)); kfree(hotplug_slot->info); @@ -216,9 +216,11 @@ static int init_slots(struct controller *ctrl) slot->hotplug_slot = hotplug_slot; snprintf(name, SLOT_NAME_SIZE, "%u", slot->number); - ctrl_dbg(ctrl, "Registering bus=%x dev=%x hp_slot=%x sun=%x " - "slot_device_offset=%x\n", slot->bus, slot->device, - slot->hp_slot, slot->number, ctrl->slot_device_offset); + ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x " + "hp_slot=%x sun=%x slot_device_offset=%x\n", + pci_domain_nr(ctrl->pci_dev->subordinate), + slot->bus, slot->device, slot->hp_slot, slot->number, + ctrl->slot_device_offset); retval = pci_hp_register(hotplug_slot, ctrl->pci_dev->subordinate, slot->device, @@ -238,7 +240,7 @@ static int init_slots(struct controller *ctrl) &hotplug_slot_attr_lock.attr); if (retval) { pci_hp_deregister(hotplug_slot); - ctrl_err(ctrl, "cannot create additional sysfs " + ctrl_err(ctrl, "Cannot create additional sysfs " "entries\n"); goto error_info; } @@ -273,7 +275,7 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) { struct slot *slot = hotplug_slot->private; - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", __func__, slot_name(slot)); hotplug_slot->info->attention_status = status; @@ -289,7 +291,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) { struct slot *slot = hotplug_slot->private; - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", __func__, slot_name(slot)); return pciehp_sysfs_enable_slot(slot); @@ -300,7 +302,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) { struct slot *slot = hotplug_slot->private; - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", __func__, slot_name(slot)); return pciehp_sysfs_disable_slot(slot); @@ -311,7 +313,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) struct slot *slot = hotplug_slot->private; int retval; - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", __func__, slot_name(slot)); retval = slot->hpc_ops->get_power_status(slot, value); @@ -326,7 +328,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) struct slot *slot = hotplug_slot->private; int retval; - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", __func__, slot_name(slot)); retval = slot->hpc_ops->get_attention_status(slot, value); @@ -341,7 +343,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) struct slot *slot = hotplug_slot->private; int retval; - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", __func__, slot_name(slot)); retval = slot->hpc_ops->get_latch_status(slot, value); @@ -356,7 +358,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) struct slot *slot = hotplug_slot->private; int retval; - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", __func__, slot_name(slot)); retval = slot->hpc_ops->get_adapter_status(slot, value); @@ -372,7 +374,7 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, struct slot *slot = hotplug_slot->private; int retval; - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", __func__, slot_name(slot)); retval = slot->hpc_ops->get_max_bus_speed(slot, value); @@ -387,7 +389,7 @@ static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe struct slot *slot = hotplug_slot->private; int retval; - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", __func__, slot_name(slot)); retval = slot->hpc_ops->get_cur_bus_speed(slot, value); @@ -414,7 +416,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ ctrl = pcie_init(dev); if (!ctrl) { - dev_err(&dev->device, "controller initialization failed\n"); + dev_err(&dev->device, "Controller initialization failed\n"); goto err_out_none; } set_service_data(dev, ctrl); @@ -423,10 +425,10 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ rc = init_slots(ctrl); if (rc) { if (rc == -EBUSY) - ctrl_warn(ctrl, "slot already registered by another " + ctrl_warn(ctrl, "Slot already registered by another " "hotplug driver\n"); else - ctrl_err(ctrl, "slot initialization failed\n"); + ctrl_err(ctrl, "Slot initialization failed\n"); goto err_out_release_ctlr; } @@ -523,7 +525,7 @@ static int __init pcied_init(void) dbg("pcie_port_service_register = %d\n", retval); info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); if (retval) - dbg("%s: Failure to register service\n", __func__); + dbg("Failure to register service\n"); return retval; } diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index d6c5eb2..fead63c 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c @@ -61,7 +61,7 @@ u8 pciehp_handle_attention_button(struct slot *p_slot) struct controller *ctrl = p_slot->ctrl; /* Attention Button Change */ - ctrl_dbg(ctrl, "Attention button interrupt received.\n"); + ctrl_dbg(ctrl, "Attention button interrupt received\n"); /* * Button pressed - See if need to TAKE ACTION!!! @@ -81,7 +81,7 @@ u8 pciehp_handle_switch_change(struct slot *p_slot) struct controller *ctrl = p_slot->ctrl; /* Switch Change */ - ctrl_dbg(ctrl, "Switch interrupt received.\n"); + ctrl_dbg(ctrl, "Switch interrupt received\n"); p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); if (getstatus) { @@ -110,7 +110,7 @@ u8 pciehp_handle_presence_change(struct slot *p_slot) struct controller *ctrl = p_slot->ctrl; /* Presence Change */ - ctrl_dbg(ctrl, "Presence/Notify input change.\n"); + ctrl_dbg(ctrl, "Presence/Notify input change\n"); /* Switch is open, assume a presence change * Save the presence state @@ -142,7 +142,7 @@ u8 pciehp_handle_power_fault(struct slot *p_slot) struct controller *ctrl = p_slot->ctrl; /* power fault */ - ctrl_dbg(ctrl, "Power fault interrupt received.\n"); + ctrl_dbg(ctrl, "Power fault interrupt received\n"); if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { /* @@ -157,7 +157,7 @@ u8 pciehp_handle_power_fault(struct slot *p_slot) */ ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot)); event_type = INT_POWER_FAULT; - ctrl_info(ctrl, "power fault bit %x set\n", 0); + ctrl_info(ctrl, "Power fault bit %x set\n", 0); } queue_interrupt_event(p_slot, event_type); @@ -175,8 +175,7 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) if (POWER_CTRL(ctrl)) { if (pslot->hpc_ops->power_off_slot(pslot)) { ctrl_err(ctrl, - "%s: Issue of Slot Power Off command failed\n", - __func__); + "Issue of Slot Power Off command failed\n"); return; } } @@ -193,8 +192,8 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) if (ATTN_LED(ctrl)) { if (pslot->hpc_ops->set_attention_status(pslot, 1)) { - ctrl_err(ctrl, "%s: Issue of Set Attention " - "Led command failed\n", __func__); + ctrl_err(ctrl, + "Issue of Set Attention Led command failed\n"); return; } } @@ -211,8 +210,9 @@ static int board_added(struct slot *p_slot) { int retval = 0; struct controller *ctrl = p_slot->ctrl; + struct pci_bus *parent = ctrl->pci_dev->subordinate; - ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = %d, %d ,%d\n", + ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = %d, %d, %d\n", __func__, p_slot->device, ctrl->slot_device_offset, p_slot->hp_slot); @@ -229,22 +229,22 @@ static int board_added(struct slot *p_slot) /* Check link training status */ retval = p_slot->hpc_ops->check_lnk_status(ctrl); if (retval) { - ctrl_err(ctrl, "%s: Failed to check link status\n", __func__); + ctrl_err(ctrl, "Failed to check link status\n"); set_slot_off(ctrl, p_slot); return retval; } /* Check for a power fault */ if (p_slot->hpc_ops->query_power_fault(p_slot)) { - ctrl_dbg(ctrl, "%s: power fault detected\n", __func__); + ctrl_dbg(ctrl, "Power fault detected\n"); retval = POWER_FAILURE; goto err_exit; } retval = pciehp_configure_device(p_slot); if (retval) { - ctrl_err(ctrl, "Cannot add device 0x%x:%x\n", - p_slot->bus, p_slot->device); + ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n", + pci_domain_nr(parent), p_slot->bus, p_slot->device); goto err_exit; } @@ -276,14 +276,14 @@ static int remove_board(struct slot *p_slot) if (retval) return retval; - ctrl_dbg(ctrl, "In %s, hp_slot = %d\n", __func__, p_slot->hp_slot); + ctrl_dbg(ctrl, "%s: hp_slot = %d\n", __func__, p_slot->hp_slot); if (POWER_CTRL(ctrl)) { /* power off slot */ retval = p_slot->hpc_ops->power_off_slot(p_slot); if (retval) { - ctrl_err(ctrl, "%s: Issue of Slot Disable command " - "failed\n", __func__); + ctrl_err(ctrl, + "Issue of Slot Disable command failed\n"); return retval; } } @@ -324,8 +324,10 @@ static void pciehp_power_thread(struct work_struct *work) switch (p_slot->state) { case POWEROFF_STATE: mutex_unlock(&p_slot->lock); - ctrl_dbg(p_slot->ctrl, "%s: disabling bus:device(%x:%x)\n", - __func__, p_slot->bus, p_slot->device); + ctrl_dbg(p_slot->ctrl, + "Disabling domain:bus:device=%04x:%02x:%02x\n", + pci_domain_nr(p_slot->ctrl->pci_dev->subordinate), + p_slot->bus, p_slot->device); pciehp_disable_slot(p_slot); mutex_lock(&p_slot->lock); p_slot->state = STATIC_STATE; @@ -433,7 +435,6 @@ static void handle_button_press_event(struct slot *p_slot) * expires to cancel hot-add or hot-remove */ ctrl_info(ctrl, "Button cancel on Slot(%s)\n", slot_name(p_slot)); - ctrl_dbg(ctrl, "%s: button cancel\n", __func__); cancel_delayed_work(&p_slot->work); if (p_slot->state == BLINKINGOFF_STATE) { if (PWR_LED(ctrl)) @@ -537,16 +538,15 @@ int pciehp_enable_slot(struct slot *p_slot) rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); if (rc || !getstatus) { - ctrl_info(ctrl, "%s: no adapter on slot(%s)\n", - __func__, slot_name(p_slot)); + ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); mutex_unlock(&p_slot->ctrl->crit_sect); return -ENODEV; } if (MRL_SENS(p_slot->ctrl)) { rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); if (rc || getstatus) { - ctrl_info(ctrl, "%s: latch open on slot(%s)\n", - __func__, slot_name(p_slot)); + ctrl_info(ctrl, "Latch open on slot(%s)\n", + slot_name(p_slot)); mutex_unlock(&p_slot->ctrl->crit_sect); return -ENODEV; } @@ -555,8 +555,8 @@ int pciehp_enable_slot(struct slot *p_slot) if (POWER_CTRL(p_slot->ctrl)) { rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); if (rc || getstatus) { - ctrl_info(ctrl, "%s: already enabled on slot(%s)\n", - __func__, slot_name(p_slot)); + ctrl_info(ctrl, "Already enabled on slot(%s)\n", + slot_name(p_slot)); mutex_unlock(&p_slot->ctrl->crit_sect); return -EINVAL; } @@ -591,8 +591,8 @@ int pciehp_disable_slot(struct slot *p_slot) if (!HP_SUPR_RM(p_slot->ctrl)) { ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); if (ret || !getstatus) { - ctrl_info(ctrl, "%s: no adapter on slot(%s)\n", - __func__, slot_name(p_slot)); + ctrl_info(ctrl, "No adapter on slot(%s)\n", + slot_name(p_slot)); mutex_unlock(&p_slot->ctrl->crit_sect); return -ENODEV; } @@ -601,8 +601,8 @@ int pciehp_disable_slot(struct slot *p_slot) if (MRL_SENS(p_slot->ctrl)) { ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); if (ret || getstatus) { - ctrl_info(ctrl, "%s: latch open on slot(%s)\n", - __func__, slot_name(p_slot)); + ctrl_info(ctrl, "Latch open on slot(%s)\n", + slot_name(p_slot)); mutex_unlock(&p_slot->ctrl->crit_sect); return -ENODEV; } @@ -611,8 +611,8 @@ int pciehp_disable_slot(struct slot *p_slot) if (POWER_CTRL(p_slot->ctrl)) { ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); if (ret || !getstatus) { - ctrl_info(ctrl, "%s: already disabled slot(%s)\n", - __func__, slot_name(p_slot)); + ctrl_info(ctrl, "Already disabled on slot(%s)\n", + slot_name(p_slot)); mutex_unlock(&p_slot->ctrl->crit_sect); return -EINVAL; } diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 58c72d2..b643ca1 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -316,22 +316,19 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) * proceed forward to issue the next command according * to spec. Just print out the error message. */ - ctrl_dbg(ctrl, - "%s: CMD_COMPLETED not clear after 1 sec.\n", - __func__); + ctrl_dbg(ctrl, "CMD_COMPLETED not clear after 1 sec\n"); } else if (!NO_CMD_CMPL(ctrl)) { /* * This controller semms to notify of command completed * event even though it supports none of power * controller, attention led, power led and EMI. */ - ctrl_dbg(ctrl, "%s: Unexpected CMD_COMPLETED. Need to " - "wait for command completed event.\n", - __func__); + ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Need to " + "wait for command completed event.\n"); ctrl->no_cmd_complete = 0; } else { - ctrl_dbg(ctrl, "%s: Unexpected CMD_COMPLETED. Maybe " - "the controller is broken.\n", __func__); + ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Maybe " + "the controller is broken.\n"); } } @@ -347,8 +344,7 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) smp_mb(); retval = pciehp_writew(ctrl, SLOTCTRL, slot_ctrl); if (retval) - ctrl_err(ctrl, "%s: Cannot write to SLOTCTRL register\n", - __func__); + ctrl_err(ctrl, "Cannot write to SLOTCTRL register\n"); /* * Wait for command completion. @@ -418,15 +414,14 @@ static int hpc_check_lnk_status(struct controller *ctrl) retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); if (retval) { - ctrl_err(ctrl, "%s: Cannot read LNKSTATUS register\n", - __func__); + ctrl_err(ctrl, "Cannot read LNKSTATUS register\n"); return retval; } ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status); if ( (lnk_status & LNK_TRN) || (lnk_status & LNK_TRN_ERR) || !(lnk_status & NEG_LINK_WD)) { - ctrl_err(ctrl, "%s : Link Training Error occurs \n", __func__); + ctrl_err(ctrl, "Link Training Error occurs \n"); retval = -1; return retval; } @@ -551,7 +546,7 @@ static int hpc_query_power_fault(struct slot *slot) retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); if (retval) { - ctrl_err(ctrl, "%s: Cannot check for power fault\n", __func__); + ctrl_err(ctrl, "Cannot check for power fault\n"); return retval; } pwr_fault = (u8)((slot_status & PWR_FAULT_DETECTED) >> 1); @@ -567,7 +562,7 @@ static int hpc_get_emi_status(struct slot *slot, u8 *status) retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); if (retval) { - ctrl_err(ctrl, "%s : Cannot check EMI status\n", __func__); + ctrl_err(ctrl, "Cannot check EMI status\n"); return retval; } *status = (slot_status & EMI_STATE) >> EMI_STATUS_BIT; @@ -697,8 +692,7 @@ static int hpc_power_on_slot(struct slot * slot) retval = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); if (retval) { - ctrl_err(ctrl, "%s: Write %x command failed!\n", - __func__, slot_cmd); + ctrl_err(ctrl, "Write %x command failed!\n", slot_cmd); return -1; } ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", @@ -776,7 +770,7 @@ static int hpc_power_off_slot(struct slot * slot) retval = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); if (retval) { - ctrl_err(ctrl, "%s: Write command failed!\n", __func__); + ctrl_err(ctrl, "Write command failed!\n"); retval = -1; goto out; } @@ -1056,8 +1050,7 @@ int pcie_enable_notification(struct controller *ctrl) PWR_FAULT_DETECT_ENABLE | HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE; if (pcie_write_cmd(ctrl, cmd, mask)) { - ctrl_err(ctrl, "%s: Cannot enable software notification\n", - __func__); + ctrl_err(ctrl, "Cannot enable software notification\n"); return -1; } return 0; @@ -1069,8 +1062,7 @@ static void pcie_disable_notification(struct controller *ctrl) mask = PRSN_DETECT_ENABLE | ATTN_BUTTN_ENABLE | MRL_DETECT_ENABLE | PWR_FAULT_DETECT_ENABLE | HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE; if (pcie_write_cmd(ctrl, 0, mask)) - ctrl_warn(ctrl, "%s: Cannot disable software notification\n", - __func__); + ctrl_warn(ctrl, "Cannot disable software notification\n"); } static int pcie_init_notification(struct controller *ctrl) @@ -1179,7 +1171,7 @@ struct controller *pcie_init(struct pcie_device *dev) ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); if (!ctrl) { - dev_err(&dev->device, "%s : out of memory\n", __func__); + dev_err(&dev->device, "%s: Out of memory\n", __func__); goto abort; } INIT_LIST_HEAD(&ctrl->slot_list); @@ -1188,12 +1180,11 @@ struct controller *pcie_init(struct pcie_device *dev) ctrl->pci_dev = pdev; ctrl->cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP); if (!ctrl->cap_base) { - ctrl_err(ctrl, "%s: Cannot find PCI Express capability\n", - __func__); + ctrl_err(ctrl, "Cannot find PCI Express capability\n"); goto abort_ctrl; } if (pciehp_readl(ctrl, SLOTCAP, &slot_cap)) { - ctrl_err(ctrl, "%s: Cannot read SLOTCAP register\n", __func__); + ctrl_err(ctrl, "Cannot read SLOTCAP register\n"); goto abort_ctrl; } diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index ffd1114..10f9566 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c @@ -39,8 +39,7 @@ static void program_hpp_type0(struct pci_dev *dev, struct hpp_type0 *hpp) u16 pci_cmd, pci_bctl; if (hpp->revision > 1) { - printk(KERN_WARNING "%s: Rev.%d type0 record not supported\n", - __func__, hpp->revision); + warn("Rev.%d type0 record not supported\n", hpp->revision); return; } @@ -81,8 +80,7 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp) u32 reg32; if (hpp->revision > 1) { - printk(KERN_WARNING "%s: Rev.%d type2 record not supported\n", - __func__, hpp->revision); + warn("Rev.%d type2 record not supported\n", hpp->revision); return; } @@ -149,8 +147,7 @@ static void program_fw_provided_values(struct pci_dev *dev) return; if (pciehp_get_hp_params_from_firmware(dev, &hpp)) { - printk(KERN_WARNING "%s: Could not get hotplug parameters\n", - __func__); + warn("Could not get hotplug parameters\n"); return; } @@ -202,9 +199,9 @@ int pciehp_configure_device(struct slot *p_slot) dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); if (dev) { - ctrl_err(ctrl, - "Device %s already exists at %x:%x, cannot hot-add\n", - pci_name(dev), p_slot->bus, p_slot->device); + ctrl_err(ctrl, "Device %s already exists " + "at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev), + pci_domain_nr(parent), p_slot->bus, p_slot->device); pci_dev_put(dev); return -EINVAL; } @@ -248,8 +245,8 @@ int pciehp_unconfigure_device(struct slot *p_slot) u16 command; struct controller *ctrl = p_slot->ctrl; - ctrl_dbg(ctrl, "%s: bus/dev = %x/%x\n", __func__, - p_slot->bus, p_slot->device); + ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:%02x\n", + __func__, pci_domain_nr(parent), p_slot->bus, p_slot->device); ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence); if (ret) presence = 0; diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index 4d9fed0..6aba0b6 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h @@ -59,6 +59,20 @@ extern struct workqueue_struct *shpchp_wq; #define warn(format, arg...) \ printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) +#define ctrl_dbg(ctrl, format, arg...) \ + do { \ + if (shpchp_debug) \ + dev_printk(, &ctrl->pci_dev->dev, \ + format, ## arg); \ + } while (0) +#define ctrl_err(ctrl, format, arg...) \ + dev_err(&ctrl->pci_dev->dev, format, ## arg) +#define ctrl_info(ctrl, format, arg...) \ + dev_info(&ctrl->pci_dev->dev, format, ## arg) +#define ctrl_warn(ctrl, format, arg...) \ + dev_warn(&ctrl->pci_dev->dev, format, ## arg) + + #define SLOT_NAME_SIZE 10 struct slot { u8 bus; @@ -239,7 +253,7 @@ static inline struct slot *shpchp_find_slot(struct controller *ctrl, u8 device) return slot; } - err("%s: slot (device=0x%x) not found\n", __func__, device); + ctrl_err(ctrl, "Slot (device=0x%02x) not found\n", device); return NULL; } @@ -273,7 +287,9 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot) pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, &pcix_bridge_errors_reg); perr_set = pcix_bridge_errors_reg & PERR_OBSERVED_MASK; if (perr_set) { - dbg ("%s W1C: Bridge_Errors[ PERR_OBSERVED = %08X]\n",__func__ , perr_set); + ctrl_dbg(p_slot->ctrl, + "Bridge_Errors[ PERR_OBSERVED = %08X] (W1C)\n", + perr_set); pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, perr_set); } @@ -282,7 +298,7 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot) pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, &pcix_mem_base_reg); rse_set = pcix_mem_base_reg & RSE_MASK; if (rse_set) { - dbg ("%s W1C: Memory_Base_Limit[ RSE ]\n",__func__ ); + ctrl_dbg(p_slot->ctrl, "Memory_Base_Limit[ RSE ] (W1C)\n"); pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); } diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index 7af9191..fe8d149 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c @@ -89,7 +89,8 @@ static void release_slot(struct hotplug_slot *hotplug_slot) { struct slot *slot = hotplug_slot->private; - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", + __func__, slot_name(slot)); kfree(slot->hotplug_slot->info); kfree(slot->hotplug_slot); @@ -135,13 +136,16 @@ static int init_slots(struct controller *ctrl) snprintf(name, SLOT_NAME_SIZE, "%d", slot->number); hotplug_slot->ops = &shpchp_hotplug_slot_ops; - dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " - "slot_device_offset=%x\n", slot->bus, slot->device, - slot->hp_slot, slot->number, ctrl->slot_device_offset); + ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x " + "hp_slot=%x sun=%x slot_device_offset=%x\n", + pci_domain_nr(ctrl->pci_dev->subordinate), + slot->bus, slot->device, slot->hp_slot, slot->number, + ctrl->slot_device_offset); retval = pci_hp_register(slot->hotplug_slot, ctrl->pci_dev->subordinate, slot->device, name); if (retval) { - err("pci_hp_register failed with error %d\n", retval); + ctrl_err(ctrl, "pci_hp_register failed with error %d\n", + retval); goto error_info; } @@ -187,7 +191,8 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) { struct slot *slot = get_slot(hotplug_slot); - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", + __func__, slot_name(slot)); hotplug_slot->info->attention_status = status; slot->hpc_ops->set_attention_status(slot, status); @@ -199,7 +204,8 @@ static int enable_slot (struct hotplug_slot *hotplug_slot) { struct slot *slot = get_slot(hotplug_slot); - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", + __func__, slot_name(slot)); return shpchp_sysfs_enable_slot(slot); } @@ -208,7 +214,8 @@ static int disable_slot (struct hotplug_slot *hotplug_slot) { struct slot *slot = get_slot(hotplug_slot); - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", + __func__, slot_name(slot)); return shpchp_sysfs_disable_slot(slot); } @@ -218,7 +225,8 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) struct slot *slot = get_slot(hotplug_slot); int retval; - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", + __func__, slot_name(slot)); retval = slot->hpc_ops->get_power_status(slot, value); if (retval < 0) @@ -232,7 +240,8 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value) struct slot *slot = get_slot(hotplug_slot); int retval; - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", + __func__, slot_name(slot)); retval = slot->hpc_ops->get_attention_status(slot, value); if (retval < 0) @@ -246,7 +255,8 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) struct slot *slot = get_slot(hotplug_slot); int retval; - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", + __func__, slot_name(slot)); retval = slot->hpc_ops->get_latch_status(slot, value); if (retval < 0) @@ -260,7 +270,8 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) struct slot *slot = get_slot(hotplug_slot); int retval; - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", + __func__, slot_name(slot)); retval = slot->hpc_ops->get_adapter_status(slot, value); if (retval < 0) @@ -275,7 +286,8 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, struct slot *slot = get_slot(hotplug_slot); int retval; - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", + __func__, slot_name(slot)); retval = slot->hpc_ops->get_max_bus_speed(slot, value); if (retval < 0) @@ -289,7 +301,8 @@ static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp struct slot *slot = get_slot(hotplug_slot); int retval; - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", + __func__, slot_name(slot)); retval = slot->hpc_ops->get_cur_bus_speed(slot, value); if (retval < 0) @@ -320,15 +333,14 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); if (!ctrl) { - err("%s : out of memory\n", __func__); + dev_err(&pdev->dev, "%s: Out of memory\n", __func__); goto err_out_none; } INIT_LIST_HEAD(&ctrl->slot_list); rc = shpc_init(ctrl, pdev); if (rc) { - dbg("%s: controller initialization failed\n", - SHPC_MODULE_NAME); + ctrl_dbg(ctrl, "Controller initialization failed\n"); goto err_out_free_ctrl; } @@ -337,7 +349,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* Setup the slot information structures */ rc = init_slots(ctrl); if (rc) { - err("%s: slot initialization failed\n", SHPC_MODULE_NAME); + ctrl_err(ctrl, "Slot initialization failed\n"); goto err_out_release_ctlr; } diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c index 919b1ee..b8ab279 100644 --- a/drivers/pci/hotplug/shpchp_ctrl.c +++ b/drivers/pci/hotplug/shpchp_ctrl.c @@ -62,7 +62,7 @@ u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl) u32 event_type; /* Attention Button Change */ - dbg("shpchp: Attention button interrupt received.\n"); + ctrl_dbg(ctrl, "Attention button interrupt received\n"); p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); @@ -70,7 +70,7 @@ u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl) /* * Button pressed - See if need to TAKE ACTION!!! */ - info("Button pressed on Slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "Button pressed on Slot(%s)\n", slot_name(p_slot)); event_type = INT_BUTTON_PRESS; queue_interrupt_event(p_slot, event_type); @@ -86,29 +86,29 @@ u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl) u32 event_type; /* Switch Change */ - dbg("shpchp: Switch interrupt received.\n"); + ctrl_dbg(ctrl, "Switch interrupt received\n"); p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); - dbg("%s: Card present %x Power status %x\n", __func__, - p_slot->presence_save, p_slot->pwr_save); + ctrl_dbg(ctrl, "Card present %x Power status %x\n", + p_slot->presence_save, p_slot->pwr_save); if (getstatus) { /* * Switch opened */ - info("Latch open on Slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "Latch open on Slot(%s)\n", slot_name(p_slot)); event_type = INT_SWITCH_OPEN; if (p_slot->pwr_save && p_slot->presence_save) { event_type = INT_POWER_FAULT; - err("Surprise Removal of card\n"); + ctrl_err(ctrl, "Surprise Removal of card\n"); } } else { /* * Switch closed */ - info("Latch close on Slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "Latch close on Slot(%s)\n", slot_name(p_slot)); event_type = INT_SWITCH_CLOSE; } @@ -123,7 +123,7 @@ u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl) u32 event_type; /* Presence Change */ - dbg("shpchp: Presence/Notify input change.\n"); + ctrl_dbg(ctrl, "Presence/Notify input change\n"); p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); @@ -135,13 +135,15 @@ u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl) /* * Card Present */ - info("Card present on Slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "Card present on Slot(%s)\n", + slot_name(p_slot)); event_type = INT_PRESENCE_ON; } else { /* * Not Present */ - info("Card not present on Slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "Card not present on Slot(%s)\n", + slot_name(p_slot)); event_type = INT_PRESENCE_OFF; } @@ -156,7 +158,7 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl) u32 event_type; /* Power fault */ - dbg("shpchp: Power fault interrupt received.\n"); + ctrl_dbg(ctrl, "Power fault interrupt received\n"); p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); @@ -164,18 +166,19 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl) /* * Power fault Cleared */ - info("Power fault cleared on Slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "Power fault cleared on Slot(%s)\n", + slot_name(p_slot)); p_slot->status = 0x00; event_type = INT_POWER_FAULT_CLEAR; } else { /* * Power fault */ - info("Power fault on Slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot)); event_type = INT_POWER_FAULT; /* set power fault status for this board */ p_slot->status = 0xFF; - info("power fault bit %x set\n", hp_slot); + ctrl_info(ctrl, "Power fault bit %x set\n", hp_slot); } queue_interrupt_event(p_slot, event_type); @@ -191,10 +194,10 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot, { int rc = 0; - dbg("%s: change to speed %d\n", __func__, speed); + ctrl_dbg(ctrl, "Change speed to %d\n", speed); if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { - err("%s: Issue of set bus speed mode command failed\n", - __func__); + ctrl_err(ctrl, "%s: Issue of set bus speed mode command " + "failed\n", __func__); return WRONG_BUS_FREQUENCY; } return rc; @@ -212,8 +215,8 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot, */ if (flag) { if (asp < bsp) { - err("%s: speed of bus %x and adapter %x mismatch\n", - __func__, bsp, asp); + ctrl_err(ctrl, "Speed of bus %x and adapter %x " + "mismatch\n", bsp, asp); rc = WRONG_BUS_FREQUENCY; } return rc; @@ -243,17 +246,18 @@ static int board_added(struct slot *p_slot) int rc = 0; enum pci_bus_speed asp, bsp, msp; struct controller *ctrl = p_slot->ctrl; + struct pci_bus *parent = ctrl->pci_dev->subordinate; hp_slot = p_slot->device - ctrl->slot_device_offset; - dbg("%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", - __func__, p_slot->device, - ctrl->slot_device_offset, hp_slot); + ctrl_dbg(ctrl, + "%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", + __func__, p_slot->device, ctrl->slot_device_offset, hp_slot); /* Power on slot without connecting to bus */ rc = p_slot->hpc_ops->power_on_slot(p_slot); if (rc) { - err("%s: Failed to power on slot\n", __func__); + ctrl_err(ctrl, "Failed to power on slot\n"); return -1; } @@ -262,33 +266,34 @@ static int board_added(struct slot *p_slot) return WRONG_BUS_FREQUENCY; if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) { - err("%s: Issue of set bus speed mode command failed\n", __func__); + ctrl_err(ctrl, "%s: Issue of set bus speed mode command" + " failed\n", __func__); return WRONG_BUS_FREQUENCY; } /* turn on board, blink green LED, turn off Amber LED */ if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { - err("%s: Issue of Slot Enable command failed\n", __func__); + ctrl_err(ctrl, "Issue of Slot Enable command failed\n"); return rc; } } rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp); if (rc) { - err("%s: Can't get adapter speed or bus mode mismatch\n", - __func__); + ctrl_err(ctrl, "Can't get adapter speed or " + "bus mode mismatch\n"); return WRONG_BUS_FREQUENCY; } rc = p_slot->hpc_ops->get_cur_bus_speed(p_slot, &bsp); if (rc) { - err("%s: Can't get bus operation speed\n", __func__); + ctrl_err(ctrl, "Can't get bus operation speed\n"); return WRONG_BUS_FREQUENCY; } rc = p_slot->hpc_ops->get_max_bus_speed(p_slot, &msp); if (rc) { - err("%s: Can't get max bus operation speed\n", __func__); + ctrl_err(ctrl, "Can't get max bus operation speed\n"); msp = bsp; } @@ -296,9 +301,9 @@ static int board_added(struct slot *p_slot) if (!list_empty(&ctrl->pci_dev->subordinate->devices)) slots_not_empty = 1; - dbg("%s: slots_not_empty %d, adapter_speed %d, bus_speed %d, " - "max_bus_speed %d\n", __func__, slots_not_empty, asp, - bsp, msp); + ctrl_dbg(ctrl, "%s: slots_not_empty %d, adapter_speed %d, bus_speed %d," + " max_bus_speed %d\n", __func__, slots_not_empty, asp, + bsp, msp); rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp); if (rc) @@ -306,26 +311,26 @@ static int board_added(struct slot *p_slot) /* turn on board, blink green LED, turn off Amber LED */ if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { - err("%s: Issue of Slot Enable command failed\n", __func__); + ctrl_err(ctrl, "Issue of Slot Enable command failed\n"); return rc; } /* Wait for ~1 second */ msleep(1000); - dbg("%s: slot status = %x\n", __func__, p_slot->status); + ctrl_dbg(ctrl, "%s: slot status = %x\n", __func__, p_slot->status); /* Check for a power fault */ if (p_slot->status == 0xFF) { /* power fault occurred, but it was benign */ - dbg("%s: power fault\n", __func__); + ctrl_dbg(ctrl, "%s: Power fault\n", __func__); rc = POWER_FAILURE; p_slot->status = 0; goto err_exit; } if (shpchp_configure_device(p_slot)) { - err("Cannot add device at 0x%x:0x%x\n", p_slot->bus, - p_slot->device); + ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n", + pci_domain_nr(parent), p_slot->bus, p_slot->device); goto err_exit; } @@ -341,7 +346,8 @@ err_exit: /* turn off slot, turn on Amber LED, turn off Green LED */ rc = p_slot->hpc_ops->slot_disable(p_slot); if (rc) { - err("%s: Issue of Slot Disable command failed\n", __func__); + ctrl_err(ctrl, "%s: Issue of Slot Disable command failed\n", + __func__); return rc; } @@ -365,7 +371,7 @@ static int remove_board(struct slot *p_slot) hp_slot = p_slot->device - ctrl->slot_device_offset; p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); - dbg("In %s, hp_slot = %d\n", __func__, hp_slot); + ctrl_dbg(ctrl, "%s: hp_slot = %d\n", __func__, hp_slot); /* Change status to shutdown */ if (p_slot->is_a_board) @@ -374,13 +380,14 @@ static int remove_board(struct slot *p_slot) /* turn off slot, turn on Amber LED, turn off Green LED */ rc = p_slot->hpc_ops->slot_disable(p_slot); if (rc) { - err("%s: Issue of Slot Disable command failed\n", __func__); + ctrl_err(ctrl, "%s: Issue of Slot Disable command failed\n", + __func__); return rc; } rc = p_slot->hpc_ops->set_attention_status(p_slot, 0); if (rc) { - err("%s: Issue of Set Attention command failed\n", __func__); + ctrl_err(ctrl, "Issue of Set Attention command failed\n"); return rc; } @@ -439,7 +446,8 @@ void shpchp_queue_pushbutton_work(struct work_struct *work) info = kmalloc(sizeof(*info), GFP_KERNEL); if (!info) { - err("%s: Cannot allocate memory\n", __func__); + ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n", + __func__); return; } info->p_slot = p_slot; @@ -486,18 +494,19 @@ static int update_slot_info (struct slot *slot) static void handle_button_press_event(struct slot *p_slot) { u8 getstatus; + struct controller *ctrl = p_slot->ctrl; switch (p_slot->state) { case STATIC_STATE: p_slot->hpc_ops->get_power_status(p_slot, &getstatus); if (getstatus) { p_slot->state = BLINKINGOFF_STATE; - info("PCI slot #%s - powering off due to button " - "press.\n", slot_name(p_slot)); + ctrl_info(ctrl, "PCI slot #%s - powering off due to " + "button press.\n", slot_name(p_slot)); } else { p_slot->state = BLINKINGON_STATE; - info("PCI slot #%s - powering on due to button " - "press.\n", slot_name(p_slot)); + ctrl_info(ctrl, "PCI slot #%s - powering on due to " + "button press.\n", slot_name(p_slot)); } /* blink green LED and turn off amber */ p_slot->hpc_ops->green_led_blink(p_slot); @@ -512,16 +521,16 @@ static void handle_button_press_event(struct slot *p_slot) * press the attention again before the 5 sec. limit * expires to cancel hot-add or hot-remove */ - info("Button cancel on Slot(%s)\n", slot_name(p_slot)); - dbg("%s: button cancel\n", __func__); + ctrl_info(ctrl, "Button cancel on Slot(%s)\n", + slot_name(p_slot)); cancel_delayed_work(&p_slot->work); if (p_slot->state == BLINKINGOFF_STATE) p_slot->hpc_ops->green_led_on(p_slot); else p_slot->hpc_ops->green_led_off(p_slot); p_slot->hpc_ops->set_attention_status(p_slot, 0); - info("PCI slot #%s - action canceled due to button press\n", - slot_name(p_slot)); + ctrl_info(ctrl, "PCI slot #%s - action canceled due to " + "button press\n", slot_name(p_slot)); p_slot->state = STATIC_STATE; break; case POWEROFF_STATE: @@ -531,11 +540,12 @@ static void handle_button_press_event(struct slot *p_slot) * this means that the previous attention button action * to hot-add or hot-remove is undergoing */ - info("Button ignore on Slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "Button ignore on Slot(%s)\n", + slot_name(p_slot)); update_slot_info(p_slot); break; default: - warn("Not a valid state\n"); + ctrl_warn(ctrl, "Not a valid state\n"); break; } } @@ -551,7 +561,7 @@ static void interrupt_event_handler(struct work_struct *work) handle_button_press_event(p_slot); break; case INT_POWER_FAULT: - dbg("%s: power fault\n", __func__); + ctrl_dbg(p_slot->ctrl, "%s: Power fault\n", __func__); p_slot->hpc_ops->set_attention_status(p_slot, 1); p_slot->hpc_ops->green_led_off(p_slot); break; @@ -569,22 +579,24 @@ static int shpchp_enable_slot (struct slot *p_slot) { u8 getstatus = 0; int rc, retval = -ENODEV; + struct controller *ctrl = p_slot->ctrl; /* Check to see if (latch closed, card present, power off) */ mutex_lock(&p_slot->ctrl->crit_sect); rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); if (rc || !getstatus) { - info("No adapter on slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); goto out; } rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); if (rc || getstatus) { - info("Latch open on slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot)); goto out; } rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); if (rc || getstatus) { - info("Already enabled on slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "Already enabled on slot(%s)\n", + slot_name(p_slot)); goto out; } @@ -593,7 +605,7 @@ static int shpchp_enable_slot (struct slot *p_slot) /* We have to save the presence info for these slots */ p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); p_slot->hpc_ops->get_power_status(p_slot, &(p_slot->pwr_save)); - dbg("%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save); + ctrl_dbg(ctrl, "%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save); p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); if(((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD) || @@ -624,6 +636,7 @@ static int shpchp_disable_slot (struct slot *p_slot) { u8 getstatus = 0; int rc, retval = -ENODEV; + struct controller *ctrl = p_slot->ctrl; if (!p_slot->ctrl) return -ENODEV; @@ -633,17 +646,18 @@ static int shpchp_disable_slot (struct slot *p_slot) rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); if (rc || !getstatus) { - info("No adapter on slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); goto out; } rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); if (rc || getstatus) { - info("Latch open on slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot)); goto out; } rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); if (rc || !getstatus) { - info("Already disabled slot(%s)\n", slot_name(p_slot)); + ctrl_info(ctrl, "Already disabled on slot(%s)\n", + slot_name(p_slot)); goto out; } @@ -657,6 +671,7 @@ static int shpchp_disable_slot (struct slot *p_slot) int shpchp_sysfs_enable_slot(struct slot *p_slot) { int retval = -ENODEV; + struct controller *ctrl = p_slot->ctrl; mutex_lock(&p_slot->lock); switch (p_slot->state) { @@ -670,15 +685,17 @@ int shpchp_sysfs_enable_slot(struct slot *p_slot) p_slot->state = STATIC_STATE; break; case POWERON_STATE: - info("Slot %s is already in powering on state\n", - slot_name(p_slot)); + ctrl_info(ctrl, "Slot %s is already in powering on state\n", + slot_name(p_slot)); break; case BLINKINGOFF_STATE: case POWEROFF_STATE: - info("Already enabled on slot %s\n", slot_name(p_slot)); + ctrl_info(ctrl, "Already enabled on slot %s\n", + slot_name(p_slot)); break; default: - err("Not a valid state on slot %s\n", slot_name(p_slot)); + ctrl_err(ctrl, "Not a valid state on slot %s\n", + slot_name(p_slot)); break; } mutex_unlock(&p_slot->lock); @@ -689,6 +706,7 @@ int shpchp_sysfs_enable_slot(struct slot *p_slot) int shpchp_sysfs_disable_slot(struct slot *p_slot) { int retval = -ENODEV; + struct controller *ctrl = p_slot->ctrl; mutex_lock(&p_slot->lock); switch (p_slot->state) { @@ -702,15 +720,17 @@ int shpchp_sysfs_disable_slot(struct slot *p_slot) p_slot->state = STATIC_STATE; break; case POWEROFF_STATE: - info("Slot %s is already in powering off state\n", - slot_name(p_slot)); + ctrl_info(ctrl, "Slot %s is already in powering off state\n", + slot_name(p_slot)); break; case BLINKINGON_STATE: case POWERON_STATE: - info("Already disabled on slot %s\n", slot_name(p_slot)); + ctrl_info(ctrl, "Already disabled on slot %s\n", + slot_name(p_slot)); break; default: - err("Not a valid state on slot %s\n", slot_name(p_slot)); + ctrl_err(ctrl, "Not a valid state on slot %s\n", + slot_name(p_slot)); break; } mutex_unlock(&p_slot->lock); diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c index 7a0bff3..86dc398 100644 --- a/drivers/pci/hotplug/shpchp_hpc.c +++ b/drivers/pci/hotplug/shpchp_hpc.c @@ -300,10 +300,10 @@ static inline int shpc_wait_cmd(struct controller *ctrl) !is_ctrl_busy(ctrl), timeout); if (!rc && is_ctrl_busy(ctrl)) { retval = -EIO; - err("Command not completed in 1000 msec\n"); + ctrl_err(ctrl, "Command not completed in 1000 msec\n"); } else if (rc < 0) { retval = -EINTR; - info("Command was interrupted by a signal\n"); + ctrl_info(ctrl, "Command was interrupted by a signal\n"); } return retval; @@ -320,15 +320,14 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) if (!shpc_poll_ctrl_busy(ctrl)) { /* After 1 sec and and the controller is still busy */ - err("%s : Controller is still busy after 1 sec.\n", - __func__); + ctrl_err(ctrl, "Controller is still busy after 1 sec\n"); retval = -EBUSY; goto out; } ++t_slot; temp_word = (t_slot << 8) | (cmd & 0xFF); - dbg("%s: t_slot %x cmd %x\n", __func__, t_slot, cmd); + ctrl_dbg(ctrl, "%s: t_slot %x cmd %x\n", __func__, t_slot, cmd); /* To make sure the Controller Busy bit is 0 before we send out the * command. @@ -344,8 +343,9 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) cmd_status = hpc_check_cmd_status(slot->ctrl); if (cmd_status) { - err("%s: Failed to issued command 0x%x (error code = %d)\n", - __func__, cmd, cmd_status); + ctrl_err(ctrl, + "Failed to issued command 0x%x (error code = %d)\n", + cmd, cmd_status); retval = -EIO; } out: @@ -364,15 +364,15 @@ static int hpc_check_cmd_status(struct controller *ctrl) break; case 1: retval = SWITCH_OPEN; - err("%s: Switch opened!\n", __func__); + ctrl_err(ctrl, "Switch opened!\n"); break; case 2: retval = INVALID_CMD; - err("%s: Invalid HPC command!\n", __func__); + ctrl_err(ctrl, "Invalid HPC command!\n"); break; case 4: retval = INVALID_SPEED_MODE; - err("%s: Invalid bus speed/mode!\n", __func__); + ctrl_err(ctrl, "Invalid bus speed/mode!\n"); break; default: retval = cmd_status; @@ -483,8 +483,8 @@ static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value) return -ENODEV; } - dbg("%s: slot_reg = %x, pcix_cap = %x, m66_cap = %x\n", - __func__, slot_reg, pcix_cap, m66_cap); + ctrl_dbg(ctrl, "%s: slot_reg = %x, pcix_cap = %x, m66_cap = %x\n", + __func__, slot_reg, pcix_cap, m66_cap); switch (pcix_cap) { case 0x0: @@ -509,7 +509,7 @@ static int hpc_get_adapter_speed(struct slot *slot, enum pci_bus_speed *value) break; } - dbg("Adapter speed = %d\n", *value); + ctrl_dbg(ctrl, "Adapter speed = %d\n", *value); return retval; } @@ -526,7 +526,7 @@ static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode) retval = -1; } - dbg("Mode 1 ECC cap = %d\n", *mode); + ctrl_dbg(ctrl, "Mode 1 ECC cap = %d\n", *mode); return retval; } @@ -629,7 +629,7 @@ static int hpc_power_on_slot(struct slot * slot) retval = shpc_write_cmd(slot, slot->hp_slot, SET_SLOT_PWR); if (retval) - err("%s: Write command failed!\n", __func__); + ctrl_err(slot->ctrl, "%s: Write command failed!\n", __func__); return retval; } @@ -642,7 +642,7 @@ static int hpc_slot_enable(struct slot * slot) retval = shpc_write_cmd(slot, slot->hp_slot, SET_SLOT_ENABLE | SET_PWR_BLINK | SET_ATTN_OFF); if (retval) - err("%s: Write command failed!\n", __func__); + ctrl_err(slot->ctrl, "%s: Write command failed!\n", __func__); return retval; } @@ -655,7 +655,7 @@ static int hpc_slot_disable(struct slot * slot) retval = shpc_write_cmd(slot, slot->hp_slot, SET_SLOT_DISABLE | SET_PWR_OFF | SET_ATTN_ON); if (retval) - err("%s: Write command failed!\n", __func__); + ctrl_err(slot->ctrl, "%s: Write command failed!\n", __func__); return retval; } @@ -719,7 +719,7 @@ static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value) retval = shpc_write_cmd(slot, 0, cmd); if (retval) - err("%s: Write command failed!\n", __func__); + ctrl_err(ctrl, "%s: Write command failed!\n", __func__); return retval; } @@ -735,7 +735,7 @@ static irqreturn_t shpc_isr(int irq, void *dev_id) if (!intr_loc) return IRQ_NONE; - dbg("%s: intr_loc = %x\n",__func__, intr_loc); + ctrl_dbg(ctrl, "%s: intr_loc = %x\n", __func__, intr_loc); if(!shpchp_poll_mode) { /* @@ -748,7 +748,7 @@ static irqreturn_t shpc_isr(int irq, void *dev_id) shpc_writel(ctrl, SERR_INTR_ENABLE, serr_int); intr_loc2 = shpc_readl(ctrl, INTR_LOC); - dbg("%s: intr_loc2 = %x\n",__func__, intr_loc2); + ctrl_dbg(ctrl, "%s: intr_loc2 = %x\n", __func__, intr_loc2); } if (intr_loc & CMD_INTR_PENDING) { @@ -773,8 +773,8 @@ static irqreturn_t shpc_isr(int irq, void *dev_id) continue; slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); - dbg("%s: Slot %x with intr, slot register = %x\n", - __func__, hp_slot, slot_reg); + ctrl_dbg(ctrl, "Slot %x with intr, slot register = %x\n", + hp_slot, slot_reg); if (slot_reg & MRL_CHANGE_DETECTED) shpchp_handle_switch_change(hp_slot, ctrl); @@ -843,7 +843,7 @@ static int hpc_get_max_bus_speed (struct slot *slot, enum pci_bus_speed *value) } *value = bus_speed; - dbg("Max bus speed = %d\n", bus_speed); + ctrl_dbg(ctrl, "Max bus speed = %d\n", bus_speed); return retval; } @@ -911,7 +911,7 @@ static int hpc_get_cur_bus_speed (struct slot *slot, enum pci_bus_speed *value) break; } - dbg("Current bus speed = %d\n", bus_speed); + ctrl_dbg(ctrl, "Current bus speed = %d\n", bus_speed); return retval; } @@ -949,6 +949,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) u8 i; ctrl->pci_dev = pdev; /* pci_dev of the P2P bridge */ + ctrl_dbg(ctrl, "Hotplug Controller:\n"); if ((pdev->vendor == PCI_VENDOR_ID_AMD) || (pdev->device == PCI_DEVICE_ID_AMD_GOLAM_7450)) { @@ -958,34 +959,33 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) } else { ctrl->cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC); if (!ctrl->cap_offset) { - err("%s : cap_offset == 0\n", __func__); + ctrl_err(ctrl, "Cannot find PCI capability\n"); goto abort; } - dbg("%s: cap_offset = %x\n", __func__, ctrl->cap_offset); + ctrl_dbg(ctrl, " cap_offset = %x\n", ctrl->cap_offset); rc = shpc_indirect_read(ctrl, 0, &shpc_base_offset); if (rc) { - err("%s: cannot read base_offset\n", __func__); + ctrl_err(ctrl, "Cannot read base_offset\n"); goto abort; } rc = shpc_indirect_read(ctrl, 3, &tempdword); if (rc) { - err("%s: cannot read slot config\n", __func__); + ctrl_err(ctrl, "Cannot read slot config\n"); goto abort; } num_slots = tempdword & SLOT_NUM; - dbg("%s: num_slots (indirect) %x\n", __func__, num_slots); + ctrl_dbg(ctrl, " num_slots (indirect) %x\n", num_slots); for (i = 0; i < 9 + num_slots; i++) { rc = shpc_indirect_read(ctrl, i, &tempdword); if (rc) { - err("%s: cannot read creg (index = %d)\n", - __func__, i); + ctrl_err(ctrl, + "Cannot read creg (index = %d)\n", i); goto abort; } - dbg("%s: offset %d: value %x\n", __func__,i, - tempdword); + ctrl_dbg(ctrl, " offset %d: value %x\n", i, tempdword); } ctrl->mmio_base = @@ -993,30 +993,31 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) ctrl->mmio_size = 0x24 + 0x4 * num_slots; } - info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor, - pdev->subsystem_device); + ctrl_info(ctrl, "HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", + pdev->vendor, pdev->device, pdev->subsystem_vendor, + pdev->subsystem_device); rc = pci_enable_device(pdev); if (rc) { - err("%s: pci_enable_device failed\n", __func__); + ctrl_err(ctrl, "pci_enable_device failed\n"); goto abort; } if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) { - err("%s: cannot reserve MMIO region\n", __func__); + ctrl_err(ctrl, "Cannot reserve MMIO region\n"); rc = -1; goto abort; } ctrl->creg = ioremap(ctrl->mmio_base, ctrl->mmio_size); if (!ctrl->creg) { - err("%s: cannot remap MMIO region %lx @ %lx\n", __func__, - ctrl->mmio_size, ctrl->mmio_base); + ctrl_err(ctrl, "Cannot remap MMIO region %lx @ %lx\n", + ctrl->mmio_size, ctrl->mmio_base); release_mem_region(ctrl->mmio_base, ctrl->mmio_size); rc = -1; goto abort; } - dbg("%s: ctrl->creg %p\n", __func__, ctrl->creg); + ctrl_dbg(ctrl, "ctrl->creg %p\n", ctrl->creg); mutex_init(&ctrl->crit_sect); mutex_init(&ctrl->cmd_lock); @@ -1035,21 +1036,21 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) /* Mask Global Interrupt Mask & Command Complete Interrupt Mask */ tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); - dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); + ctrl_dbg(ctrl, "SERR_INTR_ENABLE = %x\n", tempdword); tempdword |= (GLOBAL_INTR_MASK | GLOBAL_SERR_MASK | COMMAND_INTR_MASK | ARBITER_SERR_MASK); tempdword &= ~SERR_INTR_RSVDZ_MASK; shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword); tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); - dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); + ctrl_dbg(ctrl, "SERR_INTR_ENABLE = %x\n", tempdword); /* Mask the MRL sensor SERR Mask of individual slot in * Slot SERR-INT Mask & clear all the existing event if any */ for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); - dbg("%s: Default Logical Slot Register %d value %x\n", __func__, - hp_slot, slot_reg); + ctrl_dbg(ctrl, "Default Logical Slot Register %d value %x\n", + hp_slot, slot_reg); slot_reg |= (PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK | BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK | CON_PFAULT_INTR_MASK | MRL_CHANGE_SERR_MASK | @@ -1066,24 +1067,24 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) /* Installs the interrupt handler */ rc = pci_enable_msi(pdev); if (rc) { - info("Can't get msi for the hotplug controller\n"); - info("Use INTx for the hotplug controller\n"); + ctrl_info(ctrl, + "Can't get msi for the hotplug controller\n"); + ctrl_info(ctrl, + "Use INTx for the hotplug controller\n"); } rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED, MY_NAME, (void *)ctrl); - dbg("%s: request_irq %d for hpc%d (returns %d)\n", - __func__, ctrl->pci_dev->irq, + ctrl_dbg(ctrl, "request_irq %d for hpc%d (returns %d)\n", + ctrl->pci_dev->irq, atomic_read(&shpchp_num_controllers), rc); if (rc) { - err("Can't get irq %d for the hotplug controller\n", - ctrl->pci_dev->irq); + ctrl_err(ctrl, "Can't get irq %d for the hotplug " + "controller\n", ctrl->pci_dev->irq); goto abort_iounmap; } } - dbg("%s: HPC at b:d:f:irq=0x%x:%x:%x:%x\n", __func__, - pdev->bus->number, PCI_SLOT(pdev->devfn), - PCI_FUNC(pdev->devfn), pdev->irq); + ctrl_dbg(ctrl, "HPC at %s irq=%x\n", pci_name(pdev), pdev->irq); /* * If this is the first controller to be initialized, @@ -1102,8 +1103,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) */ for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); - dbg("%s: Default Logical Slot Register %d value %x\n", __func__, - hp_slot, slot_reg); + ctrl_dbg(ctrl, "Default Logical Slot Register %d value %x\n", + hp_slot, slot_reg); slot_reg &= ~(PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK | BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK | CON_PFAULT_INTR_MASK | SLOT_REG_RSVDZ_MASK); @@ -1116,7 +1117,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) SERR_INTR_RSVDZ_MASK); shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword); tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); - dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); + ctrl_dbg(ctrl, "SERR_INTR_ENABLE = %x\n", tempdword); } return 0; diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c index 3fc4ec0..138f161 100644 --- a/drivers/pci/hotplug/shpchp_pci.c +++ b/drivers/pci/hotplug/shpchp_pci.c @@ -49,9 +49,7 @@ static void program_fw_provided_values(struct pci_dev *dev) /* use default values if we can't get them from firmware */ if (get_hp_params_from_firmware(dev, &hpp) || !hpp.t0 || (hpp.t0->revision > 1)) { - printk(KERN_WARNING - "%s: Could not get hotplug parameters. Use defaults\n", - __func__); + warn("Could not get hotplug parameters. Use defaults\n"); hpp.t0 = &hpp.type0_data; hpp.t0->revision = 0; hpp.t0->cache_line_size = 8; @@ -101,18 +99,20 @@ int __ref shpchp_configure_device(struct slot *p_slot) struct pci_dev *dev; struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; int num, fn; + struct controller *ctrl = p_slot->ctrl; dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); if (dev) { - err("Device %s already exists at %x:%x, cannot hot-add\n", - pci_name(dev), p_slot->bus, p_slot->device); + ctrl_err(ctrl, "Device %s already exists " + "at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev), + pci_domain_nr(parent), p_slot->bus, p_slot->device); pci_dev_put(dev); return -EINVAL; } num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0)); if (num == 0) { - err("No new device found\n"); + ctrl_err(ctrl, "No new device found\n"); return -ENODEV; } @@ -121,8 +121,8 @@ int __ref shpchp_configure_device(struct slot *p_slot) if (!dev) continue; if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { - err("Cannot hot-add display device %s\n", - pci_name(dev)); + ctrl_err(ctrl, "Cannot hot-add display device %s\n", + pci_name(dev)); pci_dev_put(dev); continue; } @@ -138,14 +138,15 @@ int __ref shpchp_configure_device(struct slot *p_slot) break; } if (busnr >= end) { - err("No free bus for hot-added bridge\n"); + ctrl_err(ctrl, + "No free bus for hot-added bridge\n"); pci_dev_put(dev); continue; } child = pci_add_new_bus(parent, dev, busnr); if (!child) { - err("Cannot add new bus for %s\n", - pci_name(dev)); + ctrl_err(ctrl, "Cannot add new bus for %s\n", + pci_name(dev)); pci_dev_put(dev); continue; } @@ -168,8 +169,10 @@ int shpchp_unconfigure_device(struct slot *p_slot) int j; u8 bctl = 0; struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; + struct controller *ctrl = p_slot->ctrl; - dbg("%s: bus/dev = %x/%x\n", __func__, p_slot->bus, p_slot->device); + ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:%02x\n", + __func__, pci_domain_nr(parent), p_slot->bus, p_slot->device); for (j=0; j<8 ; j++) { struct pci_dev* temp = pci_get_slot(parent, @@ -177,16 +180,17 @@ int shpchp_unconfigure_device(struct slot *p_slot) if (!temp) continue; if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { - err("Cannot remove display device %s\n", - pci_name(temp)); + ctrl_err(ctrl, "Cannot remove display device %s\n", + pci_name(temp)); pci_dev_put(temp); continue; } if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) { pci_read_config_byte(temp, PCI_BRIDGE_CONTROL, &bctl); if (bctl & PCI_BRIDGE_CTL_VGA) { - err("Cannot remove display device %s\n", - pci_name(temp)); + ctrl_err(ctrl, + "Cannot remove display device %s\n", + pci_name(temp)); pci_dev_put(temp); continue; } diff --git a/drivers/pci/irq.c b/drivers/pci/irq.c new file mode 100644 index 0000000..6441dfa --- /dev/null +++ b/drivers/pci/irq.c @@ -0,0 +1,60 @@ +/* + * PCI IRQ failure handing code + * + * Copyright (c) 2008 James Bottomley <James.Bottomley@HansenPartnership.com> + */ + +#include <linux/acpi.h> +#include <linux/device.h> +#include <linux/kernel.h> +#include <linux/pci.h> + +static void pci_note_irq_problem(struct pci_dev *pdev, const char *reason) +{ + struct pci_dev *parent = to_pci_dev(pdev->dev.parent); + + dev_printk(KERN_ERR, &pdev->dev, + "Potentially misrouted IRQ (Bridge %s %04x:%04x)\n", + parent->dev.bus_id, parent->vendor, parent->device); + dev_printk(KERN_ERR, &pdev->dev, "%s\n", reason); + dev_printk(KERN_ERR, &pdev->dev, "Please report to linux-kernel@vger.kernel.org\n"); + WARN_ON(1); +} + +/** + * pci_lost_interrupt - reports a lost PCI interrupt + * @pdev: device whose interrupt is lost + * + * The primary function of this routine is to report a lost interrupt + * in a standard way which users can recognise (instead of blaming the + * driver). + * + * Returns: + * a suggestion for fixing it (although the driver is not required to + * act on this). + */ +enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev) +{ + if (pdev->msi_enabled || pdev->msix_enabled) { + enum pci_lost_interrupt_reason ret; + + if (pdev->msix_enabled) { + pci_note_irq_problem(pdev, "MSIX routing failure"); + ret = PCI_LOST_IRQ_DISABLE_MSIX; + } else { + pci_note_irq_problem(pdev, "MSI routing failure"); + ret = PCI_LOST_IRQ_DISABLE_MSI; + } + return ret; + } +#ifdef CONFIG_ACPI + if (!(acpi_disabled || acpi_noirq)) { + pci_note_irq_problem(pdev, "Potential ACPI misrouting please reboot with acpi=noirq"); + /* currently no way to fix acpi on the fly */ + return PCI_LOST_IRQ_DISABLE_ACPI; + } +#endif + pci_note_irq_problem(pdev, "unknown cause (not MSI or ACPI)"); + return PCI_LOST_IRQ_NO_INFORMATION; +} +EXPORT_SYMBOL(pci_lost_interrupt); diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index dfe7c8e..b3a63ed 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -83,6 +83,9 @@ static acpi_status acpi_run_osc(acpi_handle handle, if (ACPI_FAILURE(status)) return status; + if (!output.length) + return AE_NULL_OBJECT; + out_obj = output.pointer; if (out_obj->type != ACPI_TYPE_BUFFER) { printk(KERN_DEBUG "Evaluate _OSC returns wrong type\n"); diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 533aeb5..21f2ac6 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1309,27 +1309,32 @@ void pci_enable_ari(struct pci_dev *dev) int pos; u32 cap; u16 ctrl; + struct pci_dev *bridge; - if (!dev->is_pcie) + if (!dev->is_pcie || dev->devfn) return; - if (dev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && - dev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) + pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI); + if (!pos) return; - pos = pci_find_capability(dev, PCI_CAP_ID_EXP); + bridge = dev->bus->self; + if (!bridge || !bridge->is_pcie) + return; + + pos = pci_find_capability(bridge, PCI_CAP_ID_EXP); if (!pos) return; - pci_read_config_dword(dev, pos + PCI_EXP_DEVCAP2, &cap); + pci_read_config_dword(bridge, pos + PCI_EXP_DEVCAP2, &cap); if (!(cap & PCI_EXP_DEVCAP2_ARI)) return; - pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &ctrl); + pci_read_config_word(bridge, pos + PCI_EXP_DEVCTL2, &ctrl); ctrl |= PCI_EXP_DEVCTL2_ARI; - pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, ctrl); + pci_write_config_word(bridge, pos + PCI_EXP_DEVCTL2, ctrl); - dev->ari_enabled = 1; + bridge->ari_enabled = 1; } int diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 6f1e51d..003a9b3 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -298,9 +298,6 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) child->resource[i] = child->parent->resource[i - 3]; } - for(i=0; i<3; i++) - child->resource[i] = &dev->resource[PCI_BRIDGE_RESOURCES+i]; - res = child->resource[0]; pci_read_config_byte(dev, PCI_IO_BASE, &io_base_lo); pci_read_config_byte(dev, PCI_IO_LIMIT, &io_limit_lo); diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index 023803d..ae18baf 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c @@ -76,7 +76,7 @@ tapeblock_trigger_requeue(struct tape_device *device) static void tapeblock_end_request(struct request *req, int error) { - if (__blk_end_request(req, error, blk_rq_bytes(req))) + if (blk_end_request(req, error, blk_rq_bytes(req))) BUG(); } @@ -166,7 +166,7 @@ tapeblock_requeue(struct work_struct *work) { nr_queued++; spin_unlock(get_ccwdev_lock(device->cdev)); - spin_lock(&device->blk_data.request_queue_lock); + spin_lock_irq(&device->blk_data.request_queue_lock); while ( !blk_queue_plugged(queue) && elv_next_request(queue) && @@ -176,7 +176,9 @@ tapeblock_requeue(struct work_struct *work) { if (rq_data_dir(req) == WRITE) { DBF_EVENT(1, "TBLOCK: Rejecting write request\n"); blkdev_dequeue_request(req); + spin_unlock_irq(&device->blk_data.request_queue_lock); tapeblock_end_request(req, -EIO); + spin_lock_irq(&device->blk_data.request_queue_lock); continue; } blkdev_dequeue_request(req); diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index d7073db..f9bb51f 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c @@ -1200,7 +1200,7 @@ tape_open(struct tape_device *device) { int rc; - spin_lock(get_ccwdev_lock(device->cdev)); + spin_lock_irq(get_ccwdev_lock(device->cdev)); if (device->tape_state == TS_NOT_OPER) { DBF_EVENT(6, "TAPE:nodev\n"); rc = -ENODEV; @@ -1218,7 +1218,7 @@ tape_open(struct tape_device *device) tape_state_set(device, TS_IN_USE); rc = 0; } - spin_unlock(get_ccwdev_lock(device->cdev)); + spin_unlock_irq(get_ccwdev_lock(device->cdev)); return rc; } @@ -1228,11 +1228,11 @@ tape_open(struct tape_device *device) int tape_release(struct tape_device *device) { - spin_lock(get_ccwdev_lock(device->cdev)); + spin_lock_irq(get_ccwdev_lock(device->cdev)); if (device->tape_state == TS_IN_USE) tape_state_set(device, TS_UNUSED); module_put(device->discipline->owner); - spin_unlock(get_ccwdev_lock(device->cdev)); + spin_unlock_irq(get_ccwdev_lock(device->cdev)); return 0; } diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c index b539082..f055903 100644 --- a/drivers/s390/cio/qdio_debug.c +++ b/drivers/s390/cio/qdio_debug.c @@ -20,6 +20,7 @@ static struct dentry *debugfs_root; #define MAX_DEBUGFS_QUEUES 32 static struct dentry *debugfs_queues[MAX_DEBUGFS_QUEUES] = { NULL }; static DEFINE_MUTEX(debugfs_mutex); +#define QDIO_DEBUGFS_NAME_LEN 40 void qdio_allocate_do_dbf(struct qdio_initialize *init_data) { @@ -152,17 +153,6 @@ static int qstat_seq_open(struct inode *inode, struct file *filp) filp->f_path.dentry->d_inode->i_private); } -static void get_queue_name(struct qdio_q *q, struct ccw_device *cdev, char *name) -{ - memset(name, 0, sizeof(name)); - sprintf(name, "%s", dev_name(&cdev->dev)); - if (q->is_input_q) - sprintf(name + strlen(name), "_input"); - else - sprintf(name + strlen(name), "_output"); - sprintf(name + strlen(name), "_%d", q->nr); -} - static void remove_debugfs_entry(struct qdio_q *q) { int i; @@ -189,14 +179,17 @@ static struct file_operations debugfs_fops = { static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev) { int i = 0; - char name[40]; + char name[QDIO_DEBUGFS_NAME_LEN]; while (debugfs_queues[i] != NULL) { i++; if (i >= MAX_DEBUGFS_QUEUES) return; } - get_queue_name(q, cdev, name); + snprintf(name, QDIO_DEBUGFS_NAME_LEN, "%s_%s_%d", + dev_name(&cdev->dev), + q->is_input_q ? "input" : "output", + q->nr); debugfs_queues[i] = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR, debugfs_root, q, &debugfs_fops); } diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index a50682d..7c86591 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c @@ -1083,7 +1083,6 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm, case -EIO: sprintf(dbf_text, "ierr%4x", irq_ptr->schid.sch_no); QDIO_DBF_TEXT2(1, setup, dbf_text); - qdio_int_error(cdev); return; case -ETIMEDOUT: sprintf(dbf_text, "qtoh%4x", irq_ptr->schid.sch_no); diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index b92c19b..5311317 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -1924,12 +1924,9 @@ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int re (cmd->sc_data_direction == DMA_FROM_DEVICE || cmd->sc_data_direction == DMA_BIDIRECTIONAL)) { if (scsi_sg_count(cmd) == 1) { - unsigned long flags; void *buf = tw_dev->generic_buffer_virt[request_id]; - local_irq_save(flags); scsi_sg_copy_from_buffer(cmd, buf, TW_SECTOR_SIZE); - local_irq_restore(flags); } } } /* End twa_scsiop_execute_scsi_complete() */ diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index a0537f0..c03f1d2 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c @@ -1466,12 +1466,7 @@ static int tw_scsiop_inquiry(TW_Device_Extension *tw_dev, int request_id) static void tw_transfer_internal(TW_Device_Extension *tw_dev, int request_id, void *data, unsigned int len) { - struct scsi_cmnd *cmd = tw_dev->srb[request_id]; - unsigned long flags; - - local_irq_save(flags); - scsi_sg_copy_from_buffer(cmd, data, len); - local_irq_restore(flags); + scsi_sg_copy_from_buffer(tw_dev->srb[request_id], data, len); } /* This function is called by the isr to complete an inquiry command */ diff --git a/drivers/scsi/aic7xxx/aic79xx.reg b/drivers/scsi/aic7xxx/aic79xx.reg index cca16fc..0666c22 100644 --- a/drivers/scsi/aic7xxx/aic79xx.reg +++ b/drivers/scsi/aic7xxx/aic79xx.reg @@ -80,6 +80,17 @@ VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#77 $" } /* + * Registers marked "dont_generate_debug_code" are not (yet) referenced + * from the driver code, and this keyword inhibit generation + * of debug code for them. + * + * REG_PRETTY_PRINT config will complain if dont_generate_debug_code + * is added to the register which is referenced in the driver. + * Unreferenced register with no dont_generate_debug_code will result + * in dead code. No warning is issued. + */ + +/* * Mode Pointer * Controls which of the 5, 512byte, address spaces should be used * as the source and destination of any register accesses in our @@ -91,6 +102,7 @@ register MODE_PTR { field DST_MODE 0x70 field SRC_MODE 0x07 mode_pointer + dont_generate_debug_code } const SRC_MODE_SHIFT 0 @@ -190,6 +202,7 @@ register SEQINTCODE { SAW_HWERR, BAD_SCB_STATUS } + dont_generate_debug_code } /* @@ -207,6 +220,7 @@ register CLRINT { field CLRSEQINT 0x04 field CLRCMDINT 0x02 field CLRSPLTINT 0x01 + dont_generate_debug_code } /* @@ -222,6 +236,7 @@ register ERROR { field SQPARERR 0x08 field ILLOPCODE 0x04 field DSCTMOUT 0x02 + dont_generate_debug_code } /* @@ -255,6 +270,7 @@ register HCNTRL { field INTEN 0x02 field CHIPRST 0x01 field CHIPRSTACK 0x01 + dont_generate_debug_code } /* @@ -265,6 +281,7 @@ register HNSCB_QOFF { access_mode RW size 2 count 2 + dont_generate_debug_code } /* @@ -274,6 +291,7 @@ register HESCB_QOFF { address 0x008 access_mode RW count 2 + dont_generate_debug_code } /* @@ -311,6 +329,7 @@ register CLRSEQINTSTAT { field CLRSEQ_SCSIINT 0x04 field CLRSEQ_PCIINT 0x02 field CLRSEQ_SPLTINT 0x01 + dont_generate_debug_code } /* @@ -320,6 +339,7 @@ register SWTIMER { address 0x00E access_mode RW size 2 + dont_generate_debug_code } /* @@ -330,6 +350,7 @@ register SNSCB_QOFF { access_mode RW size 2 modes M_CCHAN + dont_generate_debug_code } /* @@ -340,6 +361,7 @@ register SESCB_QOFF { count 2 access_mode RW modes M_CCHAN + dont_generate_debug_code } /* @@ -350,6 +372,7 @@ register SDSCB_QOFF { access_mode RW modes M_CCHAN size 2 + dont_generate_debug_code } /* @@ -378,6 +401,7 @@ register QOFF_CTLSTA { SCB_QSIZE_8192, SCB_QSIZE_16384 } + dont_generate_debug_code } /* @@ -431,6 +455,7 @@ register DSCOMMAND0 { field EXTREQLCK 0x10 /* External Request Lock */ field DISABLE_TWATE 0x02 /* Rev B or greater */ field CIOPARCKEN 0x01 /* Internal bus parity error enable */ + dont_generate_debug_code } /* @@ -459,6 +484,7 @@ register SG_CACHE_PRE { field SG_ADDR_MASK 0xf8 field ODD_SEG 0x04 field LAST_SEG 0x02 + dont_generate_debug_code } register SG_CACHE_SHADOW { @@ -491,6 +517,7 @@ register HADDR { access_mode RW size 8 modes M_DFF0, M_DFF1 + dont_generate_debug_code } /* @@ -522,6 +549,7 @@ register HCNT { access_mode RW size 3 modes M_DFF0, M_DFF1 + dont_generate_debug_code } /* @@ -551,6 +579,7 @@ register SGHADDR { access_mode RW size 8 modes M_DFF0, M_DFF1 + dont_generate_debug_code } /* @@ -561,6 +590,7 @@ register SCBHADDR { access_mode RW size 8 modes M_CCHAN + dont_generate_debug_code } /* @@ -570,6 +600,7 @@ register SGHCNT { address 0x084 access_mode RW modes M_DFF0, M_DFF1 + dont_generate_debug_code } /* @@ -579,6 +610,7 @@ register SCBHCNT { address 0x084 access_mode RW modes M_CCHAN + dont_generate_debug_code } /* @@ -609,6 +641,7 @@ register DFF_THRSH { RD_DFTHRSH_90, RD_DFTHRSH_MAX } + dont_generate_debug_code } /* @@ -817,6 +850,7 @@ register PCIXCTL { field SRSPDPEEN 0x04 field TSCSERREN 0x02 field CMPABCDIS 0x01 + dont_generate_debug_code } /* @@ -863,6 +897,7 @@ register DCHSPLTSTAT0 { field RXOVRUN 0x04 field RXSCEMSG 0x02 field RXSPLTRSP 0x01 + dont_generate_debug_code } /* @@ -908,6 +943,7 @@ register DCHSPLTSTAT1 { modes M_DFF0, M_DFF1 count 2 field RXDATABUCKET 0x01 + dont_generate_debug_code } /* @@ -1069,6 +1105,7 @@ register SGSPLTSTAT0 { field RXOVRUN 0x04 field RXSCEMSG 0x02 field RXSPLTRSP 0x01 + dont_generate_debug_code } /* @@ -1080,6 +1117,7 @@ register SGSPLTSTAT1 { modes M_DFF0, M_DFF1 count 2 field RXDATABUCKET 0x01 + dont_generate_debug_code } /* @@ -1091,6 +1129,7 @@ register SFUNCT { modes M_CFG field TEST_GROUP 0xF0 field TEST_NUM 0x0F + dont_generate_debug_code } /* @@ -1109,6 +1148,7 @@ register DF0PCISTAT { field RDPERR 0x04 field TWATERR 0x02 field DPR 0x01 + dont_generate_debug_code } /* @@ -1204,6 +1244,7 @@ register TARGPCISTAT { field SSE 0x40 field STA 0x08 field TWATERR 0x02 + dont_generate_debug_code } /* @@ -1216,6 +1257,7 @@ register LQIN { size 20 count 2 modes M_DFF0, M_DFF1, M_SCSI + dont_generate_debug_code } /* @@ -1247,6 +1289,7 @@ register LUNPTR { access_mode RW modes M_CFG count 2 + dont_generate_debug_code } /* @@ -1278,6 +1321,7 @@ register CMDLENPTR { access_mode RW modes M_CFG count 1 + dont_generate_debug_code } /* @@ -1290,6 +1334,7 @@ register ATTRPTR { access_mode RW modes M_CFG count 1 + dont_generate_debug_code } /* @@ -1302,6 +1347,7 @@ register FLAGPTR { access_mode RW modes M_CFG count 1 + dont_generate_debug_code } /* @@ -1313,6 +1359,7 @@ register CMDPTR { access_mode RW modes M_CFG count 1 + dont_generate_debug_code } /* @@ -1324,6 +1371,7 @@ register QNEXTPTR { access_mode RW modes M_CFG count 1 + dont_generate_debug_code } /* @@ -1347,6 +1395,7 @@ register ABRTBYTEPTR { access_mode RW modes M_CFG count 1 + dont_generate_debug_code } /* @@ -1358,6 +1407,7 @@ register ABRTBITPTR { access_mode RW modes M_CFG count 1 + dont_generate_debug_code } /* @@ -1398,6 +1448,7 @@ register LUNLEN { count 2 mask ILUNLEN 0x0F mask TLUNLEN 0xF0 + dont_generate_debug_code } const LUNLEN_SINGLE_LEVEL_LUN 0xF @@ -1410,6 +1461,7 @@ register CDBLIMIT { access_mode RW modes M_CFG count 1 + dont_generate_debug_code } /* @@ -1422,6 +1474,7 @@ register MAXCMD { access_mode RW modes M_CFG count 9 + dont_generate_debug_code } /* @@ -1432,6 +1485,7 @@ register MAXCMDCNT { address 0x033 access_mode RW modes M_CFG + dont_generate_debug_code } /* @@ -1490,6 +1544,7 @@ register LQCTL1 { field PCI2PCI 0x04 field SINGLECMD 0x02 field ABORTPENDING 0x01 + dont_generate_debug_code } /* @@ -1508,6 +1563,7 @@ register LQCTL2 { field LQOCONTINUE 0x04 field LQOTOIDLE 0x02 field LQOPAUSE 0x01 + dont_generate_debug_code } /* @@ -1578,6 +1634,7 @@ register SXFRCTL0 { field DFPEXP 0x40 field BIOSCANCELEN 0x10 field SPIOEN 0x08 + dont_generate_debug_code } /* @@ -1594,6 +1651,7 @@ register SXFRCTL1 { field ENSTIMER 0x04 field ACTNEGEN 0x02 field STPWEN 0x01 + dont_generate_debug_code } /* @@ -1696,6 +1754,7 @@ register SCSISIGO { P_STATUS CDO|IOO, P_MESGIN CDO|IOO|MSGO } + dont_generate_debug_code } /* @@ -1738,6 +1797,7 @@ register MULTARGID { modes M_CFG size 2 count 2 + dont_generate_debug_code } /* @@ -1774,6 +1834,7 @@ register SCSIDAT { access_mode RW modes M_DFF0, M_DFF1, M_SCSI size 2 + dont_generate_debug_code } /* @@ -1796,6 +1857,7 @@ register TARGIDIN { count 2 field CLKOUT 0x80 field TARGID 0x0F + dont_generate_debug_code } /* @@ -1825,6 +1887,7 @@ register SBLKCTL { field ENAB40 0x08 /* LVD transceiver active */ field ENAB20 0x04 /* SE/HVD transceiver active */ field SELWIDE 0x02 + dont_generate_debug_code } /* @@ -1842,6 +1905,7 @@ register OPTIONMODE { field ENDGFORMCHK 0x04 field AUTO_MSGOUT_DE 0x02 mask OPTIONMODE_DEFAULTS AUTO_MSGOUT_DE + dont_generate_debug_code } /* @@ -1876,6 +1940,7 @@ register CLRSINT0 { field CLROVERRUN 0x04 field CLRSPIORDY 0x02 field CLRARBDO 0x01 + dont_generate_debug_code } /* @@ -1929,6 +1994,7 @@ register CLRSINT1 { field CLRSCSIPERR 0x04 field CLRSTRB2FAST 0x02 field CLRREQINIT 0x01 + dont_generate_debug_code } /* @@ -1962,6 +2028,7 @@ register CLRSINT2 { field CLRWIDE_RES 0x04 /* Modes 0 and 1 only */ field CLRSDONE 0x02 /* Modes 0 and 1 only */ field CLRDMADONE 0x01 /* Modes 0 and 1 only */ + dont_generate_debug_code } /* @@ -2002,6 +2069,7 @@ register LQISTATE { access_mode RO modes M_CFG count 6 + dont_generate_debug_code } /* @@ -2022,6 +2090,7 @@ register LQOSTATE { access_mode RO modes M_CFG count 2 + dont_generate_debug_code } /* @@ -2054,6 +2123,7 @@ register CLRLQIINT0 { field CLRLQIBADLQT 0x04 field CLRLQIATNLQ 0x02 field CLRLQIATNCMD 0x01 + dont_generate_debug_code } /* @@ -2070,6 +2140,7 @@ register LQIMODE0 { field ENLQIBADLQT 0x04 field ENLQIATNLQ 0x02 field ENLQIATNCMD 0x01 + dont_generate_debug_code } /* @@ -2106,6 +2177,7 @@ register CLRLQIINT1 { field CLRLQIBADLQI 0x04 field CLRLQIOVERI_LQ 0x02 field CLRLQIOVERI_NLQ 0x01 + dont_generate_debug_code } /* @@ -2124,6 +2196,7 @@ register LQIMODE1 { field ENLQIBADLQI 0x04 field ENLQIOVERI_LQ 0x02 /* LQIOVERI1 */ field ENLQIOVERI_NLQ 0x01 /* LQIOVERI2 */ + dont_generate_debug_code } /* @@ -2165,6 +2238,7 @@ register CLRSINT3 { count 3 field CLRNTRAMPERR 0x02 field CLROSRAMPERR 0x01 + dont_generate_debug_code } /* @@ -2177,6 +2251,7 @@ register SIMODE3 { count 4 field ENNTRAMPERR 0x02 field ENOSRAMPERR 0x01 + dont_generate_debug_code } /* @@ -2207,6 +2282,7 @@ register CLRLQOINT0 { field CLRLQOATNLQ 0x04 field CLRLQOATNPKT 0x02 field CLRLQOTCRC 0x01 + dont_generate_debug_code } /* @@ -2222,6 +2298,7 @@ register LQOMODE0 { field ENLQOATNLQ 0x04 field ENLQOATNPKT 0x02 field ENLQOTCRC 0x01 + dont_generate_debug_code } /* @@ -2251,6 +2328,7 @@ register CLRLQOINT1 { field CLRLQOBADQAS 0x04 field CLRLQOBUSFREE 0x02 field CLRLQOPHACHGINPKT 0x01 + dont_generate_debug_code } /* @@ -2266,6 +2344,7 @@ register LQOMODE1 { field ENLQOBADQAS 0x04 field ENLQOBUSFREE 0x02 field ENLQOPHACHGINPKT 0x01 + dont_generate_debug_code } /* @@ -2289,6 +2368,7 @@ register OS_SPACE_CNT { access_mode RO modes M_CFG count 2 + dont_generate_debug_code } /* @@ -2318,6 +2398,7 @@ register GSFIFO { access_mode RO size 2 modes M_DFF0, M_DFF1, M_SCSI + dont_generate_debug_code } /* @@ -2341,6 +2422,7 @@ register NEXTSCB { access_mode RW size 2 modes M_SCSI + dont_generate_debug_code } /* @@ -2357,6 +2439,7 @@ register LQOSCSCTL { field LQOBUSETDLY 0x40 field LQONOHOLDLACK 0x02 field LQONOCHKOVER 0x01 + dont_generate_debug_code } /* @@ -2389,6 +2472,7 @@ register CLRSEQINTSRC { field CLRCFG4TSTAT 0x04 field CLRCFG4ICMD 0x02 field CLRCFG4TCMD 0x01 + dont_generate_debug_code } /* @@ -2415,6 +2499,7 @@ register CURRSCB { access_mode RW size 2 modes M_SCSI + dont_generate_debug_code } /* @@ -2472,6 +2557,7 @@ register LASTSCB { access_mode RW size 2 modes M_SCSI + dont_generate_debug_code } /* @@ -2494,6 +2580,7 @@ register SHADDR { access_mode RO size 8 modes M_DFF0, M_DFF1 + dont_generate_debug_code } /* @@ -2513,6 +2600,7 @@ register NEGOADDR { address 0x060 access_mode RW modes M_SCSI + dont_generate_debug_code } /* @@ -2523,6 +2611,7 @@ register NEGPERIOD { access_mode RW modes M_SCSI count 1 + dont_generate_debug_code } /* @@ -2543,6 +2632,7 @@ register NEGOFFSET { access_mode RW modes M_SCSI count 1 + dont_generate_debug_code } /* @@ -2557,6 +2647,7 @@ register NEGPPROPTS { field PPROPT_QAS 0x04 field PPROPT_DT 0x02 field PPROPT_IUT 0x01 + dont_generate_debug_code } /* @@ -2573,6 +2664,7 @@ register NEGCONOPTS { field ENAUTOATNI 0x04 field ENAUTOATNO 0x02 field WIDEXFER 0x01 + dont_generate_debug_code } /* @@ -2583,6 +2675,7 @@ register ANNEXCOL { access_mode RW modes M_SCSI count 7 + dont_generate_debug_code } /* @@ -2602,6 +2695,7 @@ register SCSCHKN { field DFFACTCLR 0x04 field SHVALIDSTDIS 0x02 field LSTSGCLRDIS 0x01 + dont_generate_debug_code } const AHD_ANNEXCOL_PER_DEV0 4 @@ -2635,6 +2729,7 @@ register ANNEXDAT { access_mode RW modes M_SCSI count 3 + dont_generate_debug_code } /* @@ -2645,6 +2740,7 @@ register IOWNID { address 0x067 access_mode RW modes M_SCSI + dont_generate_debug_code } /* @@ -2671,6 +2767,7 @@ register TOWNID { access_mode RW modes M_SCSI count 2 + dont_generate_debug_code } /* @@ -2702,6 +2799,7 @@ register SHCNT { access_mode RW size 3 modes M_DFF0, M_DFF1 + dont_generate_debug_code } /* @@ -2789,6 +2887,7 @@ register SCBPTR { access_mode RW size 2 modes M_DFF0, M_DFF1, M_CCHAN, M_SCSI + dont_generate_debug_code } /* @@ -2816,6 +2915,7 @@ register SCBAUTOPTR { field AUSCBPTR_EN 0x80 field SCBPTR_ADDR 0x38 field SCBPTR_OFF 0x07 + dont_generate_debug_code } /* @@ -2825,6 +2925,7 @@ register CCSGADDR { address 0x0AC access_mode RW modes M_DFF0, M_DFF1 + dont_generate_debug_code } /* @@ -2834,6 +2935,7 @@ register CCSCBADDR { address 0x0AC access_mode RW modes M_CCHAN + dont_generate_debug_code } /* @@ -2899,6 +3001,7 @@ register CCSGRAM { address 0x0B0 access_mode RW modes M_DFF0, M_DFF1 + dont_generate_debug_code } /* @@ -2908,6 +3011,7 @@ register CCSCBRAM { address 0x0B0 access_mode RW modes M_CCHAN + dont_generate_debug_code } /* @@ -2958,6 +3062,7 @@ register BRDDAT { access_mode RW modes M_SCSI count 2 + dont_generate_debug_code } /* @@ -2974,6 +3079,7 @@ register BRDCTL { field BRDEN 0x04 field BRDRW 0x02 field BRDSTB 0x01 + dont_generate_debug_code } /* @@ -2984,6 +3090,7 @@ register SEEADR { access_mode RW modes M_SCSI count 4 + dont_generate_debug_code } /* @@ -2995,6 +3102,7 @@ register SEEDAT { size 2 modes M_SCSI count 4 + dont_generate_debug_code } /* @@ -3011,6 +3119,7 @@ register SEESTAT { field SEEARBACK 0x04 field SEEBUSY 0x02 field SEESTART 0x01 + dont_generate_debug_code } /* @@ -3036,6 +3145,7 @@ register SEECTL { mask SEEOP_EWDS 0x40 field SEERST 0x02 field SEESTART 0x01 + dont_generate_debug_code } const SEEOP_ERAL_ADDR 0x80 @@ -3050,6 +3160,7 @@ register SCBCNT { address 0x0BF access_mode RW modes M_SCSI + dont_generate_debug_code } /* @@ -3061,6 +3172,7 @@ register DFWADDR { access_mode RW size 2 modes M_DFF0, M_DFF1 + dont_generate_debug_code } /* @@ -3087,6 +3199,7 @@ register DSPDATACTL { field DESQDIS 0x10 field RCVROFFSTDIS 0x04 field XMITOFFSTDIS 0x02 + dont_generate_debug_code } /* @@ -3132,6 +3245,7 @@ register DFDAT { address 0x0C4 access_mode RW modes M_DFF0, M_DFF1 + dont_generate_debug_code } /* @@ -3144,6 +3258,7 @@ register DSPSELECT { count 1 field AUTOINCEN 0x80 field DSPSEL 0x1F + dont_generate_debug_code } const NUMDSPS 0x14 @@ -3158,6 +3273,7 @@ register WRTBIASCTL { count 3 field AUTOXBCDIS 0x80 field XMITMANVAL 0x3F + dont_generate_debug_code } /* @@ -3316,6 +3432,7 @@ register FLAGS { count 23 field ZERO 0x02 field CARRY 0x01 + dont_generate_debug_code } /* @@ -3344,6 +3461,7 @@ register SEQRAM { address 0x0DA access_mode RW count 2 + dont_generate_debug_code } /* @@ -3355,6 +3473,7 @@ register PRGMCNT { access_mode RW size 2 count 5 + dont_generate_debug_code } /* @@ -3364,6 +3483,7 @@ register ACCUM { address 0x0E0 access_mode RW accumulator + dont_generate_debug_code } /* @@ -3380,6 +3500,7 @@ register SINDEX { access_mode RW size 2 sindex + dont_generate_debug_code } /* @@ -3390,6 +3511,7 @@ register DINDEX { address 0x0E4 access_mode RW size 2 + dont_generate_debug_code } /* @@ -3415,6 +3537,7 @@ register ALLONES { address 0x0E8 access_mode RO allones + dont_generate_debug_code } /* @@ -3425,6 +3548,7 @@ register ALLZEROS { address 0x0EA access_mode RO allzeros + dont_generate_debug_code } /* @@ -3435,6 +3559,7 @@ register NONE { address 0x0EA access_mode WO none + dont_generate_debug_code } /* @@ -3445,6 +3570,7 @@ register NONE { register SINDIR { address 0x0EC access_mode RO + dont_generate_debug_code } /* @@ -3455,6 +3581,7 @@ register SINDIR { register DINDIR { address 0x0ED access_mode WO + dont_generate_debug_code } /* @@ -3479,6 +3606,7 @@ register FUNCTION1 { register STACK { address 0x0F2 access_mode RW + dont_generate_debug_code } /* @@ -3491,6 +3619,7 @@ register INTVEC1_ADDR { size 2 modes M_CFG count 1 + dont_generate_debug_code } /* @@ -3503,6 +3632,7 @@ register CURADDR { size 2 modes M_SCSI count 2 + dont_generate_debug_code } /* @@ -3515,6 +3645,7 @@ register INTVEC2_ADDR { size 2 modes M_CFG count 1 + dont_generate_debug_code } /* @@ -3543,12 +3674,14 @@ scratch_ram { modes 0, 1, 2, 3 REG0 { size 2 + dont_generate_debug_code } REG1 { size 2 } REG_ISR { size 2 + dont_generate_debug_code } SG_STATE { size 1 @@ -3572,9 +3705,11 @@ scratch_ram { modes 0, 1, 2, 3 LONGJMP_ADDR { size 2 + dont_generate_debug_code } ACCUM_SAVE { size 1 + dont_generate_debug_code } } @@ -3591,18 +3726,22 @@ scratch_ram { */ WAITING_SCB_TAILS { size 32 + dont_generate_debug_code } WAITING_TID_HEAD { size 2 + dont_generate_debug_code } WAITING_TID_TAIL { size 2 + dont_generate_debug_code } /* * SCBID of the next SCB in the new SCB queue. */ NEXT_QUEUED_SCB_ADDR { size 4 + dont_generate_debug_code } /* * head of list of SCBs that have @@ -3611,6 +3750,7 @@ scratch_ram { */ COMPLETE_SCB_HEAD { size 2 + dont_generate_debug_code } /* * The list of completed SCBs in @@ -3618,6 +3758,7 @@ scratch_ram { */ COMPLETE_SCB_DMAINPROG_HEAD { size 2 + dont_generate_debug_code } /* * head of list of SCBs that have @@ -3626,6 +3767,7 @@ scratch_ram { */ COMPLETE_DMA_SCB_HEAD { size 2 + dont_generate_debug_code } /* * tail of list of SCBs that have @@ -3634,6 +3776,7 @@ scratch_ram { */ COMPLETE_DMA_SCB_TAIL { size 2 + dont_generate_debug_code } /* * head of list of SCBs that have @@ -3643,6 +3786,7 @@ scratch_ram { */ COMPLETE_ON_QFREEZE_HEAD { size 2 + dont_generate_debug_code } /* * Counting semaphore to prevent new select-outs @@ -3667,6 +3811,7 @@ scratch_ram { */ MSG_OUT { size 1 + dont_generate_debug_code } /* Parameters for DMA Logic */ DMAPARAMS { @@ -3682,6 +3827,7 @@ scratch_ram { field DIRECTION 0x04 /* Set indicates PCI->SCSI */ field FIFOFLUSH 0x02 field FIFORESET 0x01 + dont_generate_debug_code } SEQ_FLAGS { size 1 @@ -3703,9 +3849,11 @@ scratch_ram { */ SAVED_SCSIID { size 1 + dont_generate_debug_code } SAVED_LUN { size 1 + dont_generate_debug_code } /* * The last bus phase as seen by the sequencer. @@ -3733,6 +3881,7 @@ scratch_ram { */ QOUTFIFO_ENTRY_VALID_TAG { size 1 + dont_generate_debug_code } /* * Kernel and sequencer offsets into the queue of @@ -3742,10 +3891,12 @@ scratch_ram { KERNEL_TQINPOS { size 1 count 1 + dont_generate_debug_code } TQINPOS { size 1 count 8 + dont_generate_debug_code } /* * Base address of our shared data with the kernel driver in host @@ -3754,6 +3905,7 @@ scratch_ram { */ SHARED_DATA_ADDR { size 4 + dont_generate_debug_code } /* * Pointer to location in host memory for next @@ -3761,6 +3913,7 @@ scratch_ram { */ QOUTFIFO_NEXT_ADDR { size 4 + dont_generate_debug_code } ARG_1 { size 1 @@ -3773,11 +3926,13 @@ scratch_ram { mask CONT_MSG_LOOP_READ 0x03 mask CONT_MSG_LOOP_TARG 0x02 alias RETURN_1 + dont_generate_debug_code } ARG_2 { size 1 count 1 alias RETURN_2 + dont_generate_debug_code } /* @@ -3785,6 +3940,7 @@ scratch_ram { */ LAST_MSG { size 1 + dont_generate_debug_code } /* @@ -3801,6 +3957,7 @@ scratch_ram { field MANUALP 0x0C field ENAUTOATNP 0x02 field ALTSTIM 0x01 + dont_generate_debug_code } /* @@ -3809,6 +3966,7 @@ scratch_ram { INITIATOR_TAG { size 1 count 1 + dont_generate_debug_code } SEQ_FLAGS2 { @@ -3820,6 +3978,7 @@ scratch_ram { ALLOCFIFO_SCBPTR { size 2 + dont_generate_debug_code } /* @@ -3829,6 +3988,7 @@ scratch_ram { */ INT_COALESCING_TIMER { size 2 + dont_generate_debug_code } /* @@ -3838,6 +3998,7 @@ scratch_ram { */ INT_COALESCING_MAXCMDS { size 1 + dont_generate_debug_code } /* @@ -3846,6 +4007,7 @@ scratch_ram { */ INT_COALESCING_MINCMDS { size 1 + dont_generate_debug_code } /* @@ -3853,6 +4015,7 @@ scratch_ram { */ CMDS_PENDING { size 2 + dont_generate_debug_code } /* @@ -3860,6 +4023,7 @@ scratch_ram { */ INT_COALESCING_CMDCOUNT { size 1 + dont_generate_debug_code } /* @@ -3868,6 +4032,7 @@ scratch_ram { */ LOCAL_HS_MAILBOX { size 1 + dont_generate_debug_code } /* * Target-mode CDB type to CDB length table used @@ -3876,6 +4041,7 @@ scratch_ram { CMDSIZE_TABLE { size 8 count 8 + dont_generate_debug_code } /* * When an SCB with the MK_MESSAGE flag is @@ -3908,25 +4074,31 @@ scb { size 4 alias SCB_CDB_STORE alias SCB_HOST_CDB_PTR + dont_generate_debug_code } SCB_RESIDUAL_SGPTR { size 4 field SG_ADDR_MASK 0xf8 /* In the last byte */ field SG_OVERRUN_RESID 0x02 /* In the first byte */ field SG_LIST_NULL 0x01 /* In the first byte */ + dont_generate_debug_code } SCB_SCSI_STATUS { size 1 alias SCB_HOST_CDB_LEN + dont_generate_debug_code } SCB_TARGET_PHASES { size 1 + dont_generate_debug_code } SCB_TARGET_DATA_DIR { size 1 + dont_generate_debug_code } SCB_TARGET_ITAG { size 1 + dont_generate_debug_code } SCB_SENSE_BUSADDR { /* @@ -3936,10 +4108,12 @@ scb { */ size 4 alias SCB_NEXT_COMPLETE + dont_generate_debug_code } SCB_TAG { alias SCB_FIFO_USE_COUNT size 2 + dont_generate_debug_code } SCB_CONTROL { size 1 @@ -3959,6 +4133,7 @@ scb { SCB_LUN { size 1 field LID 0xff + dont_generate_debug_code } SCB_TASK_ATTRIBUTE { size 1 @@ -3967,16 +4142,20 @@ scb { * ignore wide residue message handling. */ field SCB_XFERLEN_ODD 0x01 + dont_generate_debug_code } SCB_CDB_LEN { size 1 field SCB_CDB_LEN_PTR 0x80 /* CDB in host memory */ + dont_generate_debug_code } SCB_TASK_MANAGEMENT { size 1 + dont_generate_debug_code } SCB_DATAPTR { size 8 + dont_generate_debug_code } SCB_DATACNT { /* @@ -3986,22 +4165,27 @@ scb { size 4 field SG_LAST_SEG 0x80 /* In the fourth byte */ field SG_HIGH_ADDR_BITS 0x7F /* In the fourth byte */ + dont_generate_debug_code } SCB_SGPTR { size 4 field SG_STATUS_VALID 0x04 /* In the first byte */ field SG_FULL_RESID 0x02 /* In the first byte */ field SG_LIST_NULL 0x01 /* In the first byte */ + dont_generate_debug_code } SCB_BUSADDR { size 4 + dont_generate_debug_code } SCB_NEXT { alias SCB_NEXT_SCB_BUSADDR size 2 + dont_generate_debug_code } SCB_NEXT2 { size 2 + dont_generate_debug_code } SCB_SPARE { size 8 @@ -4009,6 +4193,7 @@ scb { } SCB_DISCONNECTED_LISTS { size 8 + dont_generate_debug_code } } diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 55508b0..bdad54e 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c @@ -2472,8 +2472,6 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat) if ((ahd->bugs & AHD_CLRLQO_AUTOCLR_BUG) != 0) ahd_outb(ahd, CLRLQOINT1, 0); } else if ((status & SELTO) != 0) { - u_int scbid; - /* Stop the selection */ ahd_outb(ahd, SCSISEQ0, 0); @@ -2583,9 +2581,6 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat) case BUSFREE_DFF0: case BUSFREE_DFF1: { - u_int scbid; - struct scb *scb; - mode = busfreetime == BUSFREE_DFF0 ? AHD_MODE_DFF0 : AHD_MODE_DFF1; ahd_set_modes(ahd, mode, mode); @@ -3689,7 +3684,7 @@ ahd_free_tstate(struct ahd_softc *ahd, u_int scsi_id, char channel, int force) * by the capabilities of the bus connectivity of and sync settings for * the target. */ -void +static void ahd_devlimited_syncrate(struct ahd_softc *ahd, struct ahd_initiator_tinfo *tinfo, u_int *period, u_int *ppr_options, role_t role) @@ -4136,7 +4131,7 @@ ahd_update_neg_table(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, /* * Harpoon2A assumed that there would be a - * fallback rate between 160MHz and 80Mhz, + * fallback rate between 160MHz and 80MHz, * so 7 is used as the period factor rather * than 8 for 160MHz. */ @@ -8708,7 +8703,7 @@ ahd_reset_current_bus(struct ahd_softc *ahd) int ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset) { - struct ahd_devinfo devinfo; + struct ahd_devinfo caminfo; u_int initiator; u_int target; u_int max_scsiid; @@ -8729,7 +8724,7 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset) ahd->pending_device = NULL; - ahd_compile_devinfo(&devinfo, + ahd_compile_devinfo(&caminfo, CAM_TARGET_WILDCARD, CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD, @@ -8868,7 +8863,7 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset) } /* Notify the XPT that a bus reset occurred */ - ahd_send_async(ahd, devinfo.channel, CAM_TARGET_WILDCARD, + ahd_send_async(ahd, caminfo.channel, CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD, AC_BUS_RESET); ahd_restart(ahd); diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c index c25b6ad..a734d77 100644 --- a/drivers/scsi/aic7xxx/aic79xx_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_pci.c @@ -223,10 +223,10 @@ static const char *pci_bus_modes[] = "PCI bus mode unknown", "PCI bus mode unknown", "PCI bus mode unknown", - "PCI-X 101-133Mhz", - "PCI-X 67-100Mhz", - "PCI-X 50-66Mhz", - "PCI 33 or 66Mhz" + "PCI-X 101-133MHz", + "PCI-X 67-100MHz", + "PCI-X 50-66MHz", + "PCI 33 or 66MHz" }; #define TESTMODE 0x00000800ul @@ -337,8 +337,6 @@ ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry) * 64bit bus (PCI64BIT set in devconfig). */ if ((ahd->flags & (AHD_39BIT_ADDRESSING|AHD_64BIT_ADDRESSING)) != 0) { - uint32_t devconfig; - if (bootverbose) printf("%s: Enabling 39Bit Addressing\n", ahd_name(ahd)); @@ -483,8 +481,6 @@ ahd_pci_test_register_access(struct ahd_softc *ahd) goto fail; if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) { - u_int targpcistat; - ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); targpcistat = ahd_inb(ahd, TARGPCISTAT); if ((targpcistat & STA) != 0) diff --git a/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped b/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped index c21ceab..cdcead0 100644 --- a/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped +++ b/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped @@ -34,13 +34,6 @@ ahd_reg_print_t ahd_seqintcode_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_clrint_print; -#else -#define ahd_clrint_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "CLRINT", 0x03, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_error_print; #else #define ahd_error_print(regvalue, cur_col, wrap) \ @@ -48,20 +41,6 @@ ahd_reg_print_t ahd_error_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_hcntrl_print; -#else -#define ahd_hcntrl_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "HCNTRL", 0x05, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_hnscb_qoff_print; -#else -#define ahd_hnscb_qoff_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "HNSCB_QOFF", 0x06, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_hescb_qoff_print; #else #define ahd_hescb_qoff_print(regvalue, cur_col, wrap) \ @@ -97,13 +76,6 @@ ahd_reg_print_t ahd_swtimer_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_snscb_qoff_print; -#else -#define ahd_snscb_qoff_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SNSCB_QOFF", 0x10, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_sescb_qoff_print; #else #define ahd_sescb_qoff_print(regvalue, cur_col, wrap) \ @@ -111,20 +83,6 @@ ahd_reg_print_t ahd_sescb_qoff_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_sdscb_qoff_print; -#else -#define ahd_sdscb_qoff_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SDSCB_QOFF", 0x14, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_qoff_ctlsta_print; -#else -#define ahd_qoff_ctlsta_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "QOFF_CTLSTA", 0x16, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_intctl_print; #else #define ahd_intctl_print(regvalue, cur_col, wrap) \ @@ -139,13 +97,6 @@ ahd_reg_print_t ahd_dfcntrl_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_dscommand0_print; -#else -#define ahd_dscommand0_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "DSCOMMAND0", 0x19, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_dfstatus_print; #else #define ahd_dfstatus_print(regvalue, cur_col, wrap) \ @@ -160,13 +111,6 @@ ahd_reg_print_t ahd_sg_cache_shadow_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_sg_cache_pre_print; -#else -#define ahd_sg_cache_pre_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SG_CACHE_PRE", 0x1b, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_lqin_print; #else #define ahd_lqin_print(regvalue, cur_col, wrap) \ @@ -293,13 +237,6 @@ ahd_reg_print_t ahd_sxfrctl0_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_sxfrctl1_print; -#else -#define ahd_sxfrctl1_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SXFRCTL1", 0x3d, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_dffstat_print; #else #define ahd_dffstat_print(regvalue, cur_col, wrap) \ @@ -314,13 +251,6 @@ ahd_reg_print_t ahd_multargid_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_scsisigo_print; -#else -#define ahd_scsisigo_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SCSISIGO", 0x40, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_scsisigi_print; #else #define ahd_scsisigi_print(regvalue, cur_col, wrap) \ @@ -363,13 +293,6 @@ ahd_reg_print_t ahd_selid_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_optionmode_print; -#else -#define ahd_optionmode_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "OPTIONMODE", 0x4a, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_sblkctl_print; #else #define ahd_sblkctl_print(regvalue, cur_col, wrap) \ @@ -391,13 +314,6 @@ ahd_reg_print_t ahd_simode0_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_clrsint0_print; -#else -#define ahd_clrsint0_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "CLRSINT0", 0x4b, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_sstat1_print; #else #define ahd_sstat1_print(regvalue, cur_col, wrap) \ @@ -405,13 +321,6 @@ ahd_reg_print_t ahd_sstat1_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_clrsint1_print; -#else -#define ahd_clrsint1_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "CLRSINT1", 0x4c, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_sstat2_print; #else #define ahd_sstat2_print(regvalue, cur_col, wrap) \ @@ -461,17 +370,17 @@ ahd_reg_print_t ahd_lqistat0_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_lqimode0_print; +ahd_reg_print_t ahd_clrlqiint0_print; #else -#define ahd_lqimode0_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "LQIMODE0", 0x50, regvalue, cur_col, wrap) +#define ahd_clrlqiint0_print(regvalue, cur_col, wrap) \ + ahd_print_register(NULL, 0, "CLRLQIINT0", 0x50, regvalue, cur_col, wrap) #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_clrlqiint0_print; +ahd_reg_print_t ahd_lqimode0_print; #else -#define ahd_clrlqiint0_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "CLRLQIINT0", 0x50, regvalue, cur_col, wrap) +#define ahd_lqimode0_print(regvalue, cur_col, wrap) \ + ahd_print_register(NULL, 0, "LQIMODE0", 0x50, regvalue, cur_col, wrap) #endif #if AIC_DEBUG_REGISTERS @@ -629,17 +538,17 @@ ahd_reg_print_t ahd_seqintsrc_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_seqimode_print; +ahd_reg_print_t ahd_currscb_print; #else -#define ahd_seqimode_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SEQIMODE", 0x5c, regvalue, cur_col, wrap) +#define ahd_currscb_print(regvalue, cur_col, wrap) \ + ahd_print_register(NULL, 0, "CURRSCB", 0x5c, regvalue, cur_col, wrap) #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_currscb_print; +ahd_reg_print_t ahd_seqimode_print; #else -#define ahd_currscb_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "CURRSCB", 0x5c, regvalue, cur_col, wrap) +#define ahd_seqimode_print(regvalue, cur_col, wrap) \ + ahd_print_register(NULL, 0, "SEQIMODE", 0x5c, regvalue, cur_col, wrap) #endif #if AIC_DEBUG_REGISTERS @@ -657,13 +566,6 @@ ahd_reg_print_t ahd_lastscb_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_shaddr_print; -#else -#define ahd_shaddr_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SHADDR", 0x60, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_negoaddr_print; #else #define ahd_negoaddr_print(regvalue, cur_col, wrap) \ @@ -748,27 +650,6 @@ ahd_reg_print_t ahd_seloid_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_haddr_print; -#else -#define ahd_haddr_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "HADDR", 0x70, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_hcnt_print; -#else -#define ahd_hcnt_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "HCNT", 0x78, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_sghaddr_print; -#else -#define ahd_sghaddr_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SGHADDR", 0x7c, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_scbhaddr_print; #else #define ahd_scbhaddr_print(regvalue, cur_col, wrap) \ @@ -776,10 +657,10 @@ ahd_reg_print_t ahd_scbhaddr_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_sghcnt_print; +ahd_reg_print_t ahd_sghaddr_print; #else -#define ahd_sghcnt_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SGHCNT", 0x84, regvalue, cur_col, wrap) +#define ahd_sghaddr_print(regvalue, cur_col, wrap) \ + ahd_print_register(NULL, 0, "SGHADDR", 0x7c, regvalue, cur_col, wrap) #endif #if AIC_DEBUG_REGISTERS @@ -790,10 +671,10 @@ ahd_reg_print_t ahd_scbhcnt_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_dff_thrsh_print; +ahd_reg_print_t ahd_sghcnt_print; #else -#define ahd_dff_thrsh_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "DFF_THRSH", 0x88, regvalue, cur_col, wrap) +#define ahd_sghcnt_print(regvalue, cur_col, wrap) \ + ahd_print_register(NULL, 0, "SGHCNT", 0x84, regvalue, cur_col, wrap) #endif #if AIC_DEBUG_REGISTERS @@ -867,13 +748,6 @@ ahd_reg_print_t ahd_targpcistat_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_scbptr_print; -#else -#define ahd_scbptr_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SCBPTR", 0xa8, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_scbautoptr_print; #else #define ahd_scbautoptr_print(regvalue, cur_col, wrap) \ @@ -881,13 +755,6 @@ ahd_reg_print_t ahd_scbautoptr_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_ccsgaddr_print; -#else -#define ahd_ccsgaddr_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "CCSGADDR", 0xac, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_ccscbaddr_print; #else #define ahd_ccscbaddr_print(regvalue, cur_col, wrap) \ @@ -909,13 +776,6 @@ ahd_reg_print_t ahd_ccsgctl_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_ccsgram_print; -#else -#define ahd_ccsgram_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "CCSGRAM", 0xb0, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_ccscbram_print; #else #define ahd_ccscbram_print(regvalue, cur_col, wrap) \ @@ -930,13 +790,6 @@ ahd_reg_print_t ahd_brddat_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_brdctl_print; -#else -#define ahd_brdctl_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "BRDCTL", 0xb9, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_seeadr_print; #else #define ahd_seeadr_print(regvalue, cur_col, wrap) \ @@ -972,13 +825,6 @@ ahd_reg_print_t ahd_dspdatactl_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_dfdat_print; -#else -#define ahd_dfdat_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "DFDAT", 0xc4, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_dspselect_print; #else #define ahd_dspselect_print(regvalue, cur_col, wrap) \ @@ -1000,13 +846,6 @@ ahd_reg_print_t ahd_seqctl0_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_flags_print; -#else -#define ahd_flags_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "FLAGS", 0xd8, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_seqintctl_print; #else #define ahd_seqintctl_print(regvalue, cur_col, wrap) \ @@ -1014,13 +853,6 @@ ahd_reg_print_t ahd_seqintctl_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_seqram_print; -#else -#define ahd_seqram_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SEQRAM", 0xda, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_prgmcnt_print; #else #define ahd_prgmcnt_print(regvalue, cur_col, wrap) \ @@ -1028,41 +860,6 @@ ahd_reg_print_t ahd_prgmcnt_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_accum_print; -#else -#define ahd_accum_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "ACCUM", 0xe0, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_sindex_print; -#else -#define ahd_sindex_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SINDEX", 0xe2, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_dindex_print; -#else -#define ahd_dindex_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "DINDEX", 0xe4, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_allones_print; -#else -#define ahd_allones_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "ALLONES", 0xe8, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_allzeros_print; -#else -#define ahd_allzeros_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "ALLZEROS", 0xea, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_none_print; #else #define ahd_none_print(regvalue, cur_col, wrap) \ @@ -1070,27 +867,6 @@ ahd_reg_print_t ahd_none_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_sindir_print; -#else -#define ahd_sindir_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SINDIR", 0xec, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_dindir_print; -#else -#define ahd_dindir_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "DINDIR", 0xed, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_stack_print; -#else -#define ahd_stack_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "STACK", 0xf2, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_intvec1_addr_print; #else #define ahd_intvec1_addr_print(regvalue, cur_col, wrap) \ @@ -1126,17 +902,17 @@ ahd_reg_print_t ahd_accum_save_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_sram_base_print; +ahd_reg_print_t ahd_waiting_scb_tails_print; #else -#define ahd_sram_base_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SRAM_BASE", 0x100, regvalue, cur_col, wrap) +#define ahd_waiting_scb_tails_print(regvalue, cur_col, wrap) \ + ahd_print_register(NULL, 0, "WAITING_SCB_TAILS", 0x100, regvalue, cur_col, wrap) #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_waiting_scb_tails_print; +ahd_reg_print_t ahd_sram_base_print; #else -#define ahd_waiting_scb_tails_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "WAITING_SCB_TAILS", 0x100, regvalue, cur_col, wrap) +#define ahd_sram_base_print(regvalue, cur_col, wrap) \ + ahd_print_register(NULL, 0, "SRAM_BASE", 0x100, regvalue, cur_col, wrap) #endif #if AIC_DEBUG_REGISTERS @@ -1224,13 +1000,6 @@ ahd_reg_print_t ahd_msg_out_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_dmaparams_print; -#else -#define ahd_dmaparams_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "DMAPARAMS", 0x138, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_seq_flags_print; #else #define ahd_seq_flags_print(regvalue, cur_col, wrap) \ @@ -1238,20 +1007,6 @@ ahd_reg_print_t ahd_seq_flags_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_saved_scsiid_print; -#else -#define ahd_saved_scsiid_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SAVED_SCSIID", 0x13a, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_saved_lun_print; -#else -#define ahd_saved_lun_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SAVED_LUN", 0x13b, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_lastphase_print; #else #define ahd_lastphase_print(regvalue, cur_col, wrap) \ @@ -1273,20 +1028,6 @@ ahd_reg_print_t ahd_kernel_tqinpos_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_tqinpos_print; -#else -#define ahd_tqinpos_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "TQINPOS", 0x13f, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_shared_data_addr_print; -#else -#define ahd_shared_data_addr_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SHARED_DATA_ADDR", 0x140, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_qoutfifo_next_addr_print; #else #define ahd_qoutfifo_next_addr_print(regvalue, cur_col, wrap) \ @@ -1294,20 +1035,6 @@ ahd_reg_print_t ahd_qoutfifo_next_addr_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_arg_1_print; -#else -#define ahd_arg_1_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "ARG_1", 0x148, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_arg_2_print; -#else -#define ahd_arg_2_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "ARG_2", 0x149, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_last_msg_print; #else #define ahd_last_msg_print(regvalue, cur_col, wrap) \ @@ -1406,13 +1133,6 @@ ahd_reg_print_t ahd_mk_message_scsiid_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_scb_residual_datacnt_print; -#else -#define ahd_scb_residual_datacnt_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SCB_RESIDUAL_DATACNT", 0x180, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_scb_base_print; #else #define ahd_scb_base_print(regvalue, cur_col, wrap) \ @@ -1420,17 +1140,10 @@ ahd_reg_print_t ahd_scb_base_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_scb_residual_sgptr_print; -#else -#define ahd_scb_residual_sgptr_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SCB_RESIDUAL_SGPTR", 0x184, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_scb_scsi_status_print; +ahd_reg_print_t ahd_scb_residual_datacnt_print; #else -#define ahd_scb_scsi_status_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SCB_SCSI_STATUS", 0x188, regvalue, cur_col, wrap) +#define ahd_scb_residual_datacnt_print(regvalue, cur_col, wrap) \ + ahd_print_register(NULL, 0, "SCB_RESIDUAL_DATACNT", 0x180, regvalue, cur_col, wrap) #endif #if AIC_DEBUG_REGISTERS @@ -1476,13 +1189,6 @@ ahd_reg_print_t ahd_scb_task_attribute_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_scb_cdb_len_print; -#else -#define ahd_scb_cdb_len_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SCB_CDB_LEN", 0x196, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_scb_task_management_print; #else #define ahd_scb_task_management_print(regvalue, cur_col, wrap) \ @@ -1518,13 +1224,6 @@ ahd_reg_print_t ahd_scb_busaddr_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_scb_next_print; -#else -#define ahd_scb_next_print(regvalue, cur_col, wrap) \ - ahd_print_register(NULL, 0, "SCB_NEXT", 0x1ac, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_scb_next2_print; #else #define ahd_scb_next2_print(regvalue, cur_col, wrap) \ @@ -1717,10 +1416,10 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define SG_CACHE_PRE 0x1b -#define TYPEPTR 0x20 - #define LQIN 0x20 +#define TYPEPTR 0x20 + #define TAGPTR 0x21 #define LUNPTR 0x22 @@ -1780,6 +1479,14 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define SINGLECMD 0x02 #define ABORTPENDING 0x01 +#define SCSBIST0 0x39 +#define GSBISTERR 0x40 +#define GSBISTDONE 0x20 +#define GSBISTRUN 0x10 +#define OSBISTERR 0x04 +#define OSBISTDONE 0x02 +#define OSBISTRUN 0x01 + #define LQCTL2 0x39 #define LQIRETRY 0x80 #define LQICONTINUE 0x40 @@ -1790,13 +1497,10 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define LQOTOIDLE 0x02 #define LQOPAUSE 0x01 -#define SCSBIST0 0x39 -#define GSBISTERR 0x40 -#define GSBISTDONE 0x20 -#define GSBISTRUN 0x10 -#define OSBISTERR 0x04 -#define OSBISTDONE 0x02 -#define OSBISTRUN 0x01 +#define SCSBIST1 0x3a +#define NTBISTERR 0x04 +#define NTBISTDONE 0x02 +#define NTBISTRUN 0x01 #define SCSISEQ0 0x3a #define TEMODEO 0x80 @@ -1805,15 +1509,8 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define FORCEBUSFREE 0x10 #define SCSIRSTO 0x01 -#define SCSBIST1 0x3a -#define NTBISTERR 0x04 -#define NTBISTDONE 0x02 -#define NTBISTRUN 0x01 - #define SCSISEQ1 0x3b -#define BUSINITID 0x3c - #define SXFRCTL0 0x3c #define DFON 0x80 #define DFPEXP 0x40 @@ -1822,6 +1519,8 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define DLCOUNT 0x3c +#define BUSINITID 0x3c + #define SXFRCTL1 0x3d #define BITBUCKET 0x80 #define ENSACHK 0x40 @@ -1846,8 +1545,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define CURRFIFO_1 0x01 #define CURRFIFO_0 0x00 -#define MULTARGID 0x40 - #define SCSISIGO 0x40 #define CDO 0x80 #define IOO 0x40 @@ -1858,6 +1555,8 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define REQO 0x02 #define ACKO 0x01 +#define MULTARGID 0x40 + #define SCSISIGI 0x41 #define ATNI 0x10 #define SELI 0x08 @@ -1904,6 +1603,15 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define ENAB20 0x04 #define SELWIDE 0x02 +#define CLRSINT0 0x4b +#define CLRSELDO 0x40 +#define CLRSELDI 0x20 +#define CLRSELINGO 0x10 +#define CLRIOERR 0x08 +#define CLROVERRUN 0x04 +#define CLRSPIORDY 0x02 +#define CLRARBDO 0x01 + #define SSTAT0 0x4b #define TARGET 0x80 #define SELDO 0x40 @@ -1923,14 +1631,14 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define ENSPIORDY 0x02 #define ENARBDO 0x01 -#define CLRSINT0 0x4b -#define CLRSELDO 0x40 -#define CLRSELDI 0x20 -#define CLRSELINGO 0x10 -#define CLRIOERR 0x08 -#define CLROVERRUN 0x04 -#define CLRSPIORDY 0x02 -#define CLRARBDO 0x01 +#define CLRSINT1 0x4c +#define CLRSELTIMEO 0x80 +#define CLRATNO 0x40 +#define CLRSCSIRSTI 0x20 +#define CLRBUSFREE 0x08 +#define CLRSCSIPERR 0x04 +#define CLRSTRB2FAST 0x02 +#define CLRREQINIT 0x01 #define SSTAT1 0x4c #define SELTO 0x80 @@ -1942,15 +1650,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define STRB2FAST 0x02 #define REQINIT 0x01 -#define CLRSINT1 0x4c -#define CLRSELTIMEO 0x80 -#define CLRATNO 0x40 -#define CLRSCSIRSTI 0x20 -#define CLRBUSFREE 0x08 -#define CLRSCSIPERR 0x04 -#define CLRSTRB2FAST 0x02 -#define CLRREQINIT 0x01 - #define SSTAT2 0x4d #define BUSFREETIME 0xc0 #define NONPACKREQ 0x20 @@ -1998,14 +1697,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define LQIATNLQ 0x02 #define LQIATNCMD 0x01 -#define LQIMODE0 0x50 -#define ENLQIATNQASK 0x20 -#define ENLQICRCT1 0x10 -#define ENLQICRCT2 0x08 -#define ENLQIBADLQT 0x04 -#define ENLQIATNLQ 0x02 -#define ENLQIATNCMD 0x01 - #define CLRLQIINT0 0x50 #define CLRLQIATNQAS 0x20 #define CLRLQICRCT1 0x10 @@ -2014,6 +1705,14 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define CLRLQIATNLQ 0x02 #define CLRLQIATNCMD 0x01 +#define LQIMODE0 0x50 +#define ENLQIATNQASK 0x20 +#define ENLQICRCT1 0x10 +#define ENLQICRCT2 0x08 +#define ENLQIBADLQT 0x04 +#define ENLQIATNLQ 0x02 +#define ENLQIATNCMD 0x01 + #define LQIMODE1 0x51 #define ENLQIPHASE_LQ 0x80 #define ENLQIPHASE_NLQ 0x40 @@ -2160,6 +1859,8 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define CFG4ICMD 0x02 #define CFG4TCMD 0x01 +#define CURRSCB 0x5c + #define SEQIMODE 0x5c #define ENCTXTDONE 0x40 #define ENSAVEPTRS 0x20 @@ -2169,8 +1870,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define ENCFG4ICMD 0x02 #define ENCFG4TCMD 0x01 -#define CURRSCB 0x5c - #define MDFFSTAT 0x5d #define SHCNTNEGATIVE 0x40 #define SHCNTMINUS1 0x20 @@ -2185,29 +1884,29 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define DFFTAG 0x5e +#define LASTSCB 0x5e + #define SCSITEST 0x5e #define CNTRTEST 0x08 #define SEL_TXPLL_DEBUG 0x04 -#define LASTSCB 0x5e - #define IOPDNCTL 0x5f #define DISABLE_OE 0x80 #define PDN_IDIST 0x04 #define PDN_DIFFSENSE 0x01 -#define DGRPCRCI 0x60 - #define SHADDR 0x60 #define NEGOADDR 0x60 -#define NEGPERIOD 0x61 +#define DGRPCRCI 0x60 -#define NEGOFFSET 0x62 +#define NEGPERIOD 0x61 #define PACKCRCI 0x62 +#define NEGOFFSET 0x62 + #define NEGPPROPTS 0x63 #define PPROPT_PACE 0x08 #define PPROPT_QAS 0x04 @@ -2253,8 +1952,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define SELOID 0x6b -#define FAIRNESS 0x6c - #define PLL400CTL0 0x6c #define PLL_VCOSEL 0x80 #define PLL_PWDN 0x40 @@ -2264,6 +1961,8 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define PLL_DLPF 0x02 #define PLL_ENFBM 0x01 +#define FAIRNESS 0x6c + #define PLL400CTL1 0x6d #define PLL_CNTEN 0x80 #define PLL_CNTCLR 0x40 @@ -2275,25 +1974,25 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define HADDR 0x70 -#define HODMAADR 0x70 - #define PLLDELAY 0x70 #define SPLIT_DROP_REQ 0x80 -#define HCNT 0x78 +#define HODMAADR 0x70 #define HODMACNT 0x78 -#define HODMAEN 0x7a +#define HCNT 0x78 -#define SGHADDR 0x7c +#define HODMAEN 0x7a #define SCBHADDR 0x7c -#define SGHCNT 0x84 +#define SGHADDR 0x7c #define SCBHCNT 0x84 +#define SGHCNT 0x84 + #define DFF_THRSH 0x88 #define WR_DFTHRSH 0x70 #define RD_DFTHRSH 0x07 @@ -2326,10 +2025,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define CMCRXMSG0 0x90 -#define OVLYRXMSG0 0x90 - -#define DCHRXMSG0 0x90 - #define ROENABLE 0x90 #define MSIROEN 0x20 #define OVLYROEN 0x10 @@ -2338,11 +2033,11 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define DCH1ROEN 0x02 #define DCH0ROEN 0x01 -#define OVLYRXMSG1 0x91 +#define OVLYRXMSG0 0x90 -#define CMCRXMSG1 0x91 +#define DCHRXMSG0 0x90 -#define DCHRXMSG1 0x91 +#define OVLYRXMSG1 0x91 #define NSENABLE 0x91 #define MSINSEN 0x20 @@ -2352,6 +2047,10 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define DCH1NSEN 0x02 #define DCH0NSEN 0x01 +#define CMCRXMSG1 0x91 + +#define DCHRXMSG1 0x91 + #define DCHRXMSG2 0x92 #define CMCRXMSG2 0x92 @@ -2375,24 +2074,24 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define TSCSERREN 0x02 #define CMPABCDIS 0x01 -#define CMCSEQBCNT 0x94 - #define OVLYSEQBCNT 0x94 #define DCHSEQBCNT 0x94 +#define CMCSEQBCNT 0x94 + +#define CMCSPLTSTAT0 0x96 + #define DCHSPLTSTAT0 0x96 #define OVLYSPLTSTAT0 0x96 -#define CMCSPLTSTAT0 0x96 +#define CMCSPLTSTAT1 0x97 #define OVLYSPLTSTAT1 0x97 #define DCHSPLTSTAT1 0x97 -#define CMCSPLTSTAT1 0x97 - #define SGRXMSG0 0x98 #define CDNUM 0xf8 #define CFNUM 0x07 @@ -2420,15 +2119,18 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define TAG_NUM 0x1f #define RLXORD 0x10 +#define SGSEQBCNT 0x9c + #define SLVSPLTOUTATTR0 0x9c #define LOWER_BCNT 0xff -#define SGSEQBCNT 0x9c - #define SLVSPLTOUTATTR1 0x9d #define CMPLT_DNUM 0xf8 #define CMPLT_FNUM 0x07 +#define SLVSPLTOUTATTR2 0x9e +#define CMPLT_BNUM 0xff + #define SGSPLTSTAT0 0x9e #define STAETERM 0x80 #define SCBCERR 0x40 @@ -2439,9 +2141,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define RXSCEMSG 0x02 #define RXSPLTRSP 0x01 -#define SLVSPLTOUTATTR2 0x9e -#define CMPLT_BNUM 0xff - #define SGSPLTSTAT1 0x9f #define RXDATABUCKET 0x01 @@ -2497,10 +2196,10 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define CCSGADDR 0xac -#define CCSCBADDR 0xac - #define CCSCBADR_BK 0xac +#define CCSCBADDR 0xac + #define CMC_RAMBIST 0xad #define SG_ELEMENT_SIZE 0x80 #define SCBRAMBIST_FAIL 0x40 @@ -2554,9 +2253,9 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define SEEDAT 0xbc #define SEECTL 0xbe -#define SEEOP_EWDS 0x40 #define SEEOP_WALL 0x40 #define SEEOP_EWEN 0x40 +#define SEEOP_EWDS 0x40 #define SEEOPCODE 0x70 #define SEERST 0x02 #define SEESTART 0x01 @@ -2573,25 +2272,25 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define SCBCNT 0xbf +#define DFWADDR 0xc0 + #define DSPFLTRCTL 0xc0 #define FLTRDISABLE 0x20 #define EDGESENSE 0x10 #define DSPFCNTSEL 0x0f -#define DFWADDR 0xc0 - #define DSPDATACTL 0xc1 #define BYPASSENAB 0x80 #define DESQDIS 0x10 #define RCVROFFSTDIS 0x04 #define XMITOFFSTDIS 0x02 +#define DFRADDR 0xc2 + #define DSPREQCTL 0xc2 #define MANREQCTL 0xc0 #define MANREQDLY 0x3f -#define DFRADDR 0xc2 - #define DSPACKCTL 0xc3 #define MANACKCTL 0xc0 #define MANACKDLY 0x3f @@ -2612,14 +2311,14 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define WRTBIASCALC 0xc7 -#define DFPTRS 0xc8 - #define RCVRBIASCALC 0xc8 -#define DFBKPTR 0xc9 +#define DFPTRS 0xc8 #define SKEWCALC 0xc9 +#define DFBKPTR 0xc9 + #define DFDBCTL 0xcb #define DFF_CIO_WR_RDY 0x20 #define DFF_CIO_RD_RDY 0x10 @@ -2704,12 +2403,12 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define ACCUM_SAVE 0xfa +#define WAITING_SCB_TAILS 0x100 + #define AHD_PCI_CONFIG_BASE 0x100 #define SRAM_BASE 0x100 -#define WAITING_SCB_TAILS 0x100 - #define WAITING_TID_HEAD 0x120 #define WAITING_TID_TAIL 0x122 @@ -2738,8 +2437,8 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define PRELOADEN 0x80 #define WIDEODD 0x40 #define SCSIEN 0x20 -#define SDMAENACK 0x10 #define SDMAEN 0x10 +#define SDMAENACK 0x10 #define HDMAEN 0x08 #define HDMAENACK 0x08 #define DIRECTION 0x04 @@ -2837,12 +2536,12 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define MK_MESSAGE_SCSIID 0x162 +#define SCB_BASE 0x180 + #define SCB_RESIDUAL_DATACNT 0x180 #define SCB_CDB_STORE 0x180 #define SCB_HOST_CDB_PTR 0x180 -#define SCB_BASE 0x180 - #define SCB_RESIDUAL_SGPTR 0x184 #define SG_ADDR_MASK 0xf8 #define SG_OVERRUN_RESID 0x02 @@ -2910,17 +2609,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define SCB_DISCONNECTED_LISTS 0x1b8 -#define CMD_GROUP_CODE_SHIFT 0x05 -#define STIMESEL_MIN 0x18 -#define STIMESEL_SHIFT 0x03 -#define INVALID_ADDR 0x80 -#define AHD_PRECOMP_MASK 0x07 -#define TARGET_DATA_IN 0x01 -#define CCSCBADDR_MAX 0x80 -#define NUMDSPS 0x14 -#define SEEOP_EWEN_ADDR 0xc0 -#define AHD_ANNEXCOL_PER_DEV0 0x04 -#define DST_MODE_SHIFT 0x04 #define AHD_TIMER_MAX_US 0x18ffe7 #define AHD_TIMER_MAX_TICKS 0xffff #define AHD_SENSE_BUFSIZE 0x100 @@ -2955,32 +2643,43 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; #define LUNLEN_SINGLE_LEVEL_LUN 0x0f #define NVRAM_SCB_OFFSET 0x2c #define STATUS_PKT_SENSE 0xff +#define CMD_GROUP_CODE_SHIFT 0x05 #define MAX_OFFSET_PACED_BUG 0x7f #define STIMESEL_BUG_ADJ 0x08 +#define STIMESEL_MIN 0x18 +#define STIMESEL_SHIFT 0x03 #define CCSGRAM_MAXSEGS 0x10 +#define INVALID_ADDR 0x80 #define SEEOP_ERAL_ADDR 0x80 #define AHD_SLEWRATE_DEF_REVB 0x08 #define AHD_PRECOMP_CUTBACK_17 0x04 +#define AHD_PRECOMP_MASK 0x07 #define SRC_MODE_SHIFT 0x00 #define PKT_OVERRUN_BUFSIZE 0x200 #define SCB_TRANSFER_SIZE_1BYTE_LUN 0x30 +#define TARGET_DATA_IN 0x01 #define HOST_MSG 0xff #define MAX_OFFSET 0xfe #define BUS_16_BIT 0x01 +#define CCSCBADDR_MAX 0x80 +#define NUMDSPS 0x14 +#define SEEOP_EWEN_ADDR 0xc0 +#define AHD_ANNEXCOL_PER_DEV0 0x04 +#define DST_MODE_SHIFT 0x04 /* Downloaded Constant Definitions */ -#define SG_SIZEOF 0x04 -#define SG_PREFETCH_ALIGN_MASK 0x02 -#define SG_PREFETCH_CNT_LIMIT 0x01 #define CACHELINE_MASK 0x07 #define SCB_TRANSFER_SIZE 0x06 #define PKT_OVERRUN_BUFOFFSET 0x05 +#define SG_SIZEOF 0x04 #define SG_PREFETCH_ADDR_MASK 0x03 +#define SG_PREFETCH_ALIGN_MASK 0x02 +#define SG_PREFETCH_CNT_LIMIT 0x01 #define SG_PREFETCH_CNT 0x00 #define DOWNLOAD_CONST_COUNT 0x08 /* Exported Labels */ -#define LABEL_timer_isr 0x28b #define LABEL_seq_isr 0x28f +#define LABEL_timer_isr 0x28b diff --git a/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped b/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped index c4c8a96..f5ea715 100644 --- a/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped +++ b/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped @@ -8,18 +8,6 @@ #include "aic79xx_osm.h" -static const ahd_reg_parse_entry_t MODE_PTR_parse_table[] = { - { "SRC_MODE", 0x07, 0x07 }, - { "DST_MODE", 0x70, 0x70 } -}; - -int -ahd_mode_ptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(MODE_PTR_parse_table, 2, "MODE_PTR", - 0x00, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t INTSTAT_parse_table[] = { { "SPLTINT", 0x01, 0x01 }, { "CMDCMPLT", 0x02, 0x02 }, @@ -39,110 +27,6 @@ ahd_intstat_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x01, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t SEQINTCODE_parse_table[] = { - { "NO_SEQINT", 0x00, 0xff }, - { "BAD_PHASE", 0x01, 0xff }, - { "SEND_REJECT", 0x02, 0xff }, - { "PROTO_VIOLATION", 0x03, 0xff }, - { "NO_MATCH", 0x04, 0xff }, - { "IGN_WIDE_RES", 0x05, 0xff }, - { "PDATA_REINIT", 0x06, 0xff }, - { "HOST_MSG_LOOP", 0x07, 0xff }, - { "BAD_STATUS", 0x08, 0xff }, - { "DATA_OVERRUN", 0x09, 0xff }, - { "MKMSG_FAILED", 0x0a, 0xff }, - { "MISSED_BUSFREE", 0x0b, 0xff }, - { "DUMP_CARD_STATE", 0x0c, 0xff }, - { "ILLEGAL_PHASE", 0x0d, 0xff }, - { "INVALID_SEQINT", 0x0e, 0xff }, - { "CFG4ISTAT_INTR", 0x0f, 0xff }, - { "STATUS_OVERRUN", 0x10, 0xff }, - { "CFG4OVERRUN", 0x11, 0xff }, - { "ENTERING_NONPACK", 0x12, 0xff }, - { "TASKMGMT_FUNC_COMPLETE",0x13, 0xff }, - { "TASKMGMT_CMD_CMPLT_OKAY",0x14, 0xff }, - { "TRACEPOINT0", 0x15, 0xff }, - { "TRACEPOINT1", 0x16, 0xff }, - { "TRACEPOINT2", 0x17, 0xff }, - { "TRACEPOINT3", 0x18, 0xff }, - { "SAW_HWERR", 0x19, 0xff }, - { "BAD_SCB_STATUS", 0x1a, 0xff } -}; - -int -ahd_seqintcode_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SEQINTCODE_parse_table, 27, "SEQINTCODE", - 0x02, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t CLRINT_parse_table[] = { - { "CLRSPLTINT", 0x01, 0x01 }, - { "CLRCMDINT", 0x02, 0x02 }, - { "CLRSEQINT", 0x04, 0x04 }, - { "CLRSCSIINT", 0x08, 0x08 }, - { "CLRPCIINT", 0x10, 0x10 }, - { "CLRSWTMINT", 0x20, 0x20 }, - { "CLRBRKADRINT", 0x40, 0x40 }, - { "CLRHWERRINT", 0x80, 0x80 } -}; - -int -ahd_clrint_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(CLRINT_parse_table, 8, "CLRINT", - 0x03, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t ERROR_parse_table[] = { - { "DSCTMOUT", 0x02, 0x02 }, - { "ILLOPCODE", 0x04, 0x04 }, - { "SQPARERR", 0x08, 0x08 }, - { "DPARERR", 0x10, 0x10 }, - { "MPARERR", 0x20, 0x20 }, - { "CIOACCESFAIL", 0x40, 0x40 }, - { "CIOPARERR", 0x80, 0x80 } -}; - -int -ahd_error_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(ERROR_parse_table, 7, "ERROR", - 0x04, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t HCNTRL_parse_table[] = { - { "CHIPRST", 0x01, 0x01 }, - { "CHIPRSTACK", 0x01, 0x01 }, - { "INTEN", 0x02, 0x02 }, - { "PAUSE", 0x04, 0x04 }, - { "SWTIMER_START_B", 0x08, 0x08 }, - { "SWINT", 0x10, 0x10 }, - { "POWRDN", 0x40, 0x40 }, - { "SEQ_RESET", 0x80, 0x80 } -}; - -int -ahd_hcntrl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(HCNTRL_parse_table, 8, "HCNTRL", - 0x05, regvalue, cur_col, wrap)); -} - -int -ahd_hnscb_qoff_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "HNSCB_QOFF", - 0x06, regvalue, cur_col, wrap)); -} - -int -ahd_hescb_qoff_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "HESCB_QOFF", - 0x08, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t HS_MAILBOX_parse_table[] = { { "ENINT_COALESCE", 0x40, 0x40 }, { "HOST_TQINPOS", 0x80, 0x80 } @@ -170,77 +54,6 @@ ahd_seqintstat_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x0c, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t CLRSEQINTSTAT_parse_table[] = { - { "CLRSEQ_SPLTINT", 0x01, 0x01 }, - { "CLRSEQ_PCIINT", 0x02, 0x02 }, - { "CLRSEQ_SCSIINT", 0x04, 0x04 }, - { "CLRSEQ_SEQINT", 0x08, 0x08 }, - { "CLRSEQ_SWTMRTO", 0x10, 0x10 } -}; - -int -ahd_clrseqintstat_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(CLRSEQINTSTAT_parse_table, 5, "CLRSEQINTSTAT", - 0x0c, regvalue, cur_col, wrap)); -} - -int -ahd_swtimer_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SWTIMER", - 0x0e, regvalue, cur_col, wrap)); -} - -int -ahd_snscb_qoff_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SNSCB_QOFF", - 0x10, regvalue, cur_col, wrap)); -} - -int -ahd_sescb_qoff_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SESCB_QOFF", - 0x12, regvalue, cur_col, wrap)); -} - -int -ahd_sdscb_qoff_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SDSCB_QOFF", - 0x14, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t QOFF_CTLSTA_parse_table[] = { - { "SCB_QSIZE_4", 0x00, 0x0f }, - { "SCB_QSIZE_8", 0x01, 0x0f }, - { "SCB_QSIZE_16", 0x02, 0x0f }, - { "SCB_QSIZE_32", 0x03, 0x0f }, - { "SCB_QSIZE_64", 0x04, 0x0f }, - { "SCB_QSIZE_128", 0x05, 0x0f }, - { "SCB_QSIZE_256", 0x06, 0x0f }, - { "SCB_QSIZE_512", 0x07, 0x0f }, - { "SCB_QSIZE_1024", 0x08, 0x0f }, - { "SCB_QSIZE_2048", 0x09, 0x0f }, - { "SCB_QSIZE_4096", 0x0a, 0x0f }, - { "SCB_QSIZE_8192", 0x0b, 0x0f }, - { "SCB_QSIZE_16384", 0x0c, 0x0f }, - { "SCB_QSIZE", 0x0f, 0x0f }, - { "HS_MAILBOX_ACT", 0x10, 0x10 }, - { "SDSCB_ROLLOVR", 0x20, 0x20 }, - { "NEW_SCB_AVAIL", 0x40, 0x40 }, - { "EMPTY_SCB_AVAIL", 0x80, 0x80 } -}; - -int -ahd_qoff_ctlsta_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(QOFF_CTLSTA_parse_table, 18, "QOFF_CTLSTA", - 0x16, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t INTCTL_parse_table[] = { { "SPLTINTEN", 0x01, 0x01 }, { "SEQINTEN", 0x02, 0x02 }, @@ -280,22 +93,6 @@ ahd_dfcntrl_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x19, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t DSCOMMAND0_parse_table[] = { - { "CIOPARCKEN", 0x01, 0x01 }, - { "DISABLE_TWATE", 0x02, 0x02 }, - { "EXTREQLCK", 0x10, 0x10 }, - { "MPARCKEN", 0x20, 0x20 }, - { "DPARCKEN", 0x40, 0x40 }, - { "CACHETHEN", 0x80, 0x80 } -}; - -int -ahd_dscommand0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(DSCOMMAND0_parse_table, 6, "DSCOMMAND0", - 0x19, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t DFSTATUS_parse_table[] = { { "FIFOEMP", 0x01, 0x01 }, { "FIFOFULL", 0x02, 0x02 }, @@ -327,146 +124,6 @@ ahd_sg_cache_shadow_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x1b, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t SG_CACHE_PRE_parse_table[] = { - { "LAST_SEG", 0x02, 0x02 }, - { "ODD_SEG", 0x04, 0x04 }, - { "SG_ADDR_MASK", 0xf8, 0xf8 } -}; - -int -ahd_sg_cache_pre_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SG_CACHE_PRE_parse_table, 3, "SG_CACHE_PRE", - 0x1b, regvalue, cur_col, wrap)); -} - -int -ahd_lqin_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "LQIN", - 0x20, regvalue, cur_col, wrap)); -} - -int -ahd_lunptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "LUNPTR", - 0x22, regvalue, cur_col, wrap)); -} - -int -ahd_cmdlenptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "CMDLENPTR", - 0x25, regvalue, cur_col, wrap)); -} - -int -ahd_attrptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "ATTRPTR", - 0x26, regvalue, cur_col, wrap)); -} - -int -ahd_flagptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "FLAGPTR", - 0x27, regvalue, cur_col, wrap)); -} - -int -ahd_cmdptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "CMDPTR", - 0x28, regvalue, cur_col, wrap)); -} - -int -ahd_qnextptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "QNEXTPTR", - 0x29, regvalue, cur_col, wrap)); -} - -int -ahd_abrtbyteptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "ABRTBYTEPTR", - 0x2b, regvalue, cur_col, wrap)); -} - -int -ahd_abrtbitptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "ABRTBITPTR", - 0x2c, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t LUNLEN_parse_table[] = { - { "ILUNLEN", 0x0f, 0x0f }, - { "TLUNLEN", 0xf0, 0xf0 } -}; - -int -ahd_lunlen_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(LUNLEN_parse_table, 2, "LUNLEN", - 0x30, regvalue, cur_col, wrap)); -} - -int -ahd_cdblimit_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "CDBLIMIT", - 0x31, regvalue, cur_col, wrap)); -} - -int -ahd_maxcmd_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "MAXCMD", - 0x32, regvalue, cur_col, wrap)); -} - -int -ahd_maxcmdcnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "MAXCMDCNT", - 0x33, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t LQCTL1_parse_table[] = { - { "ABORTPENDING", 0x01, 0x01 }, - { "SINGLECMD", 0x02, 0x02 }, - { "PCI2PCI", 0x04, 0x04 } -}; - -int -ahd_lqctl1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(LQCTL1_parse_table, 3, "LQCTL1", - 0x38, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t LQCTL2_parse_table[] = { - { "LQOPAUSE", 0x01, 0x01 }, - { "LQOTOIDLE", 0x02, 0x02 }, - { "LQOCONTINUE", 0x04, 0x04 }, - { "LQORETRY", 0x08, 0x08 }, - { "LQIPAUSE", 0x10, 0x10 }, - { "LQITOIDLE", 0x20, 0x20 }, - { "LQICONTINUE", 0x40, 0x40 }, - { "LQIRETRY", 0x80, 0x80 } -}; - -int -ahd_lqctl2_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(LQCTL2_parse_table, 8, "LQCTL2", - 0x39, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SCSISEQ0_parse_table[] = { { "SCSIRSTO", 0x01, 0x01 }, { "FORCEBUSFREE", 0x10, 0x10 }, @@ -498,37 +155,6 @@ ahd_scsiseq1_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x3b, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t SXFRCTL0_parse_table[] = { - { "SPIOEN", 0x08, 0x08 }, - { "BIOSCANCELEN", 0x10, 0x10 }, - { "DFPEXP", 0x40, 0x40 }, - { "DFON", 0x80, 0x80 } -}; - -int -ahd_sxfrctl0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SXFRCTL0_parse_table, 4, "SXFRCTL0", - 0x3c, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SXFRCTL1_parse_table[] = { - { "STPWEN", 0x01, 0x01 }, - { "ACTNEGEN", 0x02, 0x02 }, - { "ENSTIMER", 0x04, 0x04 }, - { "STIMESEL", 0x18, 0x18 }, - { "ENSPCHK", 0x20, 0x20 }, - { "ENSACHK", 0x40, 0x40 }, - { "BITBUCKET", 0x80, 0x80 } -}; - -int -ahd_sxfrctl1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SXFRCTL1_parse_table, 7, "SXFRCTL1", - 0x3d, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t DFFSTAT_parse_table[] = { { "CURRFIFO_0", 0x00, 0x03 }, { "CURRFIFO_1", 0x01, 0x03 }, @@ -545,40 +171,6 @@ ahd_dffstat_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x3f, regvalue, cur_col, wrap)); } -int -ahd_multargid_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "MULTARGID", - 0x40, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SCSISIGO_parse_table[] = { - { "P_DATAOUT", 0x00, 0xe0 }, - { "P_DATAOUT_DT", 0x20, 0xe0 }, - { "P_DATAIN", 0x40, 0xe0 }, - { "P_DATAIN_DT", 0x60, 0xe0 }, - { "P_COMMAND", 0x80, 0xe0 }, - { "P_MESGOUT", 0xa0, 0xe0 }, - { "P_STATUS", 0xc0, 0xe0 }, - { "P_MESGIN", 0xe0, 0xe0 }, - { "ACKO", 0x01, 0x01 }, - { "REQO", 0x02, 0x02 }, - { "BSYO", 0x04, 0x04 }, - { "SELO", 0x08, 0x08 }, - { "ATNO", 0x10, 0x10 }, - { "MSGO", 0x20, 0x20 }, - { "IOO", 0x40, 0x40 }, - { "CDO", 0x80, 0x80 }, - { "PHASE_MASK", 0xe0, 0xe0 } -}; - -int -ahd_scsisigo_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SCSISIGO_parse_table, 17, "SCSISIGO", - 0x40, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SCSISIGI_parse_table[] = { { "P_DATAOUT", 0x00, 0xe0 }, { "P_DATAOUT_DT", 0x20, 0xe0 }, @@ -624,31 +216,12 @@ ahd_scsiphase_print(u_int regvalue, u_int *cur_col, u_int wrap) } int -ahd_scsidat_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCSIDAT", - 0x44, regvalue, cur_col, wrap)); -} - -int ahd_scsibus_print(u_int regvalue, u_int *cur_col, u_int wrap) { return (ahd_print_register(NULL, 0, "SCSIBUS", 0x46, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t TARGIDIN_parse_table[] = { - { "TARGID", 0x0f, 0x0f }, - { "CLKOUT", 0x80, 0x80 } -}; - -int -ahd_targidin_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(TARGIDIN_parse_table, 2, "TARGIDIN", - 0x48, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SELID_parse_table[] = { { "ONEBIT", 0x08, 0x08 }, { "SELID_MASK", 0xf0, 0xf0 } @@ -661,38 +234,6 @@ ahd_selid_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x49, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t OPTIONMODE_parse_table[] = { - { "AUTO_MSGOUT_DE", 0x02, 0x02 }, - { "ENDGFORMCHK", 0x04, 0x04 }, - { "BUSFREEREV", 0x10, 0x10 }, - { "BIASCANCTL", 0x20, 0x20 }, - { "AUTOACKEN", 0x40, 0x40 }, - { "BIOSCANCTL", 0x80, 0x80 }, - { "OPTIONMODE_DEFAULTS",0x02, 0x02 } -}; - -int -ahd_optionmode_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(OPTIONMODE_parse_table, 7, "OPTIONMODE", - 0x4a, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SBLKCTL_parse_table[] = { - { "SELWIDE", 0x02, 0x02 }, - { "ENAB20", 0x04, 0x04 }, - { "ENAB40", 0x08, 0x08 }, - { "DIAGLEDON", 0x40, 0x40 }, - { "DIAGLEDEN", 0x80, 0x80 } -}; - -int -ahd_sblkctl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SBLKCTL_parse_table, 5, "SBLKCTL", - 0x4a, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SSTAT0_parse_table[] = { { "ARBDO", 0x01, 0x01 }, { "SPIORDY", 0x02, 0x02 }, @@ -728,23 +269,6 @@ ahd_simode0_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x4b, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t CLRSINT0_parse_table[] = { - { "CLRARBDO", 0x01, 0x01 }, - { "CLRSPIORDY", 0x02, 0x02 }, - { "CLROVERRUN", 0x04, 0x04 }, - { "CLRIOERR", 0x08, 0x08 }, - { "CLRSELINGO", 0x10, 0x10 }, - { "CLRSELDI", 0x20, 0x20 }, - { "CLRSELDO", 0x40, 0x40 } -}; - -int -ahd_clrsint0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(CLRSINT0_parse_table, 7, "CLRSINT0", - 0x4b, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SSTAT1_parse_table[] = { { "REQINIT", 0x01, 0x01 }, { "STRB2FAST", 0x02, 0x02 }, @@ -763,23 +287,6 @@ ahd_sstat1_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x4c, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t CLRSINT1_parse_table[] = { - { "CLRREQINIT", 0x01, 0x01 }, - { "CLRSTRB2FAST", 0x02, 0x02 }, - { "CLRSCSIPERR", 0x04, 0x04 }, - { "CLRBUSFREE", 0x08, 0x08 }, - { "CLRSCSIRSTI", 0x20, 0x20 }, - { "CLRATNO", 0x40, 0x40 }, - { "CLRSELTIMEO", 0x80, 0x80 } -}; - -int -ahd_clrsint1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(CLRSINT1_parse_table, 7, "CLRSINT1", - 0x4c, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SSTAT2_parse_table[] = { { "BUSFREE_LQO", 0x40, 0xc0 }, { "BUSFREE_DFF0", 0x80, 0xc0 }, @@ -800,20 +307,6 @@ ahd_sstat2_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x4d, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t CLRSINT2_parse_table[] = { - { "CLRDMADONE", 0x01, 0x01 }, - { "CLRSDONE", 0x02, 0x02 }, - { "CLRWIDE_RES", 0x04, 0x04 }, - { "CLRNONPACKREQ", 0x20, 0x20 } -}; - -int -ahd_clrsint2_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(CLRSINT2_parse_table, 4, "CLRSINT2", - 0x4d, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t PERRDIAG_parse_table[] = { { "DTERR", 0x01, 0x01 }, { "DGFORMERR", 0x02, 0x02 }, @@ -833,26 +326,12 @@ ahd_perrdiag_print(u_int regvalue, u_int *cur_col, u_int wrap) } int -ahd_lqistate_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "LQISTATE", - 0x4e, regvalue, cur_col, wrap)); -} - -int ahd_soffcnt_print(u_int regvalue, u_int *cur_col, u_int wrap) { return (ahd_print_register(NULL, 0, "SOFFCNT", 0x4f, regvalue, cur_col, wrap)); } -int -ahd_lqostate_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "LQOSTATE", - 0x4f, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t LQISTAT0_parse_table[] = { { "LQIATNCMD", 0x01, 0x01 }, { "LQIATNLQ", 0x02, 0x02 }, @@ -869,56 +348,6 @@ ahd_lqistat0_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x50, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t LQIMODE0_parse_table[] = { - { "ENLQIATNCMD", 0x01, 0x01 }, - { "ENLQIATNLQ", 0x02, 0x02 }, - { "ENLQIBADLQT", 0x04, 0x04 }, - { "ENLQICRCT2", 0x08, 0x08 }, - { "ENLQICRCT1", 0x10, 0x10 }, - { "ENLQIATNQASK", 0x20, 0x20 } -}; - -int -ahd_lqimode0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(LQIMODE0_parse_table, 6, "LQIMODE0", - 0x50, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t CLRLQIINT0_parse_table[] = { - { "CLRLQIATNCMD", 0x01, 0x01 }, - { "CLRLQIATNLQ", 0x02, 0x02 }, - { "CLRLQIBADLQT", 0x04, 0x04 }, - { "CLRLQICRCT2", 0x08, 0x08 }, - { "CLRLQICRCT1", 0x10, 0x10 }, - { "CLRLQIATNQAS", 0x20, 0x20 } -}; - -int -ahd_clrlqiint0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(CLRLQIINT0_parse_table, 6, "CLRLQIINT0", - 0x50, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t LQIMODE1_parse_table[] = { - { "ENLQIOVERI_NLQ", 0x01, 0x01 }, - { "ENLQIOVERI_LQ", 0x02, 0x02 }, - { "ENLQIBADLQI", 0x04, 0x04 }, - { "ENLQICRCI_NLQ", 0x08, 0x08 }, - { "ENLQICRCI_LQ", 0x10, 0x10 }, - { "ENLIQABORT", 0x20, 0x20 }, - { "ENLQIPHASE_NLQ", 0x40, 0x40 }, - { "ENLQIPHASE_LQ", 0x80, 0x80 } -}; - -int -ahd_lqimode1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(LQIMODE1_parse_table, 8, "LQIMODE1", - 0x51, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t LQISTAT1_parse_table[] = { { "LQIOVERI_NLQ", 0x01, 0x01 }, { "LQIOVERI_LQ", 0x02, 0x02 }, @@ -937,24 +366,6 @@ ahd_lqistat1_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x51, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t CLRLQIINT1_parse_table[] = { - { "CLRLQIOVERI_NLQ", 0x01, 0x01 }, - { "CLRLQIOVERI_LQ", 0x02, 0x02 }, - { "CLRLQIBADLQI", 0x04, 0x04 }, - { "CLRLQICRCI_NLQ", 0x08, 0x08 }, - { "CLRLQICRCI_LQ", 0x10, 0x10 }, - { "CLRLIQABORT", 0x20, 0x20 }, - { "CLRLQIPHASE_NLQ", 0x40, 0x40 }, - { "CLRLQIPHASE_LQ", 0x80, 0x80 } -}; - -int -ahd_clrlqiint1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(CLRLQIINT1_parse_table, 8, "CLRLQIINT1", - 0x51, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t LQISTAT2_parse_table[] = { { "LQIGSAVAIL", 0x01, 0x01 }, { "LQISTOPCMD", 0x02, 0x02 }, @@ -985,30 +396,6 @@ ahd_sstat3_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x53, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t SIMODE3_parse_table[] = { - { "ENOSRAMPERR", 0x01, 0x01 }, - { "ENNTRAMPERR", 0x02, 0x02 } -}; - -int -ahd_simode3_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SIMODE3_parse_table, 2, "SIMODE3", - 0x53, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t CLRSINT3_parse_table[] = { - { "CLROSRAMPERR", 0x01, 0x01 }, - { "CLRNTRAMPERR", 0x02, 0x02 } -}; - -int -ahd_clrsint3_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(CLRSINT3_parse_table, 2, "CLRSINT3", - 0x53, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t LQOSTAT0_parse_table[] = { { "LQOTCRC", 0x01, 0x01 }, { "LQOATNPKT", 0x02, 0x02 }, @@ -1024,51 +411,6 @@ ahd_lqostat0_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x54, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t CLRLQOINT0_parse_table[] = { - { "CLRLQOTCRC", 0x01, 0x01 }, - { "CLRLQOATNPKT", 0x02, 0x02 }, - { "CLRLQOATNLQ", 0x04, 0x04 }, - { "CLRLQOSTOPT2", 0x08, 0x08 }, - { "CLRLQOTARGSCBPERR", 0x10, 0x10 } -}; - -int -ahd_clrlqoint0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(CLRLQOINT0_parse_table, 5, "CLRLQOINT0", - 0x54, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t LQOMODE0_parse_table[] = { - { "ENLQOTCRC", 0x01, 0x01 }, - { "ENLQOATNPKT", 0x02, 0x02 }, - { "ENLQOATNLQ", 0x04, 0x04 }, - { "ENLQOSTOPT2", 0x08, 0x08 }, - { "ENLQOTARGSCBPERR", 0x10, 0x10 } -}; - -int -ahd_lqomode0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(LQOMODE0_parse_table, 5, "LQOMODE0", - 0x54, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t LQOMODE1_parse_table[] = { - { "ENLQOPHACHGINPKT", 0x01, 0x01 }, - { "ENLQOBUSFREE", 0x02, 0x02 }, - { "ENLQOBADQAS", 0x04, 0x04 }, - { "ENLQOSTOPI2", 0x08, 0x08 }, - { "ENLQOINITSCBPERR", 0x10, 0x10 } -}; - -int -ahd_lqomode1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(LQOMODE1_parse_table, 5, "LQOMODE1", - 0x55, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t LQOSTAT1_parse_table[] = { { "LQOPHACHGINPKT", 0x01, 0x01 }, { "LQOBUSFREE", 0x02, 0x02 }, @@ -1084,21 +426,6 @@ ahd_lqostat1_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x55, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t CLRLQOINT1_parse_table[] = { - { "CLRLQOPHACHGINPKT", 0x01, 0x01 }, - { "CLRLQOBUSFREE", 0x02, 0x02 }, - { "CLRLQOBADQAS", 0x04, 0x04 }, - { "CLRLQOSTOPI2", 0x08, 0x08 }, - { "CLRLQOINITSCBPERR", 0x10, 0x10 } -}; - -int -ahd_clrlqoint1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(CLRLQOINT1_parse_table, 5, "CLRLQOINT1", - 0x55, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t LQOSTAT2_parse_table[] = { { "LQOSTOP0", 0x01, 0x01 }, { "LQOPHACHGOUTPKT", 0x02, 0x02 }, @@ -1113,13 +440,6 @@ ahd_lqostat2_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x56, regvalue, cur_col, wrap)); } -int -ahd_os_space_cnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "OS_SPACE_CNT", - 0x56, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SIMODE1_parse_table[] = { { "ENREQINIT", 0x01, 0x01 }, { "ENSTRB2FAST", 0x02, 0x02 }, @@ -1138,13 +458,6 @@ ahd_simode1_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x57, regvalue, cur_col, wrap)); } -int -ahd_gsfifo_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "GSFIFO", - 0x58, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t DFFSXFRCTL_parse_table[] = { { "RSTCHN", 0x01, 0x01 }, { "CLRCHN", 0x02, 0x02 }, @@ -1159,44 +472,6 @@ ahd_dffsxfrctl_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x5a, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t LQOSCSCTL_parse_table[] = { - { "LQONOCHKOVER", 0x01, 0x01 }, - { "LQONOHOLDLACK", 0x02, 0x02 }, - { "LQOBUSETDLY", 0x40, 0x40 }, - { "LQOH2A_VERSION", 0x80, 0x80 } -}; - -int -ahd_lqoscsctl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(LQOSCSCTL_parse_table, 4, "LQOSCSCTL", - 0x5a, regvalue, cur_col, wrap)); -} - -int -ahd_nextscb_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "NEXTSCB", - 0x5a, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t CLRSEQINTSRC_parse_table[] = { - { "CLRCFG4TCMD", 0x01, 0x01 }, - { "CLRCFG4ICMD", 0x02, 0x02 }, - { "CLRCFG4TSTAT", 0x04, 0x04 }, - { "CLRCFG4ISTAT", 0x08, 0x08 }, - { "CLRCFG4DATA", 0x10, 0x10 }, - { "CLRSAVEPTRS", 0x20, 0x20 }, - { "CLRCTXTDONE", 0x40, 0x40 } -}; - -int -ahd_clrseqintsrc_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(CLRSEQINTSRC_parse_table, 7, "CLRSEQINTSRC", - 0x5b, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SEQINTSRC_parse_table[] = { { "CFG4TCMD", 0x01, 0x01 }, { "CFG4ICMD", 0x02, 0x02 }, @@ -1231,13 +506,6 @@ ahd_seqimode_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x5c, regvalue, cur_col, wrap)); } -int -ahd_currscb_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "CURRSCB", - 0x5c, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t MDFFSTAT_parse_table[] = { { "FIFOFREE", 0x01, 0x01 }, { "DATAINFIFO", 0x02, 0x02 }, @@ -1256,308 +524,12 @@ ahd_mdffstat_print(u_int regvalue, u_int *cur_col, u_int wrap) } int -ahd_lastscb_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "LASTSCB", - 0x5e, regvalue, cur_col, wrap)); -} - -int -ahd_shaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SHADDR", - 0x60, regvalue, cur_col, wrap)); -} - -int -ahd_negoaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "NEGOADDR", - 0x60, regvalue, cur_col, wrap)); -} - -int -ahd_negperiod_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "NEGPERIOD", - 0x61, regvalue, cur_col, wrap)); -} - -int -ahd_negoffset_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "NEGOFFSET", - 0x62, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t NEGPPROPTS_parse_table[] = { - { "PPROPT_IUT", 0x01, 0x01 }, - { "PPROPT_DT", 0x02, 0x02 }, - { "PPROPT_QAS", 0x04, 0x04 }, - { "PPROPT_PACE", 0x08, 0x08 } -}; - -int -ahd_negppropts_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NEGPPROPTS_parse_table, 4, "NEGPPROPTS", - 0x63, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t NEGCONOPTS_parse_table[] = { - { "WIDEXFER", 0x01, 0x01 }, - { "ENAUTOATNO", 0x02, 0x02 }, - { "ENAUTOATNI", 0x04, 0x04 }, - { "ENSLOWCRC", 0x08, 0x08 }, - { "RTI_OVRDTRN", 0x10, 0x10 }, - { "RTI_WRTDIS", 0x20, 0x20 }, - { "ENSNAPSHOT", 0x40, 0x40 } -}; - -int -ahd_negconopts_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NEGCONOPTS_parse_table, 7, "NEGCONOPTS", - 0x64, regvalue, cur_col, wrap)); -} - -int -ahd_annexcol_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "ANNEXCOL", - 0x65, regvalue, cur_col, wrap)); -} - -int -ahd_annexdat_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "ANNEXDAT", - 0x66, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SCSCHKN_parse_table[] = { - { "LSTSGCLRDIS", 0x01, 0x01 }, - { "SHVALIDSTDIS", 0x02, 0x02 }, - { "DFFACTCLR", 0x04, 0x04 }, - { "SDONEMSKDIS", 0x08, 0x08 }, - { "WIDERESEN", 0x10, 0x10 }, - { "CURRFIFODEF", 0x20, 0x20 }, - { "STSELSKIDDIS", 0x40, 0x40 }, - { "BIDICHKDIS", 0x80, 0x80 } -}; - -int -ahd_scschkn_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SCSCHKN_parse_table, 8, "SCSCHKN", - 0x66, regvalue, cur_col, wrap)); -} - -int -ahd_iownid_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "IOWNID", - 0x67, regvalue, cur_col, wrap)); -} - -int -ahd_shcnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SHCNT", - 0x68, regvalue, cur_col, wrap)); -} - -int -ahd_townid_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "TOWNID", - 0x69, regvalue, cur_col, wrap)); -} - -int ahd_seloid_print(u_int regvalue, u_int *cur_col, u_int wrap) { return (ahd_print_register(NULL, 0, "SELOID", 0x6b, regvalue, cur_col, wrap)); } -int -ahd_haddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "HADDR", - 0x70, regvalue, cur_col, wrap)); -} - -int -ahd_hcnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "HCNT", - 0x78, regvalue, cur_col, wrap)); -} - -int -ahd_sghaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SGHADDR", - 0x7c, regvalue, cur_col, wrap)); -} - -int -ahd_scbhaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCBHADDR", - 0x7c, regvalue, cur_col, wrap)); -} - -int -ahd_sghcnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SGHCNT", - 0x84, regvalue, cur_col, wrap)); -} - -int -ahd_scbhcnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCBHCNT", - 0x84, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t DFF_THRSH_parse_table[] = { - { "WR_DFTHRSH_MIN", 0x00, 0x70 }, - { "RD_DFTHRSH_MIN", 0x00, 0x07 }, - { "RD_DFTHRSH_25", 0x01, 0x07 }, - { "RD_DFTHRSH_50", 0x02, 0x07 }, - { "RD_DFTHRSH_63", 0x03, 0x07 }, - { "RD_DFTHRSH_75", 0x04, 0x07 }, - { "RD_DFTHRSH_85", 0x05, 0x07 }, - { "RD_DFTHRSH_90", 0x06, 0x07 }, - { "RD_DFTHRSH_MAX", 0x07, 0x07 }, - { "WR_DFTHRSH_25", 0x10, 0x70 }, - { "WR_DFTHRSH_50", 0x20, 0x70 }, - { "WR_DFTHRSH_63", 0x30, 0x70 }, - { "WR_DFTHRSH_75", 0x40, 0x70 }, - { "WR_DFTHRSH_85", 0x50, 0x70 }, - { "WR_DFTHRSH_90", 0x60, 0x70 }, - { "WR_DFTHRSH_MAX", 0x70, 0x70 }, - { "RD_DFTHRSH", 0x07, 0x07 }, - { "WR_DFTHRSH", 0x70, 0x70 } -}; - -int -ahd_dff_thrsh_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(DFF_THRSH_parse_table, 18, "DFF_THRSH", - 0x88, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t PCIXCTL_parse_table[] = { - { "CMPABCDIS", 0x01, 0x01 }, - { "TSCSERREN", 0x02, 0x02 }, - { "SRSPDPEEN", 0x04, 0x04 }, - { "SPLTSTADIS", 0x08, 0x08 }, - { "SPLTSMADIS", 0x10, 0x10 }, - { "UNEXPSCIEN", 0x20, 0x20 }, - { "SERRPULSE", 0x80, 0x80 } -}; - -int -ahd_pcixctl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(PCIXCTL_parse_table, 7, "PCIXCTL", - 0x93, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t DCHSPLTSTAT0_parse_table[] = { - { "RXSPLTRSP", 0x01, 0x01 }, - { "RXSCEMSG", 0x02, 0x02 }, - { "RXOVRUN", 0x04, 0x04 }, - { "CNTNOTCMPLT", 0x08, 0x08 }, - { "SCDATBUCKET", 0x10, 0x10 }, - { "SCADERR", 0x20, 0x20 }, - { "SCBCERR", 0x40, 0x40 }, - { "STAETERM", 0x80, 0x80 } -}; - -int -ahd_dchspltstat0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(DCHSPLTSTAT0_parse_table, 8, "DCHSPLTSTAT0", - 0x96, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t DCHSPLTSTAT1_parse_table[] = { - { "RXDATABUCKET", 0x01, 0x01 } -}; - -int -ahd_dchspltstat1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(DCHSPLTSTAT1_parse_table, 1, "DCHSPLTSTAT1", - 0x97, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SGSPLTSTAT0_parse_table[] = { - { "RXSPLTRSP", 0x01, 0x01 }, - { "RXSCEMSG", 0x02, 0x02 }, - { "RXOVRUN", 0x04, 0x04 }, - { "CNTNOTCMPLT", 0x08, 0x08 }, - { "SCDATBUCKET", 0x10, 0x10 }, - { "SCADERR", 0x20, 0x20 }, - { "SCBCERR", 0x40, 0x40 }, - { "STAETERM", 0x80, 0x80 } -}; - -int -ahd_sgspltstat0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SGSPLTSTAT0_parse_table, 8, "SGSPLTSTAT0", - 0x9e, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SGSPLTSTAT1_parse_table[] = { - { "RXDATABUCKET", 0x01, 0x01 } -}; - -int -ahd_sgspltstat1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SGSPLTSTAT1_parse_table, 1, "SGSPLTSTAT1", - 0x9f, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t DF0PCISTAT_parse_table[] = { - { "DPR", 0x01, 0x01 }, - { "TWATERR", 0x02, 0x02 }, - { "RDPERR", 0x04, 0x04 }, - { "SCAAPERR", 0x08, 0x08 }, - { "RTA", 0x10, 0x10 }, - { "RMA", 0x20, 0x20 }, - { "SSE", 0x40, 0x40 }, - { "DPE", 0x80, 0x80 } -}; - -int -ahd_df0pcistat_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(DF0PCISTAT_parse_table, 8, "DF0PCISTAT", - 0xa0, regvalue, cur_col, wrap)); -} - -int -ahd_reg0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "REG0", - 0xa0, regvalue, cur_col, wrap)); -} - -int -ahd_reg_isr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "REG_ISR", - 0xa4, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SG_STATE_parse_table[] = { { "SEGS_AVAIL", 0x01, 0x01 }, { "LOADING_NEEDED", 0x02, 0x02 }, @@ -1571,54 +543,6 @@ ahd_sg_state_print(u_int regvalue, u_int *cur_col, u_int wrap) 0xa6, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t TARGPCISTAT_parse_table[] = { - { "TWATERR", 0x02, 0x02 }, - { "STA", 0x08, 0x08 }, - { "SSE", 0x40, 0x40 }, - { "DPE", 0x80, 0x80 } -}; - -int -ahd_targpcistat_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(TARGPCISTAT_parse_table, 4, "TARGPCISTAT", - 0xa7, regvalue, cur_col, wrap)); -} - -int -ahd_scbptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCBPTR", - 0xa8, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SCBAUTOPTR_parse_table[] = { - { "SCBPTR_OFF", 0x07, 0x07 }, - { "SCBPTR_ADDR", 0x38, 0x38 }, - { "AUSCBPTR_EN", 0x80, 0x80 } -}; - -int -ahd_scbautoptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SCBAUTOPTR_parse_table, 3, "SCBAUTOPTR", - 0xab, regvalue, cur_col, wrap)); -} - -int -ahd_ccsgaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "CCSGADDR", - 0xac, regvalue, cur_col, wrap)); -} - -int -ahd_ccscbaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "CCSCBADDR", - 0xac, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t CCSCBCTL_parse_table[] = { { "CCSCBRESET", 0x01, 0x01 }, { "CCSCBDIR", 0x04, 0x04 }, @@ -1651,138 +575,6 @@ ahd_ccsgctl_print(u_int regvalue, u_int *cur_col, u_int wrap) 0xad, regvalue, cur_col, wrap)); } -int -ahd_ccsgram_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "CCSGRAM", - 0xb0, regvalue, cur_col, wrap)); -} - -int -ahd_ccscbram_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "CCSCBRAM", - 0xb0, regvalue, cur_col, wrap)); -} - -int -ahd_brddat_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "BRDDAT", - 0xb8, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t BRDCTL_parse_table[] = { - { "BRDSTB", 0x01, 0x01 }, - { "BRDRW", 0x02, 0x02 }, - { "BRDEN", 0x04, 0x04 }, - { "BRDADDR", 0x38, 0x38 }, - { "FLXARBREQ", 0x40, 0x40 }, - { "FLXARBACK", 0x80, 0x80 } -}; - -int -ahd_brdctl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(BRDCTL_parse_table, 6, "BRDCTL", - 0xb9, regvalue, cur_col, wrap)); -} - -int -ahd_seeadr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SEEADR", - 0xba, regvalue, cur_col, wrap)); -} - -int -ahd_seedat_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SEEDAT", - 0xbc, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SEECTL_parse_table[] = { - { "SEEOP_ERAL", 0x40, 0x70 }, - { "SEEOP_WRITE", 0x50, 0x70 }, - { "SEEOP_READ", 0x60, 0x70 }, - { "SEEOP_ERASE", 0x70, 0x70 }, - { "SEESTART", 0x01, 0x01 }, - { "SEERST", 0x02, 0x02 }, - { "SEEOPCODE", 0x70, 0x70 }, - { "SEEOP_EWEN", 0x40, 0x40 }, - { "SEEOP_WALL", 0x40, 0x40 }, - { "SEEOP_EWDS", 0x40, 0x40 } -}; - -int -ahd_seectl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SEECTL_parse_table, 10, "SEECTL", - 0xbe, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SEESTAT_parse_table[] = { - { "SEESTART", 0x01, 0x01 }, - { "SEEBUSY", 0x02, 0x02 }, - { "SEEARBACK", 0x04, 0x04 }, - { "LDALTID_L", 0x08, 0x08 }, - { "SEEOPCODE", 0x70, 0x70 }, - { "INIT_DONE", 0x80, 0x80 } -}; - -int -ahd_seestat_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SEESTAT_parse_table, 6, "SEESTAT", - 0xbe, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t DSPDATACTL_parse_table[] = { - { "XMITOFFSTDIS", 0x02, 0x02 }, - { "RCVROFFSTDIS", 0x04, 0x04 }, - { "DESQDIS", 0x10, 0x10 }, - { "BYPASSENAB", 0x80, 0x80 } -}; - -int -ahd_dspdatactl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(DSPDATACTL_parse_table, 4, "DSPDATACTL", - 0xc1, regvalue, cur_col, wrap)); -} - -int -ahd_dfdat_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "DFDAT", - 0xc4, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t DSPSELECT_parse_table[] = { - { "DSPSEL", 0x1f, 0x1f }, - { "AUTOINCEN", 0x80, 0x80 } -}; - -int -ahd_dspselect_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(DSPSELECT_parse_table, 2, "DSPSELECT", - 0xc4, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t WRTBIASCTL_parse_table[] = { - { "XMITMANVAL", 0x3f, 0x3f }, - { "AUTOXBCDIS", 0x80, 0x80 } -}; - -int -ahd_wrtbiasctl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(WRTBIASCTL_parse_table, 2, "WRTBIASCTL", - 0xc5, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SEQCTL0_parse_table[] = { { "LOADRAM", 0x01, 0x01 }, { "SEQRESET", 0x02, 0x02 }, @@ -1801,18 +593,6 @@ ahd_seqctl0_print(u_int regvalue, u_int *cur_col, u_int wrap) 0xd6, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t FLAGS_parse_table[] = { - { "CARRY", 0x01, 0x01 }, - { "ZERO", 0x02, 0x02 } -}; - -int -ahd_flags_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(FLAGS_parse_table, 2, "FLAGS", - 0xd8, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SEQINTCTL_parse_table[] = { { "IRET", 0x01, 0x01 }, { "INTMASK1", 0x02, 0x02 }, @@ -1831,118 +611,6 @@ ahd_seqintctl_print(u_int regvalue, u_int *cur_col, u_int wrap) } int -ahd_seqram_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SEQRAM", - 0xda, regvalue, cur_col, wrap)); -} - -int -ahd_prgmcnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "PRGMCNT", - 0xde, regvalue, cur_col, wrap)); -} - -int -ahd_accum_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "ACCUM", - 0xe0, regvalue, cur_col, wrap)); -} - -int -ahd_sindex_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SINDEX", - 0xe2, regvalue, cur_col, wrap)); -} - -int -ahd_dindex_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "DINDEX", - 0xe4, regvalue, cur_col, wrap)); -} - -int -ahd_allones_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "ALLONES", - 0xe8, regvalue, cur_col, wrap)); -} - -int -ahd_allzeros_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "ALLZEROS", - 0xea, regvalue, cur_col, wrap)); -} - -int -ahd_none_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "NONE", - 0xea, regvalue, cur_col, wrap)); -} - -int -ahd_sindir_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SINDIR", - 0xec, regvalue, cur_col, wrap)); -} - -int -ahd_dindir_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "DINDIR", - 0xed, regvalue, cur_col, wrap)); -} - -int -ahd_stack_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "STACK", - 0xf2, regvalue, cur_col, wrap)); -} - -int -ahd_intvec1_addr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "INTVEC1_ADDR", - 0xf4, regvalue, cur_col, wrap)); -} - -int -ahd_curaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "CURADDR", - 0xf4, regvalue, cur_col, wrap)); -} - -int -ahd_intvec2_addr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "INTVEC2_ADDR", - 0xf6, regvalue, cur_col, wrap)); -} - -int -ahd_longjmp_addr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "LONGJMP_ADDR", - 0xf8, regvalue, cur_col, wrap)); -} - -int -ahd_accum_save_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "ACCUM_SAVE", - 0xfa, regvalue, cur_col, wrap)); -} - -int ahd_sram_base_print(u_int regvalue, u_int *cur_col, u_int wrap) { return (ahd_print_register(NULL, 0, "SRAM_BASE", @@ -1950,69 +618,6 @@ ahd_sram_base_print(u_int regvalue, u_int *cur_col, u_int wrap) } int -ahd_waiting_scb_tails_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "WAITING_SCB_TAILS", - 0x100, regvalue, cur_col, wrap)); -} - -int -ahd_waiting_tid_head_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "WAITING_TID_HEAD", - 0x120, regvalue, cur_col, wrap)); -} - -int -ahd_waiting_tid_tail_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "WAITING_TID_TAIL", - 0x122, regvalue, cur_col, wrap)); -} - -int -ahd_next_queued_scb_addr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "NEXT_QUEUED_SCB_ADDR", - 0x124, regvalue, cur_col, wrap)); -} - -int -ahd_complete_scb_head_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "COMPLETE_SCB_HEAD", - 0x128, regvalue, cur_col, wrap)); -} - -int -ahd_complete_scb_dmainprog_head_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "COMPLETE_SCB_DMAINPROG_HEAD", - 0x12a, regvalue, cur_col, wrap)); -} - -int -ahd_complete_dma_scb_head_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "COMPLETE_DMA_SCB_HEAD", - 0x12c, regvalue, cur_col, wrap)); -} - -int -ahd_complete_dma_scb_tail_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "COMPLETE_DMA_SCB_TAIL", - 0x12e, regvalue, cur_col, wrap)); -} - -int -ahd_complete_on_qfreeze_head_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "COMPLETE_ON_QFREEZE_HEAD", - 0x130, regvalue, cur_col, wrap)); -} - -int ahd_qfreeze_count_print(u_int regvalue, u_int *cur_col, u_int wrap) { return (ahd_print_register(NULL, 0, "QFREEZE_COUNT", @@ -2033,33 +638,6 @@ ahd_saved_mode_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x136, regvalue, cur_col, wrap)); } -int -ahd_msg_out_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "MSG_OUT", - 0x137, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t DMAPARAMS_parse_table[] = { - { "FIFORESET", 0x01, 0x01 }, - { "FIFOFLUSH", 0x02, 0x02 }, - { "DIRECTION", 0x04, 0x04 }, - { "HDMAEN", 0x08, 0x08 }, - { "HDMAENACK", 0x08, 0x08 }, - { "SDMAEN", 0x10, 0x10 }, - { "SDMAENACK", 0x10, 0x10 }, - { "SCSIEN", 0x20, 0x20 }, - { "WIDEODD", 0x40, 0x40 }, - { "PRELOADEN", 0x80, 0x80 } -}; - -int -ahd_dmaparams_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(DMAPARAMS_parse_table, 10, "DMAPARAMS", - 0x138, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SEQ_FLAGS_parse_table[] = { { "NO_DISCONNECT", 0x01, 0x01 }, { "SPHASE_PENDING", 0x02, 0x02 }, @@ -2079,20 +657,6 @@ ahd_seq_flags_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x139, regvalue, cur_col, wrap)); } -int -ahd_saved_scsiid_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SAVED_SCSIID", - 0x13a, regvalue, cur_col, wrap)); -} - -int -ahd_saved_lun_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SAVED_LUN", - 0x13b, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t LASTPHASE_parse_table[] = { { "P_DATAOUT", 0x00, 0xe0 }, { "P_DATAOUT_DT", 0x20, 0xe0 }, @@ -2116,96 +680,6 @@ ahd_lastphase_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x13c, regvalue, cur_col, wrap)); } -int -ahd_qoutfifo_entry_valid_tag_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "QOUTFIFO_ENTRY_VALID_TAG", - 0x13d, regvalue, cur_col, wrap)); -} - -int -ahd_kernel_tqinpos_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "KERNEL_TQINPOS", - 0x13e, regvalue, cur_col, wrap)); -} - -int -ahd_tqinpos_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "TQINPOS", - 0x13f, regvalue, cur_col, wrap)); -} - -int -ahd_shared_data_addr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SHARED_DATA_ADDR", - 0x140, regvalue, cur_col, wrap)); -} - -int -ahd_qoutfifo_next_addr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "QOUTFIFO_NEXT_ADDR", - 0x144, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t ARG_1_parse_table[] = { - { "CONT_MSG_LOOP_TARG", 0x02, 0x02 }, - { "CONT_MSG_LOOP_READ", 0x03, 0x03 }, - { "CONT_MSG_LOOP_WRITE",0x04, 0x04 }, - { "EXIT_MSG_LOOP", 0x08, 0x08 }, - { "MSGOUT_PHASEMIS", 0x10, 0x10 }, - { "SEND_REJ", 0x20, 0x20 }, - { "SEND_SENSE", 0x40, 0x40 }, - { "SEND_MSG", 0x80, 0x80 } -}; - -int -ahd_arg_1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(ARG_1_parse_table, 8, "ARG_1", - 0x148, regvalue, cur_col, wrap)); -} - -int -ahd_arg_2_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "ARG_2", - 0x149, regvalue, cur_col, wrap)); -} - -int -ahd_last_msg_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "LAST_MSG", - 0x14a, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SCSISEQ_TEMPLATE_parse_table[] = { - { "ALTSTIM", 0x01, 0x01 }, - { "ENAUTOATNP", 0x02, 0x02 }, - { "MANUALP", 0x0c, 0x0c }, - { "ENRSELI", 0x10, 0x10 }, - { "ENSELI", 0x20, 0x20 }, - { "MANUALCTL", 0x40, 0x40 } -}; - -int -ahd_scsiseq_template_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SCSISEQ_TEMPLATE_parse_table, 6, "SCSISEQ_TEMPLATE", - 0x14b, regvalue, cur_col, wrap)); -} - -int -ahd_initiator_tag_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "INITIATOR_TAG", - 0x14c, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SEQ_FLAGS2_parse_table[] = { { "PENDING_MK_MESSAGE", 0x01, 0x01 }, { "TARGET_MSG_PENDING", 0x02, 0x02 }, @@ -2220,62 +694,6 @@ ahd_seq_flags2_print(u_int regvalue, u_int *cur_col, u_int wrap) } int -ahd_allocfifo_scbptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "ALLOCFIFO_SCBPTR", - 0x14e, regvalue, cur_col, wrap)); -} - -int -ahd_int_coalescing_timer_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "INT_COALESCING_TIMER", - 0x150, regvalue, cur_col, wrap)); -} - -int -ahd_int_coalescing_maxcmds_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "INT_COALESCING_MAXCMDS", - 0x152, regvalue, cur_col, wrap)); -} - -int -ahd_int_coalescing_mincmds_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "INT_COALESCING_MINCMDS", - 0x153, regvalue, cur_col, wrap)); -} - -int -ahd_cmds_pending_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "CMDS_PENDING", - 0x154, regvalue, cur_col, wrap)); -} - -int -ahd_int_coalescing_cmdcount_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "INT_COALESCING_CMDCOUNT", - 0x156, regvalue, cur_col, wrap)); -} - -int -ahd_local_hs_mailbox_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "LOCAL_HS_MAILBOX", - 0x157, regvalue, cur_col, wrap)); -} - -int -ahd_cmdsize_table_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "CMDSIZE_TABLE", - 0x158, regvalue, cur_col, wrap)); -} - -int ahd_mk_message_scb_print(u_int regvalue, u_int *cur_col, u_int wrap) { return (ahd_print_register(NULL, 0, "MK_MESSAGE_SCB", @@ -2290,53 +708,12 @@ ahd_mk_message_scsiid_print(u_int regvalue, u_int *cur_col, u_int wrap) } int -ahd_scb_residual_datacnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCB_RESIDUAL_DATACNT", - 0x180, regvalue, cur_col, wrap)); -} - -int ahd_scb_base_print(u_int regvalue, u_int *cur_col, u_int wrap) { return (ahd_print_register(NULL, 0, "SCB_BASE", 0x180, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t SCB_RESIDUAL_SGPTR_parse_table[] = { - { "SG_LIST_NULL", 0x01, 0x01 }, - { "SG_OVERRUN_RESID", 0x02, 0x02 }, - { "SG_ADDR_MASK", 0xf8, 0xf8 } -}; - -int -ahd_scb_residual_sgptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SCB_RESIDUAL_SGPTR_parse_table, 3, "SCB_RESIDUAL_SGPTR", - 0x184, regvalue, cur_col, wrap)); -} - -int -ahd_scb_scsi_status_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCB_SCSI_STATUS", - 0x188, regvalue, cur_col, wrap)); -} - -int -ahd_scb_sense_busaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCB_SENSE_BUSADDR", - 0x18c, regvalue, cur_col, wrap)); -} - -int -ahd_scb_tag_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCB_TAG", - 0x190, regvalue, cur_col, wrap)); -} - static const ahd_reg_parse_entry_t SCB_CONTROL_parse_table[] = { { "SCB_TAG_TYPE", 0x03, 0x03 }, { "DISCONNECTED", 0x04, 0x04 }, @@ -2366,103 +743,3 @@ ahd_scb_scsiid_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x193, regvalue, cur_col, wrap)); } -static const ahd_reg_parse_entry_t SCB_LUN_parse_table[] = { - { "LID", 0xff, 0xff } -}; - -int -ahd_scb_lun_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SCB_LUN_parse_table, 1, "SCB_LUN", - 0x194, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SCB_TASK_ATTRIBUTE_parse_table[] = { - { "SCB_XFERLEN_ODD", 0x01, 0x01 } -}; - -int -ahd_scb_task_attribute_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SCB_TASK_ATTRIBUTE_parse_table, 1, "SCB_TASK_ATTRIBUTE", - 0x195, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SCB_CDB_LEN_parse_table[] = { - { "SCB_CDB_LEN_PTR", 0x80, 0x80 } -}; - -int -ahd_scb_cdb_len_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SCB_CDB_LEN_parse_table, 1, "SCB_CDB_LEN", - 0x196, regvalue, cur_col, wrap)); -} - -int -ahd_scb_task_management_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCB_TASK_MANAGEMENT", - 0x197, regvalue, cur_col, wrap)); -} - -int -ahd_scb_dataptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCB_DATAPTR", - 0x198, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SCB_DATACNT_parse_table[] = { - { "SG_HIGH_ADDR_BITS", 0x7f, 0x7f }, - { "SG_LAST_SEG", 0x80, 0x80 } -}; - -int -ahd_scb_datacnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SCB_DATACNT_parse_table, 2, "SCB_DATACNT", - 0x1a0, regvalue, cur_col, wrap)); -} - -static const ahd_reg_parse_entry_t SCB_SGPTR_parse_table[] = { - { "SG_LIST_NULL", 0x01, 0x01 }, - { "SG_FULL_RESID", 0x02, 0x02 }, - { "SG_STATUS_VALID", 0x04, 0x04 } -}; - -int -ahd_scb_sgptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(SCB_SGPTR_parse_table, 3, "SCB_SGPTR", - 0x1a4, regvalue, cur_col, wrap)); -} - -int -ahd_scb_busaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCB_BUSADDR", - 0x1a8, regvalue, cur_col, wrap)); -} - -int -ahd_scb_next_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCB_NEXT", - 0x1ac, regvalue, cur_col, wrap)); -} - -int -ahd_scb_next2_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCB_NEXT2", - 0x1ae, regvalue, cur_col, wrap)); -} - -int -ahd_scb_disconnected_lists_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahd_print_register(NULL, 0, "SCB_DISCONNECTED_LISTS", - 0x1b8, regvalue, cur_col, wrap)); -} - diff --git a/drivers/scsi/aic7xxx/aic7xxx.reg b/drivers/scsi/aic7xxx/aic7xxx.reg index 0d2f763..9a96e55 100644 --- a/drivers/scsi/aic7xxx/aic7xxx.reg +++ b/drivers/scsi/aic7xxx/aic7xxx.reg @@ -51,6 +51,17 @@ VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#40 $" */ /* + * Registers marked "dont_generate_debug_code" are not (yet) referenced + * from the driver code, and this keyword inhibit generation + * of debug code for them. + * + * REG_PRETTY_PRINT config will complain if dont_generate_debug_code + * is added to the register which is referenced in the driver. + * Unreferenced register with no dont_generate_debug_code will result + * in dead code. No warning is issued. + */ + +/* * SCSI Sequence Control (p. 3-11). * Each bit, when set starts a specific SCSI sequence on the bus */ @@ -97,6 +108,7 @@ register SXFRCTL1 { field ENSTIMER 0x04 field ACTNEGEN 0x02 field STPWEN 0x01 /* Powered Termination */ + dont_generate_debug_code } /* @@ -155,6 +167,7 @@ register SCSISIGO { mask P_MESGOUT CDI|MSGI mask P_STATUS CDI|IOI mask P_MESGIN CDI|IOI|MSGI + dont_generate_debug_code } /* @@ -194,6 +207,7 @@ register SCSIID { */ alias SCSIOFFSET mask SOFS_ULTRA2 0x7f /* Sync offset U2 chips */ + dont_generate_debug_code } /* @@ -205,6 +219,7 @@ register SCSIID { register SCSIDATL { address 0x006 access_mode RW + dont_generate_debug_code } register SCSIDATH { @@ -223,6 +238,7 @@ register STCNT { address 0x008 size 3 access_mode RW + dont_generate_debug_code } /* ALT_MODE registers (Ultra2 and Ultra160 chips) */ @@ -248,6 +264,7 @@ register OPTIONMODE { field AUTO_MSGOUT_DE 0x02 field DIS_MSGIN_DUALEDGE 0x01 mask OPTIONMODE_DEFAULTS AUTO_MSGOUT_DE|DIS_MSGIN_DUALEDGE + dont_generate_debug_code } /* ALT_MODE register on Ultra160 chips */ @@ -256,6 +273,7 @@ register TARGCRCCNT { size 2 access_mode RW count 2 + dont_generate_debug_code } /* @@ -271,6 +289,7 @@ register CLRSINT0 { field CLRSWRAP 0x08 field CLRIOERR 0x08 /* Ultra2 Only */ field CLRSPIORDY 0x02 + dont_generate_debug_code } /* @@ -306,6 +325,7 @@ register CLRSINT1 { field CLRSCSIPERR 0x04 field CLRPHASECHG 0x02 field CLRREQINIT 0x01 + dont_generate_debug_code } /* @@ -360,6 +380,7 @@ register SCSIID_ULTRA2 { access_mode RW mask TID 0xf0 /* Target ID mask */ mask OID 0x0f /* Our ID mask */ + dont_generate_debug_code } /* @@ -425,6 +446,7 @@ register SHADDR { address 0x014 size 4 access_mode RO + dont_generate_debug_code } /* @@ -441,6 +463,7 @@ register SELTIMER { field STAGE2 0x02 field STAGE1 0x01 alias TARGIDIN + dont_generate_debug_code } /* @@ -453,6 +476,7 @@ register SELID { access_mode RW mask SELID_MASK 0xf0 field ONEBIT 0x08 + dont_generate_debug_code } register SCAMCTL { @@ -473,6 +497,7 @@ register TARGID { size 2 access_mode RW count 14 + dont_generate_debug_code } /* @@ -495,6 +520,7 @@ register SPIOCAP { field EEPROM 0x04 /* Writable external BIOS ROM */ field ROM 0x02 /* Logic for accessing external ROM */ field SSPIOCPS 0x01 /* Termination and cable detection */ + dont_generate_debug_code } register BRDCTL { @@ -514,6 +540,7 @@ register BRDCTL { field BRDDAT2 0x04 field BRDRW_ULTRA2 0x02 field BRDSTB_ULTRA2 0x01 + dont_generate_debug_code } /* @@ -551,6 +578,7 @@ register SEECTL { field SEECK 0x04 field SEEDO 0x02 field SEEDI 0x01 + dont_generate_debug_code } /* * SCSI Block Control (p. 3-32) @@ -601,6 +629,7 @@ register SEQRAM { address 0x061 access_mode RW count 2 + dont_generate_debug_code } /* @@ -610,6 +639,7 @@ register SEQRAM { register SEQADDR0 { address 0x062 access_mode RW + dont_generate_debug_code } register SEQADDR1 { @@ -617,6 +647,7 @@ register SEQADDR1 { access_mode RW count 8 mask SEQADDR1_MASK 0x01 + dont_generate_debug_code } /* @@ -627,35 +658,41 @@ register ACCUM { address 0x064 access_mode RW accumulator + dont_generate_debug_code } register SINDEX { address 0x065 access_mode RW sindex + dont_generate_debug_code } register DINDEX { address 0x066 access_mode RW + dont_generate_debug_code } register ALLONES { address 0x069 access_mode RO allones + dont_generate_debug_code } register ALLZEROS { address 0x06a access_mode RO allzeros + dont_generate_debug_code } register NONE { address 0x06a access_mode WO none + dont_generate_debug_code } register FLAGS { @@ -664,16 +701,19 @@ register FLAGS { count 18 field ZERO 0x02 field CARRY 0x01 + dont_generate_debug_code } register SINDIR { address 0x06c access_mode RO + dont_generate_debug_code } register DINDIR { address 0x06d access_mode WO + dont_generate_debug_code } register FUNCTION1 { @@ -685,6 +725,7 @@ register STACK { address 0x06f access_mode RO count 5 + dont_generate_debug_code } const STACK_SIZE 4 @@ -716,6 +757,7 @@ register DSCOMMAND0 { field RAMPS 0x04 /* External SCB RAM Present */ field USCBSIZE32 0x02 /* Use 32byte SCB Page Size */ field CIOPARCKEN 0x01 /* Internal bus parity error enable */ + dont_generate_debug_code } register DSCOMMAND1 { @@ -724,6 +766,7 @@ register DSCOMMAND1 { mask DSLATT 0xfc /* PCI latency timer (non-ultra2) */ field HADDLDSEL1 0x02 /* Host Address Load Select Bits */ field HADDLDSEL0 0x01 + dont_generate_debug_code } /* @@ -735,6 +778,7 @@ register BUSTIME { count 2 mask BOFF 0xf0 mask BON 0x0f + dont_generate_debug_code } /* @@ -749,6 +793,7 @@ register BUSSPD { mask STBON 0x07 mask DFTHRSH_100 0xc0 mask DFTHRSH_75 0x80 + dont_generate_debug_code } /* aic7850/55/60/70/80/95 only */ @@ -756,6 +801,7 @@ register DSPCISTATUS { address 0x086 count 4 mask DFTHRSH_100 0xc0 + dont_generate_debug_code } /* aic7890/91/96/97 only */ @@ -764,6 +810,7 @@ register HS_MAILBOX { mask HOST_MAILBOX 0xF0 mask SEQ_MAILBOX 0x0F mask HOST_TQINPOS 0x80 /* Boundary at either 0 or 128 */ + dont_generate_debug_code } const HOST_MAILBOX_SHIFT 4 @@ -784,6 +831,7 @@ register HCNTRL { field INTEN 0x02 field CHIPRST 0x01 field CHIPRSTACK 0x01 + dont_generate_debug_code } /* @@ -795,12 +843,14 @@ register HADDR { address 0x088 size 4 access_mode RW + dont_generate_debug_code } register HCNT { address 0x08c size 3 access_mode RW + dont_generate_debug_code } /* @@ -810,6 +860,7 @@ register HCNT { register SCBPTR { address 0x090 access_mode RW + dont_generate_debug_code } /* @@ -878,6 +929,7 @@ register INTSTAT { mask SEQINT_MASK 0xf0|SEQINT /* SEQINT Status Codes */ mask INT_PEND (BRKADRINT|SEQINT|SCSIINT|CMDCMPLT) + dont_generate_debug_code } /* @@ -911,6 +963,7 @@ register CLRINT { field CLRSCSIINT 0x04 field CLRCMDINT 0x02 field CLRSEQINT 0x01 + dont_generate_debug_code } register DFCNTRL { @@ -944,6 +997,7 @@ register DFSTATUS { register DFWADDR { address 0x95 access_mode RW + dont_generate_debug_code } register DFRADDR { @@ -954,6 +1008,7 @@ register DFRADDR { register DFDAT { address 0x099 access_mode RW + dont_generate_debug_code } /* @@ -967,6 +1022,7 @@ register SCBCNT { count 1 field SCBAUTO 0x80 mask SCBCNT_MASK 0x1f + dont_generate_debug_code } /* @@ -977,6 +1033,7 @@ register QINFIFO { address 0x09b access_mode RW count 12 + dont_generate_debug_code } /* @@ -996,6 +1053,7 @@ register QOUTFIFO { address 0x09d access_mode WO count 7 + dont_generate_debug_code } register CRCCONTROL1 { @@ -1008,6 +1066,7 @@ register CRCCONTROL1 { field CRCREQCHKEN 0x10 field TARGCRCENDEN 0x08 field TARGCRCCNTEN 0x04 + dont_generate_debug_code } @@ -1040,6 +1099,7 @@ register SFUNCT { access_mode RW count 4 field ALT_MODE 0x80 + dont_generate_debug_code } /* @@ -1053,24 +1113,31 @@ scb { size 4 alias SCB_RESIDUAL_DATACNT alias SCB_CDB_STORE + dont_generate_debug_code } SCB_RESIDUAL_SGPTR { size 4 + dont_generate_debug_code } SCB_SCSI_STATUS { size 1 + dont_generate_debug_code } SCB_TARGET_PHASES { size 1 + dont_generate_debug_code } SCB_TARGET_DATA_DIR { size 1 + dont_generate_debug_code } SCB_TARGET_ITAG { size 1 + dont_generate_debug_code } SCB_DATAPTR { size 4 + dont_generate_debug_code } SCB_DATACNT { /* @@ -1080,12 +1147,14 @@ scb { size 4 field SG_LAST_SEG 0x80 /* In the fourth byte */ mask SG_HIGH_ADDR_BITS 0x7F /* In the fourth byte */ + dont_generate_debug_code } SCB_SGPTR { size 4 field SG_RESID_VALID 0x04 /* In the first byte */ field SG_FULL_RESID 0x02 /* In the first byte */ field SG_LIST_NULL 0x01 /* In the first byte */ + dont_generate_debug_code } SCB_CONTROL { size 1 @@ -1115,22 +1184,27 @@ scb { } SCB_CDB_LEN { size 1 + dont_generate_debug_code } SCB_SCSIRATE { size 1 + dont_generate_debug_code } SCB_SCSIOFFSET { size 1 count 1 + dont_generate_debug_code } SCB_NEXT { size 1 + dont_generate_debug_code } SCB_64_SPARE { size 16 } SCB_64_BTT { size 16 + dont_generate_debug_code } } @@ -1149,6 +1223,7 @@ register SEECTL_2840 { field CS_2840 0x04 field CK_2840 0x02 field DO_2840 0x01 + dont_generate_debug_code } register STATUS_2840 { @@ -1159,6 +1234,7 @@ register STATUS_2840 { mask BIOS_SEL 0x60 mask ADSEL 0x1e field DI_2840 0x01 + dont_generate_debug_code } /* --------------------- AIC-7870-only definitions -------------------- */ @@ -1166,18 +1242,22 @@ register STATUS_2840 { register CCHADDR { address 0x0E0 size 8 + dont_generate_debug_code } register CCHCNT { address 0x0E8 + dont_generate_debug_code } register CCSGRAM { address 0x0E9 + dont_generate_debug_code } register CCSGADDR { address 0x0EA + dont_generate_debug_code } register CCSGCTL { @@ -1186,11 +1266,13 @@ register CCSGCTL { field CCSGEN 0x08 field SG_FETCH_NEEDED 0x02 /* Bit used for software state */ field CCSGRESET 0x01 + dont_generate_debug_code } register CCSCBCNT { address 0xEF count 1 + dont_generate_debug_code } register CCSCBCTL { @@ -1201,14 +1283,17 @@ register CCSCBCTL { field CCSCBEN 0x08 field CCSCBDIR 0x04 field CCSCBRESET 0x01 + dont_generate_debug_code } register CCSCBADDR { address 0x0ED + dont_generate_debug_code } register CCSCBRAM { address 0xEC + dont_generate_debug_code } /* @@ -1218,23 +1303,28 @@ register SCBBADDR { address 0x0F0 access_mode RW count 3 + dont_generate_debug_code } register CCSCBPTR { address 0x0F1 + dont_generate_debug_code } register HNSCB_QOFF { address 0x0F4 count 4 + dont_generate_debug_code } register SNSCB_QOFF { address 0x0F6 + dont_generate_debug_code } register SDSCB_QOFF { address 0x0F8 + dont_generate_debug_code } register QOFF_CTLSTA { @@ -1244,6 +1334,7 @@ register QOFF_CTLSTA { field SDSCB_ROLLOVER 0x10 mask SCB_QSIZE 0x07 mask SCB_QSIZE_256 0x06 + dont_generate_debug_code } register DFF_THRSH { @@ -1267,6 +1358,7 @@ register DFF_THRSH { mask WR_DFTHRSH_90 0x60 mask WR_DFTHRSH_MAX 0x70 count 4 + dont_generate_debug_code } register SG_CACHE_PRE { @@ -1275,6 +1367,7 @@ register SG_CACHE_PRE { mask SG_ADDR_MASK 0xf8 field LAST_SEG 0x02 field LAST_SEG_DONE 0x01 + dont_generate_debug_code } register SG_CACHE_SHADOW { @@ -1283,6 +1376,7 @@ register SG_CACHE_SHADOW { mask SG_ADDR_MASK 0xf8 field LAST_SEG 0x02 field LAST_SEG_DONE 0x01 + dont_generate_debug_code } /* ---------------------- Scratch RAM Offsets ------------------------- */ /* These offsets are either to values that are initialized by the board's @@ -1309,6 +1403,7 @@ scratch_ram { BUSY_TARGETS { alias TARG_SCSIRATE size 16 + dont_generate_debug_code } /* * Bit vector of targets that have ULTRA enabled as set by @@ -1321,6 +1416,7 @@ scratch_ram { alias CMDSIZE_TABLE size 2 count 2 + dont_generate_debug_code } /* * Bit vector of targets that have disconnection disabled as set by @@ -1331,6 +1427,7 @@ scratch_ram { DISC_DSB { size 2 count 6 + dont_generate_debug_code } CMDSIZE_TABLE_TAIL { size 4 @@ -1341,12 +1438,14 @@ scratch_ram { */ MWI_RESIDUAL { size 1 + dont_generate_debug_code } /* * SCBID of the next SCB to be started by the controller. */ NEXT_QUEUED_SCB { size 1 + dont_generate_debug_code } /* * Single byte buffer used to designate the type or message @@ -1354,6 +1453,7 @@ scratch_ram { */ MSG_OUT { size 1 + dont_generate_debug_code } /* Parameters for DMA Logic */ DMAPARAMS { @@ -1369,6 +1469,7 @@ scratch_ram { field DIRECTION 0x04 /* Set indicates PCI->SCSI */ field FIFOFLUSH 0x02 field FIFORESET 0x01 + dont_generate_debug_code } SEQ_FLAGS { size 1 @@ -1390,9 +1491,11 @@ scratch_ram { */ SAVED_SCSIID { size 1 + dont_generate_debug_code } SAVED_LUN { size 1 + dont_generate_debug_code } /* * The last bus phase as seen by the sequencer. @@ -1417,6 +1520,7 @@ scratch_ram { */ WAITING_SCBH { size 1 + dont_generate_debug_code } /* * head of list of SCBs that are @@ -1425,6 +1529,7 @@ scratch_ram { */ DISCONNECTED_SCBH { size 1 + dont_generate_debug_code } /* * head of list of SCBs that are @@ -1432,6 +1537,7 @@ scratch_ram { */ FREE_SCBH { size 1 + dont_generate_debug_code } /* * head of list of SCBs that have @@ -1446,6 +1552,7 @@ scratch_ram { */ HSCB_ADDR { size 4 + dont_generate_debug_code } /* * Base address of our shared data with the kernel driver in host @@ -1454,15 +1561,19 @@ scratch_ram { */ SHARED_DATA_ADDR { size 4 + dont_generate_debug_code } KERNEL_QINPOS { size 1 + dont_generate_debug_code } QINPOS { size 1 + dont_generate_debug_code } QOUTPOS { size 1 + dont_generate_debug_code } /* * Kernel and sequencer offsets into the queue of @@ -1471,9 +1582,11 @@ scratch_ram { */ KERNEL_TQINPOS { size 1 + dont_generate_debug_code } TQINPOS { size 1 + dont_generate_debug_code } ARG_1 { size 1 @@ -1486,10 +1599,12 @@ scratch_ram { mask CONT_MSG_LOOP 0x04 mask CONT_TARG_SESSION 0x02 alias RETURN_1 + dont_generate_debug_code } ARG_2 { size 1 alias RETURN_2 + dont_generate_debug_code } /* @@ -1498,6 +1613,7 @@ scratch_ram { LAST_MSG { size 1 alias TARG_IMMEDIATE_SCB + dont_generate_debug_code } /* @@ -1513,6 +1629,7 @@ scratch_ram { field ENAUTOATNO 0x08 field ENAUTOATNI 0x04 field ENAUTOATNP 0x02 + dont_generate_debug_code } } @@ -1533,12 +1650,14 @@ scratch_ram { field HA_274_EXTENDED_TRANS 0x01 alias INITIATOR_TAG count 1 + dont_generate_debug_code } SEQ_FLAGS2 { size 1 field SCB_DMA 0x01 field TARGET_MSG_PENDING 0x02 + dont_generate_debug_code } } @@ -1562,6 +1681,7 @@ scratch_ram { field ENSPCHK 0x20 mask HSCSIID 0x07 /* our SCSI ID */ mask HWSCSIID 0x0f /* our SCSI ID if Wide Bus */ + dont_generate_debug_code } INTDEF { address 0x05c @@ -1569,11 +1689,13 @@ scratch_ram { count 1 field EDGE_TRIG 0x80 mask VECTOR 0x0f + dont_generate_debug_code } HOSTCONF { address 0x05d size 1 count 1 + dont_generate_debug_code } HA_274_BIOSCTRL { address 0x05f @@ -1582,6 +1704,7 @@ scratch_ram { mask BIOSMODE 0x30 mask BIOSDISABLED 0x30 field CHANNEL_B_PRIMARY 0x08 + dont_generate_debug_code } } @@ -1595,6 +1718,7 @@ scratch_ram { TARG_OFFSET { size 16 count 1 + dont_generate_debug_code } } diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index 0ae2b46..e6f2bb7 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c @@ -814,6 +814,7 @@ ahc_intr(struct ahc_softc *ahc) static void ahc_restart(struct ahc_softc *ahc) { + uint8_t sblkctl; ahc_pause(ahc); @@ -868,6 +869,12 @@ ahc_restart(struct ahc_softc *ahc) ahc_outb(ahc, SEQADDR0, 0); ahc_outb(ahc, SEQADDR1, 0); + /* + * Take the LED out of diagnostic mode on PM resume, too + */ + sblkctl = ahc_inb(ahc, SBLKCTL); + ahc_outb(ahc, SBLKCTL, (sblkctl & ~(DIAGLEDEN|DIAGLEDON))); + ahc_unpause(ahc); } diff --git a/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped b/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped index 2ce1feb..e821082 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped +++ b/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped @@ -27,20 +27,6 @@ ahc_reg_print_t ahc_sxfrctl0_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_sxfrctl1_print; -#else -#define ahc_sxfrctl1_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SXFRCTL1", 0x02, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scsisigo_print; -#else -#define ahc_scsisigo_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCSISIGO", 0x03, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_scsisigi_print; #else #define ahc_scsisigi_print(regvalue, cur_col, wrap) \ @@ -55,55 +41,6 @@ ahc_reg_print_t ahc_scsirate_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scsiid_print; -#else -#define ahc_scsiid_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCSIID", 0x05, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scsidatl_print; -#else -#define ahc_scsidatl_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCSIDATL", 0x06, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scsidath_print; -#else -#define ahc_scsidath_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCSIDATH", 0x07, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_stcnt_print; -#else -#define ahc_stcnt_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "STCNT", 0x08, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_optionmode_print; -#else -#define ahc_optionmode_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "OPTIONMODE", 0x08, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_targcrccnt_print; -#else -#define ahc_targcrccnt_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "TARGCRCCNT", 0x0a, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_clrsint0_print; -#else -#define ahc_clrsint0_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CLRSINT0", 0x0b, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_sstat0_print; #else #define ahc_sstat0_print(regvalue, cur_col, wrap) \ @@ -111,13 +48,6 @@ ahc_reg_print_t ahc_sstat0_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_clrsint1_print; -#else -#define ahc_clrsint1_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CLRSINT1", 0x0c, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_sstat1_print; #else #define ahc_sstat1_print(regvalue, cur_col, wrap) \ @@ -139,13 +69,6 @@ ahc_reg_print_t ahc_sstat3_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scsiid_ultra2_print; -#else -#define ahc_scsiid_ultra2_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCSIID_ULTRA2", 0x0f, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_simode0_print; #else #define ahc_simode0_print(regvalue, cur_col, wrap) \ @@ -167,76 +90,6 @@ ahc_reg_print_t ahc_scsibusl_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scsibush_print; -#else -#define ahc_scsibush_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCSIBUSH", 0x13, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_sxfrctl2_print; -#else -#define ahc_sxfrctl2_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SXFRCTL2", 0x13, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_shaddr_print; -#else -#define ahc_shaddr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SHADDR", 0x14, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_seltimer_print; -#else -#define ahc_seltimer_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SELTIMER", 0x18, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_selid_print; -#else -#define ahc_selid_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SELID", 0x19, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scamctl_print; -#else -#define ahc_scamctl_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCAMCTL", 0x1a, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_targid_print; -#else -#define ahc_targid_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "TARGID", 0x1b, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_spiocap_print; -#else -#define ahc_spiocap_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SPIOCAP", 0x1b, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_brdctl_print; -#else -#define ahc_brdctl_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "BRDCTL", 0x1d, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_seectl_print; -#else -#define ahc_seectl_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SEECTL", 0x1e, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_sblkctl_print; #else #define ahc_sblkctl_print(regvalue, cur_col, wrap) \ @@ -244,62 +97,6 @@ ahc_reg_print_t ahc_sblkctl_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_busy_targets_print; -#else -#define ahc_busy_targets_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "BUSY_TARGETS", 0x20, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_ultra_enb_print; -#else -#define ahc_ultra_enb_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "ULTRA_ENB", 0x30, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_disc_dsb_print; -#else -#define ahc_disc_dsb_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "DISC_DSB", 0x32, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_cmdsize_table_tail_print; -#else -#define ahc_cmdsize_table_tail_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CMDSIZE_TABLE_TAIL", 0x34, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_mwi_residual_print; -#else -#define ahc_mwi_residual_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "MWI_RESIDUAL", 0x38, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_next_queued_scb_print; -#else -#define ahc_next_queued_scb_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "NEXT_QUEUED_SCB", 0x39, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_msg_out_print; -#else -#define ahc_msg_out_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "MSG_OUT", 0x3a, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_dmaparams_print; -#else -#define ahc_dmaparams_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "DMAPARAMS", 0x3b, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_seq_flags_print; #else #define ahc_seq_flags_print(regvalue, cur_col, wrap) \ @@ -307,20 +104,6 @@ ahc_reg_print_t ahc_seq_flags_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_saved_scsiid_print; -#else -#define ahc_saved_scsiid_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SAVED_SCSIID", 0x3d, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_saved_lun_print; -#else -#define ahc_saved_lun_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SAVED_LUN", 0x3e, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_lastphase_print; #else #define ahc_lastphase_print(regvalue, cur_col, wrap) \ @@ -328,153 +111,6 @@ ahc_reg_print_t ahc_lastphase_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_waiting_scbh_print; -#else -#define ahc_waiting_scbh_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "WAITING_SCBH", 0x40, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_disconnected_scbh_print; -#else -#define ahc_disconnected_scbh_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "DISCONNECTED_SCBH", 0x41, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_free_scbh_print; -#else -#define ahc_free_scbh_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "FREE_SCBH", 0x42, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_complete_scbh_print; -#else -#define ahc_complete_scbh_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "COMPLETE_SCBH", 0x43, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_hscb_addr_print; -#else -#define ahc_hscb_addr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "HSCB_ADDR", 0x44, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_shared_data_addr_print; -#else -#define ahc_shared_data_addr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SHARED_DATA_ADDR", 0x48, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_kernel_qinpos_print; -#else -#define ahc_kernel_qinpos_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "KERNEL_QINPOS", 0x4c, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_qinpos_print; -#else -#define ahc_qinpos_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "QINPOS", 0x4d, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_qoutpos_print; -#else -#define ahc_qoutpos_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "QOUTPOS", 0x4e, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_kernel_tqinpos_print; -#else -#define ahc_kernel_tqinpos_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "KERNEL_TQINPOS", 0x4f, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_tqinpos_print; -#else -#define ahc_tqinpos_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "TQINPOS", 0x50, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_arg_1_print; -#else -#define ahc_arg_1_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "ARG_1", 0x51, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_arg_2_print; -#else -#define ahc_arg_2_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "ARG_2", 0x52, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_last_msg_print; -#else -#define ahc_last_msg_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "LAST_MSG", 0x53, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scsiseq_template_print; -#else -#define ahc_scsiseq_template_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCSISEQ_TEMPLATE", 0x54, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_ha_274_biosglobal_print; -#else -#define ahc_ha_274_biosglobal_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "HA_274_BIOSGLOBAL", 0x56, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_seq_flags2_print; -#else -#define ahc_seq_flags2_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SEQ_FLAGS2", 0x57, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scsiconf_print; -#else -#define ahc_scsiconf_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCSICONF", 0x5a, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_intdef_print; -#else -#define ahc_intdef_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "INTDEF", 0x5c, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_hostconf_print; -#else -#define ahc_hostconf_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "HOSTCONF", 0x5d, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_ha_274_biosctrl_print; -#else -#define ahc_ha_274_biosctrl_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "HA_274_BIOSCTRL", 0x5f, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_seqctl_print; #else #define ahc_seqctl_print(regvalue, cur_col, wrap) \ @@ -482,111 +118,6 @@ ahc_reg_print_t ahc_seqctl_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_seqram_print; -#else -#define ahc_seqram_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SEQRAM", 0x61, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_seqaddr0_print; -#else -#define ahc_seqaddr0_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SEQADDR0", 0x62, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_seqaddr1_print; -#else -#define ahc_seqaddr1_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SEQADDR1", 0x63, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_accum_print; -#else -#define ahc_accum_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "ACCUM", 0x64, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_sindex_print; -#else -#define ahc_sindex_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SINDEX", 0x65, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_dindex_print; -#else -#define ahc_dindex_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "DINDEX", 0x66, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_allones_print; -#else -#define ahc_allones_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "ALLONES", 0x69, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_allzeros_print; -#else -#define ahc_allzeros_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "ALLZEROS", 0x6a, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_none_print; -#else -#define ahc_none_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "NONE", 0x6a, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_flags_print; -#else -#define ahc_flags_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "FLAGS", 0x6b, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_sindir_print; -#else -#define ahc_sindir_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SINDIR", 0x6c, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_dindir_print; -#else -#define ahc_dindir_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "DINDIR", 0x6d, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_function1_print; -#else -#define ahc_function1_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "FUNCTION1", 0x6e, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_stack_print; -#else -#define ahc_stack_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "STACK", 0x6f, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_targ_offset_print; -#else -#define ahc_targ_offset_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "TARG_OFFSET", 0x70, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_sram_base_print; #else #define ahc_sram_base_print(regvalue, cur_col, wrap) \ @@ -594,97 +125,6 @@ ahc_reg_print_t ahc_sram_base_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_bctl_print; -#else -#define ahc_bctl_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "BCTL", 0x84, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_dscommand0_print; -#else -#define ahc_dscommand0_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "DSCOMMAND0", 0x84, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_bustime_print; -#else -#define ahc_bustime_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "BUSTIME", 0x85, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_dscommand1_print; -#else -#define ahc_dscommand1_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "DSCOMMAND1", 0x85, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_busspd_print; -#else -#define ahc_busspd_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "BUSSPD", 0x86, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_hs_mailbox_print; -#else -#define ahc_hs_mailbox_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "HS_MAILBOX", 0x86, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_dspcistatus_print; -#else -#define ahc_dspcistatus_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "DSPCISTATUS", 0x86, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_hcntrl_print; -#else -#define ahc_hcntrl_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "HCNTRL", 0x87, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_haddr_print; -#else -#define ahc_haddr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "HADDR", 0x88, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_hcnt_print; -#else -#define ahc_hcnt_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "HCNT", 0x8c, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scbptr_print; -#else -#define ahc_scbptr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCBPTR", 0x90, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_intstat_print; -#else -#define ahc_intstat_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "INTSTAT", 0x91, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_clrint_print; -#else -#define ahc_clrint_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CLRINT", 0x92, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_error_print; #else #define ahc_error_print(regvalue, cur_col, wrap) \ @@ -706,69 +146,6 @@ ahc_reg_print_t ahc_dfstatus_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_dfwaddr_print; -#else -#define ahc_dfwaddr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "DFWADDR", 0x95, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_dfraddr_print; -#else -#define ahc_dfraddr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "DFRADDR", 0x97, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_dfdat_print; -#else -#define ahc_dfdat_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "DFDAT", 0x99, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scbcnt_print; -#else -#define ahc_scbcnt_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCBCNT", 0x9a, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_qinfifo_print; -#else -#define ahc_qinfifo_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "QINFIFO", 0x9b, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_qincnt_print; -#else -#define ahc_qincnt_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "QINCNT", 0x9c, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_qoutfifo_print; -#else -#define ahc_qoutfifo_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "QOUTFIFO", 0x9d, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_crccontrol1_print; -#else -#define ahc_crccontrol1_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CRCCONTROL1", 0x9d, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_qoutcnt_print; -#else -#define ahc_qoutcnt_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "QOUTCNT", 0x9e, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_scsiphase_print; #else #define ahc_scsiphase_print(regvalue, cur_col, wrap) \ @@ -776,13 +153,6 @@ ahc_reg_print_t ahc_scsiphase_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_sfunct_print; -#else -#define ahc_sfunct_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SFUNCT", 0x9f, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_scb_base_print; #else #define ahc_scb_base_print(regvalue, cur_col, wrap) \ @@ -790,69 +160,6 @@ ahc_reg_print_t ahc_scb_base_print; #endif #if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_cdb_ptr_print; -#else -#define ahc_scb_cdb_ptr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_CDB_PTR", 0xa0, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_residual_sgptr_print; -#else -#define ahc_scb_residual_sgptr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_RESIDUAL_SGPTR", 0xa4, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_scsi_status_print; -#else -#define ahc_scb_scsi_status_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_SCSI_STATUS", 0xa8, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_target_phases_print; -#else -#define ahc_scb_target_phases_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_TARGET_PHASES", 0xa9, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_target_data_dir_print; -#else -#define ahc_scb_target_data_dir_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_TARGET_DATA_DIR", 0xaa, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_target_itag_print; -#else -#define ahc_scb_target_itag_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_TARGET_ITAG", 0xab, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_dataptr_print; -#else -#define ahc_scb_dataptr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_DATAPTR", 0xac, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_datacnt_print; -#else -#define ahc_scb_datacnt_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_DATACNT", 0xb0, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_sgptr_print; -#else -#define ahc_scb_sgptr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_SGPTR", 0xb4, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahc_reg_print_t ahc_scb_control_print; #else #define ahc_scb_control_print(regvalue, cur_col, wrap) \ @@ -880,188 +187,6 @@ ahc_reg_print_t ahc_scb_tag_print; ahc_print_register(NULL, 0, "SCB_TAG", 0xbb, regvalue, cur_col, wrap) #endif -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_cdb_len_print; -#else -#define ahc_scb_cdb_len_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_CDB_LEN", 0xbc, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_scsirate_print; -#else -#define ahc_scb_scsirate_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_SCSIRATE", 0xbd, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_scsioffset_print; -#else -#define ahc_scb_scsioffset_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_SCSIOFFSET", 0xbe, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_next_print; -#else -#define ahc_scb_next_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_NEXT", 0xbf, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_64_spare_print; -#else -#define ahc_scb_64_spare_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_64_SPARE", 0xc0, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_seectl_2840_print; -#else -#define ahc_seectl_2840_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SEECTL_2840", 0xc0, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_status_2840_print; -#else -#define ahc_status_2840_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "STATUS_2840", 0xc1, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scb_64_btt_print; -#else -#define ahc_scb_64_btt_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCB_64_BTT", 0xd0, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_cchaddr_print; -#else -#define ahc_cchaddr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CCHADDR", 0xe0, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_cchcnt_print; -#else -#define ahc_cchcnt_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CCHCNT", 0xe8, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_ccsgram_print; -#else -#define ahc_ccsgram_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CCSGRAM", 0xe9, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_ccsgaddr_print; -#else -#define ahc_ccsgaddr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CCSGADDR", 0xea, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_ccsgctl_print; -#else -#define ahc_ccsgctl_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CCSGCTL", 0xeb, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_ccscbram_print; -#else -#define ahc_ccscbram_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CCSCBRAM", 0xec, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_ccscbaddr_print; -#else -#define ahc_ccscbaddr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CCSCBADDR", 0xed, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_ccscbctl_print; -#else -#define ahc_ccscbctl_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CCSCBCTL", 0xee, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_ccscbcnt_print; -#else -#define ahc_ccscbcnt_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CCSCBCNT", 0xef, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_scbbaddr_print; -#else -#define ahc_scbbaddr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SCBBADDR", 0xf0, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_ccscbptr_print; -#else -#define ahc_ccscbptr_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "CCSCBPTR", 0xf1, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_hnscb_qoff_print; -#else -#define ahc_hnscb_qoff_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "HNSCB_QOFF", 0xf4, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_snscb_qoff_print; -#else -#define ahc_snscb_qoff_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SNSCB_QOFF", 0xf6, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_sdscb_qoff_print; -#else -#define ahc_sdscb_qoff_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SDSCB_QOFF", 0xf8, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_qoff_ctlsta_print; -#else -#define ahc_qoff_ctlsta_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "QOFF_CTLSTA", 0xfa, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_dff_thrsh_print; -#else -#define ahc_dff_thrsh_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "DFF_THRSH", 0xfb, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_sg_cache_shadow_print; -#else -#define ahc_sg_cache_shadow_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SG_CACHE_SHADOW", 0xfc, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahc_reg_print_t ahc_sg_cache_pre_print; -#else -#define ahc_sg_cache_pre_print(regvalue, cur_col, wrap) \ - ahc_print_register(NULL, 0, "SG_CACHE_PRE", 0xfc, regvalue, cur_col, wrap) -#endif - #define SCSISEQ 0x00 #define TEMODE 0x80 diff --git a/drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped b/drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped index 309a562..9f9b880 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped +++ b/drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped @@ -43,48 +43,6 @@ ahc_sxfrctl0_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x01, regvalue, cur_col, wrap)); } -static const ahc_reg_parse_entry_t SXFRCTL1_parse_table[] = { - { "STPWEN", 0x01, 0x01 }, - { "ACTNEGEN", 0x02, 0x02 }, - { "ENSTIMER", 0x04, 0x04 }, - { "ENSPCHK", 0x20, 0x20 }, - { "SWRAPEN", 0x40, 0x40 }, - { "BITBUCKET", 0x80, 0x80 }, - { "STIMESEL", 0x18, 0x18 } -}; - -int -ahc_sxfrctl1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SXFRCTL1_parse_table, 7, "SXFRCTL1", - 0x02, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SCSISIGO_parse_table[] = { - { "ACKO", 0x01, 0x01 }, - { "REQO", 0x02, 0x02 }, - { "BSYO", 0x04, 0x04 }, - { "SELO", 0x08, 0x08 }, - { "ATNO", 0x10, 0x10 }, - { "MSGO", 0x20, 0x20 }, - { "IOO", 0x40, 0x40 }, - { "CDO", 0x80, 0x80 }, - { "P_DATAOUT", 0x00, 0x00 }, - { "P_DATAIN", 0x40, 0x40 }, - { "P_COMMAND", 0x80, 0x80 }, - { "P_MESGOUT", 0xa0, 0xa0 }, - { "P_STATUS", 0xc0, 0xc0 }, - { "PHASE_MASK", 0xe0, 0xe0 }, - { "P_MESGIN", 0xe0, 0xe0 } -}; - -int -ahc_scsisigo_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SCSISIGO_parse_table, 15, "SCSISIGO", - 0x03, regvalue, cur_col, wrap)); -} - static const ahc_reg_parse_entry_t SCSISIGI_parse_table[] = { { "ACKI", 0x01, 0x01 }, { "REQI", 0x02, 0x02 }, @@ -128,77 +86,6 @@ ahc_scsirate_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x04, regvalue, cur_col, wrap)); } -static const ahc_reg_parse_entry_t SCSIID_parse_table[] = { - { "TWIN_CHNLB", 0x80, 0x80 }, - { "OID", 0x0f, 0x0f }, - { "TWIN_TID", 0x70, 0x70 }, - { "SOFS_ULTRA2", 0x7f, 0x7f }, - { "TID", 0xf0, 0xf0 } -}; - -int -ahc_scsiid_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SCSIID_parse_table, 5, "SCSIID", - 0x05, regvalue, cur_col, wrap)); -} - -int -ahc_scsidatl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCSIDATL", - 0x06, regvalue, cur_col, wrap)); -} - -int -ahc_stcnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "STCNT", - 0x08, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t OPTIONMODE_parse_table[] = { - { "DIS_MSGIN_DUALEDGE", 0x01, 0x01 }, - { "AUTO_MSGOUT_DE", 0x02, 0x02 }, - { "SCSIDATL_IMGEN", 0x04, 0x04 }, - { "EXPPHASEDIS", 0x08, 0x08 }, - { "BUSFREEREV", 0x10, 0x10 }, - { "ATNMGMNTEN", 0x20, 0x20 }, - { "AUTOACKEN", 0x40, 0x40 }, - { "AUTORATEEN", 0x80, 0x80 }, - { "OPTIONMODE_DEFAULTS",0x03, 0x03 } -}; - -int -ahc_optionmode_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(OPTIONMODE_parse_table, 9, "OPTIONMODE", - 0x08, regvalue, cur_col, wrap)); -} - -int -ahc_targcrccnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "TARGCRCCNT", - 0x0a, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t CLRSINT0_parse_table[] = { - { "CLRSPIORDY", 0x02, 0x02 }, - { "CLRSWRAP", 0x08, 0x08 }, - { "CLRIOERR", 0x08, 0x08 }, - { "CLRSELINGO", 0x10, 0x10 }, - { "CLRSELDI", 0x20, 0x20 }, - { "CLRSELDO", 0x40, 0x40 } -}; - -int -ahc_clrsint0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(CLRSINT0_parse_table, 6, "CLRSINT0", - 0x0b, regvalue, cur_col, wrap)); -} - static const ahc_reg_parse_entry_t SSTAT0_parse_table[] = { { "DMADONE", 0x01, 0x01 }, { "SPIORDY", 0x02, 0x02 }, @@ -218,23 +105,6 @@ ahc_sstat0_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x0b, regvalue, cur_col, wrap)); } -static const ahc_reg_parse_entry_t CLRSINT1_parse_table[] = { - { "CLRREQINIT", 0x01, 0x01 }, - { "CLRPHASECHG", 0x02, 0x02 }, - { "CLRSCSIPERR", 0x04, 0x04 }, - { "CLRBUSFREE", 0x08, 0x08 }, - { "CLRSCSIRSTI", 0x20, 0x20 }, - { "CLRATNO", 0x40, 0x40 }, - { "CLRSELTIMEO", 0x80, 0x80 } -}; - -int -ahc_clrsint1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(CLRSINT1_parse_table, 7, "CLRSINT1", - 0x0c, regvalue, cur_col, wrap)); -} - static const ahc_reg_parse_entry_t SSTAT1_parse_table[] = { { "REQINIT", 0x01, 0x01 }, { "PHASECHG", 0x02, 0x02 }, @@ -284,18 +154,6 @@ ahc_sstat3_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x0e, regvalue, cur_col, wrap)); } -static const ahc_reg_parse_entry_t SCSIID_ULTRA2_parse_table[] = { - { "OID", 0x0f, 0x0f }, - { "TID", 0xf0, 0xf0 } -}; - -int -ahc_scsiid_ultra2_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SCSIID_ULTRA2_parse_table, 2, "SCSIID_ULTRA2", - 0x0f, regvalue, cur_col, wrap)); -} - static const ahc_reg_parse_entry_t SIMODE0_parse_table[] = { { "ENDMADONE", 0x01, 0x01 }, { "ENSPIORDY", 0x02, 0x02 }, @@ -339,107 +197,6 @@ ahc_scsibusl_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x12, regvalue, cur_col, wrap)); } -int -ahc_shaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SHADDR", - 0x14, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SELTIMER_parse_table[] = { - { "STAGE1", 0x01, 0x01 }, - { "STAGE2", 0x02, 0x02 }, - { "STAGE3", 0x04, 0x04 }, - { "STAGE4", 0x08, 0x08 }, - { "STAGE5", 0x10, 0x10 }, - { "STAGE6", 0x20, 0x20 } -}; - -int -ahc_seltimer_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SELTIMER_parse_table, 6, "SELTIMER", - 0x18, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SELID_parse_table[] = { - { "ONEBIT", 0x08, 0x08 }, - { "SELID_MASK", 0xf0, 0xf0 } -}; - -int -ahc_selid_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SELID_parse_table, 2, "SELID", - 0x19, regvalue, cur_col, wrap)); -} - -int -ahc_targid_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "TARGID", - 0x1b, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SPIOCAP_parse_table[] = { - { "SSPIOCPS", 0x01, 0x01 }, - { "ROM", 0x02, 0x02 }, - { "EEPROM", 0x04, 0x04 }, - { "SEEPROM", 0x08, 0x08 }, - { "EXT_BRDCTL", 0x10, 0x10 }, - { "SOFTCMDEN", 0x20, 0x20 }, - { "SOFT0", 0x40, 0x40 }, - { "SOFT1", 0x80, 0x80 } -}; - -int -ahc_spiocap_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SPIOCAP_parse_table, 8, "SPIOCAP", - 0x1b, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t BRDCTL_parse_table[] = { - { "BRDCTL0", 0x01, 0x01 }, - { "BRDSTB_ULTRA2", 0x01, 0x01 }, - { "BRDCTL1", 0x02, 0x02 }, - { "BRDRW_ULTRA2", 0x02, 0x02 }, - { "BRDRW", 0x04, 0x04 }, - { "BRDDAT2", 0x04, 0x04 }, - { "BRDCS", 0x08, 0x08 }, - { "BRDDAT3", 0x08, 0x08 }, - { "BRDSTB", 0x10, 0x10 }, - { "BRDDAT4", 0x10, 0x10 }, - { "BRDDAT5", 0x20, 0x20 }, - { "BRDDAT6", 0x40, 0x40 }, - { "BRDDAT7", 0x80, 0x80 } -}; - -int -ahc_brdctl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(BRDCTL_parse_table, 13, "BRDCTL", - 0x1d, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SEECTL_parse_table[] = { - { "SEEDI", 0x01, 0x01 }, - { "SEEDO", 0x02, 0x02 }, - { "SEECK", 0x04, 0x04 }, - { "SEECS", 0x08, 0x08 }, - { "SEERDY", 0x10, 0x10 }, - { "SEEMS", 0x20, 0x20 }, - { "EXTARBREQ", 0x40, 0x40 }, - { "EXTARBACK", 0x80, 0x80 } -}; - -int -ahc_seectl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SEECTL_parse_table, 8, "SEECTL", - 0x1e, regvalue, cur_col, wrap)); -} - static const ahc_reg_parse_entry_t SBLKCTL_parse_table[] = { { "XCVR", 0x01, 0x01 }, { "SELWIDE", 0x02, 0x02 }, @@ -458,68 +215,6 @@ ahc_sblkctl_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x1f, regvalue, cur_col, wrap)); } -int -ahc_busy_targets_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "BUSY_TARGETS", - 0x20, regvalue, cur_col, wrap)); -} - -int -ahc_ultra_enb_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "ULTRA_ENB", - 0x30, regvalue, cur_col, wrap)); -} - -int -ahc_disc_dsb_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "DISC_DSB", - 0x32, regvalue, cur_col, wrap)); -} - -int -ahc_mwi_residual_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "MWI_RESIDUAL", - 0x38, regvalue, cur_col, wrap)); -} - -int -ahc_next_queued_scb_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "NEXT_QUEUED_SCB", - 0x39, regvalue, cur_col, wrap)); -} - -int -ahc_msg_out_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "MSG_OUT", - 0x3a, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t DMAPARAMS_parse_table[] = { - { "FIFORESET", 0x01, 0x01 }, - { "FIFOFLUSH", 0x02, 0x02 }, - { "DIRECTION", 0x04, 0x04 }, - { "HDMAEN", 0x08, 0x08 }, - { "HDMAENACK", 0x08, 0x08 }, - { "SDMAEN", 0x10, 0x10 }, - { "SDMAENACK", 0x10, 0x10 }, - { "SCSIEN", 0x20, 0x20 }, - { "WIDEODD", 0x40, 0x40 }, - { "PRELOADEN", 0x80, 0x80 } -}; - -int -ahc_dmaparams_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(DMAPARAMS_parse_table, 10, "DMAPARAMS", - 0x3b, regvalue, cur_col, wrap)); -} - static const ahc_reg_parse_entry_t SEQ_FLAGS_parse_table[] = { { "NO_DISCONNECT", 0x01, 0x01 }, { "SPHASE_PENDING", 0x02, 0x02 }, @@ -539,20 +234,6 @@ ahc_seq_flags_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x3c, regvalue, cur_col, wrap)); } -int -ahc_saved_scsiid_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SAVED_SCSIID", - 0x3d, regvalue, cur_col, wrap)); -} - -int -ahc_saved_lun_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SAVED_LUN", - 0x3e, regvalue, cur_col, wrap)); -} - static const ahc_reg_parse_entry_t LASTPHASE_parse_table[] = { { "MSGI", 0x20, 0x20 }, { "IOI", 0x40, 0x40 }, @@ -574,193 +255,6 @@ ahc_lastphase_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x3f, regvalue, cur_col, wrap)); } -int -ahc_waiting_scbh_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "WAITING_SCBH", - 0x40, regvalue, cur_col, wrap)); -} - -int -ahc_disconnected_scbh_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "DISCONNECTED_SCBH", - 0x41, regvalue, cur_col, wrap)); -} - -int -ahc_free_scbh_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "FREE_SCBH", - 0x42, regvalue, cur_col, wrap)); -} - -int -ahc_hscb_addr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "HSCB_ADDR", - 0x44, regvalue, cur_col, wrap)); -} - -int -ahc_shared_data_addr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SHARED_DATA_ADDR", - 0x48, regvalue, cur_col, wrap)); -} - -int -ahc_kernel_qinpos_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "KERNEL_QINPOS", - 0x4c, regvalue, cur_col, wrap)); -} - -int -ahc_qinpos_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "QINPOS", - 0x4d, regvalue, cur_col, wrap)); -} - -int -ahc_qoutpos_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "QOUTPOS", - 0x4e, regvalue, cur_col, wrap)); -} - -int -ahc_kernel_tqinpos_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "KERNEL_TQINPOS", - 0x4f, regvalue, cur_col, wrap)); -} - -int -ahc_tqinpos_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "TQINPOS", - 0x50, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t ARG_1_parse_table[] = { - { "CONT_TARG_SESSION", 0x02, 0x02 }, - { "CONT_MSG_LOOP", 0x04, 0x04 }, - { "EXIT_MSG_LOOP", 0x08, 0x08 }, - { "MSGOUT_PHASEMIS", 0x10, 0x10 }, - { "SEND_REJ", 0x20, 0x20 }, - { "SEND_SENSE", 0x40, 0x40 }, - { "SEND_MSG", 0x80, 0x80 } -}; - -int -ahc_arg_1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(ARG_1_parse_table, 7, "ARG_1", - 0x51, regvalue, cur_col, wrap)); -} - -int -ahc_arg_2_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "ARG_2", - 0x52, regvalue, cur_col, wrap)); -} - -int -ahc_last_msg_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "LAST_MSG", - 0x53, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SCSISEQ_TEMPLATE_parse_table[] = { - { "ENAUTOATNP", 0x02, 0x02 }, - { "ENAUTOATNI", 0x04, 0x04 }, - { "ENAUTOATNO", 0x08, 0x08 }, - { "ENRSELI", 0x10, 0x10 }, - { "ENSELI", 0x20, 0x20 }, - { "ENSELO", 0x40, 0x40 } -}; - -int -ahc_scsiseq_template_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SCSISEQ_TEMPLATE_parse_table, 6, "SCSISEQ_TEMPLATE", - 0x54, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t HA_274_BIOSGLOBAL_parse_table[] = { - { "HA_274_EXTENDED_TRANS",0x01, 0x01 } -}; - -int -ahc_ha_274_biosglobal_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(HA_274_BIOSGLOBAL_parse_table, 1, "HA_274_BIOSGLOBAL", - 0x56, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SEQ_FLAGS2_parse_table[] = { - { "SCB_DMA", 0x01, 0x01 }, - { "TARGET_MSG_PENDING", 0x02, 0x02 } -}; - -int -ahc_seq_flags2_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SEQ_FLAGS2_parse_table, 2, "SEQ_FLAGS2", - 0x57, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SCSICONF_parse_table[] = { - { "ENSPCHK", 0x20, 0x20 }, - { "RESET_SCSI", 0x40, 0x40 }, - { "TERM_ENB", 0x80, 0x80 }, - { "HSCSIID", 0x07, 0x07 }, - { "HWSCSIID", 0x0f, 0x0f } -}; - -int -ahc_scsiconf_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SCSICONF_parse_table, 5, "SCSICONF", - 0x5a, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t INTDEF_parse_table[] = { - { "EDGE_TRIG", 0x80, 0x80 }, - { "VECTOR", 0x0f, 0x0f } -}; - -int -ahc_intdef_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(INTDEF_parse_table, 2, "INTDEF", - 0x5c, regvalue, cur_col, wrap)); -} - -int -ahc_hostconf_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "HOSTCONF", - 0x5d, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t HA_274_BIOSCTRL_parse_table[] = { - { "CHANNEL_B_PRIMARY", 0x08, 0x08 }, - { "BIOSMODE", 0x30, 0x30 }, - { "BIOSDISABLED", 0x30, 0x30 } -}; - -int -ahc_ha_274_biosctrl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(HA_274_BIOSCTRL_parse_table, 3, "HA_274_BIOSCTRL", - 0x5f, regvalue, cur_col, wrap)); -} - static const ahc_reg_parse_entry_t SEQCTL_parse_table[] = { { "LOADRAM", 0x01, 0x01 }, { "SEQRESET", 0x02, 0x02 }, @@ -780,285 +274,12 @@ ahc_seqctl_print(u_int regvalue, u_int *cur_col, u_int wrap) } int -ahc_seqram_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SEQRAM", - 0x61, regvalue, cur_col, wrap)); -} - -int -ahc_seqaddr0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SEQADDR0", - 0x62, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SEQADDR1_parse_table[] = { - { "SEQADDR1_MASK", 0x01, 0x01 } -}; - -int -ahc_seqaddr1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SEQADDR1_parse_table, 1, "SEQADDR1", - 0x63, regvalue, cur_col, wrap)); -} - -int -ahc_accum_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "ACCUM", - 0x64, regvalue, cur_col, wrap)); -} - -int -ahc_sindex_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SINDEX", - 0x65, regvalue, cur_col, wrap)); -} - -int -ahc_dindex_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "DINDEX", - 0x66, regvalue, cur_col, wrap)); -} - -int -ahc_allones_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "ALLONES", - 0x69, regvalue, cur_col, wrap)); -} - -int -ahc_allzeros_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "ALLZEROS", - 0x6a, regvalue, cur_col, wrap)); -} - -int -ahc_none_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "NONE", - 0x6a, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t FLAGS_parse_table[] = { - { "CARRY", 0x01, 0x01 }, - { "ZERO", 0x02, 0x02 } -}; - -int -ahc_flags_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(FLAGS_parse_table, 2, "FLAGS", - 0x6b, regvalue, cur_col, wrap)); -} - -int -ahc_sindir_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SINDIR", - 0x6c, regvalue, cur_col, wrap)); -} - -int -ahc_dindir_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "DINDIR", - 0x6d, regvalue, cur_col, wrap)); -} - -int -ahc_stack_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "STACK", - 0x6f, regvalue, cur_col, wrap)); -} - -int -ahc_targ_offset_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "TARG_OFFSET", - 0x70, regvalue, cur_col, wrap)); -} - -int ahc_sram_base_print(u_int regvalue, u_int *cur_col, u_int wrap) { return (ahc_print_register(NULL, 0, "SRAM_BASE", 0x70, regvalue, cur_col, wrap)); } -static const ahc_reg_parse_entry_t DSCOMMAND0_parse_table[] = { - { "CIOPARCKEN", 0x01, 0x01 }, - { "USCBSIZE32", 0x02, 0x02 }, - { "RAMPS", 0x04, 0x04 }, - { "INTSCBRAMSEL", 0x08, 0x08 }, - { "EXTREQLCK", 0x10, 0x10 }, - { "MPARCKEN", 0x20, 0x20 }, - { "DPARCKEN", 0x40, 0x40 }, - { "CACHETHEN", 0x80, 0x80 } -}; - -int -ahc_dscommand0_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(DSCOMMAND0_parse_table, 8, "DSCOMMAND0", - 0x84, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t BUSTIME_parse_table[] = { - { "BON", 0x0f, 0x0f }, - { "BOFF", 0xf0, 0xf0 } -}; - -int -ahc_bustime_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(BUSTIME_parse_table, 2, "BUSTIME", - 0x85, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t DSCOMMAND1_parse_table[] = { - { "HADDLDSEL0", 0x01, 0x01 }, - { "HADDLDSEL1", 0x02, 0x02 }, - { "DSLATT", 0xfc, 0xfc } -}; - -int -ahc_dscommand1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(DSCOMMAND1_parse_table, 3, "DSCOMMAND1", - 0x85, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t BUSSPD_parse_table[] = { - { "STBON", 0x07, 0x07 }, - { "STBOFF", 0x38, 0x38 }, - { "DFTHRSH_75", 0x80, 0x80 }, - { "DFTHRSH", 0xc0, 0xc0 }, - { "DFTHRSH_100", 0xc0, 0xc0 } -}; - -int -ahc_busspd_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(BUSSPD_parse_table, 5, "BUSSPD", - 0x86, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t HS_MAILBOX_parse_table[] = { - { "SEQ_MAILBOX", 0x0f, 0x0f }, - { "HOST_TQINPOS", 0x80, 0x80 }, - { "HOST_MAILBOX", 0xf0, 0xf0 } -}; - -int -ahc_hs_mailbox_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(HS_MAILBOX_parse_table, 3, "HS_MAILBOX", - 0x86, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t DSPCISTATUS_parse_table[] = { - { "DFTHRSH_100", 0xc0, 0xc0 } -}; - -int -ahc_dspcistatus_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(DSPCISTATUS_parse_table, 1, "DSPCISTATUS", - 0x86, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t HCNTRL_parse_table[] = { - { "CHIPRST", 0x01, 0x01 }, - { "CHIPRSTACK", 0x01, 0x01 }, - { "INTEN", 0x02, 0x02 }, - { "PAUSE", 0x04, 0x04 }, - { "IRQMS", 0x08, 0x08 }, - { "SWINT", 0x10, 0x10 }, - { "POWRDN", 0x40, 0x40 } -}; - -int -ahc_hcntrl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(HCNTRL_parse_table, 7, "HCNTRL", - 0x87, regvalue, cur_col, wrap)); -} - -int -ahc_haddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "HADDR", - 0x88, regvalue, cur_col, wrap)); -} - -int -ahc_hcnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "HCNT", - 0x8c, regvalue, cur_col, wrap)); -} - -int -ahc_scbptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCBPTR", - 0x90, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t INTSTAT_parse_table[] = { - { "SEQINT", 0x01, 0x01 }, - { "CMDCMPLT", 0x02, 0x02 }, - { "SCSIINT", 0x04, 0x04 }, - { "BRKADRINT", 0x08, 0x08 }, - { "BAD_PHASE", 0x01, 0x01 }, - { "INT_PEND", 0x0f, 0x0f }, - { "SEND_REJECT", 0x11, 0x11 }, - { "PROTO_VIOLATION", 0x21, 0x21 }, - { "NO_MATCH", 0x31, 0x31 }, - { "IGN_WIDE_RES", 0x41, 0x41 }, - { "PDATA_REINIT", 0x51, 0x51 }, - { "HOST_MSG_LOOP", 0x61, 0x61 }, - { "BAD_STATUS", 0x71, 0x71 }, - { "PERR_DETECTED", 0x81, 0x81 }, - { "DATA_OVERRUN", 0x91, 0x91 }, - { "MKMSG_FAILED", 0xa1, 0xa1 }, - { "MISSED_BUSFREE", 0xb1, 0xb1 }, - { "SCB_MISMATCH", 0xc1, 0xc1 }, - { "NO_FREE_SCB", 0xd1, 0xd1 }, - { "OUT_OF_RANGE", 0xe1, 0xe1 }, - { "SEQINT_MASK", 0xf1, 0xf1 } -}; - -int -ahc_intstat_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(INTSTAT_parse_table, 21, "INTSTAT", - 0x91, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t CLRINT_parse_table[] = { - { "CLRSEQINT", 0x01, 0x01 }, - { "CLRCMDINT", 0x02, 0x02 }, - { "CLRSCSIINT", 0x04, 0x04 }, - { "CLRBRKADRINT", 0x08, 0x08 }, - { "CLRPARERR", 0x10, 0x10 } -}; - -int -ahc_clrint_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(CLRINT_parse_table, 5, "CLRINT", - 0x92, regvalue, cur_col, wrap)); -} - static const ahc_reg_parse_entry_t ERROR_parse_table[] = { { "ILLHADDR", 0x01, 0x01 }, { "ILLSADDR", 0x02, 0x02 }, @@ -1115,62 +336,6 @@ ahc_dfstatus_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x94, regvalue, cur_col, wrap)); } -int -ahc_dfwaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "DFWADDR", - 0x95, regvalue, cur_col, wrap)); -} - -int -ahc_dfdat_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "DFDAT", - 0x99, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SCBCNT_parse_table[] = { - { "SCBAUTO", 0x80, 0x80 }, - { "SCBCNT_MASK", 0x1f, 0x1f } -}; - -int -ahc_scbcnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SCBCNT_parse_table, 2, "SCBCNT", - 0x9a, regvalue, cur_col, wrap)); -} - -int -ahc_qinfifo_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "QINFIFO", - 0x9b, regvalue, cur_col, wrap)); -} - -int -ahc_qoutfifo_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "QOUTFIFO", - 0x9d, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t CRCCONTROL1_parse_table[] = { - { "TARGCRCCNTEN", 0x04, 0x04 }, - { "TARGCRCENDEN", 0x08, 0x08 }, - { "CRCREQCHKEN", 0x10, 0x10 }, - { "CRCENDCHKEN", 0x20, 0x20 }, - { "CRCVALCHKEN", 0x40, 0x40 }, - { "CRCONSEEN", 0x80, 0x80 } -}; - -int -ahc_crccontrol1_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(CRCCONTROL1_parse_table, 6, "CRCCONTROL1", - 0x9d, regvalue, cur_col, wrap)); -} - static const ahc_reg_parse_entry_t SCSIPHASE_parse_table[] = { { "DATA_OUT_PHASE", 0x01, 0x01 }, { "DATA_IN_PHASE", 0x02, 0x02 }, @@ -1188,17 +353,6 @@ ahc_scsiphase_print(u_int regvalue, u_int *cur_col, u_int wrap) 0x9e, regvalue, cur_col, wrap)); } -static const ahc_reg_parse_entry_t SFUNCT_parse_table[] = { - { "ALT_MODE", 0x80, 0x80 } -}; - -int -ahc_sfunct_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SFUNCT_parse_table, 1, "SFUNCT", - 0x9f, regvalue, cur_col, wrap)); -} - int ahc_scb_base_print(u_int regvalue, u_int *cur_col, u_int wrap) { @@ -1206,80 +360,6 @@ ahc_scb_base_print(u_int regvalue, u_int *cur_col, u_int wrap) 0xa0, regvalue, cur_col, wrap)); } -int -ahc_scb_cdb_ptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCB_CDB_PTR", - 0xa0, regvalue, cur_col, wrap)); -} - -int -ahc_scb_residual_sgptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCB_RESIDUAL_SGPTR", - 0xa4, regvalue, cur_col, wrap)); -} - -int -ahc_scb_scsi_status_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCB_SCSI_STATUS", - 0xa8, regvalue, cur_col, wrap)); -} - -int -ahc_scb_target_phases_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCB_TARGET_PHASES", - 0xa9, regvalue, cur_col, wrap)); -} - -int -ahc_scb_target_data_dir_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCB_TARGET_DATA_DIR", - 0xaa, regvalue, cur_col, wrap)); -} - -int -ahc_scb_target_itag_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCB_TARGET_ITAG", - 0xab, regvalue, cur_col, wrap)); -} - -int -ahc_scb_dataptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCB_DATAPTR", - 0xac, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SCB_DATACNT_parse_table[] = { - { "SG_LAST_SEG", 0x80, 0x80 }, - { "SG_HIGH_ADDR_BITS", 0x7f, 0x7f } -}; - -int -ahc_scb_datacnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SCB_DATACNT_parse_table, 2, "SCB_DATACNT", - 0xb0, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SCB_SGPTR_parse_table[] = { - { "SG_LIST_NULL", 0x01, 0x01 }, - { "SG_FULL_RESID", 0x02, 0x02 }, - { "SG_RESID_VALID", 0x04, 0x04 } -}; - -int -ahc_scb_sgptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SCB_SGPTR_parse_table, 3, "SCB_SGPTR", - 0xb4, regvalue, cur_col, wrap)); -} - static const ahc_reg_parse_entry_t SCB_CONTROL_parse_table[] = { { "DISCONNECTED", 0x04, 0x04 }, { "ULTRAENB", 0x08, 0x08 }, @@ -1331,248 +411,3 @@ ahc_scb_tag_print(u_int regvalue, u_int *cur_col, u_int wrap) 0xbb, regvalue, cur_col, wrap)); } -int -ahc_scb_cdb_len_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCB_CDB_LEN", - 0xbc, regvalue, cur_col, wrap)); -} - -int -ahc_scb_scsirate_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCB_SCSIRATE", - 0xbd, regvalue, cur_col, wrap)); -} - -int -ahc_scb_scsioffset_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCB_SCSIOFFSET", - 0xbe, regvalue, cur_col, wrap)); -} - -int -ahc_scb_next_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCB_NEXT", - 0xbf, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SEECTL_2840_parse_table[] = { - { "DO_2840", 0x01, 0x01 }, - { "CK_2840", 0x02, 0x02 }, - { "CS_2840", 0x04, 0x04 } -}; - -int -ahc_seectl_2840_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SEECTL_2840_parse_table, 3, "SEECTL_2840", - 0xc0, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t STATUS_2840_parse_table[] = { - { "DI_2840", 0x01, 0x01 }, - { "EEPROM_TF", 0x80, 0x80 }, - { "ADSEL", 0x1e, 0x1e }, - { "BIOS_SEL", 0x60, 0x60 } -}; - -int -ahc_status_2840_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(STATUS_2840_parse_table, 4, "STATUS_2840", - 0xc1, regvalue, cur_col, wrap)); -} - -int -ahc_scb_64_btt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCB_64_BTT", - 0xd0, regvalue, cur_col, wrap)); -} - -int -ahc_cchaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "CCHADDR", - 0xe0, regvalue, cur_col, wrap)); -} - -int -ahc_cchcnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "CCHCNT", - 0xe8, regvalue, cur_col, wrap)); -} - -int -ahc_ccsgram_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "CCSGRAM", - 0xe9, regvalue, cur_col, wrap)); -} - -int -ahc_ccsgaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "CCSGADDR", - 0xea, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t CCSGCTL_parse_table[] = { - { "CCSGRESET", 0x01, 0x01 }, - { "SG_FETCH_NEEDED", 0x02, 0x02 }, - { "CCSGEN", 0x08, 0x08 }, - { "CCSGDONE", 0x80, 0x80 } -}; - -int -ahc_ccsgctl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(CCSGCTL_parse_table, 4, "CCSGCTL", - 0xeb, regvalue, cur_col, wrap)); -} - -int -ahc_ccscbram_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "CCSCBRAM", - 0xec, regvalue, cur_col, wrap)); -} - -int -ahc_ccscbaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "CCSCBADDR", - 0xed, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t CCSCBCTL_parse_table[] = { - { "CCSCBRESET", 0x01, 0x01 }, - { "CCSCBDIR", 0x04, 0x04 }, - { "CCSCBEN", 0x08, 0x08 }, - { "CCARREN", 0x10, 0x10 }, - { "ARRDONE", 0x40, 0x40 }, - { "CCSCBDONE", 0x80, 0x80 } -}; - -int -ahc_ccscbctl_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(CCSCBCTL_parse_table, 6, "CCSCBCTL", - 0xee, regvalue, cur_col, wrap)); -} - -int -ahc_ccscbcnt_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "CCSCBCNT", - 0xef, regvalue, cur_col, wrap)); -} - -int -ahc_scbbaddr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SCBBADDR", - 0xf0, regvalue, cur_col, wrap)); -} - -int -ahc_ccscbptr_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "CCSCBPTR", - 0xf1, regvalue, cur_col, wrap)); -} - -int -ahc_hnscb_qoff_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "HNSCB_QOFF", - 0xf4, regvalue, cur_col, wrap)); -} - -int -ahc_snscb_qoff_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SNSCB_QOFF", - 0xf6, regvalue, cur_col, wrap)); -} - -int -ahc_sdscb_qoff_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(NULL, 0, "SDSCB_QOFF", - 0xf8, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t QOFF_CTLSTA_parse_table[] = { - { "SDSCB_ROLLOVER", 0x10, 0x10 }, - { "SNSCB_ROLLOVER", 0x20, 0x20 }, - { "SCB_AVAIL", 0x40, 0x40 }, - { "SCB_QSIZE_256", 0x06, 0x06 }, - { "SCB_QSIZE", 0x07, 0x07 } -}; - -int -ahc_qoff_ctlsta_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(QOFF_CTLSTA_parse_table, 5, "QOFF_CTLSTA", - 0xfa, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t DFF_THRSH_parse_table[] = { - { "RD_DFTHRSH_MIN", 0x00, 0x00 }, - { "WR_DFTHRSH_MIN", 0x00, 0x00 }, - { "RD_DFTHRSH_25", 0x01, 0x01 }, - { "RD_DFTHRSH_50", 0x02, 0x02 }, - { "RD_DFTHRSH_63", 0x03, 0x03 }, - { "RD_DFTHRSH_75", 0x04, 0x04 }, - { "RD_DFTHRSH_85", 0x05, 0x05 }, - { "RD_DFTHRSH_90", 0x06, 0x06 }, - { "RD_DFTHRSH", 0x07, 0x07 }, - { "RD_DFTHRSH_MAX", 0x07, 0x07 }, - { "WR_DFTHRSH_25", 0x10, 0x10 }, - { "WR_DFTHRSH_50", 0x20, 0x20 }, - { "WR_DFTHRSH_63", 0x30, 0x30 }, - { "WR_DFTHRSH_75", 0x40, 0x40 }, - { "WR_DFTHRSH_85", 0x50, 0x50 }, - { "WR_DFTHRSH_90", 0x60, 0x60 }, - { "WR_DFTHRSH", 0x70, 0x70 }, - { "WR_DFTHRSH_MAX", 0x70, 0x70 } -}; - -int -ahc_dff_thrsh_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(DFF_THRSH_parse_table, 18, "DFF_THRSH", - 0xfb, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SG_CACHE_SHADOW_parse_table[] = { - { "LAST_SEG_DONE", 0x01, 0x01 }, - { "LAST_SEG", 0x02, 0x02 }, - { "SG_ADDR_MASK", 0xf8, 0xf8 } -}; - -int -ahc_sg_cache_shadow_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SG_CACHE_SHADOW_parse_table, 3, "SG_CACHE_SHADOW", - 0xfc, regvalue, cur_col, wrap)); -} - -static const ahc_reg_parse_entry_t SG_CACHE_PRE_parse_table[] = { - { "LAST_SEG_DONE", 0x01, 0x01 }, - { "LAST_SEG", 0x02, 0x02 }, - { "SG_ADDR_MASK", 0xf8, 0xf8 } -}; - -int -ahc_sg_cache_pre_print(u_int regvalue, u_int *cur_col, u_int wrap) -{ - return (ahc_print_register(SG_CACHE_PRE_parse_table, 3, "SG_CACHE_PRE", - 0xfc, regvalue, cur_col, wrap)); -} - diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y index 81be6a2..e406443 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y @@ -147,6 +147,8 @@ void yyerror(const char *string); %token T_ACCESS_MODE +%token T_DONT_GENERATE_DEBUG_CODE + %token T_MODES %token T_DEFINE @@ -357,6 +359,7 @@ reg_attribute: | size | count | access_mode +| dont_generate_debug_code | modes | field_defn | enum_defn @@ -410,6 +413,13 @@ access_mode: } ; +dont_generate_debug_code: + T_DONT_GENERATE_DEBUG_CODE + { + cur_symbol->dont_generate_debug_code = 1; + } +; + modes: T_MODES mode_list { diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l b/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l index 2c7f02d..93c8667 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l @@ -164,6 +164,7 @@ download { return T_DOWNLOAD; } address { return T_ADDRESS; } count { return T_COUNT; } access_mode { return T_ACCESS_MODE; } +dont_generate_debug_code { return T_DONT_GENERATE_DEBUG_CODE; } modes { return T_MODES; } RW|RO|WO { if (strcmp(yytext, "RW") == 0) diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c index fcd3578..078ed60 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c @@ -539,6 +539,9 @@ symtable_dump(FILE *ofile, FILE *dfile) aic_print_include(dfile, stock_include_file); SLIST_FOREACH(curnode, ®isters, links) { + if (curnode->symbol->dont_generate_debug_code) + continue; + switch(curnode->symbol->type) { case REGISTER: case SCBLOC: diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h index 05190c1..2ba73ae 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h @@ -137,7 +137,8 @@ typedef struct symbol { struct label_info *linfo; struct cond_info *condinfo; struct macro_info *macroinfo; - }info; + } info; + int dont_generate_debug_code; } symbol_t; typedef struct symbol_ref { diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index a43c3ed..3d50cab 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -401,6 +401,9 @@ static int check_ownership(struct scsi_device *sdev, struct rdac_dh_data *h) } } + if (h->lun_state == RDAC_LUN_UNOWNED) + h->state = RDAC_STATE_PASSIVE; + return err; } diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 098739d..ded854a 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -2456,20 +2456,14 @@ static ssize_t ipr_read_trace(struct kobject *kobj, struct Scsi_Host *shost = class_to_shost(dev); struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; unsigned long lock_flags = 0; - int size = IPR_TRACE_SIZE; - char *src = (char *)ioa_cfg->trace; - - if (off > size) - return 0; - if (off + count > size) { - size -= off; - count = size; - } + ssize_t ret; spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); - memcpy(buf, &src[off], count); + ret = memory_read_from_buffer(buf, count, &off, ioa_cfg->trace, + IPR_TRACE_SIZE); spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); - return count; + + return ret; } static struct bin_attribute ipr_trace_attr = { diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index e5a9526..f5d3b96 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -529,6 +529,14 @@ static void scsi_single_lun_run(struct scsi_device *current_sdev) spin_unlock_irqrestore(shost->host_lock, flags); } +static inline int scsi_device_is_busy(struct scsi_device *sdev) +{ + if (sdev->device_busy >= sdev->queue_depth || sdev->device_blocked) + return 1; + + return 0; +} + static inline int scsi_target_is_busy(struct scsi_target *starget) { return ((starget->can_queue > 0 && @@ -536,6 +544,15 @@ static inline int scsi_target_is_busy(struct scsi_target *starget) starget->target_blocked); } +static inline int scsi_host_is_busy(struct Scsi_Host *shost) +{ + if ((shost->can_queue > 0 && shost->host_busy >= shost->can_queue) || + shost->host_blocked || shost->host_self_blocked) + return 1; + + return 0; +} + /* * Function: scsi_run_queue() * @@ -558,11 +575,7 @@ static void scsi_run_queue(struct request_queue *q) scsi_single_lun_run(sdev); spin_lock_irqsave(shost->host_lock, flags); - while (!list_empty(&shost->starved_list) && - !shost->host_blocked && !shost->host_self_blocked && - !((shost->can_queue > 0) && - (shost->host_busy >= shost->can_queue))) { - + while (!list_empty(&shost->starved_list) && !scsi_host_is_busy(shost)) { int flagset; /* @@ -1348,8 +1361,6 @@ int scsi_prep_fn(struct request_queue *q, struct request *req) static inline int scsi_dev_queue_ready(struct request_queue *q, struct scsi_device *sdev) { - if (sdev->device_busy >= sdev->queue_depth) - return 0; if (sdev->device_busy == 0 && sdev->device_blocked) { /* * unblock after device_blocked iterates to zero @@ -1363,7 +1374,7 @@ static inline int scsi_dev_queue_ready(struct request_queue *q, return 0; } } - if (sdev->device_blocked) + if (scsi_device_is_busy(sdev)) return 0; return 1; @@ -1440,8 +1451,7 @@ static inline int scsi_host_queue_ready(struct request_queue *q, return 0; } } - if ((shost->can_queue > 0 && shost->host_busy >= shost->can_queue) || - shost->host_blocked || shost->host_self_blocked) { + if (scsi_host_is_busy(shost)) { if (list_empty(&sdev->starved_entry)) list_add_tail(&sdev->starved_entry, &shost->starved_list); return 0; @@ -1455,6 +1465,37 @@ static inline int scsi_host_queue_ready(struct request_queue *q, } /* + * Busy state exporting function for request stacking drivers. + * + * For efficiency, no lock is taken to check the busy state of + * shost/starget/sdev, since the returned value is not guaranteed and + * may be changed after request stacking drivers call the function, + * regardless of taking lock or not. + * + * When scsi can't dispatch I/Os anymore and needs to kill I/Os + * (e.g. !sdev), scsi needs to return 'not busy'. + * Otherwise, request stacking drivers may hold requests forever. + */ +static int scsi_lld_busy(struct request_queue *q) +{ + struct scsi_device *sdev = q->queuedata; + struct Scsi_Host *shost; + struct scsi_target *starget; + + if (!sdev) + return 0; + + shost = sdev->host; + starget = scsi_target(sdev); + + if (scsi_host_in_recovery(shost) || scsi_host_is_busy(shost) || + scsi_target_is_busy(starget) || scsi_device_is_busy(sdev)) + return 1; + + return 0; +} + +/* * Kill a request for a dead device */ static void scsi_kill_request(struct request *req, struct request_queue *q) @@ -1757,6 +1798,7 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev) blk_queue_prep_rq(q, scsi_prep_fn); blk_queue_softirq_done(q, scsi_softirq_done); blk_queue_rq_timed_out(q, scsi_times_out); + blk_queue_lld_busy(q, scsi_lld_busy); return q; } @@ -2105,22 +2147,21 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, do { result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr, timeout, retries); - } while ((driver_byte(result) & DRIVER_SENSE) && - sshdr && sshdr->sense_key == UNIT_ATTENTION && - --retries); + if (sdev->removable && scsi_sense_valid(sshdr) && + sshdr->sense_key == UNIT_ATTENTION) + sdev->changed = 1; + } while (scsi_sense_valid(sshdr) && + sshdr->sense_key == UNIT_ATTENTION && --retries); if (!sshdr) /* could not allocate sense buffer, so can't process it */ return result; - if ((driver_byte(result) & DRIVER_SENSE) && sdev->removable) { - - if ((scsi_sense_valid(sshdr)) && - ((sshdr->sense_key == UNIT_ATTENTION) || - (sshdr->sense_key == NOT_READY))) { - sdev->changed = 1; - result = 0; - } + if (sdev->removable && scsi_sense_valid(sshdr) && + (sshdr->sense_key == UNIT_ATTENTION || + sshdr->sense_key == NOT_READY)) { + sdev->changed = 1; + result = 0; } if (!sshdr_external) kfree(sshdr); diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c index b37e133..723fdec 100644 --- a/drivers/scsi/scsi_netlink.c +++ b/drivers/scsi/scsi_netlink.c @@ -205,16 +205,13 @@ static struct notifier_block scsi_netlink_notifier = { }; -/** +/* * GENERIC SCSI transport receive and event handlers - **/ + */ /** - * scsi_generic_msg_handler - receive message handler for GENERIC transport - * messages - * + * scsi_generic_msg_handler - receive message handler for GENERIC transport messages * @skb: socket receive buffer - * **/ static int scsi_generic_msg_handler(struct sk_buff *skb) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 43f34c7..c9e1242 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1049,7 +1049,6 @@ static int sd_done(struct scsi_cmnd *SCpnt) good_bytes = sd_completed_bytes(SCpnt); break; case RECOVERED_ERROR: - case NO_SENSE: /* Inform the user, but make sure that it's not treated * as a hard error. */ @@ -1058,6 +1057,15 @@ static int sd_done(struct scsi_cmnd *SCpnt) memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); good_bytes = scsi_bufflen(SCpnt); break; + case NO_SENSE: + /* This indicates a false check condition, so ignore it. An + * unknown amount of data was transferred so treat it as an + * error. + */ + scsi_print_sense("sd", SCpnt); + SCpnt->result = 0; + memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); + break; case ABORTED_COMMAND: if (sshdr.asc == 0x10) { /* DIF: Disk detected corruption */ scsi_print_result(SCpnt); @@ -1071,15 +1079,6 @@ static int sd_done(struct scsi_cmnd *SCpnt) scsi_print_sense("sd", SCpnt); good_bytes = sd_completed_bytes(SCpnt); } - if (!scsi_device_protection(SCpnt->device) && - SCpnt->device->use_10_for_rw && - (SCpnt->cmnd[0] == READ_10 || - SCpnt->cmnd[0] == WRITE_10)) - SCpnt->device->use_10_for_rw = 0; - if (SCpnt->device->use_10_for_ms && - (SCpnt->cmnd[0] == MODE_SENSE_10 || - SCpnt->cmnd[0] == MODE_SELECT_10)) - SCpnt->device->use_10_for_ms = 0; break; default: break; @@ -1432,7 +1431,7 @@ got_data: { char cap_str_2[10], cap_str_10[10]; - u64 sz = sdkp->capacity << ffz(~sector_size); + u64 sz = (u64)sdkp->capacity << ilog2(sector_size); string_get_size(sz, STRING_UNITS_2, cap_str_2, sizeof(cap_str_2)); diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c index 7514b3a..34a9962 100644 --- a/drivers/scsi/sun3x_esp.c +++ b/drivers/scsi/sun3x_esp.c @@ -213,7 +213,7 @@ static int __devinit esp_sun3x_probe(struct platform_device *dev) esp->ops = &sun3x_esp_ops; res = platform_get_resource(dev, IORESOURCE_MEM, 0); - if (!res && !res->start) + if (!res || !res->start) goto fail_unlink; esp->regs = ioremap_nocache(res->start, 0x20); @@ -221,7 +221,7 @@ static int __devinit esp_sun3x_probe(struct platform_device *dev) goto fail_unmap_regs; res = platform_get_resource(dev, IORESOURCE_MEM, 1); - if (!res && !res->start) + if (!res || !res->start) goto fail_unmap_regs; esp->dma_regs = ioremap_nocache(res->start, 0x10); diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index c4eff44..e1654f5 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -43,8 +43,6 @@ source "drivers/staging/echo/Kconfig" source "drivers/staging/at76_usb/Kconfig" -source "drivers/staging/pcc-acpi/Kconfig" - source "drivers/staging/poch/Kconfig" endif # STAGING diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 7cb8701..71c4d53 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -13,5 +13,4 @@ obj-$(CONFIG_W35UND) += winbond/ obj-$(CONFIG_PRISM2_USB) += wlan-ng/ obj-$(CONFIG_ECHO) += echo/ obj-$(CONFIG_USB_ATMEL) += at76_usb/ -obj-$(CONFIG_PCC_ACPI) += pcc-acpi/ obj-$(CONFIG_POCH) += poch/ diff --git a/drivers/staging/pcc-acpi/Kconfig b/drivers/staging/pcc-acpi/Kconfig deleted file mode 100644 index 6720d40..0000000 --- a/drivers/staging/pcc-acpi/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -config PCC_ACPI - tristate "Panasonic ACPI Hotkey support" - depends on ACPI - default n - ---help--- - This driver provides support for Panasonic hotkeys through the - ACPI interface. This works for the Panasonic R1 (N variant), - R2, R3, T2, W2, and Y2 laptops. - - To compile this driver as a module, choose M here. The module - will be called pcc-acpi. diff --git a/drivers/staging/pcc-acpi/Makefile b/drivers/staging/pcc-acpi/Makefile deleted file mode 100644 index f93b29e..0000000 --- a/drivers/staging/pcc-acpi/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-$(CONFIG_PCC_ACPI) += pcc-acpi.o diff --git a/drivers/staging/pcc-acpi/TODO b/drivers/staging/pcc-acpi/TODO deleted file mode 100644 index fab2409..0000000 --- a/drivers/staging/pcc-acpi/TODO +++ /dev/null @@ -1,7 +0,0 @@ -TODO: - - Lindent fixes - - checkpatch.pl fixes - - verify that the acpi interface is correct - - remove /proc dependancy if needed (not sure yet.) - -Please send any patches for this driver to Greg Kroah-Hartman <greg@kroah.com> diff --git a/drivers/staging/pcc-acpi/pcc-acpi.c b/drivers/staging/pcc-acpi/pcc-acpi.c deleted file mode 100644 index 3b34a3e..0000000 --- a/drivers/staging/pcc-acpi/pcc-acpi.c +++ /dev/null @@ -1,1111 +0,0 @@ -/* - * Panasonic HotKey and lcd brightness control Extra driver - * (C) 2004 Hiroshi Miura <miura@da-cha.org> - * (C) 2004 NTT DATA Intellilink Co. http://www.intellilink.co.jp/ - * (C) YOKOTA Hiroshi <yokota (at) netlab. is. tsukuba. ac. jp> - * (C) 2004 David Bronaugh <dbronaugh> - * - * derived from toshiba_acpi.c, Copyright (C) 2002-2004 John Belmonte - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * publicshed by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - *--------------------------------------------------------------------------- - * - * ChangeLog: - * - * Nov.04, 2006 Hiroshi Miura <miura@da-cha.org> - * -v0.9 remove warning about section reference. - * remove acpi_os_free - * add /proc/acpi/pcc/brightness interface to - * allow HAL to access. - * merge dbronaugh's enhancement - * Aug.17, 2004 David Bronaugh (dbronaugh) - * - Added screen brightness setting interface - * Thanks to the FreeBSD crew - * (acpi_panasonic.c authors) - * for the ideas I needed to accomplish it - * - * May.29, 2006 Hiroshi Miura <miura@da-cha.org> - * -v0.8.4 follow to change keyinput structure - * thanks Fabian Yamaguchi <fabs@cs.tu-berlin.de>, - * Jacob Bower <jacob.bower@ic.ac.uk> and - * Hiroshi Yokota for providing solutions. - * - * Oct.02, 2004 Hiroshi Miura <miura@da-cha.org> - * -v0.8.2 merge code of YOKOTA Hiroshi - * <yokota@netlab.is.tsukuba.ac.jp>. - * Add sticky key mode interface. - * Refactoring acpi_pcc_generete_keyinput(). - * - * Sep.15, 2004 Hiroshi Miura <miura@da-cha.org> - * -v0.8 Generate key input event on input subsystem. - * This is based on yet another driver - * written by Ryuta Nakanishi. - * - * Sep.10, 2004 Hiroshi Miura <miura@da-cha.org> - * -v0.7 Change proc interface functions using seq_file - * facility as same as other ACPI drivers. - * - * Aug.28, 2004 Hiroshi Miura <miura@da-cha.org> - * -v0.6.4 Fix a silly error with status checking - * - * Aug.25, 2004 Hiroshi Miura <miura@da-cha.org> - * -v0.6.3 replace read_acpi_int by standard - * function acpi_evaluate_integer - * some clean up and make smart copyright notice. - * fix return value of pcc_acpi_get_key() - * fix checking return value of acpi_bus_register_driver() - * - * Aug.22, 2004 David Bronaugh <dbronaugh@linuxboxen.org> - * -v0.6.2 Add check on ACPI data (num_sifr) - * Coding style cleanups, better error messages/handling - * Fixed an off-by-one error in memory allocation - * - * Aug.21, 2004 David Bronaugh <dbronaugh@linuxboxen.org> - * -v0.6.1 Fix a silly error with status checking - * - * Aug.20, 2004 David Bronaugh <dbronaugh@linuxboxen.org> - * - v0.6 Correct brightness controls to reflect reality - * based on information gleaned by Hiroshi Miura - * and discussions with Hiroshi Miura - * - * Aug.10, 2004 Hiroshi Miura <miura@da-cha.org> - * - v0.5 support LCD brightness control - * based on the disclosed information by MEI. - * - * Jul.25, 2004 Hiroshi Miura <miura@da-cha.org> - * - v0.4 first post version - * add function to retrive SIFR - * - * Jul.24, 2004 Hiroshi Miura <miura@da-cha.org> - * - v0.3 get proper status of hotkey - * - * Jul.22, 2004 Hiroshi Miura <miura@da-cha.org> - * - v0.2 add HotKey handler - * - * Jul.17, 2004 Hiroshi Miura <miura@da-cha.org> - * - v0.1 start from toshiba_acpi driver written by John Belmonte - * - */ - -#define ACPI_PCC_VERSION "0.9+hy" - -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/types.h> -#include <linux/ctype.h> -#include <linux/init.h> -#include <linux/input.h> -#include <linux/proc_fs.h> -#include <linux/seq_file.h> -#include <linux/slab.h> -#include <linux/uaccess.h> -#include <acpi/acpi_bus.h> -#include <acpi/acpi_drivers.h> - - -/************************************************************************* - * "seq" file template definition. - */ -/* "seq" initializer */ -#define SEQ_OPEN_FS(_open_func_name_, _show_func_name_) \ -static int _open_func_name_(struct inode *inode, struct file *file) \ -{ \ - return single_open(file, _show_func_name_, PDE(inode)->data); \ -} - -/*------------------------------------------------------------------------- - * "seq" fops template for read-only files. - */ -#define SEQ_FILEOPS_R(_open_func_name_) \ -{ \ - .open = _open_func_name_, \ - .read = seq_read, \ - .llseek = seq_lseek, \ - .release = single_release, \ -} - -/*------------------------------------------------------------------------ - * "seq" fops template for read-write files. - */ -#define SEQ_FILEOPS_RW(_open_func_name_, _write_func_name_) \ -{ \ - .open = _open_func_name_ , \ - .read = seq_read, \ - .write = _write_func_name_, \ - .llseek = seq_lseek, \ - .release = single_release, \ -} - -/* - * "seq" file template definition ended. - *************************************************************************** - */ -#ifndef ACPI_HOTKEY_COMPONENT -#define ACPI_HOTKEY_COMPONENT 0x10000000 -#endif - -#define _COMPONENT ACPI_HOTKEY_COMPONENT -ACPI_MODULE_NAME("pcc_acpi"); - -MODULE_AUTHOR("Hiroshi Miura, Hiroshi Yokota"); -MODULE_DESCRIPTION("ACPI HotKey driver for Panasonic Let's Note laptops"); -MODULE_LICENSE("GPL"); - -#define LOGPREFIX "pcc_acpi: " - -/**************************************************** - * Define ACPI PATHs - ****************************************************/ -/* Lets note hotkeys */ -#define METHOD_HKEY_QUERY "HINF" -#define METHOD_HKEY_SQTY "SQTY" -#define METHOD_HKEY_SINF "SINF" -#define METHOD_HKEY_SSET "SSET" -#define HKEY_NOTIFY 0x80 - -/* for brightness control */ -#define LCD_MAX_BRIGHTNESS 255 -/* This may be magical -- beware */ -#define LCD_BRIGHTNESS_INCREMENT 17 -/* Registers of SINF */ -#define SINF_LCD_BRIGHTNESS 4 - -/******************************************************************* - * - * definitions for /proc/ interface - * - *******************************************************************/ -#define ACPI_PCC_DRIVER_NAME "pcc_acpi" -#define ACPI_PCC_DEVICE_NAME "PCCExtra" -#define ACPI_PCC_CLASS "pcc" -#define PROC_PCC ACPI_PCC_CLASS - -#define ACPI_PCC_INPUT_PHYS "panasonic/hkey0" - -/* This is transitional definition */ -#ifndef KEY_BATT -# define KEY_BATT 227 -#endif - -#define PROC_STR_MAX_LEN 8 - -#define BUS_PCC_HOTKEY BUS_I8042 /*0x1a*/ /* FIXME: BUS_I8042? */ - -/* Fn+F4/F5 confricts with Shift+F1/F2 */ -/* This hack avoids key number confrict */ -#define PCC_KEYINPUT_MODE (0) - -/* LCD_TYPEs: 0 = Normal, 1 = Semi-transparent - ENV_STATEs: Normal temp=0x01, High temp=0x81, N/A=0x00 -*/ -enum SINF_BITS { SINF_NUM_BATTERIES = 0, - SINF_LCD_TYPE, - SINF_AC_MAX_BRIGHT, - SINF_AC_MIN_BRIGHT, - SINF_AC_CUR_BRIGHT, - /* 4 = R1 only handle SINF_AC_CUR_BRIGHT - * as SINF_CUR_BRIGHT and don't know AC state */ - SINF_DC_MAX_BRIGHT, - SINF_DC_MIN_BRIGHT, - SINF_DC_CUR_BRIGHT, - SINF_MUTE, - SINF_RESERVED, - SINF_ENV_STATE, /* 10 */ - SINF_STICKY_KEY = 0x80, -}; - -static struct acpi_device_id pcc_device_ids[] = { - {"MAT0012", 0}, - {"MAT0013", 0}, - {"MAT0018", 0}, - {"MAT0019", 0}, - {"", 0}, -}; -MODULE_DEVICE_TABLE(acpi, pcc_device_ids); - - -static int __devinit acpi_pcc_hotkey_add(struct acpi_device *device); -static int __devexit acpi_pcc_hotkey_remove(struct acpi_device *device, - int type); -static int acpi_pcc_hotkey_resume(struct acpi_device *device); - - -static struct acpi_driver acpi_pcc_driver = { - .name = ACPI_PCC_DRIVER_NAME, - .class = ACPI_PCC_CLASS, - .ids = pcc_device_ids, - .ops = { - .add = acpi_pcc_hotkey_add, - .remove = __devexit_p(acpi_pcc_hotkey_remove), -#ifdef CONFIG_PM - /*.suspend = acpi_pcc_hotkey_suspend,*/ - .resume = acpi_pcc_hotkey_resume, -#endif - }, -}; - -struct acpi_hotkey { - acpi_handle handle; - struct acpi_device *device; - struct proc_dir_entry *proc_dir_entry; - unsigned long num_sifr; - unsigned long status; - struct input_dev *input_dev; - int sticky_mode; -}; - -struct pcc_keyinput { - struct acpi_hotkey *hotkey; - int key_mode; -}; - -/* ************************************************************************* - Hotkey driver core - ************************************************************************* */ -/* ------------------------------------------------------------------------- - method access functions - ------------------------------------------------------------------------- */ -static int acpi_pcc_write_sset(struct acpi_hotkey *hotkey, int func, int val) -{ - union acpi_object in_objs[] = { - { .integer.type = ACPI_TYPE_INTEGER, - .integer.value = func, }, - { .integer.type = ACPI_TYPE_INTEGER, - .integer.value = val, }, - }; - struct acpi_object_list params = { - .count = ARRAY_SIZE(in_objs), - .pointer = in_objs, - }; - acpi_status status; - - ACPI_FUNCTION_TRACE("acpi_pcc_write_sset"); - - status = acpi_evaluate_object(hotkey->handle, METHOD_HKEY_SSET, - ¶ms, NULL); - - return_VALUE(status == AE_OK ? AE_OK : AE_ERROR); -} - -static inline int acpi_pcc_get_sqty(struct acpi_device *device) -{ - unsigned long s; - acpi_status status; - - ACPI_FUNCTION_TRACE("acpi_pcc_get_sqty"); - - status = acpi_evaluate_integer(device->handle, METHOD_HKEY_SQTY, - NULL, &s); - if (ACPI_SUCCESS(status)) { - return_VALUE(s); - } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "evaluation error HKEY.SQTY\n")); - return_VALUE(-EINVAL); - } -} - -static int acpi_pcc_retrieve_biosdata(struct acpi_hotkey *hotkey, u32 *sinf) -{ - acpi_status status; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - union acpi_object *hkey = NULL; - int i; - - ACPI_FUNCTION_TRACE("acpi_pcc_retrieve_biosdata"); - - status = acpi_evaluate_object(hotkey->handle, METHOD_HKEY_SINF, 0, - &buffer); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "evaluation error HKEY.SINF\n")); - status = AE_ERROR; - return_VALUE(status); - } - - hkey = buffer.pointer; - if (!hkey || (hkey->type != ACPI_TYPE_PACKAGE)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid HKEY.SINF\n")); - goto free_buffer; - } - - if (hotkey->num_sifr < hkey->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "SQTY reports bad SINF length\n")); - status = AE_ERROR; - goto free_buffer; - } - - for (i = 0; i < hkey->package.count; i++) { - union acpi_object *element = &(hkey->package.elements[i]); - if (likely(element->type == ACPI_TYPE_INTEGER)) { - sinf[i] = element->integer.value; - } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid HKEY.SINF data\n")); - status = AE_ERROR; - break; - } - } - sinf[hkey->package.count] = -1; - - free_buffer: - kfree(buffer.pointer); - return_VALUE(status == AE_OK ? AE_OK : AE_ERROR); -} - -static int acpi_pcc_read_sinf_field(struct seq_file *seq, int field) -{ - struct acpi_hotkey *hotkey = (struct acpi_hotkey *) seq->private; - u32 sinf[hotkey->num_sifr + 1]; - - ACPI_FUNCTION_TRACE("acpi_pcc_read_sinf_field"); - - if (ACPI_SUCCESS(acpi_pcc_retrieve_biosdata(hotkey, sinf))) - seq_printf(seq, "%u\n", sinf[field]); - else - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Couldn't retrieve BIOS data\n")); - - return_VALUE(AE_OK); -} - -/* ------------------------------------------------------------------------- - user interface functions - ------------------------------------------------------------------------- */ -/* read methods */ -/* Sinf read methods */ -#define PCC_SINF_READ_F(_name_, FUNC) \ -static int _name_(struct seq_file *seq, void *offset) \ -{ \ - return_VALUE(ACPI_SUCCESS(acpi_pcc_read_sinf_field(seq, \ - (FUNC))) \ - ? 0 : -EINVAL); \ -} - -PCC_SINF_READ_F(acpi_pcc_numbatteries_show, SINF_NUM_BATTERIES); -PCC_SINF_READ_F(acpi_pcc_lcdtype_show, SINF_LCD_TYPE); -PCC_SINF_READ_F(acpi_pcc_ac_brightness_max_show, SINF_AC_MAX_BRIGHT); -PCC_SINF_READ_F(acpi_pcc_ac_brightness_min_show, SINF_AC_MIN_BRIGHT); -PCC_SINF_READ_F(acpi_pcc_ac_brightness_show, SINF_AC_CUR_BRIGHT); -PCC_SINF_READ_F(acpi_pcc_dc_brightness_max_show, SINF_DC_MAX_BRIGHT); -PCC_SINF_READ_F(acpi_pcc_dc_brightness_min_show, SINF_DC_MIN_BRIGHT); -PCC_SINF_READ_F(acpi_pcc_dc_brightness_show, SINF_DC_CUR_BRIGHT); -PCC_SINF_READ_F(acpi_pcc_brightness_show, SINF_AC_CUR_BRIGHT); -PCC_SINF_READ_F(acpi_pcc_mute_show, SINF_MUTE); - -static int acpi_pcc_sticky_key_show(struct seq_file *seq, void *offset) -{ - struct acpi_hotkey *hotkey = seq->private; - - ACPI_FUNCTION_TRACE("acpi_pcc_sticky_key_show"); - - if (!hotkey || !hotkey->device) - return_VALUE(-EINVAL); - - seq_printf(seq, "%d\n", hotkey->sticky_mode); - - return_VALUE(0); -} - -static int acpi_pcc_keyinput_show(struct seq_file *seq, void *offset) -{ - struct acpi_hotkey *hotkey = seq->private; - struct input_dev *hotk_input_dev = hotkey->input_dev; - struct pcc_keyinput *keyinput = input_get_drvdata(hotk_input_dev); - - ACPI_FUNCTION_TRACE("acpi_pcc_keyinput_show"); - - seq_printf(seq, "%d\n", keyinput->key_mode); - - return_VALUE(0); -} - -static int acpi_pcc_version_show(struct seq_file *seq, void *offset) -{ - struct acpi_hotkey *hotkey = seq->private; - - ACPI_FUNCTION_TRACE("acpi_pcc_version_show"); - - if (!hotkey || !hotkey->device) - return_VALUE(-EINVAL); - - seq_printf(seq, "%s version %s\n", ACPI_PCC_DRIVER_NAME, - ACPI_PCC_VERSION); - seq_printf(seq, "%li functions\n", hotkey->num_sifr); - - return_VALUE(0); -} - -/* write methods */ -static ssize_t acpi_pcc_write_single_flag(struct file *file, - const char __user *buffer, - size_t count, - int sinf_func) -{ - struct seq_file *seq = file->private_data; - struct acpi_hotkey *hotkey = seq->private; - char write_string[PROC_STR_MAX_LEN]; - u32 val; - - ACPI_FUNCTION_TRACE("acpi_pcc_write_single_flag"); - - if (!hotkey || (count > sizeof(write_string) - 1)) - return_VALUE(-EINVAL); - - if (copy_from_user(write_string, buffer, count)) - return_VALUE(-EFAULT); - - write_string[count] = '\0'; - - if ((sscanf(write_string, "%3i", &val) == 1) && - (val == 0 || val == 1)) - acpi_pcc_write_sset(hotkey, sinf_func, val); - - return_VALUE(count); -} - -static unsigned long acpi_pcc_write_brightness(struct file *file, - const char __user *buffer, - size_t count, - int min_index, int max_index, - int cur_index) -{ - struct seq_file *seq = (struct seq_file *)file->private_data; - struct acpi_hotkey *hotkey = (struct acpi_hotkey *)seq->private; - char write_string[PROC_STR_MAX_LEN]; - u32 bright; - u32 sinf[hotkey->num_sifr + 1]; - - ACPI_FUNCTION_TRACE("acpi_pcc_write_brightness"); - - if (!hotkey || (count > sizeof(write_string) - 1)) - return_VALUE(-EINVAL); - - if (copy_from_user(write_string, buffer, count)) - return_VALUE(-EFAULT); - - write_string[count] = '\0'; - - if (ACPI_FAILURE(acpi_pcc_retrieve_biosdata(hotkey, sinf))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Couldn't retrieve BIOS data\n")); - goto end; - } - - if ((sscanf(write_string, "%4i", &bright) == 1) && - (bright >= sinf[min_index]) && - (bright <= sinf[max_index])) - acpi_pcc_write_sset(hotkey, cur_index, bright); - -end: - return_VALUE(count); -} - -static ssize_t acpi_pcc_write_ac_brightness(struct file *file, - const char __user *buffer, - size_t count, loff_t *ppos) -{ - return_VALUE(acpi_pcc_write_brightness(file, buffer, count, - SINF_AC_MIN_BRIGHT, - SINF_AC_MAX_BRIGHT, - SINF_AC_CUR_BRIGHT)); -} - -static ssize_t acpi_pcc_write_dc_brightness(struct file *file, - const char __user *buffer, - size_t count, loff_t *ppos) -{ - return_VALUE(acpi_pcc_write_brightness(file, buffer, count, - SINF_DC_MIN_BRIGHT, - SINF_DC_MAX_BRIGHT, - SINF_DC_CUR_BRIGHT)); -} - -static ssize_t acpi_pcc_write_no_brightness(struct file *file, - const char __user *buffer, - size_t count, loff_t *ppos) -{ - return acpi_pcc_write_brightness(file, buffer, count, - SINF_AC_MIN_BRIGHT, - SINF_AC_MAX_BRIGHT, - SINF_AC_CUR_BRIGHT); -} - -static ssize_t acpi_pcc_write_mute(struct file *file, - const char __user *buffer, - size_t count, loff_t *ppos) -{ - return_VALUE(acpi_pcc_write_single_flag(file, buffer, count, - SINF_MUTE)); -} - -static ssize_t acpi_pcc_write_sticky_key(struct file *file, - const char __user *buffer, - size_t count, loff_t *ppos) -{ - struct seq_file *seq = (struct seq_file *)file->private_data; - struct acpi_hotkey *hotkey = (struct acpi_hotkey *)seq->private; - char write_string[PROC_STR_MAX_LEN]; - int mode; - - ACPI_FUNCTION_TRACE("acpi_pcc_write_sticky_key"); - - if (!hotkey || (count > sizeof(write_string) - 1)) - return_VALUE(-EINVAL); - - if (copy_from_user(write_string, buffer, count)) - return_VALUE(-EFAULT); - - write_string[count] = '\0'; - - if ((sscanf(write_string, "%3i", &mode) == 1) && - (mode == 0 || mode == 1)) { - acpi_pcc_write_sset(hotkey, SINF_STICKY_KEY, mode); - hotkey->sticky_mode = mode; - } - - return_VALUE(count); -} - -static ssize_t acpi_pcc_write_keyinput(struct file *file, - const char __user *buffer, - size_t count, loff_t *ppos) -{ - struct seq_file *seq = (struct seq_file *)file->private_data; - struct acpi_hotkey *hotkey = (struct acpi_hotkey *)seq->private; - struct pcc_keyinput *keyinput; - char write_string[PROC_STR_MAX_LEN]; - int key_mode; - - ACPI_FUNCTION_TRACE("acpi_pcc_write_keyinput"); - - if (!hotkey || (count > (sizeof(write_string) - 1))) - return_VALUE(-EINVAL); - - if (copy_from_user(write_string, buffer, count)) - return_VALUE(-EFAULT); - - write_string[count] = '\0'; - - if ((sscanf(write_string, "%4i", &key_mode) == 1) && - (key_mode == 0 || key_mode == 1)) { - keyinput = input_get_drvdata(hotkey->input_dev); - keyinput->key_mode = key_mode; - } - - return_VALUE(count); -} - -/* ------------------------------------------------------------------------- - hotkey driver - ------------------------------------------------------------------------- */ -static void acpi_pcc_generete_keyinput(struct acpi_hotkey *hotkey) -{ - struct input_dev *hotk_input_dev = hotkey->input_dev; - struct pcc_keyinput *keyinput = input_get_drvdata(hotk_input_dev); - int hinf = hotkey->status; - int key_code, hkey_num; - const int key_map[] = { - /* 0 */ -1, - /* 1 */ KEY_BRIGHTNESSDOWN, - /* 2 */ KEY_BRIGHTNESSUP, - /* 3 */ -1, /* vga/lcd switch event is not occur on - hotkey driver. */ - /* 4 */ KEY_MUTE, - /* 5 */ KEY_VOLUMEDOWN, - /* 6 */ KEY_VOLUMEUP, - /* 7 */ KEY_SLEEP, - /* 8 */ -1, /* Change CPU boost: do nothing */ - /* 9 */ KEY_BATT, - /* 10 */ KEY_SUSPEND, - }; - - ACPI_FUNCTION_TRACE("acpi_pcc_generete_keyinput"); - - if (keyinput->key_mode == 0) - return_VOID; - - hkey_num = hinf & 0xf; - - if ((0 > hkey_num) || - (hkey_num > ARRAY_SIZE(key_map))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "hotkey number out of range: %d\n", - hkey_num)); - return_VOID; - } - - key_code = key_map[hkey_num]; - - if (key_code != -1) { - int pushed = (hinf & 0x80) ? TRUE : FALSE; - - input_report_key(hotk_input_dev, key_code, pushed); - input_sync(hotk_input_dev); - } -} - -static int acpi_pcc_hotkey_get_key(struct acpi_hotkey *hotkey) -{ - unsigned long result; - acpi_status status = AE_OK; - - ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_get_key"); - - status = acpi_evaluate_integer(hotkey->handle, METHOD_HKEY_QUERY, - NULL, &result); - if (likely(ACPI_SUCCESS(status))) - hotkey->status = result; - else - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "error getting hotkey status\n")); - - return_VALUE(status == AE_OK); -} - -void acpi_pcc_hotkey_notify(acpi_handle handle, u32 event, void *data) -{ - struct acpi_hotkey *hotkey = (struct acpi_hotkey *) data; - - ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_notify"); - - switch (event) { - case HKEY_NOTIFY: - if (acpi_pcc_hotkey_get_key(hotkey)) { - /* generate event like '"pcc HKEY 00000080 00000084"' - * when Fn+F4 pressed */ - acpi_bus_generate_proc_event(hotkey->device, event, - hotkey->status); - } - acpi_pcc_generete_keyinput(hotkey); - break; - default: - /* nothing to do */ - break; - } - return_VOID; -} - -/* ************************************************************************* - FS Interface (/proc) - ************************************************************************* */ -/* oepn proc file fs*/ -SEQ_OPEN_FS(acpi_pcc_dc_brightness_open_fs, acpi_pcc_dc_brightness_show); -SEQ_OPEN_FS(acpi_pcc_numbatteries_open_fs, acpi_pcc_numbatteries_show); -SEQ_OPEN_FS(acpi_pcc_lcdtype_open_fs, acpi_pcc_lcdtype_show); -SEQ_OPEN_FS(acpi_pcc_ac_brightness_max_open_fs, - acpi_pcc_ac_brightness_max_show); -SEQ_OPEN_FS(acpi_pcc_ac_brightness_min_open_fs, - acpi_pcc_ac_brightness_min_show); -SEQ_OPEN_FS(acpi_pcc_ac_brightness_open_fs, acpi_pcc_ac_brightness_show); -SEQ_OPEN_FS(acpi_pcc_dc_brightness_max_open_fs, - acpi_pcc_dc_brightness_max_show); -SEQ_OPEN_FS(acpi_pcc_dc_brightness_min_open_fs, - acpi_pcc_dc_brightness_min_show); -SEQ_OPEN_FS(acpi_pcc_brightness_open_fs, acpi_pcc_brightness_show); -SEQ_OPEN_FS(acpi_pcc_mute_open_fs, acpi_pcc_mute_show); -SEQ_OPEN_FS(acpi_pcc_version_open_fs, acpi_pcc_version_show); -SEQ_OPEN_FS(acpi_pcc_keyinput_open_fs, acpi_pcc_keyinput_show); -SEQ_OPEN_FS(acpi_pcc_sticky_key_open_fs, acpi_pcc_sticky_key_show); - -static struct file_operations acpi_pcc_numbatteries_fops = - SEQ_FILEOPS_R(acpi_pcc_numbatteries_open_fs); -static struct file_operations acpi_pcc_lcdtype_fops = - SEQ_FILEOPS_R(acpi_pcc_lcdtype_open_fs); -static struct file_operations acpi_pcc_mute_fops = - SEQ_FILEOPS_RW(acpi_pcc_mute_open_fs, acpi_pcc_write_mute); -static struct file_operations acpi_pcc_ac_brightness_fops = - SEQ_FILEOPS_RW(acpi_pcc_ac_brightness_open_fs, - acpi_pcc_write_ac_brightness); -static struct file_operations acpi_pcc_ac_brightness_max_fops = - SEQ_FILEOPS_R(acpi_pcc_ac_brightness_max_open_fs); -static struct file_operations acpi_pcc_ac_brightness_min_fops = - SEQ_FILEOPS_R(acpi_pcc_ac_brightness_min_open_fs); -static struct file_operations acpi_pcc_dc_brightness_fops = - SEQ_FILEOPS_RW(acpi_pcc_dc_brightness_open_fs, - acpi_pcc_write_dc_brightness); -static struct file_operations acpi_pcc_dc_brightness_max_fops = - SEQ_FILEOPS_R(acpi_pcc_dc_brightness_max_open_fs); -static struct file_operations acpi_pcc_dc_brightness_min_fops = - SEQ_FILEOPS_R(acpi_pcc_dc_brightness_min_open_fs); -static struct file_operations acpi_pcc_brightness_fops = - SEQ_FILEOPS_RW(acpi_pcc_brightness_open_fs, - acpi_pcc_write_no_brightness); -static struct file_operations acpi_pcc_sticky_key_fops = - SEQ_FILEOPS_RW(acpi_pcc_sticky_key_open_fs, acpi_pcc_write_sticky_key); -static struct file_operations acpi_pcc_keyinput_fops = - SEQ_FILEOPS_RW(acpi_pcc_keyinput_open_fs, acpi_pcc_write_keyinput); -static struct file_operations acpi_pcc_version_fops = - SEQ_FILEOPS_R(acpi_pcc_version_open_fs); - -struct proc_item { - const char *name; - struct file_operations *fops; - mode_t flag; -}; - -/* Note: These functions map *exactly* to the SINF/SSET functions */ -struct proc_item acpi_pcc_proc_items_sifr[] = { - { "num_batteries", &acpi_pcc_numbatteries_fops, S_IRUGO }, - { "lcd_type", &acpi_pcc_lcdtype_fops, S_IRUGO }, - { "ac_brightness_max", &acpi_pcc_ac_brightness_max_fops, S_IRUGO }, - { "ac_brightness_min", &acpi_pcc_ac_brightness_min_fops, S_IRUGO }, - { "ac_brightness", &acpi_pcc_ac_brightness_fops, - S_IFREG | S_IRUGO | S_IWUSR }, - { "dc_brightness_max", &acpi_pcc_dc_brightness_max_fops, S_IRUGO }, - { "dc_brightness_min", &acpi_pcc_dc_brightness_min_fops, S_IRUGO }, - { "dc_brightness", &acpi_pcc_dc_brightness_fops, - S_IFREG | S_IRUGO | S_IWUSR }, - { "brightness", &acpi_pcc_brightness_fops, S_IFREG | S_IRUGO | S_IWUSR}, - { "mute", &acpi_pcc_mute_fops, S_IFREG | S_IRUGO | S_IWUSR }, - { NULL, NULL, 0 }, -}; - -struct proc_item acpi_pcc_proc_items[] = { - { "sticky_key", &acpi_pcc_sticky_key_fops, S_IFREG | S_IRUGO | S_IWUSR}, - { "keyinput", &acpi_pcc_keyinput_fops, S_IFREG | S_IRUGO | S_IWUSR }, - { "version", &acpi_pcc_version_fops, S_IRUGO }, - { NULL, NULL, 0 }, -}; - -static int __devinit acpi_pcc_add_device(struct acpi_device *device, - struct proc_item *proc_items, - int num) -{ - struct acpi_hotkey *hotkey = acpi_driver_data(device); - struct proc_dir_entry *proc; - struct proc_item *item; - int i; - - for (item = proc_items, i = 0; item->name && i < num; ++item, ++i) { - proc = create_proc_entry(item->name, item->flag, - hotkey->proc_dir_entry); - if (likely(proc)) { - proc->proc_fops = item->fops; - proc->data = hotkey; - proc->owner = THIS_MODULE; - } else { - while (i-- > 0) { - item--; - remove_proc_entry(item->name, - hotkey->proc_dir_entry); - } - return_VALUE(-ENODEV); - } - } - return_VALUE(0); -} - -static int __devinit acpi_pcc_proc_init(struct acpi_device *device) -{ - struct proc_dir_entry *acpi_pcc_dir; - struct acpi_hotkey *hotkey = acpi_driver_data(device); - acpi_status status; - - ACPI_FUNCTION_TRACE("acpi_pcc_proc_init"); - - acpi_pcc_dir = proc_mkdir(PROC_PCC, acpi_root_dir); - - if (unlikely(!acpi_pcc_dir)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Couldn't create dir in /proc\n")); - return_VALUE(-ENODEV); - } - - acpi_pcc_dir->owner = THIS_MODULE; - hotkey->proc_dir_entry = acpi_pcc_dir; - - status = acpi_pcc_add_device(device, acpi_pcc_proc_items_sifr, - hotkey->num_sifr); - status |= acpi_pcc_add_device(device, acpi_pcc_proc_items, - ARRAY_SIZE(acpi_pcc_proc_items)); - if (unlikely(status)) { - remove_proc_entry(PROC_PCC, acpi_root_dir); - hotkey->proc_dir_entry = NULL; - return_VALUE(-ENODEV); - } - - return_VALUE(status); -} - -static void __devexit acpi_pcc_remove_device(struct acpi_device *device, - struct proc_item *proc_items, - int num) -{ - struct acpi_hotkey *hotkey = acpi_driver_data(device); - struct proc_item *item; - int i; - - for (item = proc_items, i = 0; - item->name != NULL && i < num; - ++item, ++i) { - remove_proc_entry(item->name, hotkey->proc_dir_entry); - } - - return_VOID; -} - -/* ************************************************************************* - Power Management - ************************************************************************* */ -#ifdef CONFIG_PM -static int acpi_pcc_hotkey_resume(struct acpi_device *device) -{ - struct acpi_hotkey *hotkey = acpi_driver_data(device); - acpi_status status = AE_OK; - - ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_resume"); - - if (device == NULL || hotkey == NULL) - return_VALUE(-EINVAL); - - if (hotkey->num_sifr != 0) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Sticky mode restore: %d\n", - hotkey->sticky_mode)); - - status = acpi_pcc_write_sset(hotkey, SINF_STICKY_KEY, - hotkey->sticky_mode); - } - if (status != AE_OK) - return_VALUE(-EINVAL); - - return_VALUE(0); -} -#endif - -/* ************************************************************************* - Module init/remove - ************************************************************************* */ -/* ------------------------------------------------------------------------- - input - ------------------------------------------------------------------------- */ -static int __devinit acpi_pcc_init_input(struct acpi_hotkey *hotkey) -{ - struct input_dev *hotk_input_dev; - struct pcc_keyinput *pcc_keyinput; - int error; - - ACPI_FUNCTION_TRACE("acpi_pcc_init_input"); - - hotk_input_dev = input_allocate_device(); - if (hotk_input_dev == NULL) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Couldn't allocate input device for hotkey")); - goto err_input; - } - - pcc_keyinput = kcalloc(1, sizeof(struct pcc_keyinput), GFP_KERNEL); - - if (pcc_keyinput == NULL) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Couldn't allocate mem for private data")); - goto err_pcc; - } - - hotk_input_dev->evbit[0] = BIT(EV_KEY); - - set_bit(KEY_BRIGHTNESSDOWN, hotk_input_dev->keybit); - set_bit(KEY_BRIGHTNESSUP, hotk_input_dev->keybit); - set_bit(KEY_MUTE, hotk_input_dev->keybit); - set_bit(KEY_VOLUMEDOWN, hotk_input_dev->keybit); - set_bit(KEY_VOLUMEUP, hotk_input_dev->keybit); - set_bit(KEY_SLEEP, hotk_input_dev->keybit); - set_bit(KEY_BATT, hotk_input_dev->keybit); - set_bit(KEY_SUSPEND, hotk_input_dev->keybit); - - hotk_input_dev->name = ACPI_PCC_DRIVER_NAME; - hotk_input_dev->phys = ACPI_PCC_INPUT_PHYS; - hotk_input_dev->id.bustype = BUS_PCC_HOTKEY; - hotk_input_dev->id.vendor = 0x0001; - hotk_input_dev->id.product = 0x0001; - hotk_input_dev->id.version = 0x0100; - - pcc_keyinput->key_mode = PCC_KEYINPUT_MODE; - pcc_keyinput->hotkey = hotkey; - - input_set_drvdata(hotk_input_dev, pcc_keyinput); - - hotkey->input_dev = hotk_input_dev; - - error = input_register_device(hotk_input_dev); - - if (error) - goto err_pcc; - - return_VALUE(0); - - err_pcc: - input_unregister_device(hotk_input_dev); - err_input: - return_VALUE(-ENOMEM); -} - -static void __devexit acpi_pcc_remove_input(struct acpi_hotkey *hotkey) -{ - struct input_dev *hotk_input_dev; - struct pcc_keyinput *pcc_keyinput; - - ACPI_FUNCTION_TRACE("acpi_pcc_remove_input"); - - if (hotkey == NULL) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Can't free memory")); - return_VOID; - } - - hotk_input_dev = hotkey->input_dev; - pcc_keyinput = input_get_drvdata(hotk_input_dev); - - input_unregister_device(hotk_input_dev); - - kfree(pcc_keyinput); -} - -/* ------------------------------------------------------------------------- - ACPI - ------------------------------------------------------------------------- */ -static int __devinit acpi_pcc_hotkey_add(struct acpi_device *device) -{ - acpi_status status = AE_OK; - struct acpi_hotkey *hotkey = NULL; - int sifr_status, num_sifr, result; - - ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_add"); - - if (device == NULL) - return_VALUE(-EINVAL); - - sifr_status = acpi_pcc_get_sqty(device); - - if (sifr_status > 255) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "num_sifr too large")); - return_VALUE(-ENODEV); - } - - if (sifr_status < 0) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "not support SQTY")); - num_sifr = 0; - } else { - num_sifr = sifr_status; - } - - hotkey = kcalloc(1, sizeof(struct acpi_hotkey), GFP_KERNEL); - if (hotkey == NULL) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Couldn't allocate mem for hotkey")); - return_VALUE(-ENOMEM); - } - - hotkey->device = device; - hotkey->handle = device->handle; - hotkey->num_sifr = num_sifr; - device->driver_data = hotkey; - strcpy(acpi_device_name(device), ACPI_PCC_DEVICE_NAME); - strcpy(acpi_device_class(device), ACPI_PCC_CLASS); - - status = acpi_install_notify_handler(hotkey->handle, - ACPI_DEVICE_NOTIFY, - acpi_pcc_hotkey_notify, - hotkey); - - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); - kfree(hotkey); - return_VALUE(-ENODEV); - } - - result = acpi_pcc_init_input(hotkey); - if (result != 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing keyinput handler\n")); - kfree(hotkey); - return_VALUE(result); - } - - return_VALUE(acpi_pcc_proc_init(device)); -} - -static int __devexit acpi_pcc_hotkey_remove(struct acpi_device *device, - int type) -{ - acpi_status status = AE_OK; - struct acpi_hotkey *hotkey = acpi_driver_data(device); - - ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_remove"); - - if (!device || !hotkey) - return_VALUE(-EINVAL); - - if (hotkey->proc_dir_entry) { - acpi_pcc_remove_device(device, acpi_pcc_proc_items_sifr, - hotkey->num_sifr); - acpi_pcc_remove_device(device, acpi_pcc_proc_items, - ARRAY_SIZE(acpi_pcc_proc_items)); - remove_proc_entry(PROC_PCC, acpi_root_dir); - } - - status = acpi_remove_notify_handler(hotkey->handle, - ACPI_DEVICE_NOTIFY, acpi_pcc_hotkey_notify); - - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); - } - - acpi_pcc_remove_input(hotkey); - kfree(hotkey); - return_VALUE(status == AE_OK); -} - -/* ********************************************************************* - Module entry point - ********************************************************************* */ -static int __init acpi_pcc_init(void) -{ - int result; - - ACPI_FUNCTION_TRACE("acpi_pcc_init"); - - printk(KERN_INFO LOGPREFIX "loading...\n"); - - if (acpi_disabled) { - printk(KERN_INFO LOGPREFIX "ACPI disabled.\n"); - return_VALUE(-ENODEV); - } - - result = acpi_bus_register_driver(&acpi_pcc_driver); - if (result < 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error registering hotkey driver\n")); - return_VALUE(-ENODEV); - } - - return_VALUE(result); -} - -static void __exit acpi_pcc_exit(void) -{ - ACPI_FUNCTION_TRACE("acpi_pcc_exit"); - - printk(KERN_INFO LOGPREFIX "unloading...\n"); - - acpi_bus_unregister_driver(&acpi_pcc_driver); - - return_VOID; -} - -module_init(acpi_pcc_init); -module_exit(acpi_pcc_exit); diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index c72a135..4a4dd9a 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -75,6 +75,15 @@ config LCD_PLATFORM This driver provides a platform-device registered LCD power control interface. +config LCD_TOSA + tristate "Sharp SL-6000 LCD Driver" + depends on LCD_CLASS_DEVICE && SPI + depends on MACH_TOSA + default n + help + If you have an Sharp SL-6000 Zaurus say Y to enable a driver + for its LCD. + # # Backlight # @@ -115,7 +124,7 @@ config BACKLIGHT_ATMEL_PWM called atmel-pwm-bl. config BACKLIGHT_CORGI - tristate "Generic (aka Sharp Corgi) Backlight Driver" + tristate "Generic (aka Sharp Corgi) Backlight Driver (DEPRECATED)" depends on BACKLIGHT_CLASS_DEVICE default n help @@ -123,6 +132,9 @@ config BACKLIGHT_CORGI known as the Corgi backlight driver. If you have a Sharp Zaurus SL-C7xx, SL-Cxx00 or SL-6000x say y. Most users can say n. + Note: this driver is marked as deprecated, try enable SPI and + use the new corgi_lcd driver with integrated backlight control + config BACKLIGHT_LOCOMO tristate "Sharp LOCOMO LCD/Backlight Driver" depends on BACKLIGHT_CLASS_DEVICE && SHARP_LOCOMO @@ -171,6 +183,13 @@ config BACKLIGHT_PWM If you have a LCD backlight adjustable by PWM, say Y to enable this driver. +config BACKLIGHT_DA903X + tristate "Backlight Driver for DA9030/DA9034 using WLED" + depends on BACKLIGHT_CLASS_DEVICE && PMIC_DA903X + help + If you have a LCD backlight connected to the WLED output of DA9030 + or DA9034 WLED output, say Y here to enable this driver. + config BACKLIGHT_MBP_NVIDIA tristate "MacBook Pro Nvidia Backlight Driver" depends on BACKLIGHT_CLASS_DEVICE && X86 @@ -179,3 +198,19 @@ config BACKLIGHT_MBP_NVIDIA If you have an Apple Macbook Pro with Nvidia graphics hardware say Y to enable a driver for its backlight +config BACKLIGHT_TOSA + tristate "Sharp SL-6000 Backlight Driver" + depends on BACKLIGHT_CLASS_DEVICE && I2C + depends on MACH_TOSA && LCD_TOSA + default n + help + If you have an Sharp SL-6000 Zaurus say Y to enable a driver + for its backlight + +config BACKLIGHT_SAHARA + tristate "Tabletkiosk Sahara Touch-iT Backlight Driver" + depends on BACKLIGHT_CLASS_DEVICE && X86 + default n + help + If you have a Tabletkiosk Sahara Touch-iT, say y to enable the + backlight driver. diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index 3ec551e..103427d 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile @@ -7,6 +7,7 @@ obj-$(CONFIG_LCD_ILI9320) += ili9320.o obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o obj-$(CONFIG_LCD_VGG2432A4) += vgg2432a4.o obj-$(CONFIG_LCD_TDO24M) += tdo24m.o +obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o obj-$(CONFIG_BACKLIGHT_ATMEL_PWM) += atmel-pwm-bl.o @@ -17,5 +18,8 @@ obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o +obj-$(CONFIG_BACKLIGHT_DA903X) += da903x.o obj-$(CONFIG_BACKLIGHT_MBP_NVIDIA) += mbp_nvidia_bl.o +obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o +obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o diff --git a/drivers/video/backlight/da903x.c b/drivers/video/backlight/da903x.c new file mode 100644 index 0000000..242c382 --- /dev/null +++ b/drivers/video/backlight/da903x.c @@ -0,0 +1,201 @@ +/* + * Backlight driver for Dialog Semiconductor DA9030/DA9034 + * + * Copyright (C) 2008 Compulab, Ltd. + * Mike Rapoport <mike@compulab.co.il> + * + * Copyright (C) 2006-2008 Marvell International Ltd. + * Eric Miao <eric.miao@marvell.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/fb.h> +#include <linux/backlight.h> +#include <linux/mfd/da903x.h> + +#define DA9030_WLED_CONTROL 0x25 +#define DA9030_WLED_CP_EN (1 << 6) +#define DA9030_WLED_TRIM(x) ((x) & 0x7) + +#define DA9034_WLED_CONTROL1 0x3C +#define DA9034_WLED_CONTROL2 0x3D + +#define DA9034_WLED_BOOST_EN (1 << 5) + +#define DA9030_MAX_BRIGHTNESS 7 +#define DA9034_MAX_BRIGHTNESS 0x7f + +struct da903x_backlight_data { + struct device *da903x_dev; + int id; + int current_brightness; +}; + +static int da903x_backlight_set(struct backlight_device *bl, int brightness) +{ + struct da903x_backlight_data *data = bl_get_data(bl); + struct device *dev = data->da903x_dev; + uint8_t val; + int ret = 0; + + switch (data->id) { + case DA9034_ID_WLED: + ret = da903x_update(dev, DA9034_WLED_CONTROL1, + brightness, 0x7f); + if (ret) + return ret; + + if (data->current_brightness && brightness == 0) + ret = da903x_clr_bits(dev, + DA9034_WLED_CONTROL2, + DA9034_WLED_BOOST_EN); + + if (data->current_brightness == 0 && brightness) + ret = da903x_set_bits(dev, + DA9034_WLED_CONTROL2, + DA9034_WLED_BOOST_EN); + break; + case DA9030_ID_WLED: + val = DA9030_WLED_TRIM(brightness); + val |= brightness ? DA9030_WLED_CP_EN : 0; + ret = da903x_write(dev, DA9030_WLED_CONTROL, val); + break; + } + + if (ret) + return ret; + + data->current_brightness = brightness; + return 0; +} + +static int da903x_backlight_update_status(struct backlight_device *bl) +{ + int brightness = bl->props.brightness; + + if (bl->props.power != FB_BLANK_UNBLANK) + brightness = 0; + + if (bl->props.fb_blank != FB_BLANK_UNBLANK) + brightness = 0; + + return da903x_backlight_set(bl, brightness); +} + +static int da903x_backlight_get_brightness(struct backlight_device *bl) +{ + struct da903x_backlight_data *data = bl_get_data(bl); + return data->current_brightness; +} + +static struct backlight_ops da903x_backlight_ops = { + .update_status = da903x_backlight_update_status, + .get_brightness = da903x_backlight_get_brightness, +}; + +static int da903x_backlight_probe(struct platform_device *pdev) +{ + struct da903x_backlight_data *data; + struct backlight_device *bl; + int max_brightness; + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (data == NULL) + return -ENOMEM; + + switch (pdev->id) { + case DA9030_ID_WLED: + max_brightness = DA9030_MAX_BRIGHTNESS; + break; + case DA9034_ID_WLED: + max_brightness = DA9034_MAX_BRIGHTNESS; + break; + default: + dev_err(&pdev->dev, "invalid backlight device ID(%d)\n", + pdev->id); + return -EINVAL; + } + + data->id = pdev->id; + data->da903x_dev = pdev->dev.parent; + data->current_brightness = 0; + + bl = backlight_device_register(pdev->name, data->da903x_dev, + data, &da903x_backlight_ops); + if (IS_ERR(bl)) { + dev_err(&pdev->dev, "failed to register backlight\n"); + return PTR_ERR(bl); + } + + bl->props.max_brightness = max_brightness; + bl->props.brightness = max_brightness; + + platform_set_drvdata(pdev, bl); + backlight_update_status(bl); + return 0; +} + +static int da903x_backlight_remove(struct platform_device *pdev) +{ + struct backlight_device *bl = platform_get_drvdata(pdev); + struct da903x_backlight_data *data = bl_get_data(bl); + + backlight_device_unregister(bl); + kfree(data); + return 0; +} + +#ifdef CONFIG_PM +static int da903x_backlight_suspend(struct platform_device *pdev, + pm_message_t state) +{ + struct backlight_device *bl = platform_get_drvdata(pdev); + return da903x_backlight_set(bl, 0); +} + +static int da903x_backlight_resume(struct platform_device *pdev) +{ + struct backlight_device *bl = platform_get_drvdata(pdev); + + backlight_update_status(bl); + return 0; +} +#else +#define da903x_backlight_suspend NULL +#define da903x_backlight_resume NULL +#endif + +static struct platform_driver da903x_backlight_driver = { + .driver = { + .name = "da903x-backlight", + .owner = THIS_MODULE, + }, + .probe = da903x_backlight_probe, + .remove = da903x_backlight_remove, + .suspend = da903x_backlight_suspend, + .resume = da903x_backlight_resume, +}; + +static int __init da903x_backlight_init(void) +{ + return platform_driver_register(&da903x_backlight_driver); +} +module_init(da903x_backlight_init); + +static void __exit da903x_backlight_exit(void) +{ + platform_driver_unregister(&da903x_backlight_driver); +} +module_exit(da903x_backlight_exit); + +MODULE_DESCRIPTION("Backlight Driver for Dialog Semiconductor DA9030/DA9034"); +MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>" + "Mike Rapoport <mike@compulab.co.il>"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:da903x-backlight"); diff --git a/drivers/video/backlight/kb3886_bl.c b/drivers/video/backlight/kb3886_bl.c new file mode 100644 index 0000000..a38fda1 --- /dev/null +++ b/drivers/video/backlight/kb3886_bl.c @@ -0,0 +1,204 @@ +/* + * Backlight Driver for the KB3886 Backlight + * + * Copyright (c) 2007-2008 Claudio Nieder + * + * Based on corgi_bl.c by Richard Purdie and kb3886 driver by Robert Woerle + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/mutex.h> +#include <linux/fb.h> +#include <linux/backlight.h> +#include <linux/delay.h> +#include <linux/dmi.h> + +#define KB3886_PARENT 0x64 +#define KB3886_IO 0x60 +#define KB3886_ADC_DAC_PWM 0xC4 +#define KB3886_PWM0_WRITE 0x81 +#define KB3886_PWM0_READ 0x41 + +static DEFINE_MUTEX(bl_mutex); + +static void kb3886_bl_set_intensity(int intensity) +{ + mutex_lock(&bl_mutex); + intensity = intensity&0xff; + outb(KB3886_ADC_DAC_PWM, KB3886_PARENT); + msleep(10); + outb(KB3886_PWM0_WRITE, KB3886_IO); + msleep(10); + outb(intensity, KB3886_IO); + mutex_unlock(&bl_mutex); +} + +struct kb3886bl_machinfo { + int max_intensity; + int default_intensity; + int limit_mask; + void (*set_bl_intensity)(int intensity); +}; + +static struct kb3886bl_machinfo kb3886_bl_machinfo = { + .max_intensity = 0xff, + .default_intensity = 0xa0, + .limit_mask = 0x7f, + .set_bl_intensity = kb3886_bl_set_intensity, +}; + +static struct platform_device kb3886bl_device = { + .name = "kb3886-bl", + .dev = { + .platform_data = &kb3886_bl_machinfo, + }, + .id = -1, +}; + +static struct platform_device *devices[] __initdata = { + &kb3886bl_device, +}; + +/* + * Back to driver + */ + +static int kb3886bl_intensity; +static struct backlight_device *kb3886_backlight_device; +static struct kb3886bl_machinfo *bl_machinfo; + +static unsigned long kb3886bl_flags; +#define KB3886BL_SUSPENDED 0x01 + +static struct dmi_system_id __initdata kb3886bl_device_table[] = { + { + .ident = "Sahara Touch-iT", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SDV"), + DMI_MATCH(DMI_PRODUCT_NAME, "iTouch T201"), + }, + }, + { } +}; + +static int kb3886bl_send_intensity(struct backlight_device *bd) +{ + int intensity = bd->props.brightness; + + if (bd->props.power != FB_BLANK_UNBLANK) + intensity = 0; + if (bd->props.fb_blank != FB_BLANK_UNBLANK) + intensity = 0; + if (kb3886bl_flags & KB3886BL_SUSPENDED) + intensity = 0; + + bl_machinfo->set_bl_intensity(intensity); + + kb3886bl_intensity = intensity; + return 0; +} + +#ifdef CONFIG_PM +static int kb3886bl_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct backlight_device *bd = platform_get_drvdata(pdev); + + kb3886bl_flags |= KB3886BL_SUSPENDED; + backlight_update_status(bd); + return 0; +} + +static int kb3886bl_resume(struct platform_device *pdev) +{ + struct backlight_device *bd = platform_get_drvdata(pdev); + + kb3886bl_flags &= ~KB3886BL_SUSPENDED; + backlight_update_status(bd); + return 0; +} +#else +#define kb3886bl_suspend NULL +#define kb3886bl_resume NULL +#endif + +static int kb3886bl_get_intensity(struct backlight_device *bd) +{ + return kb3886bl_intensity; +} + +static struct backlight_ops kb3886bl_ops = { + .get_brightness = kb3886bl_get_intensity, + .update_status = kb3886bl_send_intensity, +}; + +static int kb3886bl_probe(struct platform_device *pdev) +{ + struct kb3886bl_machinfo *machinfo = pdev->dev.platform_data; + + bl_machinfo = machinfo; + if (!machinfo->limit_mask) + machinfo->limit_mask = -1; + + kb3886_backlight_device = backlight_device_register("kb3886-bl", + &pdev->dev, NULL, &kb3886bl_ops); + if (IS_ERR(kb3886_backlight_device)) + return PTR_ERR(kb3886_backlight_device); + + platform_set_drvdata(pdev, kb3886_backlight_device); + + kb3886_backlight_device->props.max_brightness = machinfo->max_intensity; + kb3886_backlight_device->props.power = FB_BLANK_UNBLANK; + kb3886_backlight_device->props.brightness = machinfo->default_intensity; + backlight_update_status(kb3886_backlight_device); + + return 0; +} + +static int kb3886bl_remove(struct platform_device *pdev) +{ + struct backlight_device *bd = platform_get_drvdata(pdev); + + backlight_device_unregister(bd); + + return 0; +} + +static struct platform_driver kb3886bl_driver = { + .probe = kb3886bl_probe, + .remove = kb3886bl_remove, + .suspend = kb3886bl_suspend, + .resume = kb3886bl_resume, + .driver = { + .name = "kb3886-bl", + }, +}; + +static int __init kb3886_init(void) +{ + if (!dmi_check_system(kb3886bl_device_table)) + return -ENODEV; + + platform_add_devices(devices, ARRAY_SIZE(devices)); + return platform_driver_register(&kb3886bl_driver); +} + +static void __exit kb3886_exit(void) +{ + platform_driver_unregister(&kb3886bl_driver); +} + +module_init(kb3886_init); +module_exit(kb3886_exit); + +MODULE_AUTHOR("Claudio Nieder <private@claudio.ch>"); +MODULE_DESCRIPTION("Tabletkiosk Sahara Touch-iT Backlight Driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("dmi:*:svnSDV:pniTouchT201:*"); diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c new file mode 100644 index 0000000..43edbad --- /dev/null +++ b/drivers/video/backlight/tosa_bl.c @@ -0,0 +1,198 @@ +/* + * LCD / Backlight control code for Sharp SL-6000x (tosa) + * + * Copyright (c) 2005 Dirk Opfer + * Copyright (c) 2007,2008 Dmitry Baryshkov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/device.h> +#include <linux/spi/spi.h> +#include <linux/i2c.h> +#include <linux/gpio.h> +#include <linux/fb.h> +#include <linux/backlight.h> + +#include <asm/mach/sharpsl_param.h> + +#include <mach/tosa.h> + +#define COMADJ_DEFAULT 97 + +#define DAC_CH1 0 +#define DAC_CH2 1 + +struct tosa_bl_data { + struct i2c_client *i2c; + struct backlight_device *bl; + + int comadj; +}; + +static void tosa_bl_set_backlight(struct tosa_bl_data *data, int brightness) +{ + struct spi_device *spi = data->i2c->dev.platform_data; + + i2c_smbus_write_byte_data(data->i2c, DAC_CH1, data->comadj); + + /* SetBacklightDuty */ + i2c_smbus_write_byte_data(data->i2c, DAC_CH2, (u8)(brightness & 0xff)); + + /* SetBacklightVR */ + gpio_set_value(TOSA_GPIO_BL_C20MA, brightness & 0x100); + + tosa_bl_enable(spi, brightness); +} + +static int tosa_bl_update_status(struct backlight_device *dev) +{ + struct backlight_properties *props = &dev->props; + struct tosa_bl_data *data = dev_get_drvdata(&dev->dev); + int power = max(props->power, props->fb_blank); + int brightness = props->brightness; + + if (power) + brightness = 0; + + tosa_bl_set_backlight(data, brightness); + + return 0; +} + +static int tosa_bl_get_brightness(struct backlight_device *dev) +{ + struct backlight_properties *props = &dev->props; + + return props->brightness; +} + +static struct backlight_ops bl_ops = { + .get_brightness = tosa_bl_get_brightness, + .update_status = tosa_bl_update_status, +}; + +static int __devinit tosa_bl_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct tosa_bl_data *data = kzalloc(sizeof(struct tosa_bl_data), GFP_KERNEL); + int ret = 0; + if (!data) + return -ENOMEM; + + data->comadj = sharpsl_param.comadj == -1 ? COMADJ_DEFAULT : sharpsl_param.comadj; + + ret = gpio_request(TOSA_GPIO_BL_C20MA, "backlight"); + if (ret) { + dev_dbg(&data->bl->dev, "Unable to request gpio!\n"); + goto err_gpio_bl; + } + ret = gpio_direction_output(TOSA_GPIO_BL_C20MA, 0); + if (ret) + goto err_gpio_dir; + + i2c_set_clientdata(client, data); + data->i2c = client; + + data->bl = backlight_device_register("tosa-bl", &client->dev, + data, &bl_ops); + if (IS_ERR(data->bl)) { + ret = PTR_ERR(data->bl); + goto err_reg; + } + + data->bl->props.brightness = 69; + data->bl->props.max_brightness = 512 - 1; + data->bl->props.power = FB_BLANK_UNBLANK; + + backlight_update_status(data->bl); + + return 0; + +err_reg: + data->bl = NULL; + i2c_set_clientdata(client, NULL); +err_gpio_dir: + gpio_free(TOSA_GPIO_BL_C20MA); +err_gpio_bl: + kfree(data); + return ret; +} + +static int __devexit tosa_bl_remove(struct i2c_client *client) +{ + struct tosa_bl_data *data = i2c_get_clientdata(client); + + backlight_device_unregister(data->bl); + data->bl = NULL; + i2c_set_clientdata(client, NULL); + + gpio_free(TOSA_GPIO_BL_C20MA); + + kfree(data); + + return 0; +} + +#ifdef CONFIG_PM +static int tosa_bl_suspend(struct i2c_client *client, pm_message_t pm) +{ + struct tosa_bl_data *data = i2c_get_clientdata(client); + + tosa_bl_set_backlight(data, 0); + + return 0; +} + +static int tosa_bl_resume(struct i2c_client *client) +{ + struct tosa_bl_data *data = i2c_get_clientdata(client); + + backlight_update_status(data->bl); + return 0; +} +#else +#define tosa_bl_suspend NULL +#define tosa_bl_resume NULL +#endif + +static const struct i2c_device_id tosa_bl_id[] = { + { "tosa-bl", 0 }, + { }, +}; + + +static struct i2c_driver tosa_bl_driver = { + .driver = { + .name = "tosa-bl", + .owner = THIS_MODULE, + }, + .probe = tosa_bl_probe, + .remove = __devexit_p(tosa_bl_remove), + .suspend = tosa_bl_suspend, + .resume = tosa_bl_resume, + .id_table = tosa_bl_id, +}; + +static int __init tosa_bl_init(void) +{ + return i2c_add_driver(&tosa_bl_driver); +} + +static void __exit tosa_bl_exit(void) +{ + i2c_del_driver(&tosa_bl_driver); +} + +module_init(tosa_bl_init); +module_exit(tosa_bl_exit); + +MODULE_AUTHOR("Dmitry Baryshkov"); +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("LCD/Backlight control for Sharp SL-6000 PDA"); + diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c new file mode 100644 index 0000000..57a2664 --- /dev/null +++ b/drivers/video/backlight/tosa_lcd.c @@ -0,0 +1,280 @@ +/* + * LCD / Backlight control code for Sharp SL-6000x (tosa) + * + * Copyright (c) 2005 Dirk Opfer + * Copyright (c) 2007,2008 Dmitry Baryshkov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/device.h> +#include <linux/spi/spi.h> +#include <linux/i2c.h> +#include <linux/gpio.h> +#include <linux/delay.h> +#include <linux/lcd.h> +#include <linux/fb.h> + +#include <asm/mach/sharpsl_param.h> + +#include <mach/tosa.h> + +#define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) + +#define TG_REG0_VQV 0x0001 +#define TG_REG0_COLOR 0x0002 +#define TG_REG0_UD 0x0004 +#define TG_REG0_LR 0x0008 + +#define DAC_BASE 0x4e + +struct tosa_lcd_data { + struct spi_device *spi; + struct lcd_device *lcd; + struct i2c_client *i2c; + + int lcd_power; +}; + +static int tosa_tg_send(struct spi_device *spi, int adrs, uint8_t data) +{ + u8 buf[1]; + struct spi_message msg; + struct spi_transfer xfer = { + .len = 1, + .cs_change = 1, + .tx_buf = buf, + }; + + buf[0] = ((adrs & 0x07) << 5) | (data & 0x1f); + spi_message_init(&msg); + spi_message_add_tail(&xfer, &msg); + + return spi_sync(spi, &msg); +} + +int tosa_bl_enable(struct spi_device *spi, int enable) +{ + /* bl_enable GP04=1 otherwise GP04=0*/ + return tosa_tg_send(spi, TG_GPODR2, enable? 0x01 : 0x00); +} +EXPORT_SYMBOL(tosa_bl_enable); + +static void tosa_lcd_tg_init(struct tosa_lcd_data *data) +{ + /* TG on */ + gpio_set_value(TOSA_GPIO_TG_ON, 0); + + mdelay(60); + + /* delayed 0clk TCTL signal for VGA */ + tosa_tg_send(data->spi, TG_TPOSCTL, 0x00); + /* GPOS0=powercontrol, GPOS1=GPIO, GPOS2=TCTL */ + tosa_tg_send(data->spi, TG_GPOSR, 0x02); +} + +static void tosa_lcd_tg_on(struct tosa_lcd_data *data) +{ + struct spi_device *spi = data->spi; + const int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR; + tosa_tg_send(spi, TG_PNLCTL, value | TG_REG0_VQV); /* this depends on mode */ + + /* TG LCD pannel power up */ + tosa_tg_send(spi, TG_PINICTL,0x4); + mdelay(50); + + /* TG LCD GVSS */ + tosa_tg_send(spi, TG_PINICTL,0x0); + + if (!data->i2c) { + /* after the pannel is powered up the first time, we can access the i2c bus */ + /* so probe for the DAC */ + struct i2c_adapter *adap = i2c_get_adapter(0); + struct i2c_board_info info = { + .type = "tosa-bl", + .addr = DAC_BASE, + .platform_data = data->spi, + }; + data->i2c = i2c_new_device(adap, &info); + } +} + +static void tosa_lcd_tg_off(struct tosa_lcd_data *data) +{ + struct spi_device *spi = data->spi; + + /* TG LCD VHSA off */ + tosa_tg_send(spi, TG_PINICTL,0x4); + mdelay(50); + + /* TG LCD signal off */ + tosa_tg_send(spi, TG_PINICTL,0x6); + mdelay(50); + + /* TG Off */ + gpio_set_value(TOSA_GPIO_TG_ON, 1); + mdelay(100); +} + +int tosa_lcd_set_power(struct lcd_device *lcd, int power) +{ + struct tosa_lcd_data *data = lcd_get_data(lcd); + + if (POWER_IS_ON(power) && !POWER_IS_ON(data->lcd_power)) + tosa_lcd_tg_on(data); + + if (!POWER_IS_ON(power) && POWER_IS_ON(data->lcd_power)) + tosa_lcd_tg_off(data); + + data->lcd_power = power; + return 0; +} + +static int tosa_lcd_get_power(struct lcd_device *lcd) +{ + struct tosa_lcd_data *data = lcd_get_data(lcd); + + return data->lcd_power; +} + +static struct lcd_ops tosa_lcd_ops = { + .set_power = tosa_lcd_set_power, + .get_power = tosa_lcd_get_power, +}; + +static int __devinit tosa_lcd_probe(struct spi_device *spi) +{ + int ret; + struct tosa_lcd_data *data; + + data = kzalloc(sizeof(struct tosa_lcd_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + /* + * bits_per_word cannot be configured in platform data + */ + spi->bits_per_word = 8; + + ret = spi_setup(spi); + if (ret < 0) + goto err_spi; + + data->spi = spi; + dev_set_drvdata(&spi->dev, data); + + ret = gpio_request(TOSA_GPIO_TG_ON, "tg #pwr"); + if (ret < 0) + goto err_gpio_tg; + + mdelay(60); + + ret = gpio_direction_output(TOSA_GPIO_TG_ON, 0); + if (ret < 0) + goto err_gpio_dir; + + mdelay(60); + tosa_lcd_tg_init(data); + + tosa_lcd_tg_on(data); + + data->lcd = lcd_device_register("tosa-lcd", &spi->dev, data, + &tosa_lcd_ops); + + if (IS_ERR(data->lcd)) { + ret = PTR_ERR(data->lcd); + data->lcd = NULL; + goto err_register; + } + + return 0; + +err_register: + tosa_lcd_tg_off(data); +err_gpio_dir: + gpio_free(TOSA_GPIO_TG_ON); +err_gpio_tg: + dev_set_drvdata(&spi->dev, NULL); +err_spi: + kfree(data); + return ret; +} + +static int __devexit tosa_lcd_remove(struct spi_device *spi) +{ + struct tosa_lcd_data *data = dev_get_drvdata(&spi->dev); + + lcd_device_unregister(data->lcd); + + if (data->i2c) + i2c_unregister_device(data->i2c); + + tosa_lcd_tg_off(data); + + gpio_free(TOSA_GPIO_TG_ON); + dev_set_drvdata(&spi->dev, NULL); + kfree(data); + + return 0; +} + +#ifdef CONFIG_PM +static int tosa_lcd_suspend(struct spi_device *spi, pm_message_t state) +{ + struct tosa_lcd_data *data = dev_get_drvdata(&spi->dev); + + tosa_lcd_tg_off(data); + + return 0; +} + +static int tosa_lcd_resume(struct spi_device *spi) +{ + struct tosa_lcd_data *data = dev_get_drvdata(&spi->dev); + + tosa_lcd_tg_init(data); + if (POWER_IS_ON(data->lcd_power)) + tosa_lcd_tg_on(data); + else + tosa_lcd_tg_off(data); + + return 0; +} +#else +#define tosa_lcd_suspend NULL +#define tosa_lcd_reume NULL +#endif + +static struct spi_driver tosa_lcd_driver = { + .driver = { + .name = "tosa-lcd", + .owner = THIS_MODULE, + }, + .probe = tosa_lcd_probe, + .remove = __devexit_p(tosa_lcd_remove), + .suspend = tosa_lcd_suspend, + .resume = tosa_lcd_resume, +}; + +static int __init tosa_lcd_init(void) +{ + return spi_register_driver(&tosa_lcd_driver); +} + +static void __exit tosa_lcd_exit(void) +{ + spi_unregister_driver(&tosa_lcd_driver); +} + +module_init(tosa_lcd_init); +module_exit(tosa_lcd_exit); + +MODULE_AUTHOR("Dmitry Baryshkov"); +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("LCD/Backlight control for Sharp SL-6000 PDA"); + |