Date: Mon, 16 Nov 2009 22:18:22 GMT From: Alexander Motin <mav@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 170686 for review Message-ID: <200911162218.nAGMIM9l091881@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=170686 Change 170686 by mav@mav_mavbook on 2009/11/16 22:17:56 IFC Affected files ... .. //depot/projects/scottl-camlock/src/bin/sh/parser.c#7 integrate .. //depot/projects/scottl-camlock/src/lib/libc/locale/nl_langinfo.3#2 integrate .. //depot/projects/scottl-camlock/src/lib/libc/nls/ko_KR.UTF-8.msg#2 integrate .. //depot/projects/scottl-camlock/src/lib/libc/nls/ko_KR.eucKR.msg#2 integrate .. //depot/projects/scottl-camlock/src/lib/libc/posix1e/acl_from_text.c#3 integrate .. //depot/projects/scottl-camlock/src/lib/libdevinfo/devinfo.h#3 integrate .. //depot/projects/scottl-camlock/src/share/man/man4/Makefile#14 integrate .. //depot/projects/scottl-camlock/src/share/man/man4/atp.4#1 branch .. //depot/projects/scottl-camlock/src/share/man/man5/rc.conf.5#11 integrate .. //depot/projects/scottl-camlock/src/sys/amd64/include/param.h#15 integrate .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#19 integrate .. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#81 integrate .. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.h#27 integrate .. //depot/projects/scottl-camlock/src/sys/dev/ata/ata-pci.c#15 integrate .. //depot/projects/scottl-camlock/src/sys/dev/ata/ata-pci.h#24 integrate .. //depot/projects/scottl-camlock/src/sys/dev/ata/chipsets/ata-ahci.c#11 integrate .. //depot/projects/scottl-camlock/src/sys/dev/ata/chipsets/ata-jmicron.c#5 integrate .. //depot/projects/scottl-camlock/src/sys/dev/ata/chipsets/ata-marvell.c#15 integrate .. //depot/projects/scottl-camlock/src/sys/dev/siis/siis.c#20 integrate .. //depot/projects/scottl-camlock/src/sys/dev/usb/serial/u3g.c#9 integrate .. //depot/projects/scottl-camlock/src/sys/dev/usb/usbdevs#32 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/raw_ip.c#26 integrate .. //depot/projects/scottl-camlock/src/sys/nfsserver/nfs_fha.c#4 integrate .. //depot/projects/scottl-camlock/src/tools/regression/bin/sh/parser/for1.0#1 branch .. //depot/projects/scottl-camlock/src/tools/tools/ncpus/acpi.c#2 integrate .. //depot/projects/scottl-camlock/src/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c#2 integrate .. //depot/projects/scottl-camlock/src/usr.sbin/devinfo/devinfo.c#3 integrate Differences ... ==== //depot/projects/scottl-camlock/src/bin/sh/parser.c#7 (text+ko) ==== @@ -36,7 +36,7 @@ #endif #endif /* not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/sh/parser.c,v 1.65 2009/10/16 16:17:57 jilles Exp $"); +__FBSDID("$FreeBSD: src/bin/sh/parser.c,v 1.66 2009/11/14 22:08:32 jilles Exp $"); #include <stdlib.h> #include <unistd.h> @@ -364,7 +364,9 @@ n1 = (union node *)stalloc(sizeof (struct nfor)); n1->type = NFOR; n1->nfor.var = wordtext; - if (readtoken() == TWORD && ! quoteflag && equal(wordtext, "in")) { + while (readtoken() == TNL) + ; + if (lasttoken == TWORD && ! quoteflag && equal(wordtext, "in")) { app = ≈ while (readtoken() == TWORD) { n2 = (union node *)stalloc(sizeof (struct narg)); ==== //depot/projects/scottl-camlock/src/lib/libc/locale/nl_langinfo.3#2 (text+ko) ==== @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc/locale/nl_langinfo.3,v 1.6 2005/01/20 09:17:03 ru Exp $ +.\" $FreeBSD: src/lib/libc/locale/nl_langinfo.3,v 1.7 2009/11/16 14:33:31 brueffer Exp $ .\" .Dd May 3, 2001 .Dt NL_LANGINFO 3 @@ -53,7 +53,7 @@ or to the category .Dv LC_ALL , -may overwrite buffer pointed by the return value. +may overwrite the buffer pointed to by the return value. .Sh RETURN VALUES In a locale where langinfo data is not defined, .Fn nl_langinfo ==== //depot/projects/scottl-camlock/src/lib/libc/nls/ko_KR.UTF-8.msg#2 (text+ko) ==== @@ -1,4 +1,4 @@ -$ $FreeBSD: src/lib/libc/nls/ko_KR.UTF-8.msg,v 1.2 2005/07/16 05:40:14 jkim Exp $ +$ $FreeBSD: src/lib/libc/nls/ko_KR.UTF-8.msg,v 1.3 2009/11/16 19:10:09 jkim Exp $ $ $ Message catalog for ko_KR.UTF-8 locale $ @@ -181,6 +181,16 @@ 87 속성을 찾을 수 없습니다 $ EDOOFUS 88 프로그램상 오류입니다 +$ EBADMSG +89 잘못된 메시지입니다 +$ EMULTIHOP +90 멀티홉이 시도되었습니다 +$ ENOLINK +91 연결이 끊겼습니다 +$ EPROTO +92 프로토콜이 잘못되었습니다 +$ ENOTCAPABLE +93 접근 능력이 충분치 않습니다 $ $ strsignal() support catalog $ @@ -230,7 +240,7 @@ $ SIGTTOU 22 정지 (터미널 출력) $ SIGIO -23 I/O possible +23 I/O 가능 $ SIGXCPU 24 CPU 사용 시간 초과 $ SIGXFSZ @@ -247,3 +257,39 @@ 30 사용자 정의 시그널 1 $ SIGUSR2 31 사용자 정의 시그널 2 +$ +$ gai_strerror() support catalog +$ +$set 3 +$ 1 (obsolete) +1 호스트 이름이 지원하지 않는 주소군입니다 +$ EAI_AGAIN +2 주소 변환에 일시적으로 실패했습니다 +$ EAI_BADFLAGS +3 잘못된 ai_flags입니다 +$ EAI_FAIL +4 주소 변환에 완전히 실패했습니다 +$ EAI_FAMILY +5 지원되지 않는 ai_family입니다 +$ EAI_MEMORY +6 메모리 할당에 실패했습니다 +$ 7 (obsolete) +7 호스트 이름과 일치하는 주소가 없습니다 +$ EAI_NONAME +8 호스트 이름 또는 서비스 이름이 지정되지 않았거나 알 수 없습니다 +$ EAI_SERVICE +9 서비스 이름은 ai_socktype에서 지원되지 않습니다 +$ EAI_SOCKTYPE +10 지원되지 않는 ai_socktype입니다 +$ EAI_SYSTEM +11 시스템 오류가 errno에 반환되었습니다 +$ EAI_BADHINTS +12 잘못된 hints입니다 +$ EAI_PROTOCOL +13 알 수 없는 프로토콜이 변환되었습니다 +$ EAI_OVERFLOW +14 인자 버퍼 공간이 모자랍니다 +$ 0 +32766 성공 +$ NL_MSGMAX +32767 알 수 없는 오류 ==== //depot/projects/scottl-camlock/src/lib/libc/nls/ko_KR.eucKR.msg#2 (text+ko) ==== @@ -1,4 +1,4 @@ -$ $FreeBSD: src/lib/libc/nls/ko_KR.eucKR.msg,v 1.2 2005/07/16 05:40:14 jkim Exp $ +$ $FreeBSD: src/lib/libc/nls/ko_KR.eucKR.msg,v 1.3 2009/11/16 19:10:09 jkim Exp $ $ $ Message catalog for ko_KR.eucKR locale $ @@ -181,6 +181,16 @@ 87 Ӽ ã ϴ $ EDOOFUS 88 α Դϴ +$ EBADMSG +89 ߸ Դϴ +$ EMULTIHOP +90 Ƽȩ õǾϴ +$ ENOLINK +91 ϴ +$ EPROTO +92 ߸Ǿϴ +$ ENOTCAPABLE +93 ɷ ġ ʽϴ $ $ strsignal() support catalog $ @@ -230,7 +240,7 @@ $ SIGTTOU 22 (̳ ) $ SIGIO -23 I/O possible +23 I/O $ SIGXCPU 24 CPU ð ʰ $ SIGXFSZ @@ -247,3 +257,39 @@ 30 ñ׳ 1 $ SIGUSR2 31 ñ׳ 2 +$ +$ gai_strerror() support catalog +$ +$set 3 +$ 1 (obsolete) +1 ȣƮ ̸ ʴ ּұԴϴ +$ EAI_AGAIN +2 ּ ȯ Ͻ ߽ϴ +$ EAI_BADFLAGS +3 ߸ ai_flagsԴϴ +$ EAI_FAIL +4 ּ ȯ ߽ϴ +$ EAI_FAMILY +5 ʴ ai_familyԴϴ +$ EAI_MEMORY +6 Ҵ翡 ߽ϴ +$ 7 (obsolete) +7 ȣƮ ̸ ġϴ ּҰ ϴ +$ EAI_NONAME +8 ȣƮ ̸ Ǵ ̸ ʾҰų ϴ +$ EAI_SERVICE +9 ̸ ai_socktype ʽϴ +$ EAI_SOCKTYPE +10 ʴ ai_socktypeԴϴ +$ EAI_SYSTEM +11 ý errno ȯǾϴ +$ EAI_BADHINTS +12 ߸ hintsԴϴ +$ EAI_PROTOCOL +13 ȯǾϴ +$ EAI_OVERFLOW +14 ڶϴ +$ 0 +32766 +$ NL_MSGMAX +32767 ==== //depot/projects/scottl-camlock/src/lib/libc/posix1e/acl_from_text.c#3 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/posix1e/acl_from_text.c,v 1.12 2009/06/25 12:46:59 trasz Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/posix1e/acl_from_text.c,v 1.13 2009/11/16 09:28:22 brueffer Exp $"); #include <sys/types.h> #include "namespace.h" @@ -257,6 +257,7 @@ } #endif + free(mybuf_p); return(acl); error_label: ==== //depot/projects/scottl-camlock/src/lib/libdevinfo/devinfo.h#3 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libdevinfo/devinfo.h,v 1.6 2009/09/15 16:59:52 attilio Exp $ + * $FreeBSD: src/lib/libdevinfo/devinfo.h,v 1.7 2009/11/15 16:44:43 attilio Exp $ */ #ifndef _DEVINFO_H_INCLUDED @@ -32,20 +32,12 @@ #include <sys/cdefs.h> #include <sys/_types.h> +#include <sys/bus.h> typedef __uintptr_t devinfo_handle_t; #define DEVINFO_ROOT_DEVICE ((devinfo_handle_t)0) -/* - * State of the device. - */ -/* XXX not sure if I want a copy here, or expose sys/bus.h */ -typedef enum devinfo_state { - DIS_NOTPRESENT = 10, /* not probed or probe failed */ - DIS_ALIVE = 20, /* probe succeeded */ - DIS_ATTACHED = 30, /* attach method called */ - DIS_BUSY = 40 /* device is open */ -} devinfo_state_t; +typedef enum device_state devinfo_state_t; struct devinfo_dev { devinfo_handle_t dd_handle; /* device handle */ ==== //depot/projects/scottl-camlock/src/share/man/man4/Makefile#14 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile 8.1 (Berkeley) 6/18/93 -# $FreeBSD: src/share/man/man4/Makefile,v 1.463 2009/10/20 13:22:54 avg Exp $ +# $FreeBSD: src/share/man/man4/Makefile,v 1.464 2009/11/15 18:31:57 rpaulo Exp $ MAN= aac.4 \ acpi.4 \ @@ -44,6 +44,7 @@ ath_hal.4 \ atkbd.4 \ atkbdc.4 \ + ${_atp.4} \ audit.4 \ auditpipe.4 \ aue.4 \ @@ -611,6 +612,7 @@ _amdsmb.4= amdsmb.4 _amdtemp.4= amdtemp.4 _asmc.4= asmc.4 +_atp.4= atp.4 _coretemp.4= coretemp.4 _cpuctl.4= cpuctl.4 _dpms.4= dpms.4 @@ -642,6 +644,10 @@ MLINKS+=lindev.4 full.4 .endif +.if ${MACHINE_ARCH} == "powerpc" +_atp.4= atp.4 +.endif + .if exists(${.CURDIR}/man4.${MACHINE_ARCH}) SUBDIR= man4.${MACHINE_ARCH} .endif ==== //depot/projects/scottl-camlock/src/share/man/man5/rc.conf.5#11 (text+ko) ==== @@ -22,9 +22,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.367 2009/11/10 19:50:28 dougb Exp $ +.\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.368 2009/11/15 23:31:07 dougb Exp $ .\" -.Dd September 23, 2009 +.Dd November 11, 2009 .Dt RC.CONF 5 .Os .Sh NAME ==== //depot/projects/scottl-camlock/src/sys/amd64/include/param.h#15 (text+ko) ==== @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)param.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD: src/sys/amd64/include/param.h,v 1.33 2009/09/18 17:04:57 alc Exp $ + * $FreeBSD: src/sys/amd64/include/param.h,v 1.34 2009/11/16 10:53:04 phk Exp $ */ @@ -105,7 +105,7 @@ #define NPML4EPG (PAGE_SIZE/(sizeof (pml4_entry_t))) #define NPML4EPGSHIFT 9 /* LOG2(NPML4EPG) */ #define PML4SHIFT 39 /* LOG2(NBPML4) */ -#define NBPML4 (1ul<<PML4SHIFT)/* bytes/page map lev4 table */ +#define NBPML4 (1UL<<PML4SHIFT)/* bytes/page map lev4 table */ #define PML4MASK (NBPML4-1) #define MAXPAGESIZES 3 /* maximum number of supported page sizes */ ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#19 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/cam/ata/ata_pmp.c,v 1.2 2009/10/31 10:43:38 mav Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/ata/ata_pmp.c,v 1.3 2009/11/16 15:18:02 mav Exp $"); #include <sys/param.h> ==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#81 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ahci/ahci.c,v 1.14 2009/11/14 20:06:04 mav Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ahci/ahci.c,v 1.15 2009/11/16 15:38:27 mav Exp $"); #include <sys/param.h> #include <sys/module.h> @@ -99,7 +99,14 @@ static struct { uint32_t id; const char *name; - int flags; + int quirks; +#define AHCI_Q_NOFORCE 1 +#define AHCI_Q_NOPMP 2 +#define AHCI_Q_NONCQ 4 +#define AHCI_Q_1CH 8 +#define AHCI_Q_2CH 16 +#define AHCI_Q_4CH 32 +#define AHCI_Q_EDGEIS 64 } ahci_ids[] = { {0x43801002, "ATI IXP600", 0}, {0x43901002, "ATI IXP700", 0}, @@ -145,6 +152,15 @@ {0x3b2b8086, "Intel PCH", 0}, {0x3b2c8086, "Intel PCH", 0}, {0x3b2f8086, "Intel PCH", 0}, + {0x2361197b, "JMicron JMB361", AHCI_Q_NOFORCE}, + {0x2363197b, "JMicron JMB363", AHCI_Q_NOFORCE}, + {0x2365197b, "JMicron JMB365", AHCI_Q_NOFORCE}, + {0x2366197b, "JMicron JMB366", AHCI_Q_NOFORCE}, + {0x2368197b, "JMicron JMB368", AHCI_Q_NOFORCE}, + {0x611111ab, "Marvell 88SX6111", AHCI_Q_NOFORCE|AHCI_Q_1CH|AHCI_Q_EDGEIS}, + {0x612111ab, "Marvell 88SX6121", AHCI_Q_NOFORCE|AHCI_Q_2CH|AHCI_Q_EDGEIS}, + {0x614111ab, "Marvell 88SX6141", AHCI_Q_NOFORCE|AHCI_Q_4CH|AHCI_Q_EDGEIS}, + {0x614511ab, "Marvell 88SX6145", AHCI_Q_NOFORCE|AHCI_Q_4CH|AHCI_Q_EDGEIS}, {0x044c10de, "NVIDIA MCP65", 0}, {0x044d10de, "NVIDIA MCP65", 0}, {0x044e10de, "NVIDIA MCP65", 0}, @@ -226,9 +242,39 @@ ahci_probe(device_t dev) { char buf[64]; + int i, valid = 0; + uint32_t devid = pci_get_devid(dev); + + /* Is this a possible AHCI candidate? */ + if (pci_get_class(dev) == PCIC_STORAGE && + pci_get_subclass(dev) == PCIS_STORAGE_SATA && + pci_get_progif(dev) == PCIP_STORAGE_SATA_AHCI_1_0) + valid = 1; + /* Is this a known AHCI chip? */ + for (i = 0; ahci_ids[i].id != 0; i++) { + if (ahci_ids[i].id == devid && + (valid || !(ahci_ids[i].quirks & AHCI_Q_NOFORCE))) { + snprintf(buf, sizeof(buf), "%s AHCI SATA controller", + ahci_ids[i].name); + device_set_desc_copy(dev, buf); + return (BUS_PROBE_VENDOR); + } + } + if (!valid) + return (ENXIO); + device_set_desc_copy(dev, "AHCI SATA controller"); + return (BUS_PROBE_VENDOR); +} + +static int +ahci_ata_probe(device_t dev) +{ + char buf[64]; int i; uint32_t devid = pci_get_devid(dev); + if ((intptr_t)device_get_ivars(dev) >= 0) + return (ENXIO); /* Is this a known AHCI chip? */ for (i = 0; ahci_ids[i].id != 0; i++) { if (ahci_ids[i].id == devid) { @@ -238,11 +284,6 @@ return (BUS_PROBE_VENDOR); } } - /* Is this a possible AHCI candidate? */ - if (pci_get_class(dev) != PCIC_STORAGE || - pci_get_subclass(dev) != PCIS_STORAGE_SATA || - pci_get_progif(dev) != PCIP_STORAGE_SATA_AHCI_1_0) - return (ENXIO); device_set_desc_copy(dev, "AHCI SATA controller"); return (BUS_PROBE_VENDOR); } @@ -252,10 +293,15 @@ { struct ahci_controller *ctlr = device_get_softc(dev); device_t child; - int error, unit, speed; + int error, unit, speed, i; + uint32_t devid = pci_get_devid(dev); u_int32_t version; ctlr->dev = dev; + i = 0; + while (ahci_ids[i].id != 0 && ahci_ids[i].id != devid) + i++; + ctlr->quirks = ahci_ids[i].quirks; resource_int_value(device_get_name(dev), device_get_unit(dev), "ccc", &ctlr->ccc); /* if we have a memory BAR(5) we are likely on an AHCI part */ @@ -282,10 +328,32 @@ rman_fini(&ctlr->sc_iomem); return (error); }; - /* Get the number of HW channels */ + /* Get the HW capabilities */ + version = ATA_INL(ctlr->r_mem, AHCI_VS); + ctlr->caps = ATA_INL(ctlr->r_mem, AHCI_CAP); + if (version >= 0x00010020) + ctlr->caps2 = ATA_INL(ctlr->r_mem, AHCI_CAP2); ctlr->ichannels = ATA_INL(ctlr->r_mem, AHCI_PI); + if (ctlr->quirks & AHCI_Q_1CH) { + ctlr->caps &= ~AHCI_CAP_NPMASK; + ctlr->ichannels &= 0x01; + } + if (ctlr->quirks & AHCI_Q_2CH) { + ctlr->caps &= ~AHCI_CAP_NPMASK; + ctlr->caps |= 1; + ctlr->ichannels &= 0x03; + } + if (ctlr->quirks & AHCI_Q_4CH) { + ctlr->caps &= ~AHCI_CAP_NPMASK; + ctlr->caps |= 3; + ctlr->ichannels &= 0x0f; + } ctlr->channels = MAX(flsl(ctlr->ichannels), - (ATA_INL(ctlr->r_mem, AHCI_CAP) & AHCI_CAP_NPMASK) + 1); + (ctlr->caps & AHCI_CAP_NPMASK) + 1); + if (ctlr->quirks & AHCI_Q_NOPMP) + ctlr->caps &= ~AHCI_CAP_SPM; + if (ctlr->quirks & AHCI_Q_NONCQ) + ctlr->caps &= ~AHCI_CAP_SNCQ; /* Setup interrupts. */ if (ahci_setup_interrupt(dev)) { bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); @@ -293,10 +361,6 @@ return ENXIO; } /* Announce HW capabilities. */ - version = ATA_INL(ctlr->r_mem, AHCI_VS); - ctlr->caps = ATA_INL(ctlr->r_mem, AHCI_CAP); - if (version >= 0x00010020) - ctlr->caps2 = ATA_INL(ctlr->r_mem, AHCI_CAP2); speed = (ctlr->caps & AHCI_CAP_ISS) >> AHCI_CAP_ISS_SHIFT; device_printf(dev, "AHCI v%x.%02x with %d %sGbps ports, Port Multiplier %s\n", @@ -531,8 +595,15 @@ for (; unit < ctlr->channels; unit++) { if ((is & (1 << unit)) != 0 && (arg = ctlr->interrupt[unit].argument)) { - ctlr->interrupt[unit].function(arg); - ATA_OUTL(ctlr->r_mem, AHCI_IS, 1 << unit); + if (ctlr->quirks & AHCI_Q_EDGEIS) { + /* Some controller have edge triggered IS. */ + ATA_OUTL(ctlr->r_mem, AHCI_IS, 1 << unit); + ctlr->interrupt[unit].function(arg); + } else { + /* but AHCI declares level triggered IS. */ + ctlr->interrupt[unit].function(arg); + ATA_OUTL(ctlr->r_mem, AHCI_IS, 1 << unit); + } } } } @@ -665,6 +736,25 @@ sizeof(struct ahci_controller) }; DRIVER_MODULE(ahci, pci, ahci_driver, ahci_devclass, 0, 0); +static device_method_t ahci_ata_methods[] = { + DEVMETHOD(device_probe, ahci_ata_probe), + DEVMETHOD(device_attach, ahci_attach), + DEVMETHOD(device_detach, ahci_detach), + DEVMETHOD(device_suspend, ahci_suspend), + DEVMETHOD(device_resume, ahci_resume), + DEVMETHOD(bus_print_child, ahci_print_child), + DEVMETHOD(bus_alloc_resource, ahci_alloc_resource), + DEVMETHOD(bus_release_resource, ahci_release_resource), + DEVMETHOD(bus_setup_intr, ahci_setup_intr), + DEVMETHOD(bus_teardown_intr,ahci_teardown_intr), + { 0, 0 } +}; +static driver_t ahci_ata_driver = { + "ahci", + ahci_ata_methods, + sizeof(struct ahci_controller) +}; +DRIVER_MODULE(ahci, atapci, ahci_ata_driver, ahci_devclass, 0, 0); MODULE_VERSION(ahci, 1); MODULE_DEPEND(ahci, cam, 1, 1, 1); @@ -688,6 +778,7 @@ ch->unit = (intptr_t)device_get_ivars(dev); ch->caps = ctlr->caps; ch->caps2 = ctlr->caps2; + ch->quirks = ctlr->quirks; ch->numslots = ((ch->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1, mtx_init(&ch->mtx, "AHCI channel lock", NULL, MTX_DEF); resource_int_value(device_get_name(dev), @@ -858,7 +949,7 @@ ahcich_methods, sizeof(struct ahci_channel) }; -DRIVER_MODULE(ahcich, ahci, ahcich_driver, ahci_devclass, 0, 0); +DRIVER_MODULE(ahcich, ahci, ahcich_driver, ahcich_devclass, 0, 0); struct ahci_dc_cb_args { bus_addr_t maddr; ==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.h#27 (text+ko) ==== @@ -24,7 +24,7 @@ * (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: src/sys/dev/ahci/ahci.h,v 1.4 2009/11/03 11:47:07 mav Exp $ + * $FreeBSD: src/sys/dev/ahci/ahci.h,v 1.5 2009/11/16 15:38:27 mav Exp $ */ /* ATA register defines */ @@ -352,6 +352,7 @@ struct cam_path *path; uint32_t caps; /* Controller capabilities */ uint32_t caps2; /* Controller capabilities */ + int quirks; int numslots; /* Number of present slots */ int pm_level; /* power management level */ int sata_rev; /* Maximum allowed SATA generation */ @@ -391,6 +392,7 @@ } irqs[16]; uint32_t caps; /* Controller capabilities */ uint32_t caps2; /* Controller capabilities */ + int quirks; int numirqs; int channels; int ichannels; ==== //depot/projects/scottl-camlock/src/sys/dev/ata/ata-pci.c#15 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.145 2009/10/31 13:24:14 mav Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.146 2009/11/16 15:38:27 mav Exp $"); #include "opt_ata.h" #include <sys/param.h> @@ -189,91 +189,138 @@ return error; } +int +ata_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) +{ + + return (BUS_READ_IVAR(device_get_parent(dev), dev, which, result)); +} + +int +ata_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value) +{ + + return (BUS_WRITE_IVAR(device_get_parent(dev), dev, which, value)); +} + +uint32_t +ata_pci_read_config(device_t dev, device_t child, int reg, int width) +{ + + return (pci_read_config(dev, reg, width)); +} + +void +ata_pci_write_config(device_t dev, device_t child, int reg, + uint32_t val, int width) +{ + + pci_write_config(dev, reg, val, width); +} + struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { - struct ata_pci_controller *controller = device_get_softc(dev); - int unit = ((struct ata_channel *)device_get_softc(child))->unit; - struct resource *res = NULL; - int myrid; + struct ata_pci_controller *controller = device_get_softc(dev); + struct resource *res = NULL; - if (type == SYS_RES_IOPORT) { - switch (*rid) { - case ATA_IOADDR_RID: - if (controller->legacy) { - start = (unit ? ATA_SECONDARY : ATA_PRIMARY); - count = ATA_IOSIZE; - end = start + count - 1; - } - myrid = PCIR_BAR(0) + (unit << 3); - res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, - SYS_RES_IOPORT, &myrid, - start, end, count, flags); - break; + if (device_get_devclass(child) == ata_devclass) { + int unit = ((struct ata_channel *)device_get_softc(child))->unit; + int myrid; - case ATA_CTLADDR_RID: - if (controller->legacy) { - start = (unit ? ATA_SECONDARY : ATA_PRIMARY) + ATA_CTLOFFSET; - count = ATA_CTLIOSIZE; - end = start + count - 1; - } - myrid = PCIR_BAR(1) + (unit << 3); - res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, - SYS_RES_IOPORT, &myrid, - start, end, count, flags); - break; - } - } - if (type == SYS_RES_IRQ && *rid == ATA_IRQ_RID) { - if (controller->legacy) { - int irq = (unit == 0 ? 14 : 15); + if (type == SYS_RES_IOPORT) { + switch (*rid) { + case ATA_IOADDR_RID: + if (controller->legacy) { + start = (unit ? ATA_SECONDARY : ATA_PRIMARY); + count = ATA_IOSIZE; + end = start + count - 1; + } + myrid = PCIR_BAR(0) + (unit << 3); + res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, + SYS_RES_IOPORT, &myrid, + start, end, count, flags); + break; + case ATA_CTLADDR_RID: + if (controller->legacy) { + start = (unit ? ATA_SECONDARY : ATA_PRIMARY) + + ATA_CTLOFFSET; + count = ATA_CTLIOSIZE; + end = start + count - 1; + } + myrid = PCIR_BAR(1) + (unit << 3); + res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, + SYS_RES_IOPORT, &myrid, + start, end, count, flags); + break; + } + } + if (type == SYS_RES_IRQ && *rid == ATA_IRQ_RID) { + if (controller->legacy) { + int irq = (unit == 0 ? 14 : 15); - res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, - SYS_RES_IRQ, rid, irq, irq, 1, flags); + res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, + SYS_RES_IRQ, rid, irq, irq, 1, flags); + } else + res = controller->r_irq; + } + } else { + if (type == SYS_RES_IRQ) { + if (*rid != ATA_IRQ_RID) + return (NULL); + res = controller->r_irq; + } else { + res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, + type, rid, start, end, count, flags); + } } - else - res = controller->r_irq; - } - return res; + return (res); } int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { - struct ata_pci_controller *controller = device_get_softc(dev); - int unit = ((struct ata_channel *)device_get_softc(child))->unit; - if (type == SYS_RES_IOPORT) { - switch (rid) { - case ATA_IOADDR_RID: - return BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, - SYS_RES_IOPORT, - PCIR_BAR(0) + (unit << 3), r); - break; + if (device_get_devclass(child) == ata_devclass) { + struct ata_pci_controller *controller = device_get_softc(dev); + int unit = ((struct ata_channel *)device_get_softc(child))->unit; - case ATA_CTLADDR_RID: - return BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, - SYS_RES_IOPORT, - PCIR_BAR(1) + (unit << 3), r); - break; - default: - return ENOENT; + if (type == SYS_RES_IOPORT) { + switch (rid) { + case ATA_IOADDR_RID: + return BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, + SYS_RES_IOPORT, + PCIR_BAR(0) + (unit << 3), r); + case ATA_CTLADDR_RID: + return BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, + SYS_RES_IOPORT, + PCIR_BAR(1) + (unit << 3), r); + default: + return ENOENT; + } + } + if (type == SYS_RES_IRQ) { + if (rid != ATA_IRQ_RID) + return ENOENT; + if (controller->legacy) { + return BUS_RELEASE_RESOURCE(device_get_parent(dev), child, + SYS_RES_IRQ, rid, r); + } else + return 0; + } + } else { + if (type == SYS_RES_IRQ) { + if (rid != ATA_IRQ_RID) + return (ENOENT); + return (0); + } else { + return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child, + type, rid, r)); + } } - } - if (type == SYS_RES_IRQ) { - if (rid != ATA_IRQ_RID) - return ENOENT; - - if (controller->legacy) { - return BUS_RELEASE_RESOURCE(device_get_parent(dev), child, - SYS_RES_IRQ, rid, r); - } - else - return 0; - } - return EINVAL; + return (EINVAL); } int @@ -281,44 +328,50 @@ int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep) { - struct ata_pci_controller *controller = device_get_softc(dev); + struct ata_pci_controller *controller = device_get_softc(dev); - if (controller->legacy) { - return BUS_SETUP_INTR(device_get_parent(dev), child, irq, + if (controller->legacy) { + return BUS_SETUP_INTR(device_get_parent(dev), child, irq, flags, filter, function, argument, cookiep); - } - else { - struct ata_pci_controller *controller = device_get_softc(dev); - int unit = ((struct ata_channel *)device_get_softc(child))->unit; + } else { + struct ata_pci_controller *controller = device_get_softc(dev); + int unit; - if (filter != NULL) { - printf("ata-pci.c: we cannot use a filter here\n"); - return (EINVAL); + if (filter != NULL) { + printf("ata-pci.c: we cannot use a filter here\n"); + return (EINVAL); + } + if (device_get_devclass(child) == ata_devclass) + unit = ((struct ata_channel *)device_get_softc(child))->unit; + else + unit = ATA_PCI_MAX_CH - 1; + controller->interrupt[unit].function = function; + controller->interrupt[unit].argument = argument; + *cookiep = controller; + return 0; } - controller->interrupt[unit].function = function; - controller->interrupt[unit].argument = argument; - *cookiep = controller; - return 0; - } } int ata_pci_teardown_intr(device_t dev, device_t child, struct resource *irq, void *cookie) { - struct ata_pci_controller *controller = device_get_softc(dev); + struct ata_pci_controller *controller = device_get_softc(dev); - if (controller->legacy) { - return BUS_TEARDOWN_INTR(device_get_parent(dev), child, irq, cookie); - } - else { - struct ata_pci_controller *controller = device_get_softc(dev); - int unit = ((struct ata_channel *)device_get_softc(child))->unit; + if (controller->legacy) { + return BUS_TEARDOWN_INTR(device_get_parent(dev), child, irq, cookie); + } else { + struct ata_pci_controller *controller = device_get_softc(dev); + int unit; - controller->interrupt[unit].function = NULL; - controller->interrupt[unit].argument = NULL; - return 0; - } + if (device_get_devclass(child) == ata_devclass) + unit = ((struct ata_channel *)device_get_softc(child))->unit; + else + unit = ATA_PCI_MAX_CH - 1; + controller->interrupt[unit].function = NULL; + controller->interrupt[unit].argument = NULL; + return 0; + } } static void @@ -510,12 +563,16 @@ DEVMETHOD(device_shutdown, bus_generic_shutdown), /* bus methods */ + DEVMETHOD(bus_read_ivar, ata_pci_read_ivar), + DEVMETHOD(bus_write_ivar, ata_pci_write_ivar), DEVMETHOD(bus_alloc_resource, ata_pci_alloc_resource), DEVMETHOD(bus_release_resource, ata_pci_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, ata_pci_setup_intr), DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), + DEVMETHOD(pci_read_config, ata_pci_read_config), + DEVMETHOD(pci_write_config, ata_pci_write_config), { 0, 0 } }; @@ -537,6 +594,8 @@ { char buffer[32]; + if ((intptr_t)device_get_ivars(dev) < 0) + return (ENXIO); sprintf(buffer, "ATA channel %d", (int)(intptr_t)device_get_ivars(dev)); device_set_desc_copy(dev, buffer); @@ -711,7 +770,7 @@ struct ata_channel *ch; int unit; - for (unit = 0; unit < ctlr->channels; unit++) { + for (unit = 0; unit < ATA_PCI_MAX_CH; unit++) { if ((ch = ctlr->interrupt[unit].argument)) ctlr->interrupt[unit].function(ch); } ==== //depot/projects/scottl-camlock/src/sys/dev/ata/ata-pci.h#24 (text+ko) ==== @@ -23,7 +23,7 @@ * (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: src/sys/dev/ata/ata-pci.h,v 1.114 2009/11/13 22:53:49 mav Exp $ + * $FreeBSD: src/sys/dev/ata/ata-pci.h,v 1.115 2009/11/16 15:38:27 mav Exp $ */ /* structure holding chipset config info */ @@ -36,6 +36,8 @@ char *text; }; +#define ATA_PCI_MAX_CH 8 + /* structure describing a PCI ATA controller */ struct ata_pci_controller { device_t dev; @@ -65,7 +67,7 @@ struct { void (*function)(void *); void *argument; - } interrupt[8]; /* XXX SOS max ch# for now */ + } interrupt[ATA_PCI_MAX_CH]; void *chipset_data; }; @@ -486,6 +488,11 @@ int ata_pci_detach(device_t dev); int ata_pci_suspend(device_t dev); int ata_pci_resume(device_t dev); +int ata_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result); +int ata_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value); +uint32_t ata_pci_read_config(device_t dev, device_t child, int reg, int width); +void ata_pci_write_config(device_t dev, device_t child, int reg, + uint32_t val, int width); struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep); @@ -509,12 +516,6 @@ /* global prototypes from chipsets/ata-*.c */ int ata_ahci_chipinit(device_t); -int ata_ahci_ch_attach(device_t dev); -int ata_ahci_ch_detach(device_t dev); -int ata_ahci_ch_suspend(device_t dev); -int ata_ahci_ch_resume(device_t dev); -int ata_ahci_ctlr_reset(device_t dev); -void ata_ahci_reset(device_t dev); >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911162218.nAGMIM9l091881>