PERFORCE change 111409 for review
Sam Leffler
sam at FreeBSD.org
Sun Dec 10 14:59:41 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=111409
Change 111409 by sam at sam_ebb on 2006/12/10 22:58:22
IFC near 111408
Affected files ...
.. //depot/projects/crypto/sys/arm/at91/uart_dev_at91usart.c#2 integrate
.. //depot/projects/crypto/sys/arm/xscale/ixp425/files.ixp425#2 integrate
.. //depot/projects/crypto/sys/cam/cam_xpt.c#3 integrate
.. //depot/projects/crypto/sys/conf/NOTES#2 integrate
.. //depot/projects/crypto/sys/conf/files#6 integrate
.. //depot/projects/crypto/sys/conf/options#3 integrate
.. //depot/projects/crypto/sys/dev/bce/if_bce.c#2 integrate
.. //depot/projects/crypto/sys/dev/isp/isp_freebsd.c#3 integrate
.. //depot/projects/crypto/sys/dev/isp/isp_pci.c#2 integrate
.. //depot/projects/crypto/sys/dev/isp/isp_sbus.c#2 integrate
.. //depot/projects/crypto/sys/dev/isp/ispmbox.h#2 integrate
.. //depot/projects/crypto/sys/dev/ispfw/ispfw.c#2 integrate
.. //depot/projects/crypto/sys/dev/iwi/if_iwi.c#2 integrate
.. //depot/projects/crypto/sys/dev/mpt/mpt.c#3 integrate
.. //depot/projects/crypto/sys/dev/mpt/mpt.h#3 integrate
.. //depot/projects/crypto/sys/dev/mpt/mpt_cam.c#3 integrate
.. //depot/projects/crypto/sys/dev/mpt/mpt_debug.c#2 integrate
.. //depot/projects/crypto/sys/dev/mpt/mpt_pci.c#2 integrate
.. //depot/projects/crypto/sys/dev/mpt/mpt_raid.c#3 integrate
.. //depot/projects/crypto/sys/dev/ral/rt2560.c#2 integrate
.. //depot/projects/crypto/sys/dev/ral/rt2661.c#2 integrate
.. //depot/projects/crypto/sys/dev/sound/pci/hda/hdac.c#3 integrate
.. //depot/projects/crypto/sys/dev/sound/pcm/channel.c#2 integrate
.. //depot/projects/crypto/sys/dev/sound/pcm/dsp.c#2 integrate
.. //depot/projects/crypto/sys/fs/msdosfs/msdosfs_vfsops.c#2 integrate
.. //depot/projects/crypto/sys/fs/unionfs/union_subr.c#3 integrate
.. //depot/projects/crypto/sys/fs/unionfs/union_vfsops.c#3 integrate
.. //depot/projects/crypto/sys/fs/unionfs/union_vnops.c#3 integrate
.. //depot/projects/crypto/sys/isofs/cd9660/cd9660_node.h#2 integrate
.. //depot/projects/crypto/sys/kern/vfs_export.c#2 integrate
.. //depot/projects/crypto/sys/modules/isp/Makefile#2 integrate
.. //depot/projects/crypto/sys/net/if_ethersubr.c#2 integrate
.. //depot/projects/crypto/sys/netinet/ip_output.c#2 integrate
.. //depot/projects/crypto/sys/pci/if_xl.c#3 integrate
.. //depot/projects/crypto/sys/powerpc/powerpc/intr_machdep.c#2 integrate
.. //depot/projects/crypto/sys/sparc64/sparc64/elf_machdep.c#2 integrate
.. //depot/projects/crypto/sys/sun4v/mdesc/mdesc_vdevfindval.c#2 integrate
.. //depot/projects/crypto/sys/sun4v/sun4v/mp_machdep.c#2 integrate
.. //depot/projects/crypto/sys/sun4v/sun4v/pmap.c#3 integrate
.. //depot/projects/crypto/sys/sun4v/sun4v/trap.c#3 integrate
.. //depot/projects/crypto/sys/sun4v/sun4v/uio_machdep.c#2 integrate
.. //depot/projects/crypto/sys/sun4v/sun4v/vnex.c#2 integrate
.. //depot/projects/crypto/sys/vm/vm_page.c#2 integrate
Differences ...
==== //depot/projects/crypto/sys/arm/at91/uart_dev_at91usart.c#2 (text) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/at91/uart_dev_at91usart.c,v 1.9 2006/07/20 21:03:43 cognet Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/at91/uart_dev_at91usart.c,v 1.10 2006/12/07 00:24:15 cognet Exp $");
#include "opt_comconsole.h"
@@ -323,7 +323,10 @@
static int
at91_usart_bus_attach(struct uart_softc *sc)
{
- int err, i;
+#ifndef SKYEYE_WORKAROUNDS
+ int err;
+ int i;
+#endif
uint32_t cr;
struct at91_usart_softc *atsc;
@@ -345,6 +348,7 @@
sc->sc_rxfifosz = USART_BUFFER_SIZE;
sc->sc_hwiflow = 0;
+#ifndef SKYEYE_WORKAROUNDS
/*
* Allocate DMA tags and maps
*/
@@ -374,6 +378,7 @@
atsc->ping = &atsc->ping_pong[0];
atsc->pong = &atsc->ping_pong[1];
}
+#endif
/*
* Prime the pump with the RX buffer. We use two 64 byte bounce
@@ -407,9 +412,13 @@
WR4(&sc->sc_bas, USART_IER, USART_CSR_RXRDY);
}
WR4(&sc->sc_bas, USART_IER, USART_CSR_RXBRK);
+#ifndef SKYEYE_WORKAROUNDS
errout:;
// XXX bad
return (err);
+#else
+ return (0);
+#endif
}
static int
==== //depot/projects/crypto/sys/arm/xscale/ixp425/files.ixp425#2 (text+ko) ====
@@ -1,4 +1,4 @@
-#$FreeBSD: src/sys/arm/xscale/ixp425/files.ixp425,v 1.1 2006/11/19 23:55:23 sam Exp $
+#$FreeBSD: src/sys/arm/xscale/ixp425/files.ixp425,v 1.2 2006/12/07 00:49:33 sam Exp $
arm/arm/cpufunc_asm_xscale.S standard
arm/arm/irq_dispatch.S standard
arm/xscale/ixp425/ixp425.c standard
@@ -18,7 +18,11 @@
#
# NPE-based Ethernet support (requires qmgr also). Note the
# firmware images must be downloaded from the Intel web site.
+# The URL seems to change frequently; try this as a starting
+# place:
#
+# http://www.intel.com/design/network/products/npfamily/download_ixp400.htm
+#
arm/xscale/ixp425/if_npe.c optional npe
arm/xscale/ixp425/ixp425_npe.c optional npe
ixp425_npe_fw.c optional npe_fw \
@@ -31,10 +35,15 @@
# get known values for reference in the _fw.c file.
#
IxNpeMicrocode.fwo optional npe_fw \
- dependency "$S/arm/xscale/ixp425/IxNpeMicrocode.dat" \
- compile-with "ln -sf $S/arm/xscale/ixp425/IxNpeMicrocode.dat ${.OBJDIR}; ${LD} -b binary -d -warn-common -r -d -o ${.TARGET} IxNpeMicrocode.dat" \
+ dependency "IxNpeMicrocode.dat" \
+ compile-with "${LD} -b binary -d -warn-common -r -d -o ${.TARGET} IxNpeMicrocode.dat" \
no-implicit-rule \
- clean "IxNpeMicrocode.dat IxNpeMicrocode.fwo"
+ clean "IxNpeMicrocode.fwo"
+IxNpeMicrocode.dat optional npe_fw \
+ dependency ".PHONY" \
+ compile-with "if [ -e $S/arm/xscale/ixp425/IxNpeMicrocode.dat ]; then ln -sf $S/arm/xscale/ixp425/IxNpeMicrocode.dat .; else echo 'WARNING, no IxNpeMicrocode.dat file; you must obtain this from the Intel web site'; false; fi" \
+ no-obj no-implicit-rule \
+ clean "IxNpeMicrocode.dat"
#
# Q-Manager support
#
==== //depot/projects/crypto/sys/cam/cam_xpt.c#3 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.170 2006/12/05 07:45:27 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.171 2006/12/10 05:37:48 mjacob Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -1697,7 +1697,7 @@
if (path->device->inq_flags & SID_CmdQue
|| path->device->flags & CAM_DEV_TAG_AFTER_COUNT) {
- printf("\n%s%d: Tagged Queueing Enabled",
+ printf("\n%s%d: Command Queueing Enabled",
periph->periph_name, periph->unit_number);
}
printf("\n");
==== //depot/projects/crypto/sys/conf/NOTES#2 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1400 2006/11/15 09:13:24 maxim Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1401 2006/12/10 04:23:23 mjacob Exp $
#
# NOTES -- Lines that can be cut/pasted into kernel and hints configs.
#
@@ -110,6 +110,21 @@
#
options BLKDEV_IOSIZE=8192
+#
+# MAXPHYS and DFLTPHYS
+#
+# These are the max and default 'raw' I/O block device access sizes.
+# Reads and writes will be split into DFLTPHYS chunks. Some applications
+# have better performance with larger raw I/O access sizes. Typically
+# MAXPHYS should be twice the size of DFLTPHYS. Note that certain VM
+# parameters are derived from these values and making them too large
+# can make an an unbootable kernel.
+#
+# The defaults are 64K and 128K respectively.
+options DFLTPHYS=(64*1024)
+options MAXPHYS=(128*1024)
+
+
# Options for the VM subsystem
# Deprecated options supported for backwards compatibility
#options PQ_NOOPT # No coloring
==== //depot/projects/crypto/sys/conf/files#6 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1165 2006/11/29 08:08:30 imp Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1166 2006/12/10 01:10:08 imp Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -739,7 +739,6 @@
dev/mii/pnaphy.c optional miibus | pnaphy
dev/mii/qsphy.c optional miibus | qsphy
dev/mii/rgephy.c optional miibus | rgephy
-# XXX rl and re only?
dev/mii/rlphy.c optional miibus | rlphy
# XXX rue only?
dev/mii/ruephy.c optional miibus | ruephy
==== //depot/projects/crypto/sys/conf/options#3 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options,v 1.566 2006/11/30 04:17:04 jb Exp $
+# $FreeBSD: src/sys/conf/options,v 1.567 2006/12/10 04:23:23 mjacob Exp $
#
# On the handling of kernel options
#
@@ -535,6 +535,8 @@
# These cause changes all over the kernel
BLKDEV_IOSIZE opt_global.h
+MAXPHYS opt_global.h
+DFLTPHYS opt_global.h
BURN_BRIDGES opt_global.h
DEBUG opt_global.h
DEBUG_LOCKS opt_global.h
==== //depot/projects/crypto/sys/dev/bce/if_bce.c#2 (text) ====
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.21 2006/11/16 06:28:54 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.22 2006/12/06 22:53:22 jhb Exp $");
/*
* The following controllers are supported by this driver:
@@ -4566,7 +4566,7 @@
/* Try to defrag the mbuf if there are too many segments. */
DBPRINT(sc, BCE_WARN, "%s(): fragmented mbuf (%d pieces)\n",
- __FUNCTION__, map_arg.maxsegs);
+ __FUNCTION__, nsegs);
m0 = m_defrag(*m_head, M_DONTWAIT);
if (m0 == NULL) {
@@ -4619,7 +4619,7 @@
DBPRINT(sc, BCE_INFO_SEND,
"%s(): Start: prod = 0x%04X, chain_prod = %04X, "
"prod_bseq = 0x%08X\n",
- __FUNCTION__, *prod, chain_prod, prod_bseq);
+ __FUNCTION__, prod, chain_prod, prod_bseq);
/*
* Cycle through each mbuf segment that makes up
@@ -4646,7 +4646,7 @@
/* Set the END flag on the last TX buffer descriptor. */
txbd->tx_bd_flags |= htole16(TX_BD_FLAGS_END);
- DBRUN(BCE_INFO_SEND, bce_dump_tx_chain(sc, debug_prod, nseg));
+ DBRUN(BCE_INFO_SEND, bce_dump_tx_chain(sc, debug_prod, nsegs));
DBPRINT(sc, BCE_INFO_SEND,
"%s(): End: prod = 0x%04X, chain_prod = %04X, "
@@ -6163,7 +6163,7 @@
else
/* Normal tx_bd entry. */
BCE_PRINTF(sc, "tx_bd[0x%04X]: haddr = 0x%08X:%08X, nbytes = 0x%08X, "
- "vlan tag= 0x%4X, "flags = 0x%04X\n", idx,
+ "vlan tag= 0x%4X, flags = 0x%04X\n", idx,
txbd->tx_bd_haddr_hi, txbd->tx_bd_haddr_lo,
txbd->tx_bd_mss_nbytes, txbd->tx_bd_vlan_tag,
txbd->tx_bd_flags);
==== //depot/projects/crypto/sys/dev/isp/isp_freebsd.c#3 (text+ko) ====
@@ -29,7 +29,7 @@
* Platform (FreeBSD) dependent common attachment code for Qlogic adapters.
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp_freebsd.c,v 1.129 2006/12/05 07:50:23 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_freebsd.c,v 1.130 2006/12/09 01:30:05 mjacob Exp $");
#include <dev/isp/isp_freebsd.h>
#include <sys/unistd.h>
#include <sys/kthread.h>
@@ -2744,6 +2744,8 @@
CAMLOCK_2_ISPLOCK(isp);
if (IS_FC(isp)) {
fcparam *fcp = isp->isp_param;
+ struct ccb_trans_settings_scsi *scsi =
+ &cts->proto_specific.scsi;
struct ccb_trans_settings_fc *fc =
&cts->xport_specific.fc;
@@ -2752,11 +2754,14 @@
cts->transport = XPORT_FC;
cts->transport_version = 0;
+ scsi->valid = CTS_SCSI_VALID_TQ;
+ scsi->flags = CTS_SCSI_FLAGS_TAG_ENB;
fc->valid = CTS_FC_VALID_SPEED;
- if (fcp->isp_gbspeed == 2)
+ if (fcp->isp_gbspeed == 2) {
fc->bitrate = 200000;
- else
+ } else {
fc->bitrate = 100000;
+ }
if (tgt > 0 && tgt < MAX_FC_TARG) {
fcportdb_t *lp = &fcp->portdb[tgt];
fc->wwnn = lp->node_wwn;
==== //depot/projects/crypto/sys/dev/isp/isp_pci.c#2 (text+ko) ====
@@ -30,7 +30,7 @@
* FreeBSD Version.
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.127 2006/11/18 03:53:16 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.128 2006/12/10 03:41:48 mjacob Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -352,10 +352,7 @@
};
static devclass_t isp_devclass;
DRIVER_MODULE(isp, pci, isp_pci_driver, isp_devclass, 0, 0);
-#if __FreeBSD_version >= 700000
-MODULE_DEPEND(isp, ispfw, 1, 1, 1);
-MODULE_DEPEND(isp, firmware, 1, 1, 1);
-#else
+#if __FreeBSD_version < 700000
extern ispfwfunc *isp_get_firmware_p;
#endif
==== //depot/projects/crypto/sys/dev/isp/isp_sbus.c#2 (text+ko) ====
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp_sbus.c,v 1.23 2006/11/02 03:21:31 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_sbus.c,v 1.24 2006/12/10 03:41:48 mjacob Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -113,9 +113,7 @@
};
static devclass_t isp_devclass;
DRIVER_MODULE(isp, sbus, isp_sbus_driver, isp_devclass, 0, 0);
-#if __FreeBSD_version >= 700000
-MODULE_DEPEND(isp, firmware, 1, 1, 1);
-#else
+#if __FreeBSD_version < 700000
extern ispfwfunc *isp_get_firmware_p;
#endif
==== //depot/projects/crypto/sys/dev/isp/ispmbox.h#2 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/isp/ispmbox.h,v 1.55 2006/11/18 03:53:16 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/isp/ispmbox.h,v 1.56 2006/12/09 01:33:55 mjacob Exp $ */
/*-
* Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters.
*
@@ -638,7 +638,7 @@
typedef struct {
isphdr_t ms_header;
uint32_t ms_handle;
- uint16_t ms_nphdl; /* XXX: Note, this is for 2K Logins only */
+ uint16_t ms_nphdl; /* handle in high byte for !2k f/w */
uint16_t ms_status;
uint16_t ms_flags;
uint16_t ms_reserved1; /* low 8 bits */
==== //depot/projects/crypto/sys/dev/ispfw/ispfw.c#2 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ispfw/ispfw.c,v 1.18 2006/08/26 18:39:18 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ispfw/ispfw.c,v 1.19 2006/12/10 03:42:57 mjacob Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -52,7 +52,7 @@
#ifdef __sparc64__
#define ISP_1000 1
#endif
-#define MODULE_NAME "isp"
+#define MODULE_NAME "ispfw"
#endif
#if defined(ISP_1040) || defined(ISP_1040_IT)
==== //depot/projects/crypto/sys/dev/iwi/if_iwi.c#2 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/iwi/if_iwi.c,v 1.42 2006/11/07 19:03:42 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/iwi/if_iwi.c,v 1.44 2006/12/07 15:24:38 kevlo Exp $");
/*-
* Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -42,6 +42,8 @@
#include <sys/socket.h>
#include <sys/systm.h>
#include <sys/malloc.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/endian.h>
@@ -1230,6 +1232,7 @@
struct mbuf *mnew, *m;
struct ieee80211_node *ni;
int type, error, framelen;
+ IWI_LOCK_DECL;
framelen = le16toh(frame->len);
if (framelen < IEEE80211_MIN_LEN || framelen > MCLBYTES) {
@@ -1310,6 +1313,7 @@
bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m);
}
+ IWI_UNLOCK(sc);
ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *));
@@ -1319,6 +1323,7 @@
/* node is no longer needed */
ieee80211_free_node(ni);
+ IWI_LOCK(sc);
if (sc->sc_softled) {
/*
* Blink for any data frame. Otherwise do a
==== //depot/projects/crypto/sys/dev/mpt/mpt.c#3 (text+ko) ====
@@ -96,7 +96,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/mpt/mpt.c,v 1.37 2006/12/03 00:28:10 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/mpt/mpt.c,v 1.39 2006/12/07 23:51:00 mjacob Exp $");
#include <dev/mpt/mpt.h>
#include <dev/mpt/mpt_cam.h> /* XXX For static handler registration */
@@ -128,7 +128,7 @@
static int mpt_send_event_request(struct mpt_softc *mpt, int onoff);
static int mpt_soft_reset(struct mpt_softc *mpt);
static void mpt_hard_reset(struct mpt_softc *mpt);
-static int mpt_configure_ioc(struct mpt_softc *mpt);
+static int mpt_configure_ioc(struct mpt_softc *mpt, int, int);
static int mpt_enable_ioc(struct mpt_softc *mpt, int);
/************************* Personality Module Support *************************/
@@ -1484,25 +1484,27 @@
f_req.Function = MPI_FUNCTION_IOC_FACTS;
f_req.MsgContext = htole32(MPT_REPLY_HANDLER_HANDSHAKE);
error = mpt_send_handshake_cmd(mpt, sizeof f_req, &f_req);
- if (error)
+ if (error) {
return(error);
+ }
error = mpt_recv_handshake_reply(mpt, sizeof (*freplp), freplp);
return (error);
}
static int
-mpt_get_portfacts(struct mpt_softc *mpt, MSG_PORT_FACTS_REPLY *freplp)
+mpt_get_portfacts(struct mpt_softc *mpt, U8 port, MSG_PORT_FACTS_REPLY *freplp)
{
MSG_PORT_FACTS f_req;
int error;
- /* XXX: Only getting PORT FACTS for Port 0 */
memset(&f_req, 0, sizeof f_req);
f_req.Function = MPI_FUNCTION_PORT_FACTS;
+ f_req.PortNumber = port;
f_req.MsgContext = htole32(MPT_REPLY_HANDLER_HANDSHAKE);
error = mpt_send_handshake_cmd(mpt, sizeof f_req, &f_req);
- if (error)
+ if (error) {
return(error);
+ }
error = mpt_recv_handshake_reply(mpt, sizeof (*freplp), freplp);
return (error);
}
@@ -1523,8 +1525,8 @@
memset(&init, 0, sizeof init);
init.WhoInit = who;
init.Function = MPI_FUNCTION_IOC_INIT;
- init.MaxDevices = mpt->mpt_max_devices;
- init.MaxBuses = 1;
+ init.MaxDevices = 0; /* at least 256 devices per bus */
+ init.MaxBuses = 16; /* at least 16 busses */
init.MsgVersion = htole16(MPI_VERSION);
init.HeaderVersion = htole16(MPI_HEADER_VERSION);
@@ -1759,17 +1761,10 @@
return (rv);
}
-#if __FreeBSD_version >= 500000
- mpt_lprt(mpt, MPT_PRT_DEBUG, "IOC Page 2 Header: ver %x, len %zx, "
- "num %x, type %x\n", hdr.PageVersion,
- hdr.PageLength * sizeof(uint32_t),
- hdr.PageNumber, hdr.PageType);
-#else
- mpt_lprt(mpt, MPT_PRT_DEBUG, "IOC Page 2 Header: ver %x, len %z, "
- "num %x, type %x\n", hdr.PageVersion,
- hdr.PageLength * sizeof(uint32_t),
- hdr.PageNumber, hdr.PageType);
-#endif
+ mpt_lprt(mpt, MPT_PRT_DEBUG,
+ "IOC Page 2 Header: Version %x len %x PageNumber %x PageType %x\n",
+ hdr.PageVersion, hdr.PageLength << 2,
+ hdr.PageNumber, hdr.PageType);
len = hdr.PageLength * sizeof(uint32_t);
mpt->ioc_page2 = malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO);
@@ -1786,6 +1781,7 @@
mpt_raid_free_mem(mpt);
return (EIO);
}
+ mpt2host_config_page_ioc2(mpt->ioc_page2);
if (mpt->ioc_page2->CapabilitiesFlags != 0) {
uint32_t mask;
@@ -2107,11 +2103,8 @@
mpt_core_attach(struct mpt_softc *mpt)
{
int val;
- int error;
-
LIST_INIT(&mpt->ack_frames);
-
/* Put all request buffers on the free list */
TAILQ_INIT(&mpt->request_pending_list);
TAILQ_INIT(&mpt->request_free_list);
@@ -2121,24 +2114,17 @@
req->state = REQ_STATE_ALLOCATED;
mpt_free_request(mpt, req);
}
-
for (val = 0; val < MPT_MAX_LUNS; val++) {
STAILQ_INIT(&mpt->trt[val].atios);
STAILQ_INIT(&mpt->trt[val].inots);
}
STAILQ_INIT(&mpt->trt_wildcard.atios);
STAILQ_INIT(&mpt->trt_wildcard.inots);
-
mpt->scsi_tgt_handler_id = MPT_HANDLER_ID_NONE;
-
mpt_sysctl_attach(mpt);
-
mpt_lprt(mpt, MPT_PRT_DEBUG, "doorbell req = %s\n",
mpt_ioc_diag(mpt_read(mpt, MPT_OFFSET_DOORBELL)));
-
- error = mpt_configure_ioc(mpt);
-
- return (error);
+ return (mpt_configure_ioc(mpt, 0, 0));
}
int
@@ -2197,6 +2183,9 @@
void
mpt_core_detach(struct mpt_softc *mpt)
{
+ /*
+ * XXX: FREE MEMORY
+ */
mpt_disable_ints(mpt);
}
@@ -2337,226 +2326,229 @@
* once at instance startup.
*/
static int
-mpt_configure_ioc(struct mpt_softc *mpt)
+mpt_configure_ioc(struct mpt_softc *mpt, int tn, int needreset)
{
- MSG_PORT_FACTS_REPLY pfp;
- MSG_IOC_FACTS_REPLY facts;
- int try;
- int needreset;
- uint32_t max_chain_depth;
+ PTR_MSG_PORT_FACTS_REPLY pfp;
+ int error, port;
+ size_t len;
- needreset = 0;
- for (try = 0; try < MPT_MAX_TRYS; try++) {
+ if (tn == MPT_MAX_TRYS) {
+ return (-1);
+ }
- /*
- * No need to reset if the IOC is already in the READY state.
- *
- * Force reset if initialization failed previously.
- * Note that a hard_reset of the second channel of a '929
- * will stop operation of the first channel. Hopefully, if the
- * first channel is ok, the second will not require a hard
- * reset.
- */
- if (needreset || MPT_STATE(mpt_rd_db(mpt)) !=
- MPT_DB_STATE_READY) {
- if (mpt_reset(mpt, FALSE) != MPT_OK) {
- continue;
- }
+ /*
+ * No need to reset if the IOC is already in the READY state.
+ *
+ * Force reset if initialization failed previously.
+ * Note that a hard_reset of the second channel of a '929
+ * will stop operation of the first channel. Hopefully, if the
+ * first channel is ok, the second will not require a hard
+ * reset.
+ */
+ if (needreset || MPT_STATE(mpt_rd_db(mpt)) != MPT_DB_STATE_READY) {
+ if (mpt_reset(mpt, FALSE) != MPT_OK) {
+ return (mpt_configure_ioc(mpt, tn++, 1));
}
needreset = 0;
+ }
- if (mpt_get_iocfacts(mpt, &facts) != MPT_OK) {
- mpt_prt(mpt, "mpt_get_iocfacts failed\n");
- needreset = 1;
- continue;
- }
+ if (mpt_get_iocfacts(mpt, &mpt->ioc_facts) != MPT_OK) {
+ mpt_prt(mpt, "mpt_get_iocfacts failed\n");
+ return (mpt_configure_ioc(mpt, tn++, 1));
+ }
+ mpt2host_iocfacts_reply(&mpt->ioc_facts);
- mpt->mpt_global_credits = le16toh(facts.GlobalCredits);
- mpt->request_frame_size = le16toh(facts.RequestFrameSize);
- mpt->ioc_facts_flags = facts.Flags;
- mpt_prt(mpt, "MPI Version=%d.%d.%d.%d\n",
- le16toh(facts.MsgVersion) >> 8,
- le16toh(facts.MsgVersion) & 0xFF,
- le16toh(facts.HeaderVersion) >> 8,
- le16toh(facts.HeaderVersion) & 0xFF);
+ mpt_prt(mpt, "MPI Version=%d.%d.%d.%d\n",
+ mpt->ioc_facts.MsgVersion >> 8,
+ mpt->ioc_facts.MsgVersion & 0xFF,
+ mpt->ioc_facts.HeaderVersion >> 8,
+ mpt->ioc_facts.HeaderVersion & 0xFF);
- /*
- * Now that we know request frame size, we can calculate
- * the actual (reasonable) segment limit for read/write I/O.
- *
- * This limit is constrained by:
- *
- * + The size of each area we allocate per command (and how
- * many chain segments we can fit into it).
- * + The total number of areas we've set up.
- * + The actual chain depth the card will allow.
- *
- * The first area's segment count is limited by the I/O request
- * at the head of it. We cannot allocate realistically more
- * than MPT_MAX_REQUESTS areas. Therefore, to account for both
- * conditions, we'll just start out with MPT_MAX_REQUESTS-2.
- *
- */
- max_chain_depth = facts.MaxChainDepth;
+ /*
+ * Now that we know request frame size, we can calculate
+ * the actual (reasonable) segment limit for read/write I/O.
+ *
+ * This limit is constrained by:
+ *
+ * + The size of each area we allocate per command (and how
+ * many chain segments we can fit into it).
+ * + The total number of areas we've set up.
+ * + The actual chain depth the card will allow.
+ *
+ * The first area's segment count is limited by the I/O request
+ * at the head of it. We cannot allocate realistically more
+ * than MPT_MAX_REQUESTS areas. Therefore, to account for both
+ * conditions, we'll just start out with MPT_MAX_REQUESTS-2.
+ *
+ */
+ /* total number of request areas we (can) allocate */
+ mpt->max_seg_cnt = MPT_MAX_REQUESTS(mpt) - 2;
- /* total number of request areas we (can) allocate */
- mpt->max_seg_cnt = MPT_MAX_REQUESTS(mpt) - 2;
+ /* converted to the number of chain areas possible */
+ mpt->max_seg_cnt *= MPT_NRFM(mpt);
- /* converted to the number of chain areas possible */
- mpt->max_seg_cnt *= MPT_NRFM(mpt);
+ /* limited by the number of chain areas the card will support */
+ if (mpt->max_seg_cnt > mpt->ioc_facts.MaxChainDepth) {
+ mpt_lprt(mpt, MPT_PRT_DEBUG,
+ "chain depth limited to %u (from %u)\n",
+ mpt->ioc_facts.MaxChainDepth, mpt->max_seg_cnt);
+ mpt->max_seg_cnt = mpt->ioc_facts.MaxChainDepth;
+ }
- /* limited by the number of chain areas the card will support */
- if (mpt->max_seg_cnt > max_chain_depth) {
- mpt_lprt(mpt, MPT_PRT_DEBUG,
- "chain depth limited to %u (from %u)\n",
- max_chain_depth, mpt->max_seg_cnt);
- mpt->max_seg_cnt = max_chain_depth;
- }
+ /* converted to the number of simple sges in chain segments. */
+ mpt->max_seg_cnt *= (MPT_NSGL(mpt) - 1);
- /* converted to the number of simple sges in chain segments. */
- mpt->max_seg_cnt *= (MPT_NSGL(mpt) - 1);
+ mpt_lprt(mpt, MPT_PRT_DEBUG, "Maximum Segment Count: %u\n",
+ mpt->max_seg_cnt);
+ mpt_lprt(mpt, MPT_PRT_DEBUG, "MsgLength=%u IOCNumber = %d\n",
+ mpt->ioc_facts.MsgLength, mpt->ioc_facts.IOCNumber);
+ mpt_lprt(mpt, MPT_PRT_DEBUG,
+ "IOCFACTS: GlobalCredits=%d BlockSize=%u bytes "
+ "Request Frame Size %u bytes Max Chain Depth %u\n",
+ mpt->ioc_facts.GlobalCredits, mpt->ioc_facts.BlockSize,
+ mpt->ioc_facts.RequestFrameSize << 2,
+ mpt->ioc_facts.MaxChainDepth);
+ mpt_lprt(mpt, MPT_PRT_DEBUG, "IOCFACTS: Num Ports %d, FWImageSize %d, "
+ "Flags=%#x\n", mpt->ioc_facts.NumberOfPorts,
+ mpt->ioc_facts.FWImageSize, mpt->ioc_facts.Flags);
- mpt_lprt(mpt, MPT_PRT_DEBUG,
- "Maximum Segment Count: %u\n", mpt->max_seg_cnt);
- mpt_lprt(mpt, MPT_PRT_DEBUG,
- "MsgLength=%u IOCNumber = %d\n",
- facts.MsgLength, facts.IOCNumber);
- mpt_lprt(mpt, MPT_PRT_DEBUG,
- "IOCFACTS: GlobalCredits=%d BlockSize=%u bytes "
- "Request Frame Size %u bytes Max Chain Depth %u\n",
- mpt->mpt_global_credits, facts.BlockSize,
- mpt->request_frame_size << 2, max_chain_depth);
- mpt_lprt(mpt, MPT_PRT_DEBUG,
- "IOCFACTS: Num Ports %d, FWImageSize %d, "
- "Flags=%#x\n", facts.NumberOfPorts,
- le32toh(facts.FWImageSize), facts.Flags);
+ len = mpt->ioc_facts.NumberOfPorts * sizeof (MSG_PORT_FACTS_REPLY);
+ mpt->port_facts = malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO);
+ if (mpt->port_facts == NULL) {
+ mpt_prt(mpt, "unable to allocate memory for port facts\n");
+ return (ENOMEM);
+ }
- if ((facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT) != 0) {
- struct mpt_map_info mi;
- int error;
+ if ((mpt->ioc_facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT) &&
+ (mpt->fw_uploaded == 0)) {
+ struct mpt_map_info mi;
- /*
- * In some configurations, the IOC's firmware is
- * stored in a shared piece of system NVRAM that
- * is only accessable via the BIOS. In this
- * case, the firmware keeps a copy of firmware in
- * RAM until the OS driver retrieves it. Once
- * retrieved, we are responsible for re-downloading
- * the firmware after any hard-reset.
- */
- mpt->fw_image_size = le32toh(facts.FWImageSize);
- error = mpt_dma_tag_create(mpt, mpt->parent_dmat,
- /*alignment*/1, /*boundary*/0,
- /*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
- /*highaddr*/BUS_SPACE_MAXADDR, /*filter*/NULL,
- /*filterarg*/NULL, mpt->fw_image_size,
- /*nsegments*/1, /*maxsegsz*/mpt->fw_image_size,
- /*flags*/0, &mpt->fw_dmat);
- if (error != 0) {
- mpt_prt(mpt, "cannot create fw dma tag\n");
- return (ENOMEM);
- }
- error = bus_dmamem_alloc(mpt->fw_dmat,
- (void **)&mpt->fw_image, BUS_DMA_NOWAIT,
- &mpt->fw_dmap);
- if (error != 0) {
- mpt_prt(mpt, "cannot allocate fw mem.\n");
- bus_dma_tag_destroy(mpt->fw_dmat);
- return (ENOMEM);
- }
- mi.mpt = mpt;
- mi.error = 0;
- bus_dmamap_load(mpt->fw_dmat, mpt->fw_dmap,
- mpt->fw_image, mpt->fw_image_size, mpt_map_rquest,
- &mi, 0);
- mpt->fw_phys = mi.phys;
-
- error = mpt_upload_fw(mpt);
- if (error != 0) {
- mpt_prt(mpt, "fw upload failed.\n");
- bus_dmamap_unload(mpt->fw_dmat, mpt->fw_dmap);
- bus_dmamem_free(mpt->fw_dmat, mpt->fw_image,
- mpt->fw_dmap);
- bus_dma_tag_destroy(mpt->fw_dmat);
- mpt->fw_image = NULL;
- return (EIO);
- }
+ /*
+ * In some configurations, the IOC's firmware is
+ * stored in a shared piece of system NVRAM that
+ * is only accessable via the BIOS. In this
+ * case, the firmware keeps a copy of firmware in
+ * RAM until the OS driver retrieves it. Once
+ * retrieved, we are responsible for re-downloading
+ * the firmware after any hard-reset.
+ */
+ mpt->fw_image_size = mpt->ioc_facts.FWImageSize;
+ error = mpt_dma_tag_create(mpt, mpt->parent_dmat, 1, 0,
+ BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+ mpt->fw_image_size, 1, mpt->fw_image_size, 0,
+ &mpt->fw_dmat);
+ if (error != 0) {
+ mpt_prt(mpt, "cannot create firmwarew dma tag\n");
+ return (ENOMEM);
+ }
+ error = bus_dmamem_alloc(mpt->fw_dmat,
+ (void **)&mpt->fw_image, BUS_DMA_NOWAIT, &mpt->fw_dmap);
+ if (error != 0) {
+ mpt_prt(mpt, "cannot allocate firmware memory\n");
+ bus_dma_tag_destroy(mpt->fw_dmat);
+ return (ENOMEM);
}
+ mi.mpt = mpt;
+ mi.error = 0;
+ bus_dmamap_load(mpt->fw_dmat, mpt->fw_dmap,
+ mpt->fw_image, mpt->fw_image_size, mpt_map_rquest, &mi, 0);
+ mpt->fw_phys = mi.phys;
- if (mpt_get_portfacts(mpt, &pfp) != MPT_OK) {
- mpt_prt(mpt, "mpt_get_portfacts failed\n");
- needreset = 1;
- continue;
+ error = mpt_upload_fw(mpt);
+ if (error != 0) {
+ mpt_prt(mpt, "firmware upload failed.\n");
+ bus_dmamap_unload(mpt->fw_dmat, mpt->fw_dmap);
+ bus_dmamem_free(mpt->fw_dmat, mpt->fw_image,
+ mpt->fw_dmap);
+ bus_dma_tag_destroy(mpt->fw_dmat);
+ mpt->fw_image = NULL;
+ return (EIO);
}
+ mpt->fw_uploaded = 1;
+ }
- mpt_lprt(mpt, MPT_PRT_DEBUG,
- "PORTFACTS: Type %x PFlags %x IID %d MaxDev %d\n",
- pfp.PortType, pfp.ProtocolFlags, pfp.PortSCSIID,
- pfp.MaxDevices);
-
- mpt->mpt_port_type = pfp.PortType;
- mpt->mpt_proto_flags = le16toh(pfp.ProtocolFlags);
- if (pfp.PortType != MPI_PORTFACTS_PORTTYPE_SCSI &&
- pfp.PortType != MPI_PORTFACTS_PORTTYPE_SAS &&
- pfp.PortType != MPI_PORTFACTS_PORTTYPE_FC) {
- mpt_prt(mpt, "Unsupported Port Type (%x)\n",
- pfp.PortType);
- return (ENXIO);
+ for (port = 0; port < mpt->ioc_facts.NumberOfPorts; port++) {
+ pfp = &mpt->port_facts[port];
+ error = mpt_get_portfacts(mpt, 0, pfp);
+ if (error != MPT_OK) {
+ mpt_prt(mpt,
+ "mpt_get_portfacts on port %d failed\n", port);
+ free(mpt->port_facts, M_DEVBUF);
+ mpt->port_facts = NULL;
+ return (mpt_configure_ioc(mpt, tn++, 1));
}
- mpt->mpt_max_tgtcmds = le16toh(pfp.MaxPostedCmdBuffers);
+ mpt2host_portfacts_reply(pfp);
- if (pfp.PortType == MPI_PORTFACTS_PORTTYPE_FC) {
- mpt->is_fc = 1;
- mpt->is_sas = 0;
- mpt->is_spi = 0;
- } else if (pfp.PortType == MPI_PORTFACTS_PORTTYPE_SAS) {
- mpt->is_fc = 0;
- mpt->is_sas = 1;
- mpt->is_spi = 0;
+ if (port > 0) {
+ error = MPT_PRT_INFO;
} else {
- mpt->is_fc = 0;
- mpt->is_sas = 0;
- mpt->is_spi = 1;
+ error = MPT_PRT_DEBUG;
}
- mpt->mpt_ini_id = pfp.PortSCSIID;
- mpt->mpt_max_devices = pfp.MaxDevices;
+ mpt_lprt(mpt, error,
+ "PORTFACTS[%d]: Type %x PFlags %x IID %d MaxDev %d\n",
+ port, pfp->PortType, pfp->ProtocolFlags, pfp->PortSCSIID,
+ pfp->MaxDevices);
- /*
- * Set our role with what this port supports.
- *
- * Note this might be changed later in different modules
- * if this is different from what is wanted.
- */
- mpt->role = MPT_ROLE_NONE;
- if (mpt->mpt_proto_flags & MPI_PORTFACTS_PROTOCOL_INITIATOR) {
- mpt->role |= MPT_ROLE_INITIATOR;
- }
- if (mpt->mpt_proto_flags & MPI_PORTFACTS_PROTOCOL_TARGET) {
- mpt->role |= MPT_ROLE_TARGET;
- }
- if (mpt_enable_ioc(mpt, 0) != MPT_OK) {
- mpt_prt(mpt, "unable to initialize IOC\n");
- return (ENXIO);
- }
+ }
- /*
- * Read IOC configuration information.
- *
- * We need this to determine whether or not we have certain
- * settings for Integrated Mirroring (e.g.).
- */
- mpt_read_config_info_ioc(mpt);
+ /*
+ * XXX: Not yet supporting more than port 0
+ */
+ pfp = &mpt->port_facts[0];
+ if (pfp->PortType == MPI_PORTFACTS_PORTTYPE_FC) {
+ mpt->is_fc = 1;
+ mpt->is_sas = 0;
+ mpt->is_spi = 0;
+ } else if (pfp->PortType == MPI_PORTFACTS_PORTTYPE_SAS) {
+ mpt->is_fc = 0;
+ mpt->is_sas = 1;
+ mpt->is_spi = 0;
+ } else if (pfp->PortType == MPI_PORTFACTS_PORTTYPE_SCSI) {
+ mpt->is_fc = 0;
+ mpt->is_sas = 0;
+ mpt->is_spi = 1;
+ } else if (pfp->PortType == MPI_PORTFACTS_PORTTYPE_ISCSI) {
+ mpt_prt(mpt, "iSCSI not supported yet\n");
+ return (ENXIO);
+ } else if (pfp->PortType == MPI_PORTFACTS_PORTTYPE_INACTIVE) {
+ mpt_prt(mpt, "Inactive Port\n");
+ return (ENXIO);
+ } else {
+ mpt_prt(mpt, "unknown Port Type %#x\n", pfp->PortType);
+ return (ENXIO);
+ }
- /* Everything worked */
- break;
+ /*
+ * Set our role with what this port supports.
+ *
+ * Note this might be changed later in different modules
+ * if this is different from what is wanted.
+ */
+ mpt->role = MPT_ROLE_NONE;
+ if (pfp->ProtocolFlags & MPI_PORTFACTS_PROTOCOL_INITIATOR) {
+ mpt->role |= MPT_ROLE_INITIATOR;
+ }
+ if (pfp->ProtocolFlags & MPI_PORTFACTS_PROTOCOL_TARGET) {
+ mpt->role |= MPT_ROLE_TARGET;
}
- if (try >= MPT_MAX_TRYS) {
- mpt_prt(mpt, "failed to initialize IOC");
- return (EIO);
+ /*
+ * Enable the IOC
+ */
+ if (mpt_enable_ioc(mpt, 0) != MPT_OK) {
+ mpt_prt(mpt, "unable to initialize IOC\n");
+ return (ENXIO);
}
+ /*
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list