From owner-freebsd-scsi@FreeBSD.ORG Sun Jun 22 17:52:47 2003 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0507337B401 for ; Sun, 22 Jun 2003 17:52:47 -0700 (PDT) Received: from magic.adaptec.com (magic-mail.adaptec.com [208.236.45.100]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5D6EE43F93 for ; Sun, 22 Jun 2003 17:52:46 -0700 (PDT) (envelope-from scottl@freebsd.org) Received: from redfish.adaptec.com (redfish.adaptec.com [162.62.50.11]) by magic.adaptec.com (8.11.6/8.11.6) with ESMTP id h5N0qD816020; Sun, 22 Jun 2003 17:52:13 -0700 Received: from freebsd.org (hollin.btc.adaptec.com [10.100.253.56]) by redfish.adaptec.com (8.8.8p2+Sun/8.8.8) with ESMTP id RAA07326; Sun, 22 Jun 2003 17:52:43 -0700 (PDT) Message-ID: <3EF64F6F.7060702@freebsd.org> Date: Sun, 22 Jun 2003 18:53:03 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3.1) Gecko/20030425 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Nick Twaddell References: <013101c33882$24e8db10$0700a8c0@BEASTIE> In-Reply-To: <013101c33882$24e8db10$0700a8c0@BEASTIE> Content-Type: multipart/mixed; boundary="------------030603000308050403020500" cc: freebsd-scsi@freebsd.org Subject: Re: ServeRaid 4Lx + FreeBSD 5.1-Current Panic X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jun 2003 00:52:47 -0000 This is a multi-part message in MIME format. --------------030603000308050403020500 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit The attached patch come from Matt Jacob and might help with your problems. I haven't tested it out yet. Scott Nick Twaddell wrote: > Two weeks ago I tried the 5.1-RELEASE and got a kernel panic. So I just > downloaded last nights snapshot iso and this is the error im getting... > > Ips0: failed to get configuration data from device > Device_probe_and_attach: ips0 attach returned 6 > > The error I got on the -RELEASE cd 2 weeks ago was... > > Fatal trap 12: page fault while in kernel mode > Fault code = supervisor read, page not present > Instruction pointer = 0x8:0xc29ee760 > Stack pointer = 0x10:0xcd33fce4 > Frame pointer = 0x10:0xcd33fd0c > Code segment = base 0x0, limit 0xfffff, type 0x1b > = DPL 0, pres 1, def32 1, gran 1 > Processor eflags = interupt enabled, resume, IOPL = 0 > Current process = 29 (irq9: ahc0 ips0) > Trap number = 12 > > Panic = page fault > > Has anyone tried a serveraid card with freebsd yet? Scott Long maybe > your input might be helpful here :) All help is greatly appreciated. > > Thanks > > Nick Twaddell > > _______________________________________________ > freebsd-scsi@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-scsi > To unsubscribe, send any mail to "freebsd-scsi-unsubscribe@freebsd.org" > --------------030603000308050403020500 Content-Type: text/plain; name="IPS_PATCH" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="IPS_PATCH" Index: ips.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ips/ips.c,v retrieving revision 1.1 diff -u -r1.1 ips.c --- ips.c 11 May 2003 06:36:49 -0000 1.1 +++ ips.c 19 Jun 2003 17:03:41 -0000 @@ -322,6 +322,7 @@ /* check card and initialize it */ int ips_adapter_init(ips_softc_t *sc) { + int i; DEVICE_PRINTF(1,sc->dev, "initializing\n"); if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag, /* alignemnt */ 1, @@ -359,13 +360,18 @@ can handle */ sc->max_cmds = 1; ips_cmdqueue_init(sc); + callout_handle_init(&sc->timer); if(sc->ips_adapter_reinit(sc, 0)) goto error; mtx_init(&sc->cmd_mtx, "ips command mutex", NULL, MTX_DEF); - if(ips_get_adapter_info(sc) || ips_get_drive_info(sc)){ - device_printf(sc->dev, "failed to get configuration data from device\n"); + if ((i = ips_get_adapter_info(sc)) != 0) { + device_printf(sc->dev, "failed to get adapter configuration data from device (%d)\n", i); + goto error; + } + if ((i = ips_get_drive_info(sc)) != 0) { + device_printf(sc->dev, "failed to get drive configuration data from device (%d)\n", i); goto error; } ips_update_nvram(sc); /* no error check as failure doesn't matter */ Index: ips.h =================================================================== RCS file: /home/ncvs/src/sys/dev/ips/ips.h,v retrieving revision 1.1 diff -u -r1.1 ips.h --- ips.h 11 May 2003 06:36:49 -0000 1.1 +++ ips.h 19 Jun 2003 17:05:00 -0000 @@ -343,7 +343,8 @@ typedef struct ips_softc{ struct resource * iores; struct resource * irqres; - int state; + int configured; + int state; int iotype; int rid; int irqrid; Index: ips_commands.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ips/ips_commands.c,v retrieving revision 1.1 diff -u -r1.1 ips_commands.c --- ips_commands.c 11 May 2003 06:36:49 -0000 1.1 +++ ips_commands.c 19 Jun 2003 17:04:27 -0000 @@ -266,7 +266,7 @@ { int error = 0; ips_cmd_status_t *status; - status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT); + status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO); if(!status) return ENOMEM; if(ips_get_free_cmd(sc, ips_send_adapter_info_cmd, status, @@ -275,7 +275,7 @@ free(status, M_DEVBUF); return ENXIO; } - if(COMMAND_ERROR(status)){ + if (COMMAND_ERROR(status)){ error = ENXIO; } free(status, M_DEVBUF); @@ -372,7 +372,7 @@ { int error = 0; ips_cmd_status_t *status; - status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT); + status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO); if(!status) return ENOMEM; if(ips_get_free_cmd(sc, ips_send_drive_info_cmd, status, @@ -415,7 +415,7 @@ int ips_flush_cache(ips_softc_t *sc) { ips_cmd_status_t *status; - status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT); + status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO); if(!status) return ENOMEM; device_printf(sc->dev, "flushing cache\n"); @@ -534,7 +534,7 @@ int ips_update_nvram(ips_softc_t *sc) { ips_cmd_status_t *status; - status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT); + status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO); if(!status) return ENOMEM; if(ips_get_free_cmd(sc, ips_read_nvram, status, IPS_NOWAIT_FLAG)){ @@ -602,7 +602,7 @@ int ips_clear_adapter(ips_softc_t *sc) { ips_cmd_status_t *status; - status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT); + status = malloc(sizeof(ips_cmd_status_t), M_DEVBUF, M_NOWAIT|M_ZERO); if(!status) return ENOMEM; device_printf(sc->dev, "syncing config\n"); Index: ips_pci.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ips/ips_pci.c,v retrieving revision 1.1 diff -u -r1.1 ips_pci.c --- ips_pci.c 11 May 2003 06:36:49 -0000 1.1 +++ ips_pci.c 19 Jun 2003 17:05:27 -0000 @@ -50,8 +50,17 @@ static int ips_pci_attach(device_t dev) { u_int32_t command; + int tval; ips_softc_t *sc; + + tval = 0; + if (resource_int_value(device_get_name(dev), device_get_unit(dev), + "disable", &tval) == 0 && tval) { + device_printf(dev, "device is disabled\n"); + /* but return 0 so the !$)$)*!$*) unit isn't reused */ + return (0); + } DEVICE_PRINTF(1, dev, "in attach.\n"); sc = (ips_softc_t *)device_get_softc(dev); if(!sc){ @@ -125,6 +134,7 @@ } if(ips_adapter_init(sc)) goto error; + sc->configured = 1; return 0; error: ips_pci_free(sc); @@ -141,6 +151,7 @@ bus_release_resource(sc->dev, SYS_RES_IRQ, sc->irqrid, sc->irqres); if(sc->iores) bus_release_resource(sc->dev, sc->iotype, sc->rid, sc->iores); + sc->configured = 0; return 0; } @@ -149,18 +160,23 @@ ips_softc_t *sc; DEVICE_PRINTF(1, dev, "detaching ServeRaid\n"); sc = (ips_softc_t *) device_get_softc(dev); - ips_flush_cache(sc); - if(ips_adapter_free(sc)) - return EBUSY; - ips_pci_free(sc); - mtx_destroy(&sc->cmd_mtx); + if (sc->configured) { + sc->configured = 0; + ips_flush_cache(sc); + if(ips_adapter_free(sc)) + return EBUSY; + ips_pci_free(sc); + mtx_destroy(&sc->cmd_mtx); + } return 0; } static int ips_pci_shutdown(device_t dev) { ips_softc_t *sc = (ips_softc_t *) device_get_softc(dev); - ips_flush_cache(sc); + if (sc->configured) { + ips_flush_cache(sc); + } return 0; } --------------030603000308050403020500--