From 50630195bbdfe1ca775d94cd68a5f18bc1b717e4 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Tue, 13 Dec 2005 02:29:45 -0500 Subject: [PATCH 1/6] [libata] mark certain hardware (or drivers) with a no-atapi flag Some hardware does not support the PACKET command at all. Other hardware supports ATAPI, but the driver does something nasty such as calling BUG() when an ATAPI command is issued. For these such cases, we mark them with a new flag, ATA_FLAG_NO_ATAPI. Initial version contributed by Ben Collins. --- drivers/scsi/libata-scsi.c | 7 +++++-- drivers/scsi/sata_mv.c | 3 ++- drivers/scsi/sata_promise.c | 12 ++++++------ drivers/scsi/sata_sx4.c | 3 ++- include/linux/libata.h | 1 + 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 379e87089764..72ddba98f8fb 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c @@ -2173,9 +2173,12 @@ ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev) if (unlikely(!ata_dev_present(dev))) return NULL; - if (!atapi_enabled) { - if (unlikely(dev->class == ATA_DEV_ATAPI)) + if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) { + if (unlikely(dev->class == ATA_DEV_ATAPI)) { + printk(KERN_WARNING "ata%u(%u): WARNING: ATAPI is %s, device ignored.\n", + ap->id, dev->devno, atapi_enabled ? "not supported with this driver" : "disabled"); return NULL; + } } return dev; diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index ab7432a5778e..9321cdf45680 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -86,7 +86,8 @@ enum { MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | - ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO), + ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | + ATA_FLAG_NO_ATAPI), MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, CRQB_FLAG_READ = (1 << 0), diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index 8a8e3e3ef0ed..2691625f9bce 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c @@ -70,6 +70,9 @@ enum { PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */ PDC_RESET = (1 << 11), /* HDMA reset */ + + PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | + ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI, }; @@ -162,8 +165,7 @@ static struct ata_port_info pdc_port_info[] = { /* board_2037x */ { .sht = &pdc_ata_sht, - .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | - ATA_FLAG_SRST | ATA_FLAG_MMIO, + .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, .pio_mask = 0x1f, /* pio0-4 */ .mwdma_mask = 0x07, /* mwdma0-2 */ .udma_mask = 0x7f, /* udma0-6 ; FIXME */ @@ -173,8 +175,7 @@ static struct ata_port_info pdc_port_info[] = { /* board_20319 */ { .sht = &pdc_ata_sht, - .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | - ATA_FLAG_SRST | ATA_FLAG_MMIO, + .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, .pio_mask = 0x1f, /* pio0-4 */ .mwdma_mask = 0x07, /* mwdma0-2 */ .udma_mask = 0x7f, /* udma0-6 ; FIXME */ @@ -184,8 +185,7 @@ static struct ata_port_info pdc_port_info[] = { /* board_20619 */ { .sht = &pdc_ata_sht, - .host_flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | - ATA_FLAG_MMIO | ATA_FLAG_SLAVE_POSS, + .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS, .pio_mask = 0x1f, /* pio0-4 */ .mwdma_mask = 0x07, /* mwdma0-2 */ .udma_mask = 0x7f, /* udma0-6 ; FIXME */ diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index dcc3ad9a9d6e..ac7b0d819ebc 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c @@ -220,7 +220,8 @@ static struct ata_port_info pdc_port_info[] = { { .sht = &pdc_sata_sht, .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | - ATA_FLAG_SRST | ATA_FLAG_MMIO, + ATA_FLAG_SRST | ATA_FLAG_MMIO | + ATA_FLAG_NO_ATAPI, .pio_mask = 0x1f, /* pio0-4 */ .mwdma_mask = 0x07, /* mwdma0-2 */ .udma_mask = 0x7f, /* udma0-6 ; FIXME */ diff --git a/include/linux/libata.h b/include/linux/libata.h index f2dbb684ce9e..41ea7dbc1755 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -122,6 +122,7 @@ enum { ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once * proper HSM is in place. */ ATA_FLAG_DEBUGMSG = (1 << 10), + ATA_FLAG_NO_ATAPI = (1 << 11), /* No ATAPI support */ ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ From 2bd0fa3b62e8565a80f9535e0f2bd51bba46213f Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Tue, 13 Dec 2005 03:05:03 -0500 Subject: [PATCH 2/6] [PATCH] add boot option to control Intel SATA/PATA combined mode Combined mode sucks. Especially when both libata and the legacy IDE drivers try to drive ports on the same device, since that makes DMA rather difficult. This patch addresses the problem by allowing the user to control which driver binds to the ports in a combined mode configuration. In many cases, they'll probably want the libata driver to control both ports since it can use DMA for talking with ATAPI devices (when libata.atapi_enabled=1 of course). It also allows the user to get old school behavior by letting the legacy IDE driver bind to both ports. But neither is forced, the patch doesn't change current behavior unless one of combined_mode=ide or combined_mode=libata is passed on the boot line. Either of those options may require you to access your devices via different device nodes (/dev/hd* in the ide case and /dev/sd* in the libata case), though of course if you have udev installed nicely you may not notice anything. :) Let me know if the documentation is too cryptic, I'd be happy to expand on it if necessary. I think most users will want to boot with 'combined_mode=libata' and add 'options libata atapi_enabled=1' to their modules.conf to get good DVD playing and disk behavior (haven't tested CD or DVD writing though). I'd much rather things behave sanely by default (i.e. DMA for devices on both ports), but apparently that's difficult given the various chip bugs and hardware configs out there (not to mention that people's drives may suddenly change from /dev/hdc to /dev/sdb), so this boot option may be the correct long term fix. Signed-off-by: Jesse Barnes Signed-off-by: Jeff Garzik --- Documentation/kernel-parameters.txt | 8 ++++++++ drivers/pci/quirks.c | 30 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 5dffcfefc3c7..61a56b100c62 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -633,6 +633,14 @@ running once the system is up. inport.irq= [HW] Inport (ATI XL and Microsoft) busmouse driver Format: + combined_mode= [HW] control which driver uses IDE ports in combined + mode: legacy IDE driver, libata, or both + (in the libata case, libata.atapi_enabled=1 may be + useful as well). Note that using the ide or libata + options may affect your device naming (e.g. by + changing hdc to sdb). + Format: combined (default), ide, or libata + inttest= [IA64] io7= [HW] IO7 for Marvel based alpha systems diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 3a4f49f4effb..f28ebdd3958a 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1098,6 +1098,23 @@ static void __init quirk_alder_ioapic(struct pci_dev *pdev) DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic ); #endif +enum ide_combined_type { COMBINED = 0, IDE = 1, LIBATA = 2 }; +/* Defaults to combined */ +static enum ide_combined_type combined_mode; + +static int __init combined_setup(char *str) +{ + if (!strncmp(str, "ide", 3)) + combined_mode = IDE; + else if (!strncmp(str, "libata", 6)) + combined_mode = LIBATA; + else /* "combined" or anything else defaults to old behavior */ + combined_mode = COMBINED; + + return 1; +} +__setup("combined_mode=", combined_setup); + #ifdef CONFIG_SCSI_SATA_INTEL_COMBINED static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev) { @@ -1164,6 +1181,19 @@ static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev) if (prog & comb) return; + /* Don't reserve any so the IDE driver can get them (but only if + * combined_mode=ide). + */ + if (combined_mode == IDE) + return; + + /* Grab them both for libata if combined_mode=libata. */ + if (combined_mode == LIBATA) { + request_region(0x1f0, 8, "libata"); /* port 0 */ + request_region(0x170, 8, "libata"); /* port 1 */ + return; + } + /* SATA port is in legacy mode. Reserve port so that * IDE driver does not attempt to use it. If request_region * fails, it will be obvious at boot time, so we don't bother From 98684a9d91bceff829b6dc7adf0f662d59cfa6e3 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Tue, 13 Dec 2005 11:35:22 -0500 Subject: [PATCH 3/6] [netdrvr skge] fix build --- drivers/net/skge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 8b6e2a11e28d..00d683063c01 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -2280,7 +2280,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) } if (unlikely(skge->tx_avail < skb_shinfo(skb)->nr_frags +1)) { - if (!netif_stopped(dev)) { + if (!netif_queue_stopped(dev)) { netif_stop_queue(dev); printk(KERN_WARNING PFX "%s: ring full when queue awake!\n", From 83bab9a4bbf91af93f45233dc288c4d26308e281 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 13 Dec 2005 02:58:07 +0100 Subject: [PATCH 4/6] [PATCH] allow KOBJECT_UEVENT=n only if EMBEDDED KOBJECT_UEVENT=n seems to be a common pitfall for udev users in 2.6.14 . -mm already contains a bigger patch removing this option that is IMHO too big for being applied now to 2.6.15-rc. This patch simply allows KOBJECT_UEVENT=n only if EMBEDDED. Signed-off-by: Adrian Bunk Signed-off-by: Linus Torvalds --- init/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/Kconfig b/init/Kconfig index ea097e0a9c02..59344616f477 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -206,7 +206,7 @@ config HOTPLUG outside the kernel tree does. Such modules require Y here. config KOBJECT_UEVENT - bool "Kernel Userspace Events" + bool "Kernel Userspace Events" if EMBEDDED depends on NET default y help From eed66cfcbbea851c97e287440d940286fce3f829 Mon Sep 17 00:00:00 2001 From: Tony Luck Date: Tue, 13 Dec 2005 10:41:49 -0800 Subject: [PATCH 5/6] [IA64] Split 16-bit severity field in sal_log_record_header ERR_SEVERITY item is defined as a 8 bits item in SAL documentation ($B.2.1 rev december 2003), but as an u16 in sal.h. This has the side effect that current code in mca.c may not call ia64_sal_clear_state_info() upon receiving corrected platform errors if there are bits set in the validation byte. Reported by Xavier Bru. Signed-off-by: Tony Luck --- include/asm-ia64/sal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h index 29df88bdd2bc..313cad0628d0 100644 --- a/include/asm-ia64/sal.h +++ b/include/asm-ia64/sal.h @@ -320,7 +320,8 @@ typedef struct sal_log_timestamp { typedef struct sal_log_record_header { u64 id; /* Unique monotonically increasing ID */ sal_log_revision_t revision; /* Major and Minor revision of header */ - u16 severity; /* Error Severity */ + u8 severity; /* Error Severity */ + u8 validation_bits; /* 0: platform_guid, 1: !timestamp */ u32 len; /* Length of this error log in bytes */ sal_log_timestamp_t timestamp; /* Timestamp */ efi_guid_t platform_guid; /* Unique OEM Platform ID */ From 0910b444bcd7ea7f437a3ff48e0e3d2495ead22e Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 13 Dec 2005 11:39:05 -0800 Subject: [PATCH 6/6] Expose "Optimize for size" option for everybody Let's put my money where my mouth is. Smaller code is almost always faster, if only because a single I$ miss ends up leaving a lot of cycles to make up for. And system software - kernels in particular - are known for taking more cache misses than most other kinds. On my random config, this made the kernel about 10% smaller, and lmbench seems to say that it's pretty uniformly faster too. Your milage may vary. Signed-off-by: Linus Torvalds --- init/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/Kconfig b/init/Kconfig index 59344616f477..be74adb389ea 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -339,7 +339,7 @@ config EPOLL support for epoll family of system calls. config CC_OPTIMIZE_FOR_SIZE - bool "Optimize for size" if EMBEDDED + bool "Optimize for size" default y if ARM || H8300 help Enabling this option will pass "-Os" instead of "-O2" to gcc