From 35e050281e55d71fbb0e061714b905c8b0166b2a Mon Sep 17 00:00:00 2001 From: Scott Long Date: Sun, 23 Jan 2005 23:25:41 +0000 Subject: [PATCH] Add support for the LSI 320-2E PCI-Express controller. Fix a couple of bugs in the ioctl handler. Update the LSI copyrights for these. Obtained from: LSI, Corp --- sys/dev/amr/amr.c | 14 +++++++++----- sys/dev/amr/amr_pci.c | 7 +++++-- sys/dev/amr/amrreg.h | 2 +- sys/dev/amr/amrvar.h | 2 ++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index 3b9d317b2bbd..72dd89f7f6b0 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -27,7 +27,7 @@ */ /*- * Copyright (c) 2002 Eric Moore - * Copyright (c) 2002 LSI Logic Corporation + * Copyright (c) 2002, 2004 LSI Logic Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -463,8 +463,12 @@ amr_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, d_thread_t * dp = NULL; ac = NULL; + /* Logical Drive not supported by the driver */ + if (au_cmd[0] == 0xa4 && au_cmd[1] == 0x1c) + return (ENOIOCTL); + /* handle inbound data buffer */ - if (au_length != 0) { + if (au_length != 0 && au_cmd[0] != 0x06) { if ((dp = malloc(au_length, M_DEVBUF, M_WAITOK)) == NULL) return(ENOMEM); @@ -1049,7 +1053,7 @@ amr_quartz_poll_command1(struct amr_softc *sc, struct amr_command *ac) { int count, error; - if ((sc->amr_state & AMR_STATE_CRASHDUMP) == 0) { + if ((sc->amr_state & AMR_STATE_INTEN) == 0) { count=0; while (sc->amr_busyslots) { msleep(sc, &sc->amr_io_lock, PRIBIO | PCATCH, "amrpoll", hz); @@ -1924,7 +1928,7 @@ amr_dump_blocks(struct amr_softc *sc, int unit, u_int32_t lba, void *data, int b debug_called(1); - sc->amr_state |= AMR_STATE_CRASHDUMP; + sc->amr_state |= AMR_STATE_INTEN; /* get ourselves a command buffer */ if ((ac = amr_alloccmd(sc)) == NULL) @@ -1951,7 +1955,7 @@ amr_dump_blocks(struct amr_softc *sc, int unit, u_int32_t lba, void *data, int b if (ac != NULL) amr_releasecmd(ac); - sc->amr_state &= ~AMR_STATE_CRASHDUMP; + sc->amr_state &= ~AMR_STATE_INTEN; return (error); } diff --git a/sys/dev/amr/amr_pci.c b/sys/dev/amr/amr_pci.c index d408eefe3c2d..c70159babfd7 100644 --- a/sys/dev/amr/amr_pci.c +++ b/sys/dev/amr/amr_pci.c @@ -26,7 +26,7 @@ */ /*- * Copyright (c) 2002 Eric Moore - * Copyright (c) 2002 LSI Logic Corporation + * Copyright (c) 2002, 2004 LSI Logic Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -128,6 +128,8 @@ static struct {0x101e, 0x1960, 0}, {0x1000, 0x1960, PROBE_SIGNATURE}, {0x1000, 0x0407, 0}, + {0x1000, 0x0408, 0}, + {0x1000, 0x0409, 0}, {0x1028, 0x000e, PROBE_SIGNATURE}, /* perc4/di i960 */ {0x1028, 0x000f, 0}, /* perc4/di Verde*/ {0x1028, 0x0013, 0}, /* perc4/di */ @@ -151,7 +153,7 @@ amr_pci_probe(device_t dev) if ((sig != AMR_SIGNATURE_1) && (sig != AMR_SIGNATURE_2)) continue; } - device_set_desc(dev, "LSILogic MegaRAID"); + device_set_desc(dev, LSI_DESC_PCI); return(-10); /* allow room to be overridden */ } } @@ -183,6 +185,7 @@ amr_pci_attach(device_t dev) */ command = pci_read_config(dev, PCIR_COMMAND, 1); if ((pci_get_device(dev) == 0x1960) || (pci_get_device(dev) == 0x0407) || + (pci_get_device(dev) == 0x0408) || (pci_get_device(dev) == 0x0409) || (pci_get_device(dev) == 0x000e) || (pci_get_device(dev) == 0x000f) || (pci_get_device(dev) == 0x0013)) { /* diff --git a/sys/dev/amr/amrreg.h b/sys/dev/amr/amrreg.h index 07850382f0a6..f08b113b7343 100644 --- a/sys/dev/amr/amrreg.h +++ b/sys/dev/amr/amrreg.h @@ -82,7 +82,7 @@ #define AMR_LIMITCMD 120 /* maximum count of outstanding commands */ #define AMR_MAXLD 40 -#define AMR_MAX_CHANNELS 4 +#define AMR_MAX_CHANNELS 8 #define AMR_MAX_TARGETS 15 #define AMR_MAX_LUNS 7 #define AMR_MAX_SCSI_CMDS (15 * AMR_MAX_CHANNELS) /* one for every target? */ diff --git a/sys/dev/amr/amrvar.h b/sys/dev/amr/amrvar.h index a36b68405a95..3af12a35063e 100644 --- a/sys/dev/amr/amrvar.h +++ b/sys/dev/amr/amrvar.h @@ -62,6 +62,8 @@ # include #endif +#define LSI_DESC_PCI "LSILogic MegaRAID 1.51" + #ifdef AMR_DEBUG # define debug(level, fmt, args...) do {if (level <= AMR_DEBUG) printf("%s: " fmt "\n", __func__ , ##args);} while(0) # define debug_called(level) do {if (level <= AMR_DEBUG) printf("%s: called\n", __func__);} while(0)