From owner-svn-src-stable-6@FreeBSD.ORG Wed Mar 18 20:42:00 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99E72106564A; Wed, 18 Mar 2009 20:42:00 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 867FE8FC14; Wed, 18 Mar 2009 20:42:00 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2IKg0Cc037145; Wed, 18 Mar 2009 20:42:00 GMT (envelope-from ambrisko@svn.freebsd.org) Received: (from ambrisko@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2IKg0mE037140; Wed, 18 Mar 2009 20:42:00 GMT (envelope-from ambrisko@svn.freebsd.org) Message-Id: <200903182042.n2IKg0mE037140@svn.freebsd.org> From: Doug Ambrisko Date: Wed, 18 Mar 2009 20:42:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189986 - in stable/6/sys: . dev/mfi X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Mar 2009 20:42:01 -0000 Author: ambrisko Date: Wed Mar 18 20:42:00 2009 New Revision: 189986 URL: http://svn.freebsd.org/changeset/base/189986 Log: MF7: r185034 which brings in new HW support, fix some bugs in the API for the management ioctl. Submitted by: LSI Modified: stable/6/sys/ (props changed) stable/6/sys/dev/mfi/mfi.c stable/6/sys/dev/mfi/mfi_ioctl.h stable/6/sys/dev/mfi/mfi_pci.c stable/6/sys/dev/mfi/mfireg.h stable/6/sys/dev/mfi/mfivar.h Modified: stable/6/sys/dev/mfi/mfi.c ============================================================================== --- stable/6/sys/dev/mfi/mfi.c Wed Mar 18 20:22:21 2009 (r189985) +++ stable/6/sys/dev/mfi/mfi.c Wed Mar 18 20:42:00 2009 (r189986) @@ -163,7 +163,11 @@ static void mfi_enable_intr_ppc(struct mfi_softc *sc) { MFI_WRITE4(sc, MFI_ODCR0, 0xFFFFFFFF); - MFI_WRITE4(sc, MFI_OMSK, ~MFI_1078_EIM); + if (sc->mfi_flags & MFI_FLAGS_1078) { + MFI_WRITE4(sc, MFI_OMSK, ~MFI_1078_EIM); + } else if (sc->mfi_flags & MFI_FLAGS_GEN2) { + MFI_WRITE4(sc, MFI_OMSK, ~MFI_GEN2_EIM); + } } static int32_t @@ -171,14 +175,14 @@ mfi_read_fw_status_xscale(struct mfi_sof { return MFI_READ4(sc, MFI_OMSG0); } - + static int32_t mfi_read_fw_status_ppc(struct mfi_softc *sc) { return MFI_READ4(sc, MFI_OSP0); } -static int +static int mfi_check_clear_intr_xscale(struct mfi_softc *sc) { int32_t status; @@ -189,28 +193,35 @@ mfi_check_clear_intr_xscale(struct mfi_s MFI_WRITE4(sc, MFI_OSTS, status); return 0; - } +} -static int +static int mfi_check_clear_intr_ppc(struct mfi_softc *sc) { int32_t status; status = MFI_READ4(sc, MFI_OSTS); - if (!status) - return 1; + if (sc->mfi_flags & MFI_FLAGS_1078) { + if (!(status & MFI_1078_RM)) { + return 1; + } + } else if (sc->mfi_flags & MFI_FLAGS_GEN2) { + if (!(status & MFI_GEN2_RM)) { + return 1; + } + } MFI_WRITE4(sc, MFI_ODCR0, status); return 0; - } +} -static void +static void mfi_issue_cmd_xscale(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt) { MFI_WRITE4(sc, MFI_IQP,(bus_add >>3)|frame_cnt); } - -static void + +static void mfi_issue_cmd_ppc(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt) { MFI_WRITE4(sc, MFI_IQP, (bus_add |frame_cnt <<1)|1 ); @@ -1399,6 +1410,8 @@ mfi_bio_complete(struct mfi_command *cm) device_printf(sc->mfi_dev, "I/O error, status= %d " "scsi_status= %d\n", hdr->cmd_status, hdr->scsi_status); mfi_print_sense(cm->cm_sc, cm->cm_sense); + } else if (cm->cm_error != 0) { + bio->bio_flags |= BIO_ERROR; } mfi_release_command(cm); @@ -1815,6 +1828,9 @@ mfi_check_command_post(struct mfi_softc case MFI_DCMD_CFG_ADD: mfi_ldprobe(sc); break; + case MFI_DCMD_CFG_FOREIGN_IMPORT: + mfi_ldprobe(sc); + break; } } @@ -1904,7 +1920,7 @@ mfi_ioctl(struct cdev *dev, u_long cmd, struct mfi_ioc_aen *aen; struct mfi_command *cm = NULL; uint32_t context; - uint8_t *sense_ptr; + union mfi_sense_ptr sense_ptr; uint8_t *data = NULL, *temp; int i; struct mfi_ioc_passthru *iop = (struct mfi_ioc_passthru *)arg; @@ -1986,8 +2002,9 @@ mfi_ioctl(struct cdev *dev, u_long cmd, context = cm->cm_frame->header.context; bcopy(ioc->mfi_frame.raw, cm->cm_frame, - 2 * MFI_DCMD_FRAME_SIZE); /* this isn't quite right */ - cm->cm_total_frame_size = (sizeof(union mfi_sgl) * ioc->mfi_sge_count) + ioc->mfi_sgl_off; + 2 * MFI_DCMD_FRAME_SIZE); /* this isn't quite right */ + cm->cm_total_frame_size = (sizeof(union mfi_sgl) + * ioc->mfi_sge_count) + ioc->mfi_sgl_off; if (ioc->mfi_sge_count) { cm->cm_sg = (union mfi_sgl *)&cm->cm_frame->bytes[ioc->mfi_sgl_off]; @@ -2001,7 +2018,8 @@ mfi_ioctl(struct cdev *dev, u_long cmd, if (cm->cm_flags == 0) cm->cm_flags |= MFI_CMD_DATAIN | MFI_CMD_DATAOUT; cm->cm_len = cm->cm_frame->header.data_len; - if (cm->cm_flags & (MFI_CMD_DATAIN | MFI_CMD_DATAOUT)) { + if (cm->cm_len && + (cm->cm_flags & (MFI_CMD_DATAIN | MFI_CMD_DATAOUT))) { cm->cm_data = data = malloc(cm->cm_len, M_MFIBUF, M_WAITOK | M_ZERO); if (cm->cm_data == NULL) { @@ -2051,6 +2069,11 @@ mfi_ioctl(struct cdev *dev, u_long cmd, if (cm->cm_frame->header.cmd == MFI_CMD_DCMD) locked = mfi_config_lock(sc, cm->cm_frame->dcmd.opcode); + if (cm->cm_frame->header.cmd == MFI_CMD_PD_SCSI_IO) { + cm->cm_frame->pass.sense_addr_lo = cm->cm_sense_busaddr; + cm->cm_frame->pass.sense_addr_hi = 0; + } + mtx_lock(&sc->mfi_io_lock); error = mfi_check_command_pre(sc, cm); if (error) { @@ -2102,10 +2125,20 @@ mfi_ioctl(struct cdev *dev, u_long cmd, } if (ioc->mfi_sense_len) { - /* copy out sense */ - sense_ptr = &((struct mfi_ioc_packet*)arg) - ->mfi_frame.raw[0]; - error = copyout(cm->cm_sense, sense_ptr, + /* get user-space sense ptr then copy out sense */ + bcopy(&((struct mfi_ioc_packet*)arg) + ->mfi_frame.raw[ioc->mfi_sense_off], + &sense_ptr.sense_ptr_data[0], + sizeof(sense_ptr.sense_ptr_data)); +#ifdef __amd64__ + if (cmd != MFI_CMD) { + /* + * not 64bit native so zero out any address + * over 32bit */ + sense_ptr.addr.high = 0; + } +#endif + error = copyout(cm->cm_sense, sense_ptr.user_space, ioc->mfi_sense_len); if (error != 0) { device_printf(sc->mfi_dev, @@ -2203,7 +2236,7 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ struct mfi_linux_ioc_aen l_aen; struct mfi_command *cm = NULL; struct mfi_aen *mfi_aen_entry; - uint8_t *sense_ptr; + union mfi_sense_ptr sense_ptr; uint32_t context; uint8_t *data = NULL, *temp; int i; @@ -2237,7 +2270,8 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ bcopy(l_ioc.lioc_frame.raw, cm->cm_frame, 2 * MFI_DCMD_FRAME_SIZE); /* this isn't quite right */ - cm->cm_total_frame_size = (sizeof(union mfi_sgl) * l_ioc.lioc_sge_count) + l_ioc.lioc_sgl_off; + cm->cm_total_frame_size = (sizeof(union mfi_sgl) + * l_ioc.lioc_sge_count) + l_ioc.lioc_sgl_off; if (l_ioc.lioc_sge_count) cm->cm_sg = (union mfi_sgl *)&cm->cm_frame->bytes[l_ioc.lioc_sgl_off]; @@ -2247,7 +2281,8 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ if (cm->cm_frame->header.flags & MFI_FRAME_DATAOUT) cm->cm_flags |= MFI_CMD_DATAOUT; cm->cm_len = cm->cm_frame->header.data_len; - if (cm->cm_flags & (MFI_CMD_DATAIN | MFI_CMD_DATAOUT)) { + if (cm->cm_len && + (cm->cm_flags & (MFI_CMD_DATAIN | MFI_CMD_DATAOUT))) { cm->cm_data = data = malloc(cm->cm_len, M_MFIBUF, M_WAITOK | M_ZERO); if (cm->cm_data == NULL) { @@ -2279,6 +2314,11 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ if (cm->cm_frame->header.cmd == MFI_CMD_DCMD) locked = mfi_config_lock(sc, cm->cm_frame->dcmd.opcode); + if (cm->cm_frame->header.cmd == MFI_CMD_PD_SCSI_IO) { + cm->cm_frame->pass.sense_addr_lo = cm->cm_sense_busaddr; + cm->cm_frame->pass.sense_addr_hi = 0; + } + mtx_lock(&sc->mfi_io_lock); error = mfi_check_command_pre(sc, cm); if (error) { @@ -2312,10 +2352,19 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ } if (l_ioc.lioc_sense_len) { - /* copy out sense */ - sense_ptr = &((struct mfi_linux_ioc_packet*)arg) - ->lioc_frame.raw[0]; - error = copyout(cm->cm_sense, sense_ptr, + /* get user-space sense ptr then copy out sense */ + bcopy(&((struct mfi_linux_ioc_packet*)arg) + ->lioc_frame.raw[l_ioc.lioc_sense_off], + &sense_ptr.sense_ptr_data[0], + sizeof(sense_ptr.sense_ptr_data)); +#ifdef __amd64__ + /* + * only 32bit Linux support so zero out any + * address over 32bit + */ + sense_ptr.addr.high = 0; +#endif + error = copyout(cm->cm_sense, sense_ptr.user_space, l_ioc.lioc_sense_len); if (error != 0) { device_printf(sc->mfi_dev, Modified: stable/6/sys/dev/mfi/mfi_ioctl.h ============================================================================== --- stable/6/sys/dev/mfi/mfi_ioctl.h Wed Mar 18 20:22:21 2009 (r189985) +++ stable/6/sys/dev/mfi/mfi_ioctl.h Wed Mar 18 20:42:00 2009 (r189986) @@ -50,6 +50,16 @@ union mfi_statrequest { struct mfi_qstat ms_qstat; }; +#define MAX_SPACE_FOR_SENSE_PTR 32 +union mfi_sense_ptr { + uint8_t sense_ptr_data[MAX_SPACE_FOR_SENSE_PTR]; + void *user_space; + struct { + uint32_t low; + uint32_t high; + } addr; +} __packed; + #define MAX_IOCTL_SGE 16 struct mfi_ioc_packet { Modified: stable/6/sys/dev/mfi/mfi_pci.c ============================================================================== --- stable/6/sys/dev/mfi/mfi_pci.c Wed Mar 18 20:22:21 2009 (r189985) +++ stable/6/sys/dev/mfi/mfi_pci.c Wed Mar 18 20:42:00 2009 (r189986) @@ -118,7 +118,14 @@ struct mfi_ident { {0x1000, 0x0413, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Verde ZCR */ {0x1028, 0x0015, 0xffff, 0xffff, MFI_FLAGS_1064R, "Dell PERC 5/i"}, {0x1000, 0x0060, 0x1028, 0xffff, MFI_FLAGS_1078, "Dell PERC 6"}, - {0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, + {0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, + {0x1000, 0x0079, 0x1028, 0x1f15, MFI_FLAGS_GEN2, "Dell PERC 607E Adapter"}, + {0x1000, 0x0079, 0x1028, 0x1f16, MFI_FLAGS_GEN2, "Dell PERC 607I Adapter"}, + {0x1000, 0x0079, 0x1028, 0x1f17, MFI_FLAGS_GEN2, "Dell PERC 607I Integrated"}, + {0x1000, 0x0079, 0x1028, 0x1f18, MFI_FLAGS_GEN2, "Dell PERC 607I Modular"}, + {0x1000, 0x0078, 0xffff, 0xffff, MFI_FLAGS_GEN2, "LSI MegaSAS Gen2"}, + {0x1000, 0x0079, 0xffff, 0xffff, MFI_FLAGS_GEN2, "LSI MegaSAS Gen2"}, + {0x1000, 0x007c, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, {0, 0, 0, 0, 0, NULL} }; @@ -163,6 +170,8 @@ mfi_pci_attach(device_t dev) sc = device_get_softc(dev); bzero(sc, sizeof(*sc)); sc->mfi_dev = dev; + m = mfi_find_ident(dev); + sc->mfi_flags = m->flags; /* Verify that the adapter can be set up in PCI space */ command = pci_read_config(dev, PCIR_COMMAND, 2); @@ -179,7 +188,14 @@ mfi_pci_attach(device_t dev) } /* Allocate PCI registers */ - sc->mfi_regs_rid = PCIR_BAR(0); + if ((sc->mfi_flags & MFI_FLAGS_1064R) || + (sc->mfi_flags & MFI_FLAGS_1078)) { + /* 1068/1078: Memory mapped BAR is at offset 0x10 */ + sc->mfi_regs_rid = PCIR_BAR(0); + } else if (sc->mfi_flags & MFI_FLAGS_GEN2) { + /* GEN2: Memory mapped BAR is at offset 0x14 */ + sc->mfi_regs_rid = PCIR_BAR(1); + } if ((sc->mfi_regs_resource = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_MEMORY, &sc->mfi_regs_rid, RF_ACTIVE)) == NULL) { device_printf(dev, "Cannot allocate PCI registers\n"); @@ -206,9 +222,6 @@ mfi_pci_attach(device_t dev) goto out; } - m = mfi_find_ident(dev); - sc->mfi_flags = m->flags; - error = mfi_attach(sc); out: if (error) { Modified: stable/6/sys/dev/mfi/mfireg.h ============================================================================== --- stable/6/sys/dev/mfi/mfireg.h Wed Mar 18 20:22:21 2009 (r189985) +++ stable/6/sys/dev/mfi/mfireg.h Wed Mar 18 20:42:00 2009 (r189986) @@ -89,10 +89,16 @@ __FBSDID("$FreeBSD$"); #define MFI_ODCR0 0xa0 /* outbound doorbell clear register0 */ #define MFI_OSP0 0xb0 /* outbound scratch pad0 */ #define MFI_1078_EIM 0x80000004 /* 1078 enable intrrupt mask */ -#define MFI_RMI 0x2 /* reply message interrupt */ +#define MFI_RMI 0x2 /* reply message interrupt */ #define MFI_1078_RM 0x80000000 /* reply 1078 message interrupt */ #define MFI_ODC 0x4 /* outbound doorbell change interrupt */ +/* + * GEN2 specific changes + */ +#define MFI_GEN2_EIM 0x00000005 /* GEN2 enable interrupt mask */ +#define MFI_GEN2_RM 0x00000001 /* reply GEN2 message interrupt */ + /* Bits for MFI_OSTS */ #define MFI_OSTS_INTR_VALID 0x00000002 @@ -153,6 +159,7 @@ typedef enum { MFI_DCMD_CFG_READ = 0x04010000, MFI_DCMD_CFG_ADD = 0x04020000, MFI_DCMD_CFG_CLEAR = 0x04030000, + MFI_DCMD_CFG_FOREIGN_IMPORT = 0x04060400, MFI_DCMD_CLUSTER = 0x08000000, MFI_DCMD_CLUSTER_RESET_ALL = 0x08010100, MFI_DCMD_CLUSTER_RESET_LD = 0x08010200 Modified: stable/6/sys/dev/mfi/mfivar.h ============================================================================== --- stable/6/sys/dev/mfi/mfivar.h Wed Mar 18 20:22:21 2009 (r189985) +++ stable/6/sys/dev/mfi/mfivar.h Wed Mar 18 20:42:00 2009 (r189986) @@ -133,6 +133,7 @@ struct mfi_softc { #define MFI_FLAGS_STOP (1<<3) #define MFI_FLAGS_1064R (1<<4) #define MFI_FLAGS_1078 (1<<5) +#define MFI_FLAGS_GEN2 (1<<6) struct mfi_hwcomms *mfi_comms; TAILQ_HEAD(,mfi_command) mfi_free; From owner-svn-src-stable-6@FreeBSD.ORG Wed Mar 18 22:13:30 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10CFC106567C; Wed, 18 Mar 2009 22:13:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED1D98FC18; Wed, 18 Mar 2009 22:13:29 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2IMDT6D039416; Wed, 18 Mar 2009 22:13:29 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2IMDTOo039413; Wed, 18 Mar 2009 22:13:29 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903182213.n2IMDTOo039413@svn.freebsd.org> From: Marius Strobl Date: Wed, 18 Mar 2009 22:13:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189997 - in stable/6/sys: . contrib/pf dev/cxgb net netinet netinet6 X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Mar 2009 22:13:32 -0000 Author: marius Date: Wed Mar 18 22:13:29 2009 New Revision: 189997 URL: http://svn.freebsd.org/changeset/base/189997 Log: MFC: r189494 On architectures with strict alignment requirements compensate the misalignment of the IP header that prepending the EtherIP header might have caused. PR: 131921 Modified: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) stable/6/sys/net/if_gif.h stable/6/sys/netinet/in_gif.c stable/6/sys/netinet6/in6_gif.c Modified: stable/6/sys/net/if_gif.h ============================================================================== --- stable/6/sys/net/if_gif.h Wed Mar 18 22:12:54 2009 (r189996) +++ stable/6/sys/net/if_gif.h Wed Mar 18 22:13:29 2009 (r189997) @@ -99,6 +99,8 @@ struct etherip_header { #define ETHERIP_VER_VERS_MASK 0x0f #define ETHERIP_VER_RSVD_MASK 0xf0 #define ETHERIP_VERSION 0x03 +/* mbuf adjust factor to force 32-bit alignment of IP header */ +#define ETHERIP_ALIGN 2 /* Prototypes */ void gif_input(struct mbuf *, int, struct ifnet *); Modified: stable/6/sys/netinet/in_gif.c ============================================================================== --- stable/6/sys/netinet/in_gif.c Wed Mar 18 22:12:54 2009 (r189996) +++ stable/6/sys/netinet/in_gif.c Wed Mar 18 22:13:29 2009 (r189997) @@ -101,7 +101,7 @@ in_gif_output(ifp, family, m) struct sockaddr_in *sin_dst = (struct sockaddr_in *)sc->gif_pdst; struct ip iphdr; /* capsule IP header, host byte ordered */ struct etherip_header eiphdr; - int proto, error; + int error, len, proto; u_int8_t tos; GIF_LOCK_ASSERT(sc); @@ -185,13 +185,27 @@ in_gif_output(ifp, family, m) &iphdr.ip_tos, &tos); /* prepend new IP header */ - M_PREPEND(m, sizeof(struct ip), M_DONTWAIT); - if (m && m->m_len < sizeof(struct ip)) - m = m_pullup(m, sizeof(struct ip)); + len = sizeof(struct ip); +#ifndef __NO_STRICT_ALIGNMENT + if (family == AF_LINK) + len += ETHERIP_ALIGN; +#endif + M_PREPEND(m, len, M_DONTWAIT); + if (m != NULL && m->m_len < len) + m = m_pullup(m, len); if (m == NULL) { printf("ENOBUFS in in_gif_output %d\n", __LINE__); return ENOBUFS; } +#ifndef __NO_STRICT_ALIGNMENT + if (family == AF_LINK) { + len = mtod(m, vm_offset_t) & 3; + KASSERT(len == 0 || len == ETHERIP_ALIGN, + ("in_gif_output: unexpected misalignment")); + m->m_data += len; + m->m_len -= ETHERIP_ALIGN; + } +#endif bcopy(&iphdr, mtod(m, struct ip *), sizeof(struct ip)); if (dst->sin_family != sin_dst->sin_family || Modified: stable/6/sys/netinet6/in6_gif.c ============================================================================== --- stable/6/sys/netinet6/in6_gif.c Wed Mar 18 22:12:54 2009 (r189996) +++ stable/6/sys/netinet6/in6_gif.c Wed Mar 18 22:13:29 2009 (r189997) @@ -96,7 +96,7 @@ in6_gif_output(ifp, family, m) struct sockaddr_in6 *sin6_dst = (struct sockaddr_in6 *)sc->gif_pdst; struct ip6_hdr *ip6; struct etherip_header eiphdr; - int proto, error; + int error, len, proto; u_int8_t itos, otos; GIF_LOCK_ASSERT(sc); @@ -164,13 +164,27 @@ in6_gif_output(ifp, family, m) } /* prepend new IP header */ - M_PREPEND(m, sizeof(struct ip6_hdr), M_DONTWAIT); - if (m && m->m_len < sizeof(struct ip6_hdr)) - m = m_pullup(m, sizeof(struct ip6_hdr)); + len = sizeof(struct ip6_hdr); +#ifndef __NO_STRICT_ALIGNMENT + if (family == AF_LINK) + len += ETHERIP_ALIGN; +#endif + M_PREPEND(m, len, M_DONTWAIT); + if (m != NULL && m->m_len < len) + m = m_pullup(m, len); if (m == NULL) { printf("ENOBUFS in in6_gif_output %d\n", __LINE__); return ENOBUFS; } +#ifndef __NO_STRICT_ALIGNMENT + if (family == AF_LINK) { + len = mtod(m, vm_offset_t) & 3; + KASSERT(len == 0 || len == ETHERIP_ALIGN, + ("in6_gif_output: unexpected misalignment")); + m->m_data += len; + m->m_len -= ETHERIP_ALIGN; + } +#endif ip6 = mtod(m, struct ip6_hdr *); ip6->ip6_flow = 0; From owner-svn-src-stable-6@FreeBSD.ORG Thu Mar 19 15:46:34 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0225110656E9; Thu, 19 Mar 2009 15:46:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D93588FC16; Thu, 19 Mar 2009 15:46:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2JFkXm7067441; Thu, 19 Mar 2009 15:46:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2JFkXBa067438; Thu, 19 Mar 2009 15:46:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903191546.n2JFkXBa067438@svn.freebsd.org> From: John Baldwin Date: Thu, 19 Mar 2009 15:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190073 - in stable/6/sys: . boot/i386/libi386 contrib/pf dev/cxgb X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2009 15:46:35 -0000 Author: jhb Date: Thu Mar 19 15:46:33 2009 New Revision: 190073 URL: http://svn.freebsd.org/changeset/base/190073 Log: MFC: Teach the BIOS CD driver to use bounce buffers when the destination address is > 1 MB. Modified: stable/6/sys/ (props changed) stable/6/sys/boot/i386/libi386/bioscd.c stable/6/sys/boot/i386/libi386/biosdisk.c stable/6/sys/boot/i386/libi386/libi386.h stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/boot/i386/libi386/bioscd.c ============================================================================== --- stable/6/sys/boot/i386/libi386/bioscd.c Thu Mar 19 15:45:43 2009 (r190072) +++ stable/6/sys/boot/i386/libi386/bioscd.c Thu Mar 19 15:46:33 2009 (r190073) @@ -173,9 +173,9 @@ bc_add(int biosdev) static void bc_print(int verbose) { - int i; char line[80]; - + int i; + for (i = 0; i < nbcinfo; i++) { sprintf(line, " cd%d: Device 0x%x\n", i, bcinfo[i].bc_sp.sp_devicespec); @@ -235,7 +235,7 @@ bc_strategy(void *devdata, int rw, daddr if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0) return (EINVAL); dblk /= (BIOSCD_SECSIZE / DEV_BSIZE); - DEBUG("read %d from %d to %p", blks, dblk, buf); + DEBUG("read %d from %lld to %p", blks, dblk, buf); if (rsize) *rsize = 0; @@ -244,9 +244,9 @@ bc_strategy(void *devdata, int rw, daddr return (EIO); } #ifdef BD_SUPPORT_FRAGS - DEBUG("bc_strategy: frag read %d from %d+%d to %p", + DEBUG("frag read %d from %lld+%d to %p", fragsize, dblk, blks, buf + (blks * BIOSCD_SECSIZE)); - if (fragsize && bc_read(unit, dblk + blks, 1, fragsize)) { + if (fragsize && bc_read(unit, dblk + blks, 1, fragbuf)) { DEBUG("frag read error"); return(EIO); } @@ -257,11 +257,15 @@ bc_strategy(void *devdata, int rw, daddr return (0); } +/* Max number of sectors to bounce-buffer at a time. */ +#define CD_BOUNCEBUF 8 + static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest) { - u_int result, retry; - static unsigned short packet[8]; + u_int maxfer, resid, result, retry, x; + caddr_t bbuf, p, xp; + static struct edd_packet packet; int biosdev; #ifdef DISK_DEBUG int error; @@ -275,47 +279,77 @@ bc_read(int unit, daddr_t dblk, int blks if (blks == 0) return (0); + /* Decide whether we have to bounce */ + if (VTOP(dest) >> 20 != 0) { + /* + * The destination buffer is above first 1MB of + * physical memory so we have to arrange a suitable + * bounce buffer. + */ + x = min(CD_BOUNCEBUF, (unsigned)blks); + bbuf = alloca(x * BIOSCD_SECSIZE); + maxfer = x; + } else { + bbuf = NULL; + maxfer = 0; + } + biosdev = bc_unit2bios(unit); - /* - * Loop retrying the operation a couple of times. The BIOS - * may also retry. - */ - for (retry = 0; retry < 3; retry++) { - /* If retrying, reset the drive */ - if (retry > 0) { + resid = blks; + p = dest; + + while (resid > 0) { + if (bbuf) + xp = bbuf; + else + xp = p; + x = resid; + if (maxfer > 0) + x = min(x, maxfer); + + /* + * Loop retrying the operation a couple of times. The BIOS + * may also retry. + */ + for (retry = 0; retry < 3; retry++) { + /* If retrying, reset the drive */ + if (retry > 0) { + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0; + v86.edx = biosdev; + v86int(); + } + + packet.len = 0x10; + packet.count = x; + packet.offset = VTOPOFF(xp); + packet.seg = VTOPSEG(xp); + packet.lba = dblk; v86.ctl = V86_FLAGS; v86.addr = 0x13; - v86.eax = 0; + v86.eax = 0x4200; v86.edx = biosdev; + v86.ds = VTOPSEG(&packet); + v86.esi = VTOPOFF(&packet); v86int(); + result = (v86.efl & PSL_C); + if (result == 0) + break; } - - packet[0] = 0x10; - packet[1] = blks; - packet[2] = VTOPOFF(dest); - packet[3] = VTOPSEG(dest); - packet[4] = dblk & 0xffff; - packet[5] = dblk >> 16; - packet[6] = 0; - packet[7] = 0; - v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x4200; - v86.edx = biosdev; - v86.ds = VTOPSEG(packet); - v86.esi = VTOPOFF(packet); - v86int(); - result = (v86.efl & PSL_C); - if (result == 0) - break; - } #ifdef DISK_DEBUG - error = (v86.eax >> 8) & 0xff; + error = (v86.eax >> 8) & 0xff; #endif - DEBUG("%d sectors from %ld to %p (0x%x) %s", blks, dblk, dest, - VTOP(dest), result ? "failed" : "ok"); - DEBUG("unit %d status 0x%x", unit, error); + DEBUG("%d sectors from %lld to %p (0x%x) %s", x, dblk, p, + VTOP(p), result ? "failed" : "ok"); + DEBUG("unit %d status 0x%x", unit, error); + if (bbuf != NULL) + bcopy(bbuf, p, x * BIOSCD_SECSIZE); + p += (x * BIOSCD_SECSIZE); + dblk += x; + resid -= x; + } /* hexdump(dest, (blks * BIOSCD_SECSIZE)); */ return(0); Modified: stable/6/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/6/sys/boot/i386/libi386/biosdisk.c Thu Mar 19 15:45:43 2009 (r190072) +++ stable/6/sys/boot/i386/libi386/biosdisk.c Thu Mar 19 15:46:33 2009 (r190073) @@ -1105,14 +1105,6 @@ bd_realstrategy(void *devdata, int rw, d /* Max number of sectors to bounce-buffer if the request crosses a 64k boundary */ #define FLOPPY_BOUNCEBUF 18 -struct edd_packet { - uint16_t len; - uint16_t count; - uint16_t offset; - uint16_t seg; - uint64_t lba; -}; - static int bd_edd_io(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest, int write) { Modified: stable/6/sys/boot/i386/libi386/libi386.h ============================================================================== --- stable/6/sys/boot/i386/libi386/libi386.h Thu Mar 19 15:45:43 2009 (r190072) +++ stable/6/sys/boot/i386/libi386/libi386.h Thu Mar 19 15:46:33 2009 (r190073) @@ -57,6 +57,14 @@ struct i386_devdesc } d_kind; }; +struct edd_packet { + uint16_t len; + uint16_t count; + uint16_t offset; + uint16_t seg; + uint64_t lba; +}; + int i386_getdev(void **vdev, const char *devspec, const char **path); char *i386_fmtdev(void *vdev); int i386_setcurrdev(struct env_var *ev, int flags, const void *value); From owner-svn-src-stable-6@FreeBSD.ORG Thu Mar 19 15:59:30 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57BE71065794; Thu, 19 Mar 2009 15:59:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 18DE58FC1A; Thu, 19 Mar 2009 15:59:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2JFxTMO067944; Thu, 19 Mar 2009 15:59:29 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2JFxT2I067943; Thu, 19 Mar 2009 15:59:29 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903191559.n2JFxT2I067943@svn.freebsd.org> From: Marius Strobl Date: Thu, 19 Mar 2009 15:59:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190076 - stable/6/share/man/man9 X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2009 15:59:31 -0000 Author: marius Date: Thu Mar 19 15:59:29 2009 New Revision: 190076 URL: http://svn.freebsd.org/changeset/base/190076 Log: r167274, r179694, r182816, r182962, r185004 - Some minor tweaks and updates to bus_dma(9) including some additional notes on the address filter and locking callback. - Mark "highaddr" and "lowaddr" appropriately. Change "dma" to "DMA". - Fix spelling mistage found by rodrigc@. - Document BUS_DMA_NOCACHE. - Remove unneeded comma. - For maximum flexibility, sparc64 supports BUS_DMA_COHERENT also with bus_dmamap_create() and not only bus_dmamem_alloc() so move the description of this flag up accordingly in order to document this fact. While at, it refine this description with an application example. Modified: stable/6/share/man/man9/bus_dma.9 Modified: stable/6/share/man/man9/bus_dma.9 ============================================================================== --- stable/6/share/man/man9/bus_dma.9 Thu Mar 19 15:50:45 2009 (r190075) +++ stable/6/share/man/man9/bus_dma.9 Thu Mar 19 15:59:29 2009 (r190076) @@ -60,7 +60,7 @@ .\" $FreeBSD$ .\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $ .\" -.Dd August 31, 2006 +.Dd November 16, 2008 .Dt BUS_DMA 9 .Os .Sh NAME @@ -153,7 +153,7 @@ for devices whose DMA address restrictio by a single window. The .Fa filtarg -is client specified during tag creation to be passed to all +argument is specified by the client during tag creation to be passed to all invocations of the callback. The .Fa testaddr @@ -163,11 +163,12 @@ The filter function operates on the set to .Ql trunc_page(testaddr) + PAGE_SIZE - 1 , inclusive. -The filter function should return zero for any mapping in this range -that can be accommodated by the device and non-zero otherwise. +The filter function should return zero if any mapping in this range +can be accommodated by the device and non-zero otherwise. .It Vt bus_dma_segment_t A machine-dependent type that describes individual DMA segments. +It contains the following fields: .Bd -literal bus_addr_t ds_addr; bus_size_t ds_len; @@ -213,13 +214,13 @@ The .Fa segs and .Fa nseg -parameters describe an array of +arguments describe an array of .Vt bus_dma_segment_t structures that represent the mapping. This array is only valid within the scope of the callback function. The success or failure of the mapping is indicated by the .Fa error -parameter. +argument. More information on the use of callbacks can be found in the description of the individual dmamap load functions. .It Vt bus_dmamap_callback2_t @@ -275,14 +276,14 @@ and prior to device access to host memor Perform any synchronization required after an update of host memory by the device and prior to CPU access to host memory. .It Dv BUS_DMASYNC_POSTWRITE -Perform any synchronization required after the device access to host memory. +Perform any synchronization required after device access to host memory. .El .It Vt bus_dma_lock_t Client specified lock/mutex manipulation method. This will be called from within busdma whenever a client lock needs to be manipulated. In its current form, the function will be called immediately before -the callback for a dma load operation that has been deferred with +the callback for a DMA load operation that has been deferred with .Dv BUS_DMA_LOCK and immediately after with .Dv BUS_DMA_UNLOCK . @@ -295,14 +296,20 @@ This method is of the format: .Fn "lockfunc" "void *lockfunc_arg" "bus_dma_lock_op_t op" .El .Pp +The +.Fa lockfuncarg +argument is specified by the client during tag creation to be passed to all +invocations of the callback. +The +.Fa op +argument specifies the lock operation to perform. +.Pp Two .Vt lockfunc implementations are provided for convenience. .Fn busdma_lock_mutex -performs standard mutex operations on the sleep mutex provided via the +performs standard mutex operations on the sleep mutex provided via .Fa lockfuncarg . -passed into -.Fn bus_dma_tag_create . .Fn dflt_lock will generate a system panic if it is called. It is substituted into the tag when @@ -310,7 +317,8 @@ It is substituted into the tag when is passed as .Dv NULL to -.Fn bus_dma_tag_create . +.Fn bus_dma_tag_create +and is useful for tags that should not be used with deferred load operations. .It Vt bus_dma_lock_op_t Operations to be performed by the client-specified .Fn lockfunc . @@ -355,17 +363,26 @@ indicates that there are no boundary res Bounds of the window of bus address space that .Em cannot be directly accessed by the device. -The window contains all addresses greater than lowaddr and -less than or equal to highaddr. -For example, a device incapable of DMA above 4GB, would specify -a highaddr of +The window contains all addresses greater than +.Fa lowaddr +and less than or equal to +.Fa highaddr . +For example, a device incapable of DMA above 4GB, would specify a +.Fa highaddr +of .Dv BUS_SPACE_MAXADDR -and a lowaddr of +and a +.Fa lowaddr +of .Dv BUS_SPACE_MAXADDR_32BIT . -Similarly a device that can only dma to addresses bellow 16MB would -specify a highaddr of +Similarly a device that can only perform DMA to addresses below +16MB would specify a +.Fa highaddr +of .Dv BUS_SPACE_MAXADDR -and a lowaddr of +and a +.Fa lowaddr +of .Dv BUS_SPACE_MAXADDR_24BIT . Some implementations requires that some region of device visible address space, overlapping available host memory, be outside the @@ -465,9 +482,23 @@ Arguments are as follows: .It Fa dmat DMA tag. .It Fa flags -The value of this argument is currently undefined and should be -specified as -.Ql 0 . +Are as follows: +.Bl -tag -width ".Dv BUS_DMA_COHERENT" +.It Dv BUS_DMA_COHERENT +Attempt to map the memory loaded with this map such that cache sync +operations are as cheap as possible. +This flag is typically set on maps when the memory loaded with these will +be accessed by both a CPU and a DMA engine, frequently such as control data +and as opposed to streamable data such as receive and transmit buffers. +Use of this flag does not remove the requirement of using +.Fn bus_dmamap_sync , +but it may reduce the cost of performing these operations. +For +.Fn bus_dmamap_create , +the +.Dv BUS_DMA_COHERENT +flag is currently implemented on sparc64. +.El .It Fa mapp Pointer to a .Vt bus_dmamap_t @@ -529,6 +560,15 @@ Are as follows: .It Dv BUS_DMA_NOWAIT The load should not be deferred in case of insufficient mapping resources, and instead should return immediately with an appropriate error. +.It Dv BUS_DMA_NOCACHE +The allocated memory will not be cached in the processor caches. +All memory accesses appear on the bus and are executed +without reordering. +On the amd64 and i386 architectures this flag results in the +Strong Uncacheable PAT to be set for the allocated virtual address range. +The +.Dv BUS_DMA_NOCACHE +flag is currently implemented on amd64, i386 and sparc64. .El .El .Pp @@ -690,15 +730,16 @@ that is to be made available to a device To ensure that the data are visible via the device's mapping of that memory, the buffer must be loaded and a DMA sync operation of .Dv BUS_DMASYNC_PREWRITE -must be performed. -If later CPU modifies this buffer again, another +must be performed after the CPU has updated the buffer and before the device +access is initiated. +If the CPU modifies this buffer again later, another .Dv BUS_DMASYNC_PREWRITE -sync operation must be performed before an additional -access to this memory by a device. -Conversely, a device updates the memory that is to be read by a CPU. +sync operation must be performed before an additional device +access. +Conversely, suppose a device updates memory that is to be read by a CPU. In this case, the buffer must be loaded, and a DMA sync operation of .Dv BUS_DMASYNC_PREREAD -must be performed. +must be performed before the device access is initiated. The CPU will only be able to see the results of this memory update once the DMA operation has completed and a .Dv BUS_DMASYNC_POSTREAD @@ -710,7 +751,7 @@ appropriate synchronization operations, Allocates memory that is mapped into KVA at the address returned in .Fa vaddr -that is permanently loaded into the newly created +and that is permanently loaded into the newly created .Vt bus_dmamap_t returned via .Fa mapp . @@ -732,16 +773,15 @@ If resources are not available, .Dv ENOMEM is returned. .It Dv BUS_DMA_COHERENT -Attempt to map this memory such that cache sync operations are -as cheap as possible. -This flag is typically set on memory that will be accessed by both -a CPU and a DMA engine, frequently. -Use of this flag does not remove the requirement of using -bus_dmamap_sync, but it may reduce the cost of performing -these operations. -The +Attempt to map this memory in a coherent fashion. +See +.Fn bus_dmamap_create +above for a description of this flag. +For +.Fn bus_dmamem_alloc , +the .Dv BUS_DMA_COHERENT -flag is currently implemented on sparc64 and arm. +flag is currently implemented on arm and sparc64. .It Dv BUS_DMA_ZERO Causes the allocated memory to be set to all zeros. .El @@ -753,7 +793,9 @@ where the resulting DMA map will be stor .Pp The size of memory to be allocated is .Fa maxsize -as specified in +as specified in the call to +.Fn bus_dma_tag_create +for .Fa dmat . .Pp The current implementation of @@ -801,10 +843,10 @@ transaction, .Er ENOMEM is returned. All -routines that are not of type, -.Vt void , +routines that are not of type +.Vt void will return 0 on success or an error -code, as discussed above. +code on failure as discussed above. .Pp All .Vt void @@ -878,7 +920,7 @@ called with any non-sleepable locks held .El .Pp All other functions do not have a locking protocol and can thus be -called with or without and system or driver locks held. +called with or without any system or driver locks held. .Sh SEE ALSO .Xr devclass 9 , .Xr device 9 , From owner-svn-src-stable-6@FreeBSD.ORG Thu Mar 19 16:39:59 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E231710656BF; Thu, 19 Mar 2009 16:39:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEA458FC1F; Thu, 19 Mar 2009 16:39:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2JGdxvG069240; Thu, 19 Mar 2009 16:39:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2JGdxpH069239; Thu, 19 Mar 2009 16:39:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903191639.n2JGdxpH069239@svn.freebsd.org> From: Marius Strobl Date: Thu, 19 Mar 2009 16:39:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190081 - in stable/6/sys: . contrib/pf dev/cxgb dev/isp X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2009 16:40:02 -0000 Author: marius Date: Thu Mar 19 16:39:59 2009 New Revision: 190081 URL: http://svn.freebsd.org/changeset/base/190081 Log: MFC: r186140 Don't try reading the SXP_PINS_DIFF on the 10160 and 12160 SCSI controllers. Reading this register, for which there are indications that it doesn't really exist, returns 0 on at least some 12160 and doing so on Sun Fire V880 causes a data access error exception. Reported and tested by: Beat Gaetzi Approved by: mjacob Obtained from: OpenBSD (modulo setting isp_lvdmode) Modified: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) stable/6/sys/dev/isp/isp.c Modified: stable/6/sys/dev/isp/isp.c ============================================================================== --- stable/6/sys/dev/isp/isp.c Thu Mar 19 16:37:30 2009 (r190080) +++ stable/6/sys/dev/isp/isp.c Thu Mar 19 16:39:59 2009 (r190081) @@ -335,6 +335,23 @@ isp_reset(ispsoftc_t *isp) /* * XXX: Should probably do some bus sensing. */ + } else if (IS_ULTRA3(isp)) { + sdparam *sdp = isp->isp_param; + + isp->isp_clock = 100; + + if (IS_10160(isp)) + btype = "10160"; + else if (IS_12160(isp)) + btype = "12160"; + else + btype = ""; + sdp->isp_lvdmode = 1; + + if (IS_DUALBUS(isp)) { + sdp++; + sdp->isp_lvdmode = 1; + } } else if (IS_ULTRA2(isp)) { static const char m[] = "bus %d is in %s Mode"; uint16_t l; @@ -346,10 +363,6 @@ isp_reset(ispsoftc_t *isp) btype = "1280"; else if (IS_1080(isp)) btype = "1080"; - else if (IS_10160(isp)) - btype = "10160"; - else if (IS_12160(isp)) - btype = "12160"; else btype = ""; From owner-svn-src-stable-6@FreeBSD.ORG Thu Mar 19 16:44:37 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91D9710656E8; Thu, 19 Mar 2009 16:44:37 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7EE5B8FC13; Thu, 19 Mar 2009 16:44:37 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2JGib5Y069438; Thu, 19 Mar 2009 16:44:37 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2JGibK6069437; Thu, 19 Mar 2009 16:44:37 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903191644.n2JGibK6069437@svn.freebsd.org> From: Marius Strobl Date: Thu, 19 Mar 2009 16:44:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190083 - in stable/6/sys: . contrib/pf dev/bge dev/cxgb X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2009 16:44:39 -0000 Author: marius Date: Thu Mar 19 16:44:37 2009 New Revision: 190083 URL: http://svn.freebsd.org/changeset/base/190083 Log: MFC: r188164, r188457 - device_shutdown returns an int. - Don't reset the PHY probe retry counter within the loop so it will eventually terminate as intended. [1] Submitted by: Helen Zhang [1] Modified: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/bge/if_bge.c stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/dev/bge/if_bge.c ============================================================================== --- stable/6/sys/dev/bge/if_bge.c Thu Mar 19 16:44:37 2009 (r190082) +++ stable/6/sys/dev/bge/if_bge.c Thu Mar 19 16:44:37 2009 (r190083) @@ -348,7 +348,7 @@ static void bge_init_locked(struct bge_s static void bge_init(void *); static void bge_stop(struct bge_softc *); static void bge_watchdog(struct bge_softc *); -static void bge_shutdown(device_t); +static int bge_shutdown(device_t); static int bge_ifmedia_upd_locked(struct ifnet *); static int bge_ifmedia_upd(struct ifnet *); static void bge_ifmedia_sts(struct ifnet *, struct ifmediareq *); @@ -2661,11 +2661,11 @@ bge_attach(device_t dev) * if we get a conflict with the ASF firmware accessing * the PHY. */ + trys = 0; BGE_CLRBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); again: bge_asf_driver_up(sc); - trys = 0; if (mii_phy_probe(dev, &sc->bge_miibus, bge_ifmedia_upd, bge_ifmedia_sts)) { if (trys++ < 4) { @@ -4223,17 +4223,18 @@ bge_stop(struct bge_softc *sc) * Stop all chip I/O so that the kernel's probe routines don't * get confused by errant DMAs when rebooting. */ -static void +static int bge_shutdown(device_t dev) { struct bge_softc *sc; sc = device_get_softc(dev); - BGE_LOCK(sc); bge_stop(sc); bge_reset(sc); BGE_UNLOCK(sc); + + return (0); } static int From owner-svn-src-stable-6@FreeBSD.ORG Thu Mar 19 16:55:42 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BADC41065709; Thu, 19 Mar 2009 16:55:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5FCF8FC22; Thu, 19 Mar 2009 16:55:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2JGtgwa069759; Thu, 19 Mar 2009 16:55:42 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2JGtgYl069758; Thu, 19 Mar 2009 16:55:42 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903191655.n2JGtgYl069758@svn.freebsd.org> From: John Baldwin Date: Thu, 19 Mar 2009 16:55:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190085 - in stable/6/sys: . boot/i386/libi386 contrib/pf dev/cxgb X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2009 16:55:45 -0000 Author: jhb Date: Thu Mar 19 16:55:42 2009 New Revision: 190085 URL: http://svn.freebsd.org/changeset/base/190085 Log: MFC: Fix uninitialized pointer dereference. Modified: stable/6/sys/ (props changed) stable/6/sys/boot/i386/libi386/devicename.c stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/boot/i386/libi386/devicename.c ============================================================================== --- stable/6/sys/boot/i386/libi386/devicename.c Thu Mar 19 16:55:26 2009 (r190084) +++ stable/6/sys/boot/i386/libi386/devicename.c Thu Mar 19 16:55:42 2009 (r190085) @@ -150,6 +150,8 @@ i386_parsedev(struct i386_devdesc **dev, cp++; } } + } else { + cp = np; } if (*cp && (*cp != ':')) { err = EINVAL; @@ -173,6 +175,8 @@ i386_parsedev(struct i386_devdesc **dev, err = EUNIT; goto fail; } + } else { + cp = np; } if (*cp && (*cp != ':')) { err = EINVAL; From owner-svn-src-stable-6@FreeBSD.ORG Thu Mar 19 17:14:01 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D89D1065670; Thu, 19 Mar 2009 17:14:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69CE08FC0A; Thu, 19 Mar 2009 17:14:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2JHE14q070309; Thu, 19 Mar 2009 17:14:01 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2JHE1l4070303; Thu, 19 Mar 2009 17:14:01 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903191714.n2JHE1l4070303@svn.freebsd.org> From: John Baldwin Date: Thu, 19 Mar 2009 17:14:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190088 - in stable/6/sys: . boot/i386/libi386 boot/i386/loader contrib/pf dev/cxgb X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2009 17:14:02 -0000 Author: jhb Date: Thu Mar 19 17:14:00 2009 New Revision: 190088 URL: http://svn.freebsd.org/changeset/base/190088 Log: MFC: - Make it possible to disable GPT support by setting LOADER_NO_GPT_SUPPORT in make.conf or src.conf. - When GPT is enabled (which it is by default), use memory above 1 MB and leave the memory from the end of the bss to the end of the 640k window purely for the stack. The loader has grown and now it is much more common for the heap and stack to grow into each other when both are located in the 640k window. Modified: stable/6/sys/ (props changed) stable/6/sys/boot/i386/libi386/Makefile stable/6/sys/boot/i386/libi386/biosdisk.c stable/6/sys/boot/i386/libi386/devicename.c stable/6/sys/boot/i386/loader/Makefile stable/6/sys/boot/i386/loader/main.c stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/boot/i386/libi386/Makefile ============================================================================== --- stable/6/sys/boot/i386/libi386/Makefile Thu Mar 19 17:06:04 2009 (r190087) +++ stable/6/sys/boot/i386/libi386/Makefile Thu Mar 19 17:14:00 2009 (r190088) @@ -26,6 +26,10 @@ CFLAGS+= -DDISK_DEBUG CFLAGS+= -DSMBIOS_SERIAL_NUMBERS .endif +.if !defined(LOADER_NO_GPT_SUPPORT) +CFLAGS+= -DLOADER_GPT_SUPPORT +.endif + # Include simple terminal emulation (cons25-compatible) CFLAGS+= -DTERM_EMU Modified: stable/6/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/6/sys/boot/i386/libi386/biosdisk.c Thu Mar 19 17:06:04 2009 (r190087) +++ stable/6/sys/boot/i386/libi386/biosdisk.c Thu Mar 19 17:14:00 2009 (r190088) @@ -68,12 +68,14 @@ __FBSDID("$FreeBSD$"); # define DEBUG(fmt, args...) #endif +#ifdef LOADER_GPT_SUPPORT struct gpt_part { int gp_index; uuid_t gp_type; uint64_t gp_start; uint64_t gp_end; }; +#endif struct open_disk { int od_dkunit; /* disk unit number */ @@ -90,25 +92,31 @@ struct open_disk { #define BD_FLOPPY 0x0004 #define BD_LABELOK 0x0008 #define BD_PARTTABOK 0x0010 +#ifdef LOADER_GPT_SUPPORT #define BD_GPTOK 0x0020 +#endif union { struct { struct disklabel mbr_disklabel; int mbr_nslices; /* slice count */ struct dos_partition mbr_slicetab[NEXTDOSPART]; } _mbr; +#ifdef LOADER_GPT_SUPPORT struct { int gpt_nparts; struct gpt_part *gpt_partitions; } _gpt; +#endif } _data; }; #define od_disklabel _data._mbr.mbr_disklabel #define od_nslices _data._mbr.mbr_nslices #define od_slicetab _data._mbr.mbr_slicetab +#ifdef LOADER_GPT_SUPPORT #define od_nparts _data._gpt.gpt_nparts #define od_partitions _data._gpt.gpt_partitions +#endif /* * List of BIOS devices, translation from disk unit number to @@ -130,8 +138,10 @@ static int bd_write(struct open_disk *od static int bd_int13probe(struct bdinfo *bd); +#ifdef LOADER_GPT_SUPPORT static void bd_printgptpart(struct open_disk *od, struct gpt_part *gp, char *prefix, int verbose); +#endif static void bd_printslice(struct open_disk *od, struct dos_partition *dp, char *prefix, int verbose); static void bd_printbsdslice(struct open_disk *od, daddr_t offset, @@ -163,8 +173,10 @@ static void bd_closedisk(struct open_dis static int bd_open_mbr(struct open_disk *od, struct i386_devdesc *dev); static int bd_bestslice(struct open_disk *od); static void bd_checkextended(struct open_disk *od, int slicenum); +#ifdef LOADER_GPT_SUPPORT static int bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev); static struct gpt_part *bd_best_gptpart(struct open_disk *od); +#endif /* * Translate between BIOS device numbers and our private unit numbers. @@ -286,6 +298,7 @@ bd_print(int verbose) if (!bd_opendisk(&od, &dev)) { +#ifdef LOADER_GPT_SUPPORT /* Do we have a GPT table? */ if (od->od_flags & BD_GPTOK) { for (j = 0; j < od->od_nparts; j++) { @@ -293,9 +306,10 @@ bd_print(int verbose) od->od_partitions[j].gp_index); bd_printgptpart(od, &od->od_partitions[j], line, verbose); } - + } else +#endif /* Do we have a partition table? */ - } else if (od->od_flags & BD_PARTTABOK) { + if (od->od_flags & BD_PARTTABOK) { dptr = &od->od_slicetab[0]; /* Check for a "dedicated" disk */ @@ -316,6 +330,7 @@ bd_print(int verbose) } } +#ifdef LOADER_GPT_SUPPORT static uuid_t efi = GPT_ENT_TYPE_EFI; static uuid_t freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; static uuid_t freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; @@ -365,6 +380,7 @@ bd_printgptpart(struct open_disk *od, st stats); pager_output(line); } +#endif /* * Print information about slices on a disk. For the size calculations we @@ -566,8 +582,10 @@ bd_opendisk(struct open_disk **odp, stru } /* Determine disk layout. */ +#ifdef LOADER_GPT_SUPPORT error = bd_open_gpt(od, dev); if (error) +#endif error = bd_open_mbr(od, dev); out: @@ -831,6 +849,7 @@ bd_bestslice(struct open_disk *od) return (prefslice); } +#ifdef LOADER_GPT_SUPPORT static int bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev) { @@ -1005,6 +1024,7 @@ bd_best_gptpart(struct open_disk *od) } return (prefpart); } +#endif static int bd_close(struct open_file *f) @@ -1024,8 +1044,10 @@ bd_closedisk(struct open_disk *od) if (od->od_flags & BD_FLOPPY) delay(3000000); #endif +#ifdef LOADER_GPT_SUPPORT if (od->od_flags & BD_GPTOK) free(od->od_partitions); +#endif free(od); } Modified: stable/6/sys/boot/i386/libi386/devicename.c ============================================================================== --- stable/6/sys/boot/i386/libi386/devicename.c Thu Mar 19 17:06:04 2009 (r190087) +++ stable/6/sys/boot/i386/libi386/devicename.c Thu Mar 19 17:14:00 2009 (r190088) @@ -120,6 +120,7 @@ i386_parsedev(struct i386_devdesc **dev, err = EUNIT; goto fail; } +#ifdef LOADER_GPT_SUPPORT if (*cp == 'p') { /* got a GPT partition */ np = cp + 1; slice = strtol(np, &cp, 10); @@ -133,6 +134,7 @@ i386_parsedev(struct i386_devdesc **dev, } partition = 0xff; } else { +#endif if (*cp == 's') { /* got a slice number */ np = cp + 1; slice = strtol(np, &cp, 10); @@ -149,7 +151,9 @@ i386_parsedev(struct i386_devdesc **dev, } cp++; } +#ifdef LOADER_GPT_SUPPORT } +#endif } else { cp = np; } @@ -229,14 +233,18 @@ i386_fmtdev(void *vdev) case DEVT_DISK: cp = buf; cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_kind.biosdisk.unit); +#ifdef LOADER_GPT_SUPPORT if (dev->d_kind.biosdisk.partition == 0xff) { cp += sprintf(cp, "p%d", dev->d_kind.biosdisk.slice); } else { +#endif if (dev->d_kind.biosdisk.slice > 0) cp += sprintf(cp, "s%d", dev->d_kind.biosdisk.slice); if (dev->d_kind.biosdisk.partition >= 0) cp += sprintf(cp, "%c", dev->d_kind.biosdisk.partition + 'a'); +#ifdef LOADER_GPT_SUPPORT } +#endif strcat(cp, ":"); break; Modified: stable/6/sys/boot/i386/loader/Makefile ============================================================================== --- stable/6/sys/boot/i386/loader/Makefile Thu Mar 19 17:06:04 2009 (r190087) +++ stable/6/sys/boot/i386/loader/Makefile Thu Mar 19 17:14:00 2009 (r190088) @@ -31,6 +31,9 @@ CFLAGS+= -DLOADER_BZIP2_SUPPORT .if !defined(LOADER_NO_GZIP_SUPPORT) CFLAGS+= -DLOADER_GZIP_SUPPORT .endif +.if !defined(LOADER_NO_GPT_SUPPORT) +CFLAGS+= -DLOADER_GPT_SUPPORT +.endif # Always add MI sources .PATH: ${.CURDIR}/../../common Modified: stable/6/sys/boot/i386/loader/main.c ============================================================================== --- stable/6/sys/boot/i386/loader/main.c Thu Mar 19 17:06:04 2009 (r190087) +++ stable/6/sys/boot/i386/loader/main.c Thu Mar 19 17:14:00 2009 (r190088) @@ -96,7 +96,7 @@ main(void) */ bios_getmem(); -#ifdef LOADER_BZIP2_SUPPORT +#if defined(LOADER_BZIP2_SUPPORT) || defined(LOADER_GPT_SUPPORT) heap_top = PTOV(memtop_copyin); memtop_copyin -= 0x300000; heap_bottom = PTOV(memtop_copyin); From owner-svn-src-stable-6@FreeBSD.ORG Thu Mar 19 19:22:12 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54E1E106566B; Thu, 19 Mar 2009 19:22:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 421FA8FC13; Thu, 19 Mar 2009 19:22:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2JJMClH073185; Thu, 19 Mar 2009 19:22:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2JJMCF5073184; Thu, 19 Mar 2009 19:22:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903191922.n2JJMCF5073184@svn.freebsd.org> From: John Baldwin Date: Thu, 19 Mar 2009 19:22:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190095 - in stable/6/sys: . contrib/pf dev/cxgb dev/pci X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2009 19:22:13 -0000 Author: jhb Date: Thu Mar 19 19:22:11 2009 New Revision: 190095 URL: http://svn.freebsd.org/changeset/base/190095 Log: MFC: Honor the prefetchable flag in memory BARs. Modified: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) stable/6/sys/dev/pci/pci.c Modified: stable/6/sys/dev/pci/pci.c ============================================================================== --- stable/6/sys/dev/pci/pci.c Thu Mar 19 18:45:37 2009 (r190094) +++ stable/6/sys/dev/pci/pci.c Thu Mar 19 19:22:11 2009 (r190095) @@ -1706,9 +1706,11 @@ pci_add_map(device_t pcib, device_t bus, testval = PCIB_READ_CONFIG(pcib, b, s, f, reg, 4); PCIB_WRITE_CONFIG(pcib, b, s, f, reg, map, 4); - if (pci_maptype(map) & PCI_MAPMEM) + if (pci_maptype(map) & PCI_MAPMEM) { type = SYS_RES_MEMORY; - else + if (pci_maptype(map) & PCI_MAPMEMP) + prefetch = 1; + } else type = SYS_RES_IOPORT; ln2size = pci_mapsize(testval); ln2range = pci_maprange(testval); @@ -2811,7 +2813,9 @@ pci_alloc_map(device_t dev, device_t chi count = 1 << mapsize; if (RF_ALIGNMENT(flags) < mapsize) flags = (flags & ~RF_ALIGNMENT_MASK) | RF_ALIGNMENT_LOG2(mapsize); - + if (pci_maptype(testval) & PCI_MAPMEMP) + flags |= RF_PREFETCHABLE; + /* * Allocate enough resource, and then write back the * appropriate bar for that resource. From owner-svn-src-stable-6@FreeBSD.ORG Fri Mar 20 16:02:37 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7A361065688; Fri, 20 Mar 2009 16:02:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4BA18FC2A; Fri, 20 Mar 2009 16:02:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2KG2bUQ007142; Fri, 20 Mar 2009 16:02:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2KG2bak007141; Fri, 20 Mar 2009 16:02:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903201602.n2KG2bak007141@svn.freebsd.org> From: John Baldwin Date: Fri, 20 Mar 2009 16:02:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190160 - in stable/6/sys: . contrib/pf dev/cxgb nfsclient X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Mar 2009 16:02:38 -0000 Author: jhb Date: Fri Mar 20 16:02:37 2009 New Revision: 190160 URL: http://svn.freebsd.org/changeset/base/190160 Log: MFC: Add a new vfs.nfs.prime_access_cache sysctl to determine whether or not nfs_getattr() will use an ACCESS RPC to prime the access cache instead of a simple GETATTR RPC. The sysctl defaults to enabled to maintain the previous behavior. Modified: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) stable/6/sys/nfsclient/nfs_vnops.c Modified: stable/6/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/6/sys/nfsclient/nfs_vnops.c Fri Mar 20 15:52:11 2009 (r190159) +++ stable/6/sys/nfsclient/nfs_vnops.c Fri Mar 20 16:02:37 2009 (r190160) @@ -205,6 +205,11 @@ static int nfsaccess_cache_timeout = NFS SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_timeout, CTLFLAG_RW, &nfsaccess_cache_timeout, 0, "NFS ACCESS cache timeout"); +static int nfs_prime_access_cache = 1; +SYSCTL_INT(_vfs_nfs, OID_AUTO, prime_access_cache, CTLFLAG_RW, + &nfs_prime_access_cache, 0, + "Prime NFS ACCESS cache when fetching attributes"); + static int nfsv3_commit_on_close = 0; SYSCTL_INT(_vfs_nfs, OID_AUTO, nfsv3_commit_on_close, CTLFLAG_RW, &nfsv3_commit_on_close, 0, "write+commit on close, else only write"); @@ -585,7 +590,7 @@ nfs_getattr(struct vop_getattr_args *ap) if (nfs_getattrcache(vp, ap->a_vap) == 0) return (0); - if (v3 && nfsaccess_cache_timeout > 0) { + if (v3 && nfs_prime_access_cache && nfsaccess_cache_timeout > 0) { nfsstats.accesscache_misses++; nfs3_access_otw(vp, NFSV3ACCESS_ALL, ap->a_td, ap->a_cred); if (nfs_getattrcache(vp, ap->a_vap) == 0) From owner-svn-src-stable-6@FreeBSD.ORG Fri Mar 20 21:47:27 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FA79106564A; Fri, 20 Mar 2009 21:47:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D704F8FC0A; Fri, 20 Mar 2009 21:47:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2KLlQWJ014474; Fri, 20 Mar 2009 21:47:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2KLlQ4e014473; Fri, 20 Mar 2009 21:47:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903202147.n2KLlQ4e014473@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 20 Mar 2009 21:47:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190179 - in stable/6/sys: . contrib/pf dev/cxgb kern X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Mar 2009 21:47:28 -0000 Author: kib Date: Fri Mar 20 21:47:26 2009 New Revision: 190179 URL: http://svn.freebsd.org/changeset/base/190179 Log: MFC r185983: The userland_sysctl() function retries sysctl_root() until returned error is not EAGAIN. Several sysctls that inspect another process use p_candebug() for checking access right for the curproc. p_candebug() returns EAGAIN for some reasons, in particular, for the process doing exec() now. If execing process tries to lock Giant, we get a livelock, because sysctl handlers are covered by Giant, and often do not sleep. Break the livelock by dropping Giant and allowing other threads to execute in the EAGAIN loop. This commit does not merge the following change, as was discussed with jhb: [Also, do not return EAGAIN from p_candebug() when process is executing, use more appropriate EBUSY error.] MFC r185987: Uio_yield() already does DROP_GIANT/PICKUP_GIANT, no need to repeat this around the call. Tested by: Eugene Grosbein Modified: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) stable/6/sys/kern/kern_sysctl.c Modified: stable/6/sys/kern/kern_sysctl.c ============================================================================== --- stable/6/sys/kern/kern_sysctl.c Fri Mar 20 21:46:28 2009 (r190178) +++ stable/6/sys/kern/kern_sysctl.c Fri Mar 20 21:47:26 2009 (r190179) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1374,11 +1375,14 @@ userland_sysctl(struct thread *td, int * SYSCTL_LOCK(); - do { + for (;;) { req.oldidx = 0; req.newidx = 0; error = sysctl_root(0, name, namelen, &req); - } while (error == EAGAIN); + if (error != EAGAIN) + break; + uio_yield(); + } if (req.lock == REQ_WIRED && req.validlen > 0) vsunlock(req.oldptr, req.validlen); From owner-svn-src-stable-6@FreeBSD.ORG Sat Mar 21 22:35:45 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D0C7106564A; Sat, 21 Mar 2009 22:35:45 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED8AE8FC08; Sat, 21 Mar 2009 22:35:44 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2LMZibZ049153; Sat, 21 Mar 2009 22:35:44 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2LMZinB049151; Sat, 21 Mar 2009 22:35:44 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200903212235.n2LMZinB049151@svn.freebsd.org> From: Doug Barton Date: Sat, 21 Mar 2009 22:35:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190224 - stable/6/usr.sbin/mergemaster X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Mar 2009 22:35:45 -0000 Author: dougb Date: Sat Mar 21 22:35:44 2009 New Revision: 190224 URL: http://svn.freebsd.org/changeset/base/190224 Log: MFC r189761, r189763, r189992, r189994: 1. Fix creation and saving of the new mtree file with the -D option 2. Clean up usage() and man page so the options are all listed consistently 3. Add -F option 4. More man page cleanups for CVS -> VCS, punctuation, etc. Modified: stable/6/usr.sbin/mergemaster/ (props changed) stable/6/usr.sbin/mergemaster/mergemaster.8 stable/6/usr.sbin/mergemaster/mergemaster.sh Modified: stable/6/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/6/usr.sbin/mergemaster/mergemaster.8 Sat Mar 21 22:32:53 2009 (r190223) +++ stable/6/usr.sbin/mergemaster/mergemaster.8 Sat Mar 21 22:35:44 2009 (r190224) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 2, 2009 +.Dd March 18, 2009 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -32,14 +32,14 @@ .Nd merge configuration files, et al during an upgrade .Sh SYNOPSIS .Nm -.Op Fl achiprsvCPU -.Op Fl A Ar Target architecture -.Op Fl D Ar /destdir/path +.Op Fl scrvahipFCPU .Op Fl m Ar /path/to/sources .Op Fl t Ar /path/to/temp/root .Op Fl d .Op Fl u Ar N .Op Fl w Ar N +.Op Fl A Ar Target architecture +.Op Fl D Ar /destdir/path .Sh DESCRIPTION The .Nm @@ -82,15 +82,23 @@ merge by hand later. By default it creates the temporary root in .Pa /var/tmp/temproot and compares the -.Xr cvs 1 -version $Id/$FreeBSD strings for files that have them, deleting +Version Control System (VCS) Id strings ($FreeBSD$) +for files that have them, deleting the temporary file if the strings match. If there is -no $Id string, or if the strings are different it +no Id string, or if the strings are different it compares the files themselves. You can -also specify that the script ignore the $Id strings and -compare every file. +also specify that the script ignore the Id strings and +compare every file with the +.Op Fl s +option. +Using the +.Op Fl F +option +.Nm +will install the new file for you if they differ only by +VCS strings. .Pp The merge menu option is designed to let you easily combine your customizations from the old version of a file into the new one. @@ -117,11 +125,13 @@ After installing an updated version of this file you should probably run .Xr pwd_mkdb 8 -with the -p option to rebuild your password databases +with the +.Op Fl p +option to rebuild your password databases and recreate .Pa /etc/passwd . .Pp -The script uses the owner and group id's +The script uses the owner and group ids that the files are created with by .Pa /usr/src/etc/Makefile , and file permissions as specified by the umask. @@ -158,9 +168,9 @@ and therefore can override both files. The options are as follows: .Bl -tag -width Fl .It Fl s -Perform a strict comparison, diff'ing every pair of files. +Perform a strict comparison, diffing every pair of files. This comparison is performed line by line, -without regard to CVS $Id's. +without regard to VCS Ids. .It Fl c Use context diffs instead of unified diffs. .It Fl r @@ -189,8 +199,11 @@ directory exists, it creates a new one i non-existent directory. This option unsets the verbose flag, but is compatible with all other options. -Setting -a makes --w superfluous. +Setting +.Op Fl a +makes +.Op Fl w +superfluous. .It Fl h Display usage and help information. .It Fl i @@ -202,6 +215,9 @@ Compares only files known to be essentia {build|install}world, including .Pa /etc/make.conf . +.It Fl F +If the files differ only by VCS Id ($FreeBSD$) +install the new file. .It Fl C After a standard .Nm @@ -213,6 +229,8 @@ Preserve files that you replace in or another directory you specify in your .Nm rc file. +.It Fl U +Attempt to auto upgrade files that have not been user modified. .It Fl m Ar /path/to/sources Specify the path to the directory where you want to do the .Xr make 1 . @@ -234,7 +252,9 @@ instead of the default .It Fl d Add the date and time to the name of the temporary root directory. -If -t is specified, this option must +If +.Op Fl t +is specified, this option must follow it if you want the date added too. .It Fl u Ar N Specify a numeric umask. @@ -250,8 +270,6 @@ Specify an alternative architecture name. .It Fl D Ar /path Specify the destination directory for the installed files. -.It Fl U -Attempt to auto upgrade files that have not been user modified. .El .Sh ENVIRONMENT The @@ -314,12 +332,15 @@ with all values commented out: # Specify the destination directory for the installed files #DESTDIR= # -# Strict comparison bypasses the CVS $Id tests and compares every file +# Strict comparison skips the VCS Id test and compares every file #STRICT=no # # Type of diff, such as unified, context, etc. #DIFF_FLAG='-u' # +# Install the new file if it differs only by VCS Id ($FreeBSD$) +#FREEBSD_ID= +# # Verbose mode includes more details and additional checks #VERBOSE= # @@ -345,7 +366,7 @@ with all values commented out: #IGNORE_FILES='/etc/motd /etc/printcap foo bar' # # Additional options for diff. This will get unset when using -s. -#DIFF_OPTIONS='-I$\&FreeBSD:.*[$]' # Ignores CVS Id tags +#DIFF_OPTIONS='-Bb' # Ignore changes in whitespace # # Location to store the list of mtree values for AUTO_UPGRADE purposes #MTREEDB='/var/db' @@ -382,7 +403,7 @@ Typically all you will need to do is typ .Nm at the prompt and the script will do all the work for you. .Pp -To use context diff's and have +To use context diffs and have .Nm explain more things as it goes along, use: .Pp @@ -401,7 +422,6 @@ comparison, use: .Pp .Dl # mergemaster -sw 110 .Sh SEE ALSO -.Xr cvs 1 , .Xr diff 1 , .Xr make 1 , .Xr more 1 , Modified: stable/6/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/6/usr.sbin/mergemaster/mergemaster.sh Sat Mar 21 22:32:53 2009 (r190223) +++ stable/6/usr.sbin/mergemaster/mergemaster.sh Sat Mar 21 22:35:44 2009 (r190224) @@ -15,8 +15,8 @@ PATH=/bin:/usr/bin:/usr/sbin display_usage () { VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` echo "mergemaster version ${VERSION_NUMBER}" - echo 'Usage: mergemaster [-scrvahipCP] [-m /path]' - echo ' [-t /path] [-d] [-u N] [-w N] [-D /path]' + echo 'Usage: mergemaster [-scrvahipFCPU]' + echo ' [-m /path] [-t /path] [-d] [-u N] [-w N] [-A arch] [-D /path]' echo "Options:" echo " -s Strict comparison (diff every pair of files)" echo " -c Use context diff instead of unified diff" @@ -26,8 +26,11 @@ display_usage () { echo " -h Display more complete help" echo ' -i Automatically install files that do not exist in destination directory' echo ' -p Pre-buildworld mode, only compares crucial files' + echo ' -F Install files that differ only by revision control Id ($FreeBSD$)' echo ' -C Compare local rc.conf variables to the defaults' echo ' -P Preserve files that are overwritten' + echo " -U Attempt to auto upgrade files that have not been user modified" + echo '' echo " -m /path/directory Specify location of source to do the make in" echo " -t /path/directory Specify temp root directory" echo " -d Add date and time to directory name (e.g., /var/tmp/temproot.`date +%m%d.%H.%M`)" @@ -35,7 +38,6 @@ display_usage () { echo " -w N Specify a screen width in columns to sdiff" echo " -A architecture Alternative architecture name to pass to make" echo ' -D /path/directory Specify the destination directory to install files to' - echo " -U Attempt to auto upgrade files that have not been user modified." echo '' } @@ -263,11 +265,14 @@ MTREEFILE="${MTREEDB}/mergemaster.mtree" # Check the command line options # -while getopts ":ascrvhipCPm:t:du:w:D:A:U" COMMAND_LINE_ARGUMENT ; do +while getopts ":ascrvhipCPm:t:du:w:D:A:FU" COMMAND_LINE_ARGUMENT ; do case "${COMMAND_LINE_ARGUMENT}" in A) ARCHSTRING='TARGET_ARCH='${OPTARG} ;; + F) + FREEBSD_ID=yes + ;; U) AUTO_UPGRADE=yes ;; @@ -665,7 +670,7 @@ find ${TEMPROOT} -type f -size 0 -delete # Build the mtree database in a temporary location. MTREENEW=`mktemp -t mergemaster.mtree` case "${PRE_WORLD}" in -'') mtree -ci -p ${TEMPROOT} -k size,md5digest > ${DESTDIR}${MTREENEW} 2>/dev/null +'') mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null ;; *) # We don't want to mess with the mtree database on a pre-world run. ;; @@ -1014,6 +1019,19 @@ for COMPFILE in `find . -type f -size +0 # Use more if not. # Use unified diffs by default. Context diffs give me a headache. :) # + # If the user chose the -F option, test for that before proceeding + # + if [ -n "$FREEBSD_ID" ]; then + if diff -q -I'[$]FreeBSD:.*$' "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > \ + /dev/null 2>&1; then + if mm_install "${COMPFILE}"; then + echo "*** Updated revision control Id for ${DESTDIR}${COMPFILE#.}" + else + echo "*** Problem installing ${COMPFILE}, it will remain to merge by hand later" + fi + continue + fi + fi case "${AUTO_RUN}" in '') # prompt user to install/delete/merge changes @@ -1026,15 +1044,15 @@ for COMPFILE in `find . -type f -size +0 esac # Auto run test fi # Yes, the files are different fi # Yes, the file still remains to be checked -done # This is for the do way up there at the beginning of the comparison +done # This is for the for way up there at the beginning of the comparison echo '' echo "*** Comparison complete" -if [ -f "${DESTDIR}${MTREENEW}" ]; then +if [ -f "${MTREENEW}" ]; then echo "*** Saving mtree database for future upgrades" - test -e "${MTREEFILE}" && unlink ${MTREEFILE} - mv ${DESTDIR}${MTREENEW} ${DESTDIR}${MTREEFILE} + test -e "${DESTDIR}${MTREEFILE}" && unlink ${DESTDIR}${MTREEFILE} + mv ${MTREENEW} ${DESTDIR}${MTREEFILE} fi echo ''