Date: Wed, 21 Jun 2006 18:29:06 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 99769 for review Message-ID: <200606211829.k5LIT6UF020740@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99769 Change 99769 by jhb@jhb_mutex on 2006/06/21 18:28:32 IFC @99768. Affected files ... .. //depot/projects/smpng/sys/amd64/linux32/linux32_dummy.c#3 integrate .. //depot/projects/smpng/sys/arm/at91/kb920x_machdep.c#6 integrate .. //depot/projects/smpng/sys/arm/sa11x0/uart_cpu_sa1110.c#4 integrate .. //depot/projects/smpng/sys/dev/mfi/mfi.c#8 integrate .. //depot/projects/smpng/sys/dev/mfi/mfi_disk.c#4 integrate .. //depot/projects/smpng/sys/dev/mfi/mfi_pci.c#3 integrate .. //depot/projects/smpng/sys/dev/mfi/mfireg.h#3 integrate .. //depot/projects/smpng/sys/dev/mfi/mfivar.h#3 integrate .. //depot/projects/smpng/sys/kern/kern_linker.c#74 integrate .. //depot/projects/smpng/sys/kern/subr_bus.c#60 integrate .. //depot/projects/smpng/sys/net/if.c#83 integrate .. //depot/projects/smpng/sys/net/if_vlan.c#48 integrate .. //depot/projects/smpng/sys/vm/vm_mmap.c#59 integrate Differences ... ==== //depot/projects/smpng/sys/amd64/linux32/linux32_dummy.c#3 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_dummy.c,v 1.2 2006/05/10 18:17:28 netchild Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_dummy.c,v 1.3 2006/06/21 08:45:40 netchild Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -67,6 +67,62 @@ DUMMY(fadvise64); DUMMY(ptrace); DUMMY(settimeofday); +DUMMY(lookup_dcookie); +DUMMY(epoll_create); +DUMMY(epoll_ctl); +DUMMY(epoll_wait); +DUMMY(remap_file_pages); +DUMMY(set_tid_address); +DUMMY(timer_create); +DUMMY(timer_settime); +DUMMY(timer_gettime); +DUMMY(timer_getoverrun); +DUMMY(timer_delete); +DUMMY(clock_settime); +DUMMY(clock_gettime); +DUMMY(clock_getres); +DUMMY(clock_nanosleep); +DUMMY(statfs64); +DUMMY(fstatfs64); +DUMMY(tgkill); +DUMMY(utimes); +DUMMY(fadvise64_64); +DUMMY(mbind); +DUMMY(get_mempolicy); +DUMMY(set_mempolicy); +DUMMY(mq_open); +DUMMY(mq_unlink); +DUMMY(mq_timedsend); +DUMMY(mq_timedreceive); +DUMMY(mq_notify); +DUMMY(mq_getsetattr); +DUMMY(kexec_load); +DUMMY(waitid); +DUMMY(add_key); +DUMMY(request_key); +DUMMY(keyctl); +DUMMY(ioprio_set); +DUMMY(ioprio_get); +DUMMY(inotify_init); +DUMMY(inotify_add_watch); +DUMMY(inotify_rm_watch); +DUMMY(migrate_pages); +DUMMY(openat); +DUMMY(mkdirat); +DUMMY(mknodat); +DUMMY(fchownat); +DUMMY(futimesat); +DUMMY(fstatat64); +DUMMY(unlinkat); +DUMMY(renameat); +DUMMY(linkat); +DUMMY(symlinkat); +DUMMY(readlinkat); +DUMMY(fchmodat); +DUMMY(faccessat); +DUMMY(pselect6); +DUMMY(ppoll); +DUMMY(unshare); #define DUMMY_XATTR(s) \ int \ ==== //depot/projects/smpng/sys/arm/at91/kb920x_machdep.c#6 (text) ==== @@ -47,7 +47,7 @@ #include "opt_ddb.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/at91/kb920x_machdep.c,v 1.7 2006/06/20 20:13:40 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/at91/kb920x_machdep.c,v 1.8 2006/06/20 23:40:04 imp Exp $"); #define _ARM32_BUS_DMA_PRIVATE #include <sys/param.h> @@ -182,10 +182,9 @@ extern vm_offset_t ksym_start, ksym_end; #endif -static int +static long board_init(void) { - uint32_t memsize; uint32_t *SDRAMC = (uint32_t *)(AT91RM92_BASE + AT91RM92_SDRAMC_BASE); uint32_t cr, mr; int banks, rows, cols, bw; /* log2 size */ @@ -196,8 +195,7 @@ banks = (cr & AT91RM92_SDRAMC_CR_NB_4) ? 2 : 1; rows = ((cr & AT91RM92_SDRAMC_CR_NR_MASK) >> 2) + 11; cols = (cr & AT91RM92_SDRAMC_CR_NC_MASK) + 8; - memsize = 1 << (cols + rows + banks + bw); - return (memsize); + return (1 << (cols + rows + banks + bw)); } void * @@ -360,6 +358,8 @@ cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)); cninit(); memsize = board_init(); + physmem = memsize / PAGE_SIZE; + /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. @@ -428,7 +428,7 @@ phys_avail[3] = 0; /* Do basic tuning, hz etc */ init_param1(); - init_param2(memsize / PAGE_SIZE); + init_param2(physmem); avail_end = KERNPHYSADDR + memsize - 1; kdb_init(); return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - ==== //depot/projects/smpng/sys/arm/sa11x0/uart_cpu_sa1110.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/sa11x0/uart_cpu_sa1110.c,v 1.5 2006/06/07 11:28:17 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/sa11x0/uart_cpu_sa1110.c,v 1.6 2006/06/21 10:56:59 cognet Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -44,6 +44,8 @@ extern struct uart_ops uart_sa1110_ops; +vm_offset_t sa1110_uart_vaddr; + int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { ==== //depot/projects/smpng/sys/dev/mfi/mfi.c#8 (text) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi.c,v 1.9 2006/06/20 21:06:05 ps Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi.c,v 1.12 2006/06/20 23:08:35 ps Exp $"); #include "opt_mfi.h" @@ -56,6 +56,7 @@ static void mfi_release_command(struct mfi_command *cm); static int mfi_comms_init(struct mfi_softc *); static int mfi_polled_command(struct mfi_softc *, struct mfi_command *); +static int mfi_wait_command(struct mfi_softc *, struct mfi_command *); static int mfi_get_controller_info(struct mfi_softc *); static int mfi_get_log_state(struct mfi_softc *, struct mfi_evt_log_state **); @@ -68,16 +69,12 @@ static void mfi_startup(void *arg); static void mfi_intr(void *arg); static void mfi_enable_intr(struct mfi_softc *sc); -static void mfi_ldprobe_inq(struct mfi_softc *sc); -static void mfi_ldprobe_inq_complete(struct mfi_command *); -static int mfi_ldprobe_capacity(struct mfi_softc *sc, int id); -static void mfi_ldprobe_capacity_complete(struct mfi_command *); -static int mfi_ldprobe_tur(struct mfi_softc *sc, int id); -static void mfi_ldprobe_tur_complete(struct mfi_command *); +static void mfi_ldprobe(struct mfi_softc *sc); static int mfi_aen_register(struct mfi_softc *sc, int seq, int locale); static void mfi_aen_complete(struct mfi_command *); static int mfi_aen_setup(struct mfi_softc *, uint32_t); -static int mfi_add_ld(struct mfi_softc *sc, int id, uint64_t, uint32_t); +static int mfi_add_ld(struct mfi_softc *sc, int); +static void mfi_add_ld_complete(struct mfi_command *); static struct mfi_command * mfi_bio_command(struct mfi_softc *); static void mfi_bio_complete(struct mfi_command *); static int mfi_mapcmd(struct mfi_softc *, struct mfi_command *); @@ -580,7 +577,7 @@ static int mfi_get_log_state(struct mfi_softc *sc, struct mfi_evt_log_state **log_state) { - struct mfi_command *cm; + struct mfi_command *cm = NULL; int error; mtx_lock(&sc->mfi_io_lock); @@ -588,7 +585,7 @@ (void **)log_state, sizeof(**log_state)); if (error) goto out; - cm->cm_len = sizeof(struct mfi_evt_log_state); + cm->cm_flags = MFI_CMD_DATAIN | MFI_CMD_POLLED; if ((error = mfi_mapcmd(sc, cm)) != 0) { device_printf(sc->mfi_dev, "Log state buffer map failed\n"); @@ -605,7 +602,8 @@ bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap); out: - mfi_release_command(cm); + if (cm) + mfi_release_command(cm); mtx_unlock(&sc->mfi_io_lock); return (error); @@ -679,6 +677,18 @@ return (0); } +static int +mfi_wait_command(struct mfi_softc *sc, struct mfi_command *cm) +{ + + mtx_assert(&sc->mfi_io_lock, MA_OWNED); + cm->cm_complete = NULL; + + mfi_enqueue_ready(cm); + mfi_startio(sc); + return (msleep(cm, &sc->mfi_io_lock, PRIBIO, "mfiwait", 0)); +} + void mfi_free(struct mfi_softc *sc) { @@ -747,7 +757,7 @@ config_intrhook_disestablish(&sc->mfi_ich); mfi_enable_intr(sc); - mfi_ldprobe_inq(sc); + mfi_ldprobe(sc); } static void @@ -813,6 +823,7 @@ device_printf(sc->mfi_dev, "Failed to shutdown controller\n"); } + mfi_release_command(cm); return (error); } @@ -824,136 +835,41 @@ } static void -mfi_ldprobe_inq(struct mfi_softc *sc) +mfi_ldprobe(struct mfi_softc *sc) { - struct mfi_command *cm; - struct mfi_pass_frame *pass; - char *inq; - int i; + struct mfi_frame_header *hdr; + struct mfi_command *cm = NULL; + struct mfi_ld_list *list = NULL; + int error, i; - /* Probe all possible targets with a SCSI INQ command */ mtx_lock(&sc->mfi_io_lock); - sc->mfi_probe_count = 0; - for (i = 0; i < MFI_MAX_CHANNEL_DEVS; i++) { - inq = malloc(MFI_INQ_LENGTH, M_MFIBUF, M_NOWAIT|M_ZERO); - if (inq == NULL) - break; - cm = mfi_dequeue_free(sc); - if (cm == NULL) { - free(inq, M_MFIBUF); - msleep(mfi_startup, &sc->mfi_io_lock, 0, "mfistart", - 5 * hz); - i--; - continue; - } - pass = &cm->cm_frame->pass; - pass->header.cmd = MFI_CMD_LD_SCSI_IO; - pass->header.target_id = i; - pass->header.lun_id = 0; - pass->header.cdb_len = 6; - pass->header.timeout = 0; - pass->header.data_len = MFI_INQ_LENGTH; - bzero(pass->cdb, 16); - pass->cdb[0] = INQUIRY; - pass->cdb[4] = MFI_INQ_LENGTH; - pass->header.sense_len = MFI_SENSE_LEN; - pass->sense_addr_lo = cm->cm_sense_busaddr; - pass->sense_addr_hi = 0; - cm->cm_complete = mfi_ldprobe_inq_complete; - cm->cm_private = inq; - cm->cm_sg = &pass->sgl; - cm->cm_total_frame_size = MFI_PASS_FRAME_SIZE; - cm->cm_flags |= MFI_CMD_DATAIN; - cm->cm_data = inq; - cm->cm_len = MFI_INQ_LENGTH; - sc->mfi_probe_count++; - mfi_enqueue_ready(cm); - mfi_startio(sc); + error = mfi_dcmd_command(sc, &cm, MFI_DCMD_LD_GET_LIST, + (void **)&list, sizeof(*list)); + if (error) + goto out; + + cm->cm_flags = MFI_CMD_DATAIN; + if (mfi_wait_command(sc, cm) != 0) { + device_printf(sc->mfi_dev, "Failed to get device listing\n"); + goto out; } - /* Sleep while the arrays are attaching */ - msleep(mfi_startup, &sc->mfi_io_lock, 0, "mfistart", 60 * hz); - mtx_unlock(&sc->mfi_io_lock); - - return; -} - -static void -mfi_ldprobe_inq_complete(struct mfi_command *cm) -{ - struct mfi_frame_header *hdr; - struct mfi_softc *sc; - struct scsi_inquiry_data *inq; - - sc = cm->cm_sc; - inq = cm->cm_private; hdr = &cm->cm_frame->header; - - if ((hdr->cmd_status != MFI_STAT_OK) || (hdr->scsi_status != 0x00) || - (SID_TYPE(inq) != T_DIRECT)) { - free(inq, M_MFIBUF); - mfi_release_command(cm); - if (--sc->mfi_probe_count <= 0) - wakeup(mfi_startup); - return; + if (hdr->cmd_status != MFI_STAT_OK) { + device_printf(sc->mfi_dev, "MFI_DCMD_LD_GET_LIST failed %x\n", + hdr->cmd_status); + goto out; } - free(inq, M_MFIBUF); - mfi_release_command(cm); - mfi_ldprobe_tur(sc, hdr->target_id); -} - -static int -mfi_ldprobe_tur(struct mfi_softc *sc, int id) -{ - struct mfi_command *cm; - struct mfi_pass_frame *pass; - - cm = mfi_dequeue_free(sc); - if (cm == NULL) - return (EBUSY); - pass = &cm->cm_frame->pass; - pass->header.cmd = MFI_CMD_LD_SCSI_IO; - pass->header.target_id = id; - pass->header.lun_id = 0; - pass->header.cdb_len = 6; - pass->header.timeout = 0; - pass->header.data_len = 0; - bzero(pass->cdb, 16); - pass->cdb[0] = TEST_UNIT_READY; - pass->header.sense_len = MFI_SENSE_LEN; - pass->sense_addr_lo = cm->cm_sense_busaddr; - pass->sense_addr_hi = 0; - cm->cm_complete = mfi_ldprobe_tur_complete; - cm->cm_total_frame_size = MFI_PASS_FRAME_SIZE; - cm->cm_flags = 0; - mfi_enqueue_ready(cm); - mfi_startio(sc); - - return (0); -} - -static void -mfi_ldprobe_tur_complete(struct mfi_command *cm) -{ - struct mfi_frame_header *hdr; - struct mfi_softc *sc; - - sc = cm->cm_sc; - hdr = &cm->cm_frame->header; - - if ((hdr->cmd_status != MFI_STAT_OK) || (hdr->scsi_status != 0x00)) { - device_printf(sc->mfi_dev, "Logical disk %d is not ready, " - "cmd_status= %d scsi_status= %d\n", hdr->target_id, - hdr->cmd_status, hdr->scsi_status); - mfi_print_sense(sc, cm->cm_sense); + for (i = 0; i < list->ld_count; i++) + mfi_add_ld(sc, list->ld_list[i].ld.target_id); +out: + if (list) + free(list, M_MFIBUF); + if (cm) mfi_release_command(cm); - if (--sc->mfi_probe_count <= 0) - wakeup(mfi_startup); - return; - } - mfi_release_command(cm); - mfi_ldprobe_capacity(sc, hdr->target_id); + mtx_unlock(&sc->mfi_io_lock); + return; } #ifdef NOTYET @@ -1361,40 +1277,29 @@ #endif static int -mfi_ldprobe_capacity(struct mfi_softc *sc, int id) +mfi_add_ld(struct mfi_softc *sc, int id) { struct mfi_command *cm; - struct mfi_pass_frame *pass; - struct scsi_read_capacity_data_long *cap; + struct mfi_dcmd_frame *dcmd = NULL; + struct mfi_ld_info *ld_info = NULL; + int error; + + mtx_assert(&sc->mfi_io_lock, MA_OWNED); - cap = malloc(sizeof(*cap), M_MFIBUF, M_NOWAIT|M_ZERO); - if (cap == NULL) - return (ENOMEM); - cm = mfi_dequeue_free(sc); - if (cm == NULL) { - free(cap, M_MFIBUF); - return (EBUSY); + error = mfi_dcmd_command(sc, &cm, MFI_DCMD_LD_GET_INFO, + (void **)&ld_info, sizeof(*ld_info)); + if (error) { + device_printf(sc->mfi_dev, + "Failed to allocate for MFI_DCMD_LD_GET_INFO %d\n", error); + if (ld_info) + free(ld_info, M_MFIBUF); + return (error); } - pass = &cm->cm_frame->pass; - pass->header.cmd = MFI_CMD_LD_SCSI_IO; - pass->header.target_id = id; - pass->header.lun_id = 0; - pass->header.cdb_len = 6; - pass->header.timeout = 0; - pass->header.data_len = sizeof(*cap); - bzero(pass->cdb, 16); - pass->cdb[0] = 0x9e; /* READ CAPACITY 16 */ - pass->cdb[13] = sizeof(*cap); - pass->header.sense_len = MFI_SENSE_LEN; - pass->sense_addr_lo = cm->cm_sense_busaddr; - pass->sense_addr_hi = 0; - cm->cm_complete = mfi_ldprobe_capacity_complete; - cm->cm_private = cap; - cm->cm_sg = &pass->sgl; - cm->cm_total_frame_size = MFI_PASS_FRAME_SIZE; - cm->cm_flags |= MFI_CMD_DATAIN; - cm->cm_data = cap; - cm->cm_len = sizeof(*cap); + cm->cm_flags = MFI_CMD_DATAIN; + cm->cm_complete = mfi_add_ld_complete; + dcmd = &cm->cm_frame->dcmd; + dcmd->mbox[0] = id; + mfi_enqueue_ready(cm); mfi_startio(sc); @@ -1402,70 +1307,42 @@ } static void -mfi_ldprobe_capacity_complete(struct mfi_command *cm) +mfi_add_ld_complete(struct mfi_command *cm) { struct mfi_frame_header *hdr; + struct mfi_ld_info *ld_info; struct mfi_softc *sc; - struct scsi_read_capacity_data_long *cap; - uint64_t sectors; - uint32_t secsize; - int target; + struct mfi_ld *ld; + device_t child; sc = cm->cm_sc; - cap = cm->cm_private; hdr = &cm->cm_frame->header; + ld_info = cm->cm_private; - if ((hdr->cmd_status != MFI_STAT_OK) || (hdr->scsi_status != 0x00)) { - device_printf(sc->mfi_dev, "Failed to read capacity for " - "logical disk\n"); - device_printf(sc->mfi_dev, "cmd_status= %d scsi_status= %d\n", - hdr->cmd_status, hdr->scsi_status); - free(cap, M_MFIBUF); + if (hdr->cmd_status != MFI_STAT_OK) { + free(ld_info, M_MFIBUF); mfi_release_command(cm); - if (--sc->mfi_probe_count <= 0) - wakeup(mfi_startup); return; } - target = hdr->target_id; - sectors = scsi_8btou64(cap->addr); - secsize = scsi_4btoul(cap->length); - free(cap, M_MFIBUF); mfi_release_command(cm); - mfi_add_ld(sc, target, sectors, secsize); - if (--sc->mfi_probe_count <= 0) - wakeup(mfi_startup); - - return; -} - -static int -mfi_add_ld(struct mfi_softc *sc, int id, uint64_t sectors, uint32_t secsize) -{ - struct mfi_ld *ld; - device_t child; - - if ((secsize == 0) || (sectors == 0)) { - device_printf(sc->mfi_dev, "Invalid capacity parameters for " - "logical disk %d\n", id); - return (EINVAL); - } ld = malloc(sizeof(struct mfi_ld), M_MFIBUF, M_NOWAIT|M_ZERO); if (ld == NULL) { device_printf(sc->mfi_dev, "Cannot allocate ld\n"); - return (ENOMEM); + free(ld_info, M_MFIBUF); + return; } if ((child = device_add_child(sc->mfi_dev, "mfid", -1)) == NULL) { device_printf(sc->mfi_dev, "Failed to add logical disk\n"); free(ld, M_MFIBUF); - return (EINVAL); + free(ld_info, M_MFIBUF); + return; } - ld->ld_id = id; + ld->ld_id = ld_info->ld_config.properties.ld.target_id; ld->ld_disk = child; - ld->ld_secsize = secsize; - ld->ld_sectors = sectors; + ld->ld_info = ld_info; device_set_ivars(child, ld); device_set_desc(child, "MFI Logical Disk"); @@ -1474,8 +1351,6 @@ bus_generic_attach(sc->mfi_dev); mtx_unlock(&Giant); mtx_lock(&sc->mfi_io_lock); - - return (0); } static struct mfi_command * @@ -1705,6 +1580,8 @@ if (cm->cm_complete != NULL) cm->cm_complete(cm); + else + wakeup(cm); sc->mfi_flags &= ~MFI_FLAGS_QFRZN; mfi_startio(sc); ==== //depot/projects/smpng/sys/dev/mfi/mfi_disk.c#4 (text) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_disk.c,v 1.3 2006/05/18 23:30:47 ambrisko Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_disk.c,v 1.4 2006/06/20 22:41:44 ps Exp $"); #include "opt_mfi.h" @@ -113,14 +113,8 @@ sc->ld_ld = device_get_ivars(dev); sc->ld_controller = device_get_softc(device_get_parent(dev)); - sectors = sc->ld_ld->ld_sectors; - secsize = sc->ld_ld->ld_secsize; - if (secsize != MFI_SECTOR_LEN) { - device_printf(sc->ld_dev, "Reported sector length %d is not " - "512, aborting\n", secsize); - free(sc->ld_ld, M_MFIBUF); - return (EINVAL); - } + sectors = ld->ld_info->size; + secsize = MFI_SECTOR_LEN; TAILQ_INSERT_TAIL(&sc->ld_controller->mfi_ld_tqh, ld, ld_link); device_printf(dev, "%juMB (%ju sectors) RAID\n", @@ -235,7 +229,7 @@ if (len > 0) { if ((error = mfi_dump_blocks(parent_sc, sc->ld_id, offset / - sc->ld_ld->ld_secsize, virt, len)) != 0) + MFI_SECTOR_LEN, virt, len)) != 0) return (error); } else { /* mfi_sync_cache(parent_sc, sc->ld_id); */ ==== //depot/projects/smpng/sys/dev/mfi/mfi_pci.c#3 (text) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_pci.c,v 1.2 2006/05/18 23:30:47 ambrisko Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_pci.c,v 1.3 2006/06/20 22:41:44 ps Exp $"); /* PCI/PCI-X/PCIe bus interface for the LSI MegaSAS controllers */ @@ -207,6 +207,7 @@ if (error) return (error); TAILQ_REMOVE(&sc->mfi_ld_tqh, ld, ld_link); + free(ld->ld_info, M_MFIBUF); free(ld, M_MFIBUF); } ==== //depot/projects/smpng/sys/dev/mfi/mfireg.h#3 (text) ==== @@ -28,7 +28,7 @@ #define _MFIREG_H #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mfi/mfireg.h,v 1.2 2006/05/18 23:30:47 ambrisko Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mfi/mfireg.h,v 1.3 2006/06/20 22:41:44 ps Exp $"); /* * MegaRAID SAS MFI firmware definitions @@ -106,7 +106,10 @@ MFI_DCMD_CTRL_EVENT_GETINFO = 0x01040100, MFI_DCMD_CTRL_EVENT_GET = 0x01040300, MFI_DCMD_CTRL_EVENT_WAIT = 0x01040500, + MFI_DCMD_LD_GET_LIST = 0x03010000, + MFI_DCMD_LD_GET_INFO = 0x03020000, MFI_DCMD_LD_GET_PROP = 0x03030000, + MFI_DCMD_LD_SET_PROP = 0x03040000, MFI_DCMD_CLUSTER = 0x08000000, MFI_DCMD_CLUSTER_RESET_ALL = 0x08010100, MFI_DCMD_CLUSTER_RESET_LD = 0x08010200 @@ -727,4 +730,97 @@ char description[128]; } __packed; +struct mfi_ldref { + uint8_t target_id; + uint8_t reserved; + uint16_t seq; +} __packed; + +struct mfi_ld_list { + uint32_t ld_count; + uint32_t reserved1; + struct { + struct mfi_ldref ld; + uint8_t state; + uint8_t reserved2[3]; + uint64_t size; + } ld_list[MFI_MAX_LD]; +} __packed; + +enum mfi_ld_access { + MFI_LD_ACCESS_RW = 0, + MFI_LD_ACCSSS_RO = 2, + MFI_LD_ACCESS_BLOCKED = 3, +}; +#define MFI_LD_ACCESS_MASK 3 + +enum mfi_ld_state { + MFI_LD_STATE_OFFLINE = 0, + MFI_LD_STATE_PARTIALLY_DEGRADED = 1, + MFI_LD_STATE_DEGRADED = 2, + MFI_LD_STATE_OPTIMAL = 3 +}; + +struct mfi_ld_props { + struct mfi_ldref ld; + char name[16]; + uint8_t default_cache_policy; + uint8_t access_policy; + uint8_t disk_cache_policy; + uint8_t current_cache_policy; + uint8_t no_bgi; + uint8_t reserved[7]; +} __packed; + +struct mfi_ld_params { + uint8_t primary_raid_level; + uint8_t raid_level_qualifier; + uint8_t secondary_raid_level; + uint8_t stripe_size; + uint8_t num_drives; + uint8_t span_depth; + uint8_t state; + uint8_t init_state; + uint8_t is_consistent; + uint8_t reserved[23]; +} __packed; + +struct mfi_ld_progress { + uint32_t active; +#define MFI_LD_PROGRESS_CC (1<<0) +#define MFI_LD_PROGRESS_BGI (1<<1) +#define MFI_LD_PROGRESS_FGI (1<<2) +#define MFI_LD_PORGRESS_RECON (1<<3) + struct mfi_progress cc; + struct mfi_progress bgi; + struct mfi_progress fgi; + struct mfi_progress recon; + struct mfi_progress reserved[4]; +} __packed; + +struct mfi_span { + uint64_t start_block; + uint64_t num_blocks; + uint16_t array_ref; + uint8_t reserved[6]; +} __packed; + +#define MFI_MAX_SPAN_DEPTH 8 +struct mfi_ld_config { + struct mfi_ld_props properties; + struct mfi_ld_params params; + struct mfi_span span[MFI_MAX_SPAN_DEPTH]; +} __packed; + +struct mfi_ld_info { + struct mfi_ld_config ld_config; + uint64_t size; + struct mfi_ld_progress progress; + uint16_t cluster_owner; + uint8_t reconstruct_active; + uint8_t reserved1[1]; + uint8_t vpd_page83[64]; + uint8_t reserved2[16]; +} __packed; + #endif /* _MFIREG_H */ ==== //depot/projects/smpng/sys/dev/mfi/mfivar.h#3 (text) ==== @@ -28,7 +28,7 @@ #define _MFIVAR_H #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mfi/mfivar.h,v 1.2 2006/05/18 23:30:47 ambrisko Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mfi/mfivar.h,v 1.3 2006/06/20 22:41:44 ps Exp $"); /* * SCSI structures and definitions are used from here, but no linking @@ -75,8 +75,7 @@ struct mfi_ld { TAILQ_ENTRY(mfi_ld) ld_link; device_t ld_disk; - uint64_t ld_sectors; - uint32_t ld_secsize; + struct mfi_ld_info *ld_info; int ld_id; }; @@ -133,7 +132,6 @@ struct intr_config_hook mfi_ich; eventhandler_tag eh; - int mfi_probe_count; /* * Allocation for the command array. Used as an indexable array to ==== //depot/projects/smpng/sys/kern/kern_linker.c#74 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_linker.c,v 1.134 2006/06/20 21:31:38 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_linker.c,v 1.136 2006/06/21 17:48:03 jhb Exp $"); #include "opt_ddb.h" #include "opt_hwpmc_hooks.h" ==== //depot/projects/smpng/sys/kern/subr_bus.c#60 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/subr_bus.c,v 1.191 2006/04/20 01:44:16 jmg Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/subr_bus.c,v 1.193 2006/06/21 17:48:59 jhb Exp $"); #include "opt_bus.h" ==== //depot/projects/smpng/sys/net/if.c#83 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)if.c 8.5 (Berkeley) 1/9/95 - * $FreeBSD: src/sys/net/if.c,v 1.258 2006/06/19 22:20:44 mlaier Exp $ + * $FreeBSD: src/sys/net/if.c,v 1.259 2006/06/21 06:02:35 glebius Exp $ */ #include "opt_compat.h" @@ -432,9 +432,6 @@ TASK_INIT(&ifp->if_linktask, 0, do_link_state_change, ifp); IF_AFDATA_LOCK_INIT(ifp); ifp->if_afdata_initialized = 0; - IFNET_WLOCK(); - TAILQ_INSERT_TAIL(&ifnet, ifp, if_link); - IFNET_WUNLOCK(); /* * XXX - * The old code would work if the interface passed a pre-existing @@ -509,6 +506,10 @@ ifp->if_snd.altq_tbr = NULL; ifp->if_snd.altq_ifp = ifp; + IFNET_WLOCK(); + TAILQ_INSERT_TAIL(&ifnet, ifp, if_link); + IFNET_WUNLOCK(); + if (domain_init_status >= 2) if_attachdomain1(ifp); @@ -625,7 +626,18 @@ int i; struct domain *dp; struct ifnet *iter; - int found; + int found = 0; + + IFNET_WLOCK(); + TAILQ_FOREACH(iter, &ifnet, if_link) + if (iter == ifp) { + TAILQ_REMOVE(&ifnet, ifp, if_link); + found = 1; + break; + } + IFNET_WUNLOCK(); + if (!found) + return; /* * Remove/wait for pending events. @@ -707,16 +719,6 @@ KNOTE_UNLOCKED(&ifp->if_klist, NOTE_EXIT); knlist_clear(&ifp->if_klist, 0); knlist_destroy(&ifp->if_klist); - IFNET_WLOCK(); - found = 0; - TAILQ_FOREACH(iter, &ifnet, if_link) - if (iter == ifp) { - found = 1; - break; - } - if (found) - TAILQ_REMOVE(&ifnet, ifp, if_link); - IFNET_WUNLOCK(); mtx_destroy(&ifp->if_snd.ifq_mtx); IF_AFDATA_DESTROY(ifp); splx(s); ==== //depot/projects/smpng/sys/net/if_vlan.c#48 (text+ko) ==== @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/net/if_vlan.c,v 1.101 2006/03/09 14:42:51 ru Exp $ + * $FreeBSD: src/sys/net/if_vlan.c,v 1.103 2006/06/21 13:48:34 yar Exp $ */ /* @@ -81,7 +81,8 @@ struct ifnet *parent; /* parent interface of this trunk */ struct rwlock rw; #ifdef VLAN_ARRAY - struct ifvlan *vlans[EVL_VLID_MASK+1]; /* static table */ +#define VLAN_ARRAY_SIZE (EVL_VLID_MASK + 1) + struct ifvlan *vlans[VLAN_ARRAY_SIZE]; /* static table */ #else struct ifvlanhead *hash; /* dynamic hash-list table */ uint16_t hmask; @@ -135,6 +136,8 @@ static MALLOC_DEFINE(M_VLAN, VLANNAME, "802.1Q Virtual LAN Interface"); +static eventhandler_tag ifdetach_tag; + /* * We have a global mutex, that is used to serialize configuration * changes and isn't used in normal packet delivery. @@ -182,6 +185,7 @@ static int vlan_setflags(struct ifnet *ifp, int status); static int vlan_setmulti(struct ifnet *ifp); static int vlan_unconfig(struct ifnet *ifp); +static int vlan_unconfig_locked(struct ifnet *ifp); static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag); static void vlan_link_state(struct ifnet *ifp, int link); static void vlan_capabilities(struct ifvlan *ifv); @@ -193,6 +197,8 @@ static int vlan_clone_create(struct if_clone *, char *, size_t); static int vlan_clone_destroy(struct if_clone *, struct ifnet *); +static void vlan_ifdetach(void *arg, struct ifnet *ifp); + static struct if_clone vlan_cloner = IFC_CLONE_INITIALIZER(VLANNAME, NULL, IF_MAXUNIT, NULL, vlan_clone_match, vlan_clone_create, vlan_clone_destroy); @@ -452,6 +458,54 @@ } /* + * A handler for network interface departure events. + * Track departure of trunks here so that we don't access invalid + * pointers or whatever if a trunk is ripped from under us, e.g., + * by ejecting its hot-plug card. + */ +static void +vlan_ifdetach(void *arg __unused, struct ifnet *ifp) +{ + struct ifvlan *ifv; + int i; + + /* + * Check if it's a trunk interface first of all + * to avoid needless locking. + */ + if (ifp->if_vlantrunk == NULL) + return; + + VLAN_LOCK(); + /* + * OK, it's a trunk. Loop over and detach all vlan's on it. + * Check trunk pointer after each vlan_unconfig() as it will + * free it and set to NULL after the last vlan was detached. + */ +#ifdef VLAN_ARRAY + for (i = 0; i < VLAN_ARRAY_SIZE; i++) + if ((ifv = ifp->if_vlantrunk->vlans[i])) { + vlan_unconfig_locked(ifv->ifv_ifp); + if (ifp->if_vlantrunk == NULL) + break; + } +#else /* VLAN_ARRAY */ +restart: + for (i = 0; i < (1 << ifp->if_vlantrunk->hwidth); i++) + if ((ifv = LIST_FIRST(&ifp->if_vlantrunk->hash[i]))) { + vlan_unconfig_locked(ifv->ifv_ifp); + if (ifp->if_vlantrunk) + goto restart; /* trunk->hwidth can change */ + else + break; + } +#endif /* VLAN_ARRAY */ + /* Trunk should have been destroyed in vlan_unconfig(). */ + KASSERT(ifp->if_vlantrunk == NULL, ("%s: purge failed", __func__)); + VLAN_UNLOCK(); +} + >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606211829.k5LIT6UF020740>