CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: skrll Date: Tue Jan 5 16:30:37 UTC 2021 Modified Files: src/sys/arch/mips/adm5120/dev: ahci.c Log Message: Misc KNF. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/mips/adm5120/dev/ahci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/ahci.c diff -u src/sys/arch/mips/adm5120/dev/ahci.c:1.22 src/sys/arch/mips/adm5120/dev/ahci.c:1.23 --- src/sys/arch/mips/adm5120/dev/ahci.c:1.22 Sun Apr 5 20:59:38 2020 +++ src/sys/arch/mips/adm5120/dev/ahci.c Tue Jan 5 16:30:37 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ahci.c,v 1.22 2020/04/05 20:59:38 skrll Exp $ */ +/* $NetBSD: ahci.c,v 1.23 2021/01/05 16:30:37 skrll Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.22 2020/04/05 20:59:38 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.23 2021/01/05 16:30:37 skrll Exp $"); #include #include @@ -889,7 +889,7 @@ ahci_device_ctrl_start(struct usbd_xfer ep->control = pipe->up_dev->ud_addr | \ ((pipe->up_dev->ud_speed==USB_SPEED_FULL)?ADMHCD_ED_SPEED:0) | \ ((UGETW(pipe->up_endpoint->ue_edesc->wMaxPacketSize))up_dev->ud_speed); @@ -1236,16 +1236,17 @@ ahci_device_bulk_start(struct usbd_xfer i = 0; offset = 0; - while ((len>0) || (i==0)) { + while (len > 0) || i == 0) { tlen = uimin(len,4096); - td[i]->buffer = DMAADDR(&xfer->ux_dmabuf,offset) | 0xa000; - td[i]->buflen=tlen; - td[i]->control=(isread?ADMHCD_TD_IN:ADMHCD_TD_OUT) | toggle | ADMHCD_TD_OWN | short_ok; - td[i]->len=tlen; + td[i]->buffer = DMAADDR(&xfer->ux_dmabuf, offset) | 0xa000; + td[i]->buflen = tlen; + td[i]->control = (isread ? ADMHCD_TD_IN : ADMHCD_TD_OUT) | + toggle | ADMHCD_TD_OWN | short_ok; + td[i]->len = tlen; toggle = ADMHCD_TD_TOGGLE; len -= tlen; offset += tlen; - td[i]->next = td[i+1]; + td[i]->next = td[i + 1]; i++; };
CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: skrll Date: Thu Dec 3 08:48:06 UTC 2020 Modified Files: src/sys/arch/mips/adm5120/dev: wdc_extio.c Log Message: Fix build To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/adm5120/dev/wdc_extio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/wdc_extio.c diff -u src/sys/arch/mips/adm5120/dev/wdc_extio.c:1.11 src/sys/arch/mips/adm5120/dev/wdc_extio.c:1.12 --- src/sys/arch/mips/adm5120/dev/wdc_extio.c:1.11 Mon Sep 9 22:01:23 2019 +++ src/sys/arch/mips/adm5120/dev/wdc_extio.c Thu Dec 3 08:48:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_extio.c,v 1.11 2019/09/09 22:01:23 jdolecek Exp $ */ +/* $NetBSD: wdc_extio.c,v 1.12 2020/12/03 08:48:06 skrll Exp $ */ /*- * Copyright (c) 2007 David Young. All rights reserved. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wdc_extio.c,v 1.11 2019/09/09 22:01:23 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_extio.c,v 1.12 2020/12/03 08:48:06 skrll Exp $"); #include #include @@ -245,10 +245,7 @@ wdc_extio_match(device_t parent, cfdata_ WDC_EXTIO_DPRINTF("%s: enter\n", __func__); - memset(&wdc, 0, sizeof(wdc)); - memset(&ch, 0, sizeof(ch)); - ch.ch_atac = &wdc.sc_atac; - wdc.regs = &wdr; +#if 0 wdc.datain_pio = wdc_extio_datain; wdc.dataout_pio = wdc_extio_dataout; if (cf->cf_flags != -1) { @@ -257,6 +254,7 @@ wdc_extio_match(device_t parent, cfdata_ wdc.cap |= cf->cf_flags & (WDC_CAPABILITY_PREATA|WDC_CAPABILITY_NO_EXTRA_RESETS); } +#endif if (wdc_extio_map(ea, &wdr, &gpio, &pm) == -1) return 0;
CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: msaitoh Date: Thu Dec 5 06:25:33 UTC 2019 Modified Files: src/sys/arch/mips/adm5120/dev: if_admsw.c Log Message: Revert if_admsw.c rev. 1.25. It's not required to check sc->sc_ifmedia[port].ifm_cur->ifm_media instead of ifm->ifm_media. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/mips/adm5120/dev/if_admsw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/if_admsw.c diff -u src/sys/arch/mips/adm5120/dev/if_admsw.c:1.26 src/sys/arch/mips/adm5120/dev/if_admsw.c:1.27 --- src/sys/arch/mips/adm5120/dev/if_admsw.c:1.26 Thu Dec 5 03:15:20 2019 +++ src/sys/arch/mips/adm5120/dev/if_admsw.c Thu Dec 5 06:25:33 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_admsw.c,v 1.26 2019/12/05 03:15:20 msaitoh Exp $ */ +/* $NetBSD: if_admsw.c,v 1.27 2019/12/05 06:25:33 msaitoh Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.26 2019/12/05 03:15:20 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.27 2019/12/05 06:25:33 msaitoh Exp $"); #include @@ -1237,21 +1237,21 @@ admsw_mediachange(struct ifnet *ifp) { struct admsw_softc *sc = ifp->if_softc; int port = (struct ethercom *)ifp - sc->sc_ethercom; /* XXX */ - struct ifmedia_entry *ife = sc->sc_ifmedia[port].ifm_cur; + struct ifmedia *ifm = &sc->sc_ifmedia[port]; int old, new, val; - if (IFM_TYPE(ife->ifm_media) != IFM_ETHER) + if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) return EINVAL; - if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) { + if (IFM_SUBTYPE(ifm->ifm_media) == IFM_AUTO) { val = PHY_CNTL2_AUTONEG | PHY_CNTL2_100M | PHY_CNTL2_FDX; - } else if (IFM_SUBTYPE(ife->ifm_media) == IFM_100_TX) { - if ((ife->ifm_media & IFM_FDX) != 0) + } else if (IFM_SUBTYPE(ifm->ifm_media) == IFM_100_TX) { + if ((ifm->ifm_media & IFM_FDX) != 0) val = PHY_CNTL2_100M | PHY_CNTL2_FDX; else val = PHY_CNTL2_100M; - } else if (IFM_SUBTYPE(ife->ifm_media) == IFM_10_T) { - if ((ife->ifm_media & IFM_FDX) != 0) + } else if (IFM_SUBTYPE(ifm->ifm_media) == IFM_10_T) { + if ((ifm->ifm_media & IFM_FDX) != 0) val = PHY_CNTL2_FDX; else val = 0;
CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: msaitoh Date: Thu Dec 5 03:15:20 UTC 2019 Modified Files: src/sys/arch/mips/adm5120/dev: if_admsw.c Log Message: Do SIOC[GS]IFMEDIA like others. Not tested. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/adm5120/dev/if_admsw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/if_admsw.c diff -u src/sys/arch/mips/adm5120/dev/if_admsw.c:1.25 src/sys/arch/mips/adm5120/dev/if_admsw.c:1.26 --- src/sys/arch/mips/adm5120/dev/if_admsw.c:1.25 Wed Dec 4 05:19:10 2019 +++ src/sys/arch/mips/adm5120/dev/if_admsw.c Thu Dec 5 03:15:20 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_admsw.c,v 1.25 2019/12/04 05:19:10 msaitoh Exp $ */ +/* $NetBSD: if_admsw.c,v 1.26 2019/12/05 03:15:20 msaitoh Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.25 2019/12/04 05:19:10 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.26 2019/12/05 03:15:20 msaitoh Exp $"); #include @@ -454,6 +454,7 @@ admsw_attach(device_t parent, device_t s admsw_reset(sc); for (i = 0; i < SW_DEVS; i++) { + sc->sc_ethercom[i].ec_ifmedia = &sc->sc_ifmedia[i]; ifmedia_init(&sc->sc_ifmedia[i], 0, admsw_mediachange, admsw_mediastatus); ifmedia_add(&sc->sc_ifmedia[i], IFM_ETHER|IFM_10_T, 0, NULL); ifmedia_add(&sc->sc_ifmedia[i], IFM_ETHER|IFM_10_T|IFM_FDX, 0, NULL); @@ -740,6 +741,10 @@ admsw_ioctl(struct ifnet *ifp, u_long cm struct ifdrv *ifd; int s, error, port; + port = (struct ethercom *)ifp - sc->sc_ethercom; /* XXX */ + if (port >= SW_DEVS) + return EOPNOTSUPP; + s = splnet(); switch (cmd) { @@ -747,16 +752,6 @@ admsw_ioctl(struct ifnet *ifp, u_long cm if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) error = 0; break; - case SIOCSIFMEDIA: - case SIOCGIFMEDIA: - port = (struct ethercom *)ifp - sc->sc_ethercom; /* XXX */ - if (port >= SW_DEVS) - error = EOPNOTSUPP; - else - error = ifmedia_ioctl(ifp, (struct ifreq *)data, - &sc->sc_ifmedia[port], cmd); - break; - case SIOCGDRVSPEC: case SIOCSDRVSPEC: ifd = (struct ifdrv *) data;
CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: msaitoh Date: Wed Dec 4 05:19:11 UTC 2019 Modified Files: src/sys/arch/mips/adm5120/dev: if_admsw.c Log Message: Fix admsw_mediachange(). Not tested. ifmedia_change() is used to change the device's media setting from user-selected media. The user-selected media is not sc->sc_ifmedia[port]->ifm_media but sc->sc_ifmedia[port].ifm_cur->ifm_media. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/mips/adm5120/dev/if_admsw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/if_admsw.c diff -u src/sys/arch/mips/adm5120/dev/if_admsw.c:1.24 src/sys/arch/mips/adm5120/dev/if_admsw.c:1.25 --- src/sys/arch/mips/adm5120/dev/if_admsw.c:1.24 Tue May 28 07:41:47 2019 +++ src/sys/arch/mips/adm5120/dev/if_admsw.c Wed Dec 4 05:19:10 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_admsw.c,v 1.24 2019/05/28 07:41:47 msaitoh Exp $ */ +/* $NetBSD: if_admsw.c,v 1.25 2019/12/04 05:19:10 msaitoh Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.24 2019/05/28 07:41:47 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.25 2019/12/04 05:19:10 msaitoh Exp $"); #include @@ -1242,21 +1242,21 @@ admsw_mediachange(struct ifnet *ifp) { struct admsw_softc *sc = ifp->if_softc; int port = (struct ethercom *)ifp - sc->sc_ethercom; /* XXX */ - struct ifmedia *ifm = &sc->sc_ifmedia[port]; + struct ifmedia_entry *ife = sc->sc_ifmedia[port].ifm_cur; int old, new, val; - if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) + if (IFM_TYPE(ife->ifm_media) != IFM_ETHER) return EINVAL; - if (IFM_SUBTYPE(ifm->ifm_media) == IFM_AUTO) { + if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) { val = PHY_CNTL2_AUTONEG | PHY_CNTL2_100M | PHY_CNTL2_FDX; - } else if (IFM_SUBTYPE(ifm->ifm_media) == IFM_100_TX) { - if ((ifm->ifm_media & IFM_FDX) != 0) + } else if (IFM_SUBTYPE(ife->ifm_media) == IFM_100_TX) { + if ((ife->ifm_media & IFM_FDX) != 0) val = PHY_CNTL2_100M | PHY_CNTL2_FDX; else val = PHY_CNTL2_100M; - } else if (IFM_SUBTYPE(ifm->ifm_media) == IFM_10_T) { - if ((ifm->ifm_media & IFM_FDX) != 0) + } else if (IFM_SUBTYPE(ife->ifm_media) == IFM_10_T) { + if ((ife->ifm_media & IFM_FDX) != 0) val = PHY_CNTL2_FDX; else val = 0;
CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: msaitoh Date: Mon Apr 22 06:09:19 UTC 2019 Modified Files: src/sys/arch/mips/adm5120/dev: if_admsw.c Log Message: Don't include mii*.h because this driver doesn't use MII(4). To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/mips/adm5120/dev/if_admsw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/if_admsw.c diff -u src/sys/arch/mips/adm5120/dev/if_admsw.c:1.20 src/sys/arch/mips/adm5120/dev/if_admsw.c:1.21 --- src/sys/arch/mips/adm5120/dev/if_admsw.c:1.20 Fri Apr 12 05:19:24 2019 +++ src/sys/arch/mips/adm5120/dev/if_admsw.c Mon Apr 22 06:09:19 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_admsw.c,v 1.20 2019/04/12 05:19:24 msaitoh Exp $ */ +/* $NetBSD: if_admsw.c,v 1.21 2019/04/22 06:09:19 msaitoh Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.20 2019/04/12 05:19:24 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.21 2019/04/22 06:09:19 msaitoh Exp $"); #include @@ -104,9 +104,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v #include -#include -#include - #include #include
CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: msaitoh Date: Fri Apr 12 05:19:24 UTC 2019 Modified Files: src/sys/arch/mips/adm5120/dev: if_admsw.c Log Message: Fix a bug that the duplex of manual media setting may be wrong when the IFM_GMASK bit other than IFM_[FH]DX is set. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/mips/adm5120/dev/if_admsw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/if_admsw.c diff -u src/sys/arch/mips/adm5120/dev/if_admsw.c:1.19 src/sys/arch/mips/adm5120/dev/if_admsw.c:1.20 --- src/sys/arch/mips/adm5120/dev/if_admsw.c:1.19 Thu Apr 11 08:50:59 2019 +++ src/sys/arch/mips/adm5120/dev/if_admsw.c Fri Apr 12 05:19:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_admsw.c,v 1.19 2019/04/11 08:50:59 msaitoh Exp $ */ +/* $NetBSD: if_admsw.c,v 1.20 2019/04/12 05:19:24 msaitoh Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.19 2019/04/11 08:50:59 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.20 2019/04/12 05:19:24 msaitoh Exp $"); #include @@ -1237,7 +1237,7 @@ admsw_mediachange(struct ifnet *ifp) else val = PHY_CNTL2_100M; } else if (IFM_SUBTYPE(ifm->ifm_media) == IFM_10_T) { - if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) + if ((ifm->ifm_media & IFM_FDX) != 0) val = PHY_CNTL2_FDX; else val = 0;
CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: skrll Date: Sat Jun 28 10:25:16 UTC 2014 Modified Files: src/sys/arch/mips/adm5120/dev: admpci.c Log Message: #ifdef a variable like its usage. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/adm5120/dev/admpci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/admpci.c diff -u src/sys/arch/mips/adm5120/dev/admpci.c:1.10 src/sys/arch/mips/adm5120/dev/admpci.c:1.11 --- src/sys/arch/mips/adm5120/dev/admpci.c:1.10 Sat Mar 29 19:28:29 2014 +++ src/sys/arch/mips/adm5120/dev/admpci.c Sat Jun 28 10:25:16 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: admpci.c,v 1.10 2014/03/29 19:28:29 christos Exp $ */ +/* $NetBSD: admpci.c,v 1.11 2014/06/28 10:25:16 skrll Exp $ */ /*- * Copyright (c) 2007 David Young. All rights reserved. @@ -61,7 +61,7 @@ #include "pci.h" #include -__KERNEL_RCSID(0, "$NetBSD: admpci.c,v 1.10 2014/03/29 19:28:29 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: admpci.c,v 1.11 2014/06/28 10:25:16 skrll Exp $"); #include #include @@ -182,7 +182,6 @@ admpciattach(device_t parent, device_t s struct mainbus_attach_args *ma = (struct mainbus_attach_args *)aux; #if NPCI > 0 u_longresult; - pcitag_t tag; struct pcibus_attach_args pba; #endif @@ -226,9 +225,11 @@ admpciattach(device_t parent, device_t s sc->sc_pc.pc_intr_disestablish = admpci_intr_disestablish; sc->sc_pc.pc_conf_interrupt = admpci_conf_interrupt; - tag = pci_make_tag(&sc->sc_pc, 0, 0, 0); +#ifdef ADMPCI_DEBUG + pcitag_t tag = pci_make_tag(&sc->sc_pc, 0, 0, 0); ADMPCI_DPRINTF("%s: BAR 0x10 0x%08x\n", __func__, pci_conf_read(&sc->sc_pc, tag, PCI_MAPREG_START)); +#endif #ifdef PCI_NETBSD_CONFIGURE mem_ex = extent_create("pcimem",
CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: skrll Date: Sat Jun 28 10:25:32 UTC 2014 Modified Files: src/sys/arch/mips/adm5120/dev: uart.c Log Message: Remove unused variables To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/adm5120/dev/uart.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/uart.c diff -u src/sys/arch/mips/adm5120/dev/uart.c:1.10 src/sys/arch/mips/adm5120/dev/uart.c:1.11 --- src/sys/arch/mips/adm5120/dev/uart.c:1.10 Sun Mar 16 05:20:25 2014 +++ src/sys/arch/mips/adm5120/dev/uart.c Sat Jun 28 10:25:32 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: uart.c,v 1.10 2014/03/16 05:20:25 dholland Exp $ */ +/* $NetBSD: uart.c,v 1.11 2014/06/28 10:25:32 skrll Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uart.c,v 1.10 2014/03/16 05:20:25 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uart.c,v 1.11 2014/06/28 10:25:32 skrll Exp $"); #include #include @@ -171,8 +171,6 @@ uart_cnattach(void) void uart_cnputc(dev_t dev, int c) { - char chr; - chr = c; while ((*((volatile unsigned long *)0xb2600018)) & 0x20) continue; (*((volatile unsigned long *)0xb260)) = c; @@ -335,7 +333,7 @@ uart_intr(void *v) { struct uart_softc *sc = v; struct tty *tp = sc->sc_tty; - int c, l_r; + int c; if (REG_READ(UART_RSR_REG) & UART_RSR_BE) { REG_WRITE(UART_ECR_REG, UART_ECR_RSR); @@ -345,7 +343,7 @@ uart_intr(void *v) while ((REG_READ(UART_FR_REG) & UART_FR_RX_FIFO_EMPTY) == 0) { c = REG_READ(UART_DR_REG) & 0xff; if (tp->t_state & TS_ISOPEN) - l_r = (*tp->t_linesw->l_rint)(c, tp); + (*tp->t_linesw->l_rint)(c, tp); } return 0; }
CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: skrll Date: Sun Sep 22 08:30:22 UTC 2013 Modified Files: src/sys/arch/mips/adm5120/dev: ahci.c ahcivar.h Log Message: Adapt to usbmp. Compile tested only. Did this ever work? To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/adm5120/dev/ahci.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/adm5120/dev/ahcivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/ahci.c diff -u src/sys/arch/mips/adm5120/dev/ahci.c:1.11 src/sys/arch/mips/adm5120/dev/ahci.c:1.12 --- src/sys/arch/mips/adm5120/dev/ahci.c:1.11 Sun Sep 22 07:26:42 2013 +++ src/sys/arch/mips/adm5120/dev/ahci.c Sun Sep 22 08:30:22 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ahci.c,v 1.11 2013/09/22 07:26:42 skrll Exp $ */ +/* $NetBSD: ahci.c,v 1.12 2013/09/22 08:30:22 skrll Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.11 2013/09/22 07:26:42 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.12 2013/09/22 08:30:22 skrll Exp $"); #include #include @@ -99,6 +99,8 @@ static void ahci_freem(struct usbd_bus static usbd_xfer_handle ahci_allocx(struct usbd_bus *); static void ahci_freex(struct usbd_bus *, usbd_xfer_handle); +static void ahci_get_lock(struct usbd_bus *, kmutex_t **); + static int ahci_str(usb_string_descriptor_t *, int, const char *); static usbd_status ahci_root_ctrl_transfer(usbd_xfer_handle); @@ -178,6 +180,7 @@ struct usbd_bus_methods ahci_bus_methods .freem = ahci_freem, .allocx = ahci_allocx, .freex = ahci_freex, + .get_lock = ahci_get_lock, }; struct usbd_pipe_methods ahci_root_ctrl_methods = { @@ -277,7 +280,6 @@ ahci_attach(device_t parent, device_t se sc->sc_bus.methods = &ahci_bus_methods; sc->sc_bus.pipe_size = sizeof(struct ahci_pipe); sc->sc_bus.dmatag = sc->sc_dmat; - sc->busy = 0; /* Map the device. */ if (bus_space_map(sc->sc_st, aa->oba_addr, @@ -299,6 +301,9 @@ ahci_attach(device_t parent, device_t se callout_init(&sc->sc_poll_handle, 0); + mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB); + mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED /* XXXNH */); + REG_WRITE(ADMHCD_REG_INTENABLE, 0); /* disable interrupts */ REG_WRITE(ADMHCD_REG_CONTROL, ADMHCD_SW_RESET); /* reset */ delay_ms(10); @@ -432,7 +437,6 @@ ahci_poll_hub(void *arg) usbd_xfer_handle xfer = arg; usbd_pipe_handle pipe = xfer->pipe; struct ahci_softc *sc = (struct ahci_softc *)pipe->device->bus; - int s; u_char *p; static int p0_state=0; static int p1_state=0; @@ -459,9 +463,9 @@ ahci_poll_hub(void *arg) xfer->actlen = 1; xfer->status = USBD_NORMAL_COMPLETION; - s = splusb(); + mutex_enter(&sc->sc_lock); usb_transfer_complete(xfer); - splx(s); + mutex_exit(&sc->sc_lock); } usbd_status @@ -531,6 +535,14 @@ ahci_freex(struct usbd_bus *bus, usbd_xf SIMPLEQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next); } +static void +ahci_get_lock(struct usbd_bus *bus, kmutex_t **lock) +{ + struct ahci_softc *sc = bus->hci_private; + + *lock = &sc->sc_lock; +} + void ahci_noop(usbd_pipe_handle pipe) { @@ -623,12 +635,15 @@ ahci_str(usb_string_descriptor_t *p, int usbd_status ahci_root_ctrl_transfer(usbd_xfer_handle xfer) { + struct ahci_softc *sc = (struct ahci_softc *)xfer->pipe->device->bus; usbd_status error; DPRINTF(D_TRACE, ("SLRCtrans ")); /* Insert last in queue */ + mutex_enter(&sc->sc_lock); error = usb_insert_transfer(xfer); + mutex_exit(&sc->sc_lock); if (error) { DPRINTF(D_MSG, ("usb_insert_transfer returns err! ")); return error; @@ -646,7 +661,7 @@ ahci_root_ctrl_start(usbd_xfer_handle xf { struct ahci_softc *sc = (struct ahci_softc *)xfer->pipe->device->bus; usb_device_request_t *req; - int len, value, index, l, s, status; + int len, value, index, l, status; int totlen = 0; void *buf = NULL; usb_port_status_t ps; @@ -942,9 +957,9 @@ ahci_root_ctrl_start(usbd_xfer_handle xf error = USBD_NORMAL_COMPLETION; ret: xfer->status = error; - s = splusb(); + mutex_enter(&sc->sc_lock); usb_transfer_complete(xfer); - splx(s); + mutex_exit(&sc->sc_lock); return USBD_IN_PROGRESS; } @@ -969,12 +984,15 @@ ahci_root_ctrl_done(usbd_xfer_handle xfe static usbd_status ahci_root_intr_transfer(usbd_xfer_handle xfer) { + struct ahci_softc *sc = (struct ahci_softc *)xfer->pipe->device->bus; usbd_status error; DPRINTF(D_TRACE, ("SLRItransfer ")); /* Insert last in queue */ + mutex_enter(&sc->sc_lock); error = usb_insert_transfer(xfer); + mutex_exit(&sc->sc_lock); if (error) return error; @@ -1025,11 +1043,14 @@ ahci_root_intr_done(usbd_xfer_handle xfe static usbd_status ahci_device_ctrl_transfer(usbd_xfer_handle xfer) { + struct ahci_softc *sc = (struct ahci_softc *)xfer->pipe->device->bus; usbd_status error; DPRINTF(D_TRACE,
CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: skrll Date: Sun Sep 22 07:26:42 UTC 2013 Modified Files: src/sys/arch/mips/adm5120/dev: ahci.c Log Message: Remove trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/adm5120/dev/ahci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/ahci.c diff -u src/sys/arch/mips/adm5120/dev/ahci.c:1.10 src/sys/arch/mips/adm5120/dev/ahci.c:1.11 --- src/sys/arch/mips/adm5120/dev/ahci.c:1.10 Mon Sep 2 15:48:08 2013 +++ src/sys/arch/mips/adm5120/dev/ahci.c Sun Sep 22 07:26:42 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ahci.c,v 1.10 2013/09/02 15:48:08 skrll Exp $ */ +/* $NetBSD: ahci.c,v 1.11 2013/09/22 07:26:42 skrll Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.10 2013/09/02 15:48:08 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.11 2013/09/22 07:26:42 skrll Exp $"); #include #include @@ -302,7 +302,7 @@ ahci_attach(device_t parent, device_t se REG_WRITE(ADMHCD_REG_INTENABLE, 0); /* disable interrupts */ REG_WRITE(ADMHCD_REG_CONTROL, ADMHCD_SW_RESET); /* reset */ delay_ms(10); -while (REG_READ(ADMHCD_REG_CONTROL) & ADMHCD_SW_RESET) +while (REG_READ(ADMHCD_REG_CONTROL) & ADMHCD_SW_RESET) delay_ms(1); REG_WRITE(ADMHCD_REG_CONTROL, ADMHCD_HOST_EN); @@ -354,7 +354,7 @@ ahci_intr(void *arg) ? "\20\x8""D+\7RESUME\6INSERT\5SOF\4res\3""BABBLE\2USBB\1USBA" : "\20\x8""D+\7RESET\6INSERT\5SOF\4res\3""BABBLE\2USBB\1USBA"), r); - + DPRINTF(D_XFER, ("I=%s ", bitbuf)); #endif /* AHCI_DEBUG */ #endif @@ -1048,7 +1048,7 @@ ahci_device_ctrl_start(usbd_xfer_handle usb_device_request_t *req = &xfer->request; struct ahci_softc *sc = (struct ahci_softc *)pipe->device->bus; int len, isread; - + #if 0 struct ahci_pipe *apipe = (struct ahci_pipe *)xfer->pipe; @@ -1070,11 +1070,11 @@ ahci_device_ctrl_start(usbd_xfer_handle #define KSEG1ADDR(x) (0xa000 | (((u_int32_t)x) & 0x1fff)) DPRINTF(D_TRACE, ("st ")); if (!ep) { - ep = (struct admhcd_ed *)KSEG1ADDR(&ep_v); - td = (struct admhcd_td *)KSEG1ADDR(&td_v[0]); - td1 = (struct admhcd_td *)KSEG1ADDR(&td_v[1]); - td2 = (struct admhcd_td *)KSEG1ADDR(&td_v[2]); - td3 = (struct admhcd_td *)KSEG1ADDR(&td_v[3]); + ep = (struct admhcd_ed *)KSEG1ADDR(&ep_v); + td = (struct admhcd_td *)KSEG1ADDR(&td_v[0]); + td1 = (struct admhcd_td *)KSEG1ADDR(&td_v[1]); + td2 = (struct admhcd_td *)KSEG1ADDR(&td_v[2]); + td3 = (struct admhcd_td *)KSEG1ADDR(&td_v[3]); err = usb_allocmem(&sc->sc_bus, sizeof(usb_device_request_t), 0, &reqdma); @@ -1242,7 +1242,7 @@ ahci_device_intr_start(usbd_xfer_handle /* initialize callout */ callout_init(&sx->sx_callout_t, 0); - callout_reset(&sx->sx_callout_t, + callout_reset(&sx->sx_callout_t, MS_TO_TICKS(pipe->endpoint->edesc->bInterval), ahci_poll_device, sx); @@ -1400,9 +1400,9 @@ ahci_device_bulk_start(usbd_xfer_handle /* printf("bulk_start>>>\n"); */ if (!ep) { - ep = (struct admhcd_ed *)KSEG1ADDR(&ep_v); + ep = (struct admhcd_ed *)KSEG1ADDR(&ep_v); for (i=0; i
CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: skrll Date: Mon Sep 2 15:48:08 UTC 2013 Modified Files: src/sys/arch/mips/adm5120/dev: ahci.c Log Message: Use C99 designated initializers. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/adm5120/dev/ahci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/ahci.c diff -u src/sys/arch/mips/adm5120/dev/ahci.c:1.9 src/sys/arch/mips/adm5120/dev/ahci.c:1.10 --- src/sys/arch/mips/adm5120/dev/ahci.c:1.9 Sat Oct 27 17:18:01 2012 +++ src/sys/arch/mips/adm5120/dev/ahci.c Mon Sep 2 15:48:08 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ahci.c,v 1.9 2012/10/27 17:18:01 chs Exp $ */ +/* $NetBSD: ahci.c,v 1.10 2013/09/02 15:48:08 skrll Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.9 2012/10/27 17:18:01 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.10 2013/09/02 15:48:08 skrll Exp $"); #include #include @@ -171,67 +171,67 @@ void print_xfer(usbd_xfer_handle); struct usbd_bus_methods ahci_bus_methods = { - ahci_open, - ahci_softintr, - ahci_poll, - ahci_allocm, - ahci_freem, - ahci_allocx, - ahci_freex, + .open_pipe = ahci_open, + .soft_intr = ahci_softintr, + .do_poll = ahci_poll, + .allocm = ahci_allocm, + .freem = ahci_freem, + .allocx = ahci_allocx, + .freex = ahci_freex, }; struct usbd_pipe_methods ahci_root_ctrl_methods = { - ahci_root_ctrl_transfer, - ahci_root_ctrl_start, - ahci_root_ctrl_abort, - ahci_root_ctrl_close, - ahci_noop, - ahci_root_ctrl_done, + .transfer = ahci_root_ctrl_transfer, + .start = ahci_root_ctrl_start, + .abort = ahci_root_ctrl_abort, + .close = ahci_root_ctrl_close, + .cleartoggle = ahci_noop, + .done = ahci_root_ctrl_done, }; struct usbd_pipe_methods ahci_root_intr_methods = { - ahci_root_intr_transfer, - ahci_root_intr_start, - ahci_root_intr_abort, - ahci_root_intr_close, - ahci_noop, - ahci_root_intr_done, + .transfer = ahci_root_intr_transfer, + .start = ahci_root_intr_start, + .abort = ahci_root_intr_abort, + .close = ahci_root_intr_close, + .cleartoggle = ahci_noop, + .done = ahci_root_intr_done, }; struct usbd_pipe_methods ahci_device_ctrl_methods = { - ahci_device_ctrl_transfer, - ahci_device_ctrl_start, - ahci_device_ctrl_abort, - ahci_device_ctrl_close, - ahci_noop, - ahci_device_ctrl_done, + .transfer = ahci_device_ctrl_transfer, + .start = ahci_device_ctrl_start, + .abort = ahci_device_ctrl_abort, + .close = ahci_device_ctrl_close, + .cleartoggle = ahci_noop, + .done = ahci_device_ctrl_done, }; struct usbd_pipe_methods ahci_device_intr_methods = { - ahci_device_intr_transfer, - ahci_device_intr_start, - ahci_device_intr_abort, - ahci_device_intr_close, - ahci_device_clear_toggle, - ahci_device_intr_done, + .transfer = ahci_device_intr_transfer, + .start = ahci_device_intr_start, + .abort = ahci_device_intr_abort, + .close = ahci_device_intr_close, + .cleartoggle = ahci_device_clear_toggle, + .done = ahci_device_intr_done, }; struct usbd_pipe_methods ahci_device_isoc_methods = { - ahci_device_isoc_transfer, - ahci_device_isoc_start, - ahci_device_isoc_abort, - ahci_device_isoc_close, - ahci_noop, - ahci_device_isoc_done, + .transfer = ahci_device_isoc_transfer, + .start = ahci_device_isoc_start, + .abort = ahci_device_isoc_abort, + .close = ahci_device_isoc_close, + .cleartoggle = ahci_noop, + .done = ahci_device_isoc_done, }; struct usbd_pipe_methods ahci_device_bulk_methods = { - ahci_device_bulk_transfer, - ahci_device_bulk_start, - ahci_device_bulk_abort, - ahci_device_bulk_close, - ahci_device_clear_toggle, - ahci_device_bulk_done, + .transfer = ahci_device_bulk_transfer, + .start = ahci_device_bulk_start, + .abort = ahci_device_bulk_abort, + .close = ahci_device_bulk_close, + .cleartoggle = ahci_device_clear_toggle, + .done = ahci_device_bulk_done, }; struct ahci_pipe {
CVS commit: src/sys/arch/mips/adm5120/dev
Module Name:src Committed By: dyoung Date: Mon Apr 4 19:58:56 UTC 2011 Modified Files: src/sys/arch/mips/adm5120/dev: ahci.c ahcivar.h Log Message: Use callout(9) instead of the USB compatibility junk that went away months ago. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/adm5120/dev/ahci.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/adm5120/dev/ahcivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/adm5120/dev/ahci.c diff -u src/sys/arch/mips/adm5120/dev/ahci.c:1.5 src/sys/arch/mips/adm5120/dev/ahci.c:1.6 --- src/sys/arch/mips/adm5120/dev/ahci.c:1.5 Tue Dec 16 22:35:24 2008 +++ src/sys/arch/mips/adm5120/dev/ahci.c Mon Apr 4 19:58:56 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ahci.c,v 1.5 2008/12/16 22:35:24 christos Exp $ */ +/* $NetBSD: ahci.c,v 1.6 2011/04/04 19:58:56 dyoung Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.5 2008/12/16 22:35:24 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.6 2011/04/04 19:58:56 dyoung Exp $"); #include #include @@ -297,7 +297,7 @@ SIMPLEQ_INIT(&sc->sc_free_xfers); - usb_callout_init(sc->sc_poll_handle); + callout_init(&sc->sc_poll_handle, 0); REG_WRITE(ADMHCD_REG_INTENABLE, 0); /* disable interrupts */ REG_WRITE(ADMHCD_REG_CONTROL, ADMHCD_SW_RESET); /* reset */ @@ -437,7 +437,7 @@ static int p0_state=0; static int p1_state=0; - usb_callout(sc->sc_poll_handle, sc->sc_interval, ahci_poll_hub, xfer); + callout_reset(&sc->sc_poll_handle, sc->sc_interval, ahci_poll_hub, xfer); /* USB spec 11.13.3 (p.260) */ p = KERNADDR(&xfer->dmabuf, 0); @@ -996,7 +996,7 @@ DPRINTF(D_TRACE, ("SLRIstart ")); sc->sc_interval = MS_TO_TICKS(xfer->pipe->endpoint->edesc->bInterval); - usb_callout(sc->sc_poll_handle, sc->sc_interval, ahci_poll_hub, xfer); + callout_reset(&sc->sc_poll_handle, sc->sc_interval, ahci_poll_hub, xfer); sc->sc_intr_xfer = xfer; return USBD_IN_PROGRESS; } @@ -1014,7 +1014,7 @@ DPRINTF(D_TRACE, ("SLRIclose ")); - usb_uncallout(sc->sc_poll_handle, ahci_poll_hub, sc->sc_intr_xfer); + callout_stop(&sc->sc_poll_handle); sc->sc_intr_xfer = NULL; } @@ -1243,8 +1243,8 @@ xfer->hcpriv = sx; /* initialize callout */ - usb_callout_init(sx->sx_callout_t); - usb_callout(sx->sx_callout_t, + callout_init(&sx->sx_callout_t, 0); + callout_reset(&sx->sx_callout_t, MS_TO_TICKS(pipe->endpoint->edesc->bInterval), ahci_poll_device, sx); @@ -1269,7 +1269,7 @@ DPRINTF(D_TRACE, ("pldev")); - usb_callout(sx->sx_callout_t, + callout_reset(&sx->sx_callout_t, MS_TO_TICKS(pipe->endpoint->edesc->bInterval), ahci_poll_device, sx); @@ -1304,7 +1304,7 @@ sx = xfer->hcpriv; if (sx) { - usb_uncallout(sx->sx_callout_t, ahci_poll_device, sx); + callout_stop(&sx->sx_callout_t); free(sx, M_USB); xfer->hcpriv = NULL; } else { Index: src/sys/arch/mips/adm5120/dev/ahcivar.h diff -u src/sys/arch/mips/adm5120/dev/ahcivar.h:1.2 src/sys/arch/mips/adm5120/dev/ahcivar.h:1.3 --- src/sys/arch/mips/adm5120/dev/ahcivar.h:1.2 Mon Apr 28 20:23:27 2008 +++ src/sys/arch/mips/adm5120/dev/ahcivar.h Mon Apr 4 19:58:56 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ahcivar.h,v 1.2 2008/04/28 20:23:27 martin Exp $ */ +/* $NetBSD: ahcivar.h,v 1.3 2011/04/04 19:58:56 dyoung Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -71,7 +71,7 @@ struct ahci_xfer { usbd_xfer_handle sx_xfer; - usb_callout_t sx_callout_t; + callout_t sx_callout_t; }; struct ahci_softc { @@ -91,7 +91,7 @@ #define INTR_ON (1) #define INTR_OFF (0) - device_ptr_t sc_child; + device_t sc_child; struct device *sc_parent; /* parent device */ @@ -102,7 +102,7 @@ /* Information for the root hub interrupt pipe */ int sc_interval; usbd_xfer_handle sc_intr_xfer; - usb_callout_t sc_poll_handle; + callout_t sc_poll_handle; int sc_flags; #define AHCDF_RESET (0x01)