diff --git a/sys/conf/files b/sys/conf/files index 917a98a042c1..9d7ee67991f2 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.673 2004/05/28 15:35:41 toshii Exp $ +# $NetBSD: files,v 1.674 2004/05/28 23:26:27 thorpej Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -205,6 +205,7 @@ define audiobus { } define midibus { } define midisyn define ata {[channel = -1]} +define sata define scsi_core define scsi {[channel = -1]}: scsi_core define ata_hl {[drive = -1]} diff --git a/sys/dev/ata/files.ata b/sys/dev/ata/files.ata index 376783e8fbc7..026dd87d1d58 100644 --- a/sys/dev/ata/files.ata +++ b/sys/dev/ata/files.ata @@ -1,4 +1,4 @@ -# $NetBSD: files.ata,v 1.8 2003/10/08 20:58:00 bouyer Exp $ +# $NetBSD: files.ata,v 1.9 2004/05/28 23:26:27 thorpej Exp $ # # Config file and device description for machine-independent devices # which attach to ATA busses. Included by ports that need it. Ports @@ -20,3 +20,6 @@ file dev/ata/ata_raid_promise.c ataraid attach ld at ataraid with ld_ataraid file dev/ata/ld_ataraid.c ld_ataraid + +# Common SATA subroutines +file dev/ata/sata_subr.c sata diff --git a/sys/dev/ata/sata_subr.c b/sys/dev/ata/sata_subr.c new file mode 100644 index 000000000000..3b96665d5760 --- /dev/null +++ b/sys/dev/ata/sata_subr.c @@ -0,0 +1,78 @@ +/* $NetBSD: sata_subr.c,v 1.1 2004/05/28 23:26:27 thorpej Exp $ */ + +/*- + * Copyright (c) 2004 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of Wasabi Systems, Inc. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``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 FOUNDATION OR CONTRIBUTORS + * 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. + */ + +/* + * Common functions for Serial ATA. + */ + +#include + +#include +#include + +/* + * sata_speed: + * + * Return a string describing the port speed reported by + * the port's SStatus register. + */ +const char * +sata_speed(uint32_t sstatus) +{ + static const char *sata_speedtab[] = { + "no negotiated speed", + "1.5Gb/s", + "3.0GB/s", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + }; + + return (sata_speedtab[(sstatus & SStatus_SPD_mask) >> + SStatus_SPD_shift]); +} diff --git a/sys/dev/ata/satavar.h b/sys/dev/ata/satavar.h new file mode 100644 index 000000000000..e72c97b51062 --- /dev/null +++ b/sys/dev/ata/satavar.h @@ -0,0 +1,48 @@ +/* $NetBSD: satavar.h,v 1.1 2004/05/28 23:26:27 thorpej Exp $ */ + +/*- + * Copyright (c) 2004 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of Wasabi Systems, Inc. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``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 FOUNDATION OR CONTRIBUTORS + * 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. + */ + +#ifndef _DEV_ATA_SATAVAR_H_ +#define _DEV_ATA_SATAVAR_H_ + +/* + * Declaration of common data structures and functions for Serial ATA. + */ + +const char *sata_speed(uint32_t); + +#endif /* _DEV_ATA_SATAVAR_H_ */