Date: Wed, 24 Feb 2010 03:41:46 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r204272 - in projects/ppc64: gnu/usr.bin/diff gnu/usr.bin/diff3 gnu/usr.bin/sdiff share/man/man4/man4.powerpc sys/cam sys/cam/ata sys/cam/scsi sys/dev/aac sys/dev/alc sys/dev/ata sys/de... Message-ID: <201002240341.o1O3fkK7067363@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Wed Feb 24 03:41:46 2010 New Revision: 204272 URL: http://svn.freebsd.org/changeset/base/204272 Log: IFC to get some recent bug fixes Added: projects/ppc64/share/man/man4/man4.powerpc/smu.4 - copied unchanged from r204271, head/share/man/man4/man4.powerpc/smu.4 Modified: projects/ppc64/gnu/usr.bin/diff/Makefile projects/ppc64/gnu/usr.bin/diff3/Makefile projects/ppc64/gnu/usr.bin/sdiff/Makefile projects/ppc64/share/man/man4/man4.powerpc/Makefile projects/ppc64/sys/cam/ata/ata_xpt.c projects/ppc64/sys/cam/cam_xpt.c projects/ppc64/sys/cam/cam_xpt_internal.h projects/ppc64/sys/cam/scsi/scsi_xpt.c projects/ppc64/sys/dev/aac/aac.c projects/ppc64/sys/dev/aac/aac_cam.c projects/ppc64/sys/dev/alc/if_alc.c projects/ppc64/sys/dev/ata/ata-all.c projects/ppc64/sys/dev/bge/if_bge.c projects/ppc64/sys/dev/bwn/if_bwn.c projects/ppc64/sys/dev/bwn/if_bwnvar.h projects/ppc64/sys/dev/cxgb/cxgb_sge.c projects/ppc64/sys/dev/fb/fb.c projects/ppc64/sys/dev/fb/vesa.c projects/ppc64/sys/dev/gem/if_gem.c projects/ppc64/sys/dev/isp/isp_freebsd.c projects/ppc64/sys/dev/jme/if_jme.c projects/ppc64/sys/dev/re/if_re.c projects/ppc64/sys/dev/syscons/scvidctl.c projects/ppc64/sys/dev/syscons/snake/snake_saver.c projects/ppc64/sys/dev/syscons/syscons.c projects/ppc64/sys/dev/syscons/syscons.h projects/ppc64/sys/powerpc/aim/mmu_oea64.c projects/ppc64/sys/powerpc/include/pte.h projects/ppc64/sys/powerpc/powermac/smu.c projects/ppc64/sys/sys/fbio.h projects/ppc64/usr.sbin/cxgbtool/cxgbtool.c projects/ppc64/usr.sbin/cxgbtool/reg_defs.c projects/ppc64/usr.sbin/cxgbtool/reg_defs_t3.c projects/ppc64/usr.sbin/cxgbtool/reg_defs_t3b.c projects/ppc64/usr.sbin/cxgbtool/reg_defs_t3c.c Directory Properties: projects/ppc64/ (props changed) projects/ppc64/contrib/expat/ (props changed) projects/ppc64/contrib/groff/ (props changed) projects/ppc64/contrib/one-true-awk/ (props changed) projects/ppc64/lib/libz/ (props changed) projects/ppc64/sys/ (props changed) projects/ppc64/sys/dev/xen/xenpci/ (props changed) Modified: projects/ppc64/gnu/usr.bin/diff/Makefile ============================================================================== --- projects/ppc64/gnu/usr.bin/diff/Makefile Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/gnu/usr.bin/diff/Makefile Wed Feb 24 03:41:46 2010 (r204272) @@ -29,7 +29,7 @@ LDADD= -lgnuregex .for f in diff.c context.c ${f}: ${DIFFSRC}/${f} ${.CURDIR}/${f}.diff - patch -s -b .orig -o ${.TARGET} < ${.CURDIR}/${f}.diff ${DIFFSRC}/${f} + patch -s -o ${.TARGET} < ${.CURDIR}/${f}.diff ${DIFFSRC}/${f} CLEANFILES+= ${f} .endfor Modified: projects/ppc64/gnu/usr.bin/diff3/Makefile ============================================================================== --- projects/ppc64/gnu/usr.bin/diff3/Makefile Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/gnu/usr.bin/diff3/Makefile Wed Feb 24 03:41:46 2010 (r204272) @@ -20,7 +20,7 @@ CFLAGS+=-DDEFAULT_DIFF_PROGRAM=\"/usr/bi .for f in diff3.c ${f}: ${DIFFSRC}/${f} ${.CURDIR}/${f}.diff - patch -s -b .orig -o ${.TARGET} < ${.CURDIR}/${f}.diff ${DIFFSRC}/${f} + patch -s -o ${.TARGET} < ${.CURDIR}/${f}.diff ${DIFFSRC}/${f} CLEANFILES+= ${f} .endfor Modified: projects/ppc64/gnu/usr.bin/sdiff/Makefile ============================================================================== --- projects/ppc64/gnu/usr.bin/sdiff/Makefile Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/gnu/usr.bin/sdiff/Makefile Wed Feb 24 03:41:46 2010 (r204272) @@ -21,7 +21,7 @@ CFLAGS+=-DDEFAULT_DIFF_PROGRAM=\"/usr/bi .for f in sdiff.c ${f}: ${DIFFSRC}/${f} ${.CURDIR}/${f}.diff - patch -s -b .orig -o ${.TARGET} < ${.CURDIR}/${f}.diff ${DIFFSRC}/${f} + patch -s -o ${.TARGET} < ${.CURDIR}/${f}.diff ${DIFFSRC}/${f} CLEANFILES+= ${f} .endfor Modified: projects/ppc64/share/man/man4/man4.powerpc/Makefile ============================================================================== --- projects/ppc64/share/man/man4/man4.powerpc/Makefile Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/share/man/man4/man4.powerpc/Makefile Wed Feb 24 03:41:46 2010 (r204272) @@ -7,6 +7,7 @@ MAN= adb.4 \ cuda.4 \ pmu.4 \ powermac_nvram.4 \ + smu.4 \ snd_ai2s.4 \ snd_davbus.4 \ tsec.4 Copied: projects/ppc64/share/man/man4/man4.powerpc/smu.4 (from r204271, head/share/man/man4/man4.powerpc/smu.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ppc64/share/man/man4/man4.powerpc/smu.4 Wed Feb 24 03:41:46 2010 (r204272, copy of r204271, head/share/man/man4/man4.powerpc/smu.4) @@ -0,0 +1,125 @@ +.\"- +.\" Copyright (c) 2010 Nathan Whitehorn <nwhitehorn@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd February 22, 2010 +.Dt SMU 4 +.Os +.Sh NAME +.Nm smu +.Nd Apple System Management Unit Driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device smu" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the System Management Unit (SMU) found in many +Apple G5 systems. +This includes most Power Macintosh G5 and all iMac G5 systems. +.Pp +The Apple SMU controller provides software power management and thermal +control functionality, and is responsible for managing system cooling +devices. +.Sh HARDWARE +Chips supported by the +.Nm +driver include: +.Pp +.Bl -bullet -compact +.It +Apple System Management Unit +.El +.Sh THERMAL MANAGEMENT +The +.Nm +driver provides basic automatic thermal management. Without a userspace +daemon providing more advanced control, the driver will attempt to maintain +system temperatures in a conservative range through coarse-grained control of +system cooling devices (see below). Automatic kernel-level thermal control +will take over if more than 3 seconds elapses between userspace cooling +setting adjustments. +.Sh SYSCTL VARIABLES +The +.Nm +driver provides power management services and thermal readout through a +sysctl interface. +The following sysctls can be used to control the +power management behavior and to examine current system power and +thermal conditions. +.Bl -tag -width indent +.It Va dev.smu.%d.server_mode +Restart after power failure behavior (1 causes system to reboot after power +cut, 0 causes system to remain off). +.It Va dev.smu.%d.target_temp +Target system temperature, in degrees Celsius. The +.Nm +driver will attempt to adjust fans to maintain the temperature of the +warmest component in the system at or below this level. +.It Va dev.smu.%d.critical_temp +System critical temperature, in degrees Celsius. If any component in +the system exceeds this temperature, the machine will be shut down within +500 ms. +.It Va dev.smu.%d.fans.%s.minrpm +Minimum allowed speed for this fan. +.It Va dev.smu.%d.fans.%s.maxrpm +Maximum allowed speed for this fan. +.It Va dev.smu.%d.fans.%s.rpm +Current speed for this fan. The fan speed can be adjusted by changing this +sysctl. If more than 3 seconds elapses between fan speed adjustments, the +kernel will resume automatic control of the fan. +.It Va dev.smu.%d.sensors.%s +Current reading from this sensor. Four sensor types are supported. Temperature +sensors are in units of degrees Celsius, current sensors in milliamps, voltage +sensors in millivolts, and power sensors in milliwatts. +.El +.Sh LED INTERFACE +The +.Nm +driver provides an +.Xr led 4 +annunciator interface at +.Pa /dev/led/sleepled . +.Sh SEE ALSO +.Xr acpi 4 , +.Xr pmu 4 , +.Xr led 4 +.Sh HISTORY +The +.Nm +device driver appeared in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Nathan Whitehorn +.Aq nwhitehorn@FreeBSD.org . Modified: projects/ppc64/sys/cam/ata/ata_xpt.c ============================================================================== --- projects/ppc64/sys/cam/ata/ata_xpt.c Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/sys/cam/ata/ata_xpt.c Wed Feb 24 03:41:46 2010 (r204272) @@ -178,11 +178,13 @@ static void ata_dev_async(u_int32_t asy struct cam_ed *device, void *async_arg); static void ata_action(union ccb *start_ccb); +static void ata_announce_periph(struct cam_periph *periph); static struct xpt_xport ata_xport = { .alloc_device = ata_alloc_device, .action = ata_action, .async = ata_dev_async, + .announce = ata_announce_periph, }; struct xpt_xport * @@ -1641,3 +1643,82 @@ ata_dev_async(u_int32_t async_code, stru } } +static void +ata_announce_periph(struct cam_periph *periph) +{ + struct ccb_pathinq cpi; + struct ccb_trans_settings cts; + struct cam_path *path = periph->path; + u_int speed; + u_int mb; + + mtx_assert(periph->sim->mtx, MA_OWNED); + + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_CURRENT_SETTINGS; + xpt_action((union ccb*)&cts); + if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) + return; + /* Ask the SIM for its base transfer speed */ + xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL); + cpi.ccb_h.func_code = XPT_PATH_INQ; + xpt_action((union ccb *)&cpi); + /* Report connection speed */ + speed = cpi.base_transfer_speed; + if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_ATA) { + struct ccb_trans_settings_ata *ata = + &cts.xport_specific.ata; + + if (ata->valid & CTS_ATA_VALID_MODE) + speed = ata_mode2speed(ata->mode); + } + if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SATA) { + struct ccb_trans_settings_sata *sata = + &cts.xport_specific.sata; + + if (sata->valid & CTS_SATA_VALID_REVISION) + speed = ata_revision2speed(sata->revision); + } + mb = speed / 1000; + if (mb > 0) + printf("%s%d: %d.%03dMB/s transfers", + periph->periph_name, periph->unit_number, + mb, speed % 1000); + else + printf("%s%d: %dKB/s transfers", periph->periph_name, + periph->unit_number, speed); + /* Report additional information about connection */ + if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_ATA) { + struct ccb_trans_settings_ata *ata = + &cts.xport_specific.ata; + + printf(" ("); + if (ata->valid & CTS_ATA_VALID_MODE) + printf("%s, ", ata_mode2string(ata->mode)); + if ((ata->valid & CTS_ATA_VALID_ATAPI) && ata->atapi != 0) + printf("ATAPI %dbytes, ", ata->atapi); + if (ata->valid & CTS_ATA_VALID_BYTECOUNT) + printf("PIO %dbytes", ata->bytecount); + printf(")"); + } + if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SATA) { + struct ccb_trans_settings_sata *sata = + &cts.xport_specific.sata; + + printf(" ("); + if (sata->valid & CTS_SATA_VALID_REVISION) + printf("SATA %d.x, ", sata->revision); + else + printf("SATA, "); + if (sata->valid & CTS_SATA_VALID_MODE) + printf("%s, ", ata_mode2string(sata->mode)); + if ((sata->valid & CTS_ATA_VALID_ATAPI) && sata->atapi != 0) + printf("ATAPI %dbytes, ", sata->atapi); + if (sata->valid & CTS_SATA_VALID_BYTECOUNT) + printf("PIO %dbytes", sata->bytecount); + printf(")"); + } + printf("\n"); +} + Modified: projects/ppc64/sys/cam/cam_xpt.c ============================================================================== --- projects/ppc64/sys/cam/cam_xpt.c Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/sys/cam/cam_xpt.c Wed Feb 24 03:41:46 2010 (r204272) @@ -866,7 +866,8 @@ xpt_rescan(union ccb *ccb) struct ccb_hdr *hdr; /* Prepare request */ - if(ccb->ccb_h.path->target->target_id == CAM_TARGET_WILDCARD) + if (ccb->ccb_h.path->target->target_id == CAM_TARGET_WILDCARD || + ccb->ccb_h.path->device->lun_id == CAM_LUN_WILDCARD) ccb->ccb_h.func_code = XPT_SCAN_BUS; else ccb->ccb_h.func_code = XPT_SCAN_LUN; @@ -1065,20 +1066,10 @@ xpt_remove_periph(struct cam_periph *per void xpt_announce_periph(struct cam_periph *periph, char *announce_string) { - struct ccb_pathinq cpi; - struct ccb_trans_settings cts; - struct cam_path *path; - u_int speed; - u_int freq; - u_int mb; + struct cam_path *path = periph->path; mtx_assert(periph->sim->mtx, MA_OWNED); - path = periph->path; - /* - * To ensure that this is printed in one piece, - * mask out CAM interrupts. - */ printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n", periph->periph_name, periph->unit_number, path->bus->sim->sim_name, @@ -1089,157 +1080,26 @@ xpt_announce_periph(struct cam_periph *p path->device->lun_id); printf("%s%d: ", periph->periph_name, periph->unit_number); if (path->device->protocol == PROTO_SCSI) - scsi_print_inquiry(&path->device->inq_data); + scsi_print_inquiry(&path->device->inq_data); else if (path->device->protocol == PROTO_ATA || path->device->protocol == PROTO_SATAPM) ata_print_ident(&path->device->ident_data); else - printf("Unknown protocol device\n"); + printf("Unknown protocol device\n"); if (bootverbose && path->device->serial_num_len > 0) { /* Don't wrap the screen - print only the first 60 chars */ printf("%s%d: Serial Number %.60s\n", periph->periph_name, periph->unit_number, path->device->serial_num); } - xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); - cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; - cts.type = CTS_TYPE_CURRENT_SETTINGS; - xpt_action((union ccb*)&cts); - if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - return; - } - - /* Ask the SIM for its base transfer speed */ - xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL); - cpi.ccb_h.func_code = XPT_PATH_INQ; - xpt_action((union ccb *)&cpi); - - speed = cpi.base_transfer_speed; - freq = 0; - if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SPI) { - struct ccb_trans_settings_spi *spi = - &cts.xport_specific.spi; - - if ((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) != 0 - && spi->sync_offset != 0) { - freq = scsi_calc_syncsrate(spi->sync_period); - speed = freq; - } - if ((spi->valid & CTS_SPI_VALID_BUS_WIDTH) != 0) - speed *= (0x01 << spi->bus_width); - } - if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_FC) { - struct ccb_trans_settings_fc *fc = - &cts.xport_specific.fc; - - if (fc->valid & CTS_FC_VALID_SPEED) - speed = fc->bitrate; - } - if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SAS) { - struct ccb_trans_settings_sas *sas = - &cts.xport_specific.sas; - - if (sas->valid & CTS_SAS_VALID_SPEED) - speed = sas->bitrate; - } - if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = - &cts.xport_specific.ata; - - if (ata->valid & CTS_ATA_VALID_MODE) - speed = ata_mode2speed(ata->mode); - } - if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SATA) { - struct ccb_trans_settings_sata *sata = - &cts.xport_specific.sata; - - if (sata->valid & CTS_SATA_VALID_REVISION) - speed = ata_revision2speed(sata->revision); - } - - mb = speed / 1000; - if (mb > 0) - printf("%s%d: %d.%03dMB/s transfers", - periph->periph_name, periph->unit_number, - mb, speed % 1000); - else - printf("%s%d: %dKB/s transfers", periph->periph_name, - periph->unit_number, speed); - /* Report additional information about SPI connections */ - if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SPI) { - struct ccb_trans_settings_spi *spi; - - spi = &cts.xport_specific.spi; - if (freq != 0) { - printf(" (%d.%03dMHz%s, offset %d", freq / 1000, - freq % 1000, - (spi->ppr_options & MSG_EXT_PPR_DT_REQ) != 0 - ? " DT" : "", - spi->sync_offset); - } - if ((spi->valid & CTS_SPI_VALID_BUS_WIDTH) != 0 - && spi->bus_width > 0) { - if (freq != 0) { - printf(", "); - } else { - printf(" ("); - } - printf("%dbit)", 8 * (0x01 << spi->bus_width)); - } else if (freq != 0) { - printf(")"); - } - } - if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_FC) { - struct ccb_trans_settings_fc *fc; - - fc = &cts.xport_specific.fc; - if (fc->valid & CTS_FC_VALID_WWNN) - printf(" WWNN 0x%llx", (long long) fc->wwnn); - if (fc->valid & CTS_FC_VALID_WWPN) - printf(" WWPN 0x%llx", (long long) fc->wwpn); - if (fc->valid & CTS_FC_VALID_PORT) - printf(" PortID 0x%x", fc->port); - } - if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = - &cts.xport_specific.ata; - - printf(" ("); - if (ata->valid & CTS_ATA_VALID_MODE) - printf("%s, ", ata_mode2string(ata->mode)); - if ((ata->valid & CTS_ATA_VALID_ATAPI) && ata->atapi != 0) - printf("ATAPI %dbytes, ", ata->atapi); - if (ata->valid & CTS_ATA_VALID_BYTECOUNT) - printf("PIO %dbytes", ata->bytecount); - printf(")"); - } - if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SATA) { - struct ccb_trans_settings_sata *sata = - &cts.xport_specific.sata; - - printf(" ("); - if (sata->valid & CTS_SATA_VALID_REVISION) - printf("SATA %d.x, ", sata->revision); - else - printf("SATA, "); - if (sata->valid & CTS_SATA_VALID_MODE) - printf("%s, ", ata_mode2string(sata->mode)); - if ((sata->valid & CTS_ATA_VALID_ATAPI) && sata->atapi != 0) - printf("ATAPI %dbytes, ", sata->atapi); - if (sata->valid & CTS_SATA_VALID_BYTECOUNT) - printf("PIO %dbytes", sata->bytecount); - printf(")"); - } + /* Announce transport details. */ + (*(path->bus->xport->announce))(periph); + /* Announce command queueing. */ if (path->device->inq_flags & SID_CmdQue || path->device->flags & CAM_DEV_TAG_AFTER_COUNT) { printf("\n%s%d: Command Queueing enabled", periph->periph_name, periph->unit_number); } - printf("\n"); - - /* - * We only want to print the caller's announce string if they've - * passed one in.. - */ + /* Announce caller's details if they've passed in. */ if (announce_string != NULL) printf("%s%d: %s\n", periph->periph_name, periph->unit_number, announce_string); Modified: projects/ppc64/sys/cam/cam_xpt_internal.h ============================================================================== --- projects/ppc64/sys/cam/cam_xpt_internal.h Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/sys/cam/cam_xpt_internal.h Wed Feb 24 03:41:46 2010 (r204272) @@ -44,8 +44,7 @@ typedef void (*xpt_dev_async_func)(u_int struct cam_et *target, struct cam_ed *device, void *async_arg); -typedef void (*xpt_announce_periph_func)(struct cam_periph *periph, - char *announce_string); +typedef void (*xpt_announce_periph_func)(struct cam_periph *periph); struct xpt_xport { xpt_alloc_device_func alloc_device; Modified: projects/ppc64/sys/cam/scsi/scsi_xpt.c ============================================================================== --- projects/ppc64/sys/cam/scsi/scsi_xpt.c Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/sys/cam/scsi/scsi_xpt.c Wed Feb 24 03:41:46 2010 (r204272) @@ -552,11 +552,13 @@ static void scsi_dev_async(u_int32_t as struct cam_ed *device, void *async_arg); static void scsi_action(union ccb *start_ccb); +static void scsi_announce_periph(struct cam_periph *periph); static struct xpt_xport scsi_xport = { .alloc_device = scsi_alloc_device, .action = scsi_action, .async = scsi_dev_async, + .announce = scsi_announce_periph, }; struct xpt_xport * @@ -2414,3 +2416,100 @@ scsi_dev_async(u_int32_t async_code, str } } +static void +scsi_announce_periph(struct cam_periph *periph) +{ + struct ccb_pathinq cpi; + struct ccb_trans_settings cts; + struct cam_path *path = periph->path; + u_int speed; + u_int freq; + u_int mb; + + mtx_assert(periph->sim->mtx, MA_OWNED); + + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_CURRENT_SETTINGS; + xpt_action((union ccb*)&cts); + if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) + return; + /* Ask the SIM for its base transfer speed */ + xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL); + cpi.ccb_h.func_code = XPT_PATH_INQ; + xpt_action((union ccb *)&cpi); + /* Report connection speed */ + speed = cpi.base_transfer_speed; + freq = 0; + if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SPI) { + struct ccb_trans_settings_spi *spi = + &cts.xport_specific.spi; + + if ((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) != 0 + && spi->sync_offset != 0) { + freq = scsi_calc_syncsrate(spi->sync_period); + speed = freq; + } + if ((spi->valid & CTS_SPI_VALID_BUS_WIDTH) != 0) + speed *= (0x01 << spi->bus_width); + } + if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_FC) { + struct ccb_trans_settings_fc *fc = + &cts.xport_specific.fc; + + if (fc->valid & CTS_FC_VALID_SPEED) + speed = fc->bitrate; + } + if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SAS) { + struct ccb_trans_settings_sas *sas = + &cts.xport_specific.sas; + + if (sas->valid & CTS_SAS_VALID_SPEED) + speed = sas->bitrate; + } + mb = speed / 1000; + if (mb > 0) + printf("%s%d: %d.%03dMB/s transfers", + periph->periph_name, periph->unit_number, + mb, speed % 1000); + else + printf("%s%d: %dKB/s transfers", periph->periph_name, + periph->unit_number, speed); + /* Report additional information about SPI connections */ + if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SPI) { + struct ccb_trans_settings_spi *spi; + + spi = &cts.xport_specific.spi; + if (freq != 0) { + printf(" (%d.%03dMHz%s, offset %d", freq / 1000, + freq % 1000, + (spi->ppr_options & MSG_EXT_PPR_DT_REQ) != 0 + ? " DT" : "", + spi->sync_offset); + } + if ((spi->valid & CTS_SPI_VALID_BUS_WIDTH) != 0 + && spi->bus_width > 0) { + if (freq != 0) { + printf(", "); + } else { + printf(" ("); + } + printf("%dbit)", 8 * (0x01 << spi->bus_width)); + } else if (freq != 0) { + printf(")"); + } + } + if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_FC) { + struct ccb_trans_settings_fc *fc; + + fc = &cts.xport_specific.fc; + if (fc->valid & CTS_FC_VALID_WWNN) + printf(" WWNN 0x%llx", (long long) fc->wwnn); + if (fc->valid & CTS_FC_VALID_WWPN) + printf(" WWPN 0x%llx", (long long) fc->wwpn); + if (fc->valid & CTS_FC_VALID_PORT) + printf(" PortID 0x%x", fc->port); + } + printf("\n"); +} + Modified: projects/ppc64/sys/dev/aac/aac.c ============================================================================== --- projects/ppc64/sys/dev/aac/aac.c Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/sys/dev/aac/aac.c Wed Feb 24 03:41:46 2010 (r204272) @@ -1195,7 +1195,6 @@ aac_bio_command(struct aac_softc *sc, st cm->cm_complete = aac_bio_complete; cm->cm_private = bp; cm->cm_timestamp = time_uptime; - cm->cm_queue = AAC_ADAP_NORM_CMD_QUEUE; /* build the FIB */ fib = cm->cm_fib; @@ -1350,7 +1349,6 @@ aac_wait_command(struct aac_command *cm) fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); /* Put the command on the ready queue and get things going */ - cm->cm_queue = AAC_ADAP_NORM_CMD_QUEUE; aac_enqueue_ready(cm); aac_startio(sc); error = msleep(cm, &sc->aac_io_lock, PRIBIO, "aacwait", 0); @@ -1400,6 +1398,7 @@ aac_release_command(struct aac_command * cm->cm_flags = 0; cm->cm_complete = NULL; cm->cm_private = NULL; + cm->cm_queue = AAC_ADAP_NORM_CMD_QUEUE; cm->cm_fib->Header.XferState = AAC_FIBSTATE_EMPTY; cm->cm_fib->Header.StructType = AAC_FIBTYPE_TFIB; cm->cm_fib->Header.Flags = 0; Modified: projects/ppc64/sys/dev/aac/aac_cam.c ============================================================================== --- projects/ppc64/sys/dev/aac/aac_cam.c Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/sys/dev/aac/aac_cam.c Wed Feb 24 03:41:46 2010 (r204272) @@ -453,7 +453,6 @@ aac_cam_action(struct cam_sim *sim, unio cm->cm_complete = aac_cam_complete; cm->cm_private = ccb; cm->cm_timestamp = time_uptime; - cm->cm_queue = AAC_ADAP_NORM_CMD_QUEUE; fib->Header.XferState = AAC_FIBSTATE_HOSTOWNED | Modified: projects/ppc64/sys/dev/alc/if_alc.c ============================================================================== --- projects/ppc64/sys/dev/alc/if_alc.c Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/sys/dev/alc/if_alc.c Wed Feb 24 03:41:46 2010 (r204272) @@ -84,9 +84,6 @@ __FBSDID("$FreeBSD$"); #else #define ALC_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) #endif -#ifndef IFCAP_VLAN_HWTSO -#define IFCAP_VLAN_HWTSO 0 -#endif MODULE_DEPEND(alc, pci, 1, 1, 1); MODULE_DEPEND(alc, ether, 1, 1, 1); @@ -756,8 +753,8 @@ alc_attach(device_t dev) ether_ifattach(ifp, sc->alc_eaddr); /* VLAN capability setup. */ - ifp->if_capabilities |= IFCAP_VLAN_MTU; - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM; + ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | + IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO; ifp->if_capenable = ifp->if_capabilities; /* * XXX @@ -1791,7 +1788,7 @@ alc_encap(struct alc_softc *sc, struct m struct tcphdr *tcp; bus_dma_segment_t txsegs[ALC_MAXTXSEGS]; bus_dmamap_t map; - uint32_t cflags, hdrlen, ip_off, poff, vtag; + uint32_t cflags, hdrlen, poff, vtag; int error, idx, nsegs, prod; ALC_LOCK_ASSERT(sc); @@ -1801,7 +1798,7 @@ alc_encap(struct alc_softc *sc, struct m m = *m_head; ip = NULL; tcp = NULL; - ip_off = poff = 0; + poff = 0; if ((m->m_pkthdr.csum_flags & (ALC_CSUM_FEATURES | CSUM_TSO)) != 0) { /* * AR8131/AR8132 requires offset of TCP/UDP header in its @@ -1811,7 +1808,6 @@ alc_encap(struct alc_softc *sc, struct m * cycles on FreeBSD so fast host CPU is required to get * smooth TSO performance. */ - struct ether_header *eh; if (M_WRITABLE(m) == 0) { /* Get a writable copy. */ @@ -1825,32 +1821,13 @@ alc_encap(struct alc_softc *sc, struct m *m_head = m; } - ip_off = sizeof(struct ether_header); - m = m_pullup(m, ip_off); - if (m == NULL) { - *m_head = NULL; - return (ENOBUFS); - } - eh = mtod(m, struct ether_header *); - /* - * Check if hardware VLAN insertion is off. - * Additional check for LLC/SNAP frame? - */ - if (eh->ether_type == htons(ETHERTYPE_VLAN)) { - ip_off = sizeof(struct ether_vlan_header); - m = m_pullup(m, ip_off); - if (m == NULL) { - *m_head = NULL; - return (ENOBUFS); - } - } - m = m_pullup(m, ip_off + sizeof(struct ip)); + m = m_pullup(m, sizeof(struct ether_header) + sizeof(struct ip)); if (m == NULL) { *m_head = NULL; return (ENOBUFS); } - ip = (struct ip *)(mtod(m, char *) + ip_off); - poff = ip_off + (ip->ip_hl << 2); + ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header)); + poff = sizeof(struct ether_header) + (ip->ip_hl << 2); if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { m = m_pullup(m, poff + sizeof(struct tcphdr)); if (m == NULL) { @@ -2133,6 +2110,7 @@ alc_ioctl(struct ifnet *ifp, u_long cmd, (ifp->if_capenable & IFCAP_TSO4) != 0) { ifp->if_capenable &= ~IFCAP_TSO4; ifp->if_hwassist &= ~CSUM_TSO; + VLAN_CAPABILITIES(ifp); } ALC_UNLOCK(sc); } @@ -2204,14 +2182,6 @@ alc_ioctl(struct ifnet *ifp, u_long cmd, if ((mask & IFCAP_VLAN_HWTSO) != 0 && (ifp->if_capabilities & IFCAP_VLAN_HWTSO) != 0) ifp->if_capenable ^= IFCAP_VLAN_HWTSO; - /* - * VLAN hardware tagging is required to do checksum - * offload or TSO on VLAN interface. Checksum offload - * on VLAN interface also requires hardware checksum - * offload of parent interface. - */ - if ((ifp->if_capenable & IFCAP_TXCSUM) == 0) - ifp->if_capenable &= ~IFCAP_VLAN_HWCSUM; if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0) ifp->if_capenable &= ~(IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM); Modified: projects/ppc64/sys/dev/ata/ata-all.c ============================================================================== --- projects/ppc64/sys/dev/ata/ata-all.c Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/sys/dev/ata/ata-all.c Wed Feb 24 03:41:46 2010 (r204272) @@ -289,15 +289,13 @@ static void ata_conn_event(void *context, int dummy) { device_t dev = (device_t)context; - struct ata_channel *ch = device_get_softc(dev); #ifdef ATA_CAM + struct ata_channel *ch = device_get_softc(dev); union ccb *ccb; -#endif mtx_lock(&ch->state_mtx); ata_reinit(dev); mtx_unlock(&ch->state_mtx); -#ifdef ATA_CAM if ((ccb = xpt_alloc_ccb()) == NULL) return; if (xpt_create_path(&ccb->ccb_h.path, NULL, @@ -307,6 +305,8 @@ ata_conn_event(void *context, int dummy) return; } xpt_rescan(ccb); +#else + ata_reinit(dev); #endif } Modified: projects/ppc64/sys/dev/bge/if_bge.c ============================================================================== --- projects/ppc64/sys/dev/bge/if_bge.c Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/sys/dev/bge/if_bge.c Wed Feb 24 03:41:46 2010 (r204272) @@ -3835,12 +3835,11 @@ bge_cksum_pad(struct mbuf *m) static struct mbuf * bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss) { - struct ether_header *eh; struct ip *ip; struct tcphdr *tcp; struct mbuf *n; uint16_t hlen; - uint32_t ip_off, poff; + uint32_t poff; if (M_WRITABLE(m) == 0) { /* Get a writable copy. */ @@ -3850,28 +3849,16 @@ bge_setup_tso(struct bge_softc *sc, stru return (NULL); m = n; } - ip_off = sizeof(struct ether_header); - m = m_pullup(m, ip_off); + m = m_pullup(m, sizeof(struct ether_header) + sizeof(struct ip)); if (m == NULL) return (NULL); - eh = mtod(m, struct ether_header *); - /* Check the existence of VLAN tag. */ - if (eh->ether_type == htons(ETHERTYPE_VLAN)) { - ip_off = sizeof(struct ether_vlan_header); - m = m_pullup(m, ip_off); - if (m == NULL) - return (NULL); - } - m = m_pullup(m, ip_off + sizeof(struct ip)); - if (m == NULL) - return (NULL); - ip = (struct ip *)(mtod(m, char *) + ip_off); - poff = ip_off + (ip->ip_hl << 2); + ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header)); + poff = sizeof(struct ether_header) + (ip->ip_hl << 2); m = m_pullup(m, poff + sizeof(struct tcphdr)); if (m == NULL) return (NULL); tcp = (struct tcphdr *)(mtod(m, char *) + poff); - m = m_pullup(m, poff + sizeof(struct tcphdr) + tcp->th_off); + m = m_pullup(m, poff + (tcp->th_off << 2)); if (m == NULL) return (NULL); /* Modified: projects/ppc64/sys/dev/bwn/if_bwn.c ============================================================================== --- projects/ppc64/sys/dev/bwn/if_bwn.c Wed Feb 24 01:44:39 2010 (r204271) +++ projects/ppc64/sys/dev/bwn/if_bwn.c Wed Feb 24 03:41:46 2010 (r204272) @@ -536,6 +536,7 @@ static void bwn_phy_lp_gaintbl_write_r2( struct bwn_txgain_entry); static void bwn_phy_lp_gaintbl_write_r01(struct bwn_mac *, int, struct bwn_txgain_entry); +static void bwn_sysctl_node(struct bwn_softc *); static struct resource_spec bwn_res_spec_legacy[] = { { SYS_RES_IRQ, 0, RF_ACTIVE | RF_SHAREABLE }, @@ -1066,9 +1067,6 @@ bwn_attach_post(struct bwn_softc *sc) struct ifnet *ifp = sc->sc_ifp; struct siba_dev_softc *sd = sc->sc_sd; struct siba_sprom *sprom = &sd->sd_bus->siba_sprom; -#ifdef BWN_DEBUG - device_t dev = sc->sc_dev; -#endif ic = ifp->if_l2com; ic->ic_ifp = ifp; @@ -1117,11 +1115,7 @@ bwn_attach_post(struct bwn_softc *sc) &sc->sc_rx_th.wr_ihdr, sizeof(sc->sc_rx_th), BWN_RX_RADIOTAP_PRESENT); -#ifdef BWN_DEBUG - SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, - "debug", CTLFLAG_RW, &sc->sc_debug, 0, "Debug flags"); -#endif + bwn_sysctl_node(sc); if (bootverbose) ieee80211_announce(ic); @@ -1496,6 +1490,7 @@ bwn_pio_select(struct bwn_mac *mac, uint return (&mac->mac_method.pio.wme[WME_AC_VO]); } KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__)); + return (NULL); } static int @@ -1905,10 +1900,9 @@ bwn_setup_channels(struct bwn_mac *mac, static uint32_t bwn_shm_read_4(struct bwn_mac *mac, uint16_t way, uint16_t offset) { - struct bwn_softc *sc = mac->mac_sc; uint32_t ret; - BWN_ASSERT_LOCKED(sc); + BWN_ASSERT_LOCKED(mac->mac_sc); if (way == BWN_SHARED) { KASSERT((offset & 0x0001) == 0, @@ -1932,10 +1926,9 @@ out: static uint16_t bwn_shm_read_2(struct bwn_mac *mac, uint16_t way, uint16_t offset) { - struct bwn_softc *sc = mac->mac_sc; uint16_t ret; - BWN_ASSERT_LOCKED(sc); + BWN_ASSERT_LOCKED(mac->mac_sc); if (way == BWN_SHARED) { KASSERT((offset & 0x0001) == 0, @@ -1970,9 +1963,7 @@ static void bwn_shm_write_4(struct bwn_mac *mac, uint16_t way, uint16_t offset, uint32_t value) { - struct bwn_softc *sc = mac->mac_sc; - - BWN_ASSERT_LOCKED(sc); + BWN_ASSERT_LOCKED(mac->mac_sc); if (way == BWN_SHARED) { KASSERT((offset & 0x0001) == 0, @@ -1995,9 +1986,7 @@ static void bwn_shm_write_2(struct bwn_mac *mac, uint16_t way, uint16_t offset, uint16_t value) { - struct bwn_softc *sc = mac->mac_sc; - - BWN_ASSERT_LOCKED(sc); + BWN_ASSERT_LOCKED(mac->mac_sc); if (way == BWN_SHARED) { KASSERT((offset & 0x0001) == 0, @@ -3335,10 +3324,9 @@ bwn_core_start(struct bwn_mac *mac) static void bwn_core_exit(struct bwn_mac *mac) { - struct bwn_softc *sc = mac->mac_sc; uint32_t macctl; - BWN_ASSERT_LOCKED(sc); + BWN_ASSERT_LOCKED(mac->mac_sc); KASSERT(mac->mac_status <= BWN_MAC_STATUS_INITED, ("%s:%d: fail", __func__, __LINE__)); @@ -5198,6 +5186,8 @@ bwn_rf_init_bcm2050(struct bwn_mac *mac) 0x0e, 0x0f, 0x0d, 0x0f, }; + loctl = lomask = reg0 = classctl = crs0 = analogoverval = analogover = + rfoverval = rfover = cck3 = 0; radio0 = BWN_RF_READ(mac, 0x43); radio1 = BWN_RF_READ(mac, 0x51); radio2 = BWN_RF_READ(mac, 0x52); @@ -5891,7 +5881,6 @@ static void bwn_dummy_transmission(struct bwn_mac *mac, int ofdm, int paon) { struct bwn_phy *phy = &mac->mac_phy; - struct bwn_softc *sc = mac->mac_sc; unsigned int i, max_loop; uint16_t value; uint32_t buffer[5] = { @@ -5906,7 +5895,7 @@ bwn_dummy_transmission(struct bwn_mac *m buffer[0] = 0x000b846e; } - BWN_ASSERT_LOCKED(sc); + BWN_ASSERT_LOCKED(mac->mac_sc); for (i = 0; i < 5; i++) bwn_ram_write(mac, i * 4, buffer[i]); @@ -5972,10 +5961,9 @@ bwn_ram_write(struct bwn_mac *mac, uint1 static void bwn_lo_write(struct bwn_mac *mac, struct bwn_loctl *ctl) { - struct bwn_phy *phy = &mac->mac_phy; uint16_t value; - KASSERT(phy->type == BWN_PHYTYPE_G, + KASSERT(mac->mac_phy.type == BWN_PHYTYPE_G, ("%s:%d: fail", __func__, __LINE__)); value = (uint8_t) (ctl->q); @@ -6570,7 +6558,7 @@ bwn_lo_calibset(struct bwn_mac *mac, struct bwn_phy_g *pg = &phy->phy_g; struct bwn_loctl loctl = { 0, 0 }; struct bwn_lo_calib *cal; - struct bwn_lo_g_value sval; + struct bwn_lo_g_value sval = { 0 }; int rxgain; uint16_t pad, reg, value; @@ -8984,9 +8972,7 @@ bwn_noise_gensample(struct bwn_mac *mac) static int bwn_dma_freeslot(struct bwn_dma_ring *dr) { - struct bwn_mac *mac = dr->dr_mac; - - BWN_ASSERT_LOCKED(mac->mac_sc); + BWN_ASSERT_LOCKED(dr->dr_mac->mac_sc); return (dr->dr_numslots - dr->dr_usedslot); } @@ -8994,9 +8980,7 @@ bwn_dma_freeslot(struct bwn_dma_ring *dr static int bwn_dma_nextslot(struct bwn_dma_ring *dr, int slot) { - struct bwn_mac *mac = dr->dr_mac; - - BWN_ASSERT_LOCKED(mac->mac_sc); + BWN_ASSERT_LOCKED(dr->dr_mac->mac_sc); KASSERT(slot >= -1 && slot <= dr->dr_numslots - 1, ("%s:%d: fail", __func__, __LINE__)); @@ -9087,6 +9071,7 @@ bwn_handle_txeof(struct bwn_mac *mac, co struct bwn_pio_txqueue *tq; struct bwn_pio_txpkt *tp = NULL; struct bwn_softc *sc = mac->mac_sc; + struct bwn_stats *stats = &mac->mac_stats; struct ieee80211_node *ni; int slot; @@ -9098,9 +9083,9 @@ bwn_handle_txeof(struct bwn_mac *mac, co device_printf(sc->sc_dev, "TODO: STATUS AMPDU\n"); if (status->rtscnt) { if (status->rtscnt == 0xf) - device_printf(sc->sc_dev, "TODO: RTS fail\n"); + stats->rtsfail++; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002240341.o1O3fkK7067363>