Lines Matching defs:ace
200 static void ace_set_geometry(struct ace_softc *ace);
215 if (strcmp("ace", d->ia_name) != 0)
226 struct ace_softc *ace = device_private(self);
230 ace->sc_dev = self;
235 ace->sc_dr = (struct _Sac *)ia->ia_vaddr;
237 printf(" virt=%p", (void*)ace->sc_dr);
239 printf(" : System ACE\n");
242 ace_ebus_intr, ace);
247 ace, NULL, "%s", device_xname(ace->sc_dev));
249 aprint_error_dev(ace->sc_dev, "unable to create kernel "
670 * Take control of the ACE datapath
713 * Release control of the ACE datapath
761 * Check if the ACE is waiting for a comamnd
766 * Check if the ACE is executing a comamnd
771 * Turn on interrupts from the ACE
779 * Turn off interrupts from the ACE
787 * Start a command on the ACE, such as read or identify.
862 * This will invalidate the ACE's current sector data
999 /* Free the ACE for the JTAG, just in case */
1123 * Get the data out of the ACE
1172 /* Free the ACE for the JTAG, just in case */
1247 * Get the data out to the ACE
1321 /* Free the ACE for the JTAG, just in case */
1396 * Get the data out to the ACE
1585 aceattach(struct ace_softc *ace)
1587 device_t self = ace->sc_dev;
1592 callout_init(&ace->sc_restart_ch, 0);
1593 bufq_alloc(&ace->sc_q, BUFQ_DISK_DEFAULT_STRAT, BUFQ_SORT_RAWBLOCK);
1595 ace->openings = 1; /* wazziz?*/
1596 ace->sc_multi = MAXATATIME;
1601 ace->sc_dk.dk_driver = &acedkdriver;
1602 ace->sc_dk.dk_name = device_xname(ace->sc_dev);
1605 if (sysace_attach(ace) != 0) {
1606 aprint_error_dev(ace->sc_dev, "attach failed\n");
1610 aprint_normal_dev(ace->sc_dev, "drive supports %d-sector PIO xfers\n",
1611 ace->sc_multi);
1613 for (blank = 0, p = ace->sc_params.ModelNumber, q = tbuf, i = 0;
1614 i < sizeof(ace->sc_params.ModelNumber); i++) {
1629 aprint_normal_dev(ace->sc_dev, "card is <%s>\n", tbuf);
1631 format_bytes(pbuf, sizeof(pbuf), ace->sc_capacity * DEV_BSIZE);
1635 (int)(ace->sc_capacity /
1636 (ace->sc_params.CurrentNumberOfHeads *
1637 ace->sc_params.CurrentSectorsPerTrack)),
1638 ace->sc_params.CurrentNumberOfHeads,
1639 ace->sc_params.CurrentSectorsPerTrack,
1640 DEV_BSIZE, (unsigned long long)ace->sc_capacity);
1645 disk_attach(&ace->sc_dk);
1647 rnd_attach_source(&ace->rnd_source, device_xname(ace->sc_dev),
1721 struct ace_softc *ace;
1726 ace = device_lookup_private(&ace_cd, ACEUNIT(bp->b_dev));
1728 if (ace == NULL) {
1733 lp = ace->sc_dk.dk_label;
1736 device_xname(ace->sc_dev), bp->b_blkno), DEBUG_XFERS);
1747 if ((ace->sc_flags & ACEF_LOADED) == 0) {
1762 ace->sc_capacity) <= 0)
1765 if (bounds_check_with_label(&ace->sc_dk, bp,
1766 (ace->sc_flags & (ACEF_WLABEL|ACEF_LABELLING)) != 0) <= 0)
1786 bufq_put(ace->sc_q, bp);
1787 acestart(ace);
1802 struct ace_softc *ace = arg;
1805 DEBUG_PRINT(("acestart %s\n", device_xname(ace->sc_dev)), DEBUG_XFERS);
1806 while (ace->openings > 0) {
1809 if ((bp = bufq_get(ace->sc_q)) == NULL)
1815 ace->openings--;
1817 ace->retries = 0;
1818 __acestart(ace, bp);
1850 acedone(struct ace_softc *ace)
1852 struct buf *bp = ace->sc_bp;
1856 DEBUG_PRINT(("acedone %s\n", device_xname(ace->sc_dev)), DEBUG_XFERS);
1861 bp->b_resid = ace->sc_bio.nbytes;
1862 switch (ace->sc_bio.error) {
1871 sysace_reset(ace);
1872 diskerr(bp, "ace", errmsg, LOG_PRINTF,
1873 ace->sc_bio.blkdone, ace->sc_dk.dk_label);
1874 if (ace->retries < ACEIORETRIES)
1878 aceperror(ace);
1879 if (ace->retries < ACEIORETRIES) {
1880 ace->retries++;
1881 callout_reset(&ace->sc_restart_ch, RECOVERYTIME,
1882 acerestart, ace);
1889 if ((ace->sc_bio.flags & ATA_CORR) || ace->retries > 0)
1891 device_xname(ace->sc_dev));
1898 disk_unbusy(&ace->sc_dk, (bp->b_bcount - bp->b_resid),
1900 rnd_add_uint32(&ace->rnd_source, bp->b_blkno);
1902 ace->openings++;
1903 acestart(ace);
1909 struct ace_softc *ace = v;
1910 struct buf *bp = ace->sc_bp;
1913 device_xname(ace->sc_dev)), DEBUG_XFERS);
1943 struct ace_softc *ace;
1947 ace = device_lookup_private(&ace_cd, ACEUNIT(dev));
1948 if (ace == NULL)
1951 if (! device_is_active(ace->sc_dev))
1956 mutex_enter(&ace->sc_dk.dk_openlock);
1962 if (ace->sc_dk.dk_nwedges != 0 && part != RAW_PART) {
1967 if (ace->sc_dk.dk_openmask != 0) {
1972 if ((ace->sc_flags & ACEF_LOADED) == 0) {
1977 if ((ace->sc_flags & ACEF_LOADED) == 0) {
1978 ace->sc_flags |= ACEF_LOADED;
1981 if (ace->sc_capacity == 0) {
1982 error = sysace_identify(ace);
1988 acegetdisklabel(ace);
1994 (part >= ace->sc_dk.dk_label->d_npartitions ||
1995 ace->sc_dk.dk_label->d_partitions[part].p_fstype == FS_UNUSED)) {
2003 ace->sc_dk.dk_copenmask |= (1 << part);
2006 ace->sc_dk.dk_bopenmask |= (1 << part);
2009 ace->sc_dk.dk_openmask =
2010 ace->sc_dk.dk_copenmask | ace->sc_dk.dk_bopenmask;
2012 ace->sc_dk.dk_openlock);
2016 mutex_exit(&ace->sc_dk.dk_openlock);
2023 struct ace_softc *ace = device_lookup_private(&ace_cd, ACEUNIT(dev));
2027 if (ace == NULL)
2030 mutex_enter(&ace->sc_dk.dk_openlock);
2034 ace->sc_dk.dk_copenmask &= ~(1 << part);
2037 ace->sc_dk.dk_bopenmask &= ~(1 << part);
2040 ace->sc_dk.dk_openmask =
2041 ace->sc_dk.dk_copenmask | ace->sc_dk.dk_bopenmask;
2043 if (ace->sc_dk.dk_openmask == 0) {
2045 if (!(ace->sc_flags & ACEF_KLABEL))
2046 ace->sc_flags &= ~ACEF_LOADED;
2050 mutex_exit(&ace->sc_dk.dk_openlock);
2055 acegetdefaultlabel(struct ace_softc *ace, struct disklabel *lp)
2062 lp->d_ntracks = ace->sc_params.CurrentNumberOfHeads;
2063 lp->d_nsectors = ace->sc_params.CurrentSectorsPerTrack;
2064 lp->d_ncylinders = ace->sc_capacity /
2065 (ace->sc_params.CurrentNumberOfHeads *
2066 ace->sc_params.CurrentSectorsPerTrack);
2071 strncpy(lp->d_typename, ace->sc_params.ModelNumber, 16);
2073 if (ace->sc_capacity > UINT32_MAX)
2076 lp->d_secperunit = ace->sc_capacity;
2096 acegetdisklabel(struct ace_softc *ace)
2098 struct disklabel *lp = ace->sc_dk.dk_label;
2103 memset(ace->sc_dk.dk_cpulabel, 0, sizeof(struct cpu_disklabel));
2105 acegetdefaultlabel(ace, lp);
2108 ace->sc_bio.badsect[0] = -1;
2111 errstring = readdisklabel(MAKEACEDEV(0, device_unit(ace->sc_dev),
2113 ace->sc_dk.dk_cpulabel);
2115 printf("%s: %s\n", device_xname(ace->sc_dev), errstring);
2121 int i, n = ace->sc_dk.dk_label->d_npartitions;
2122 printf("%s: %d parts\n", device_xname(ace->sc_dev), n);
2125 ace->sc_dk.dk_label->d_partitions[i].p_fstype,
2126 ace->sc_dk.dk_label->d_partitions[i].p_size,
2127 ace->sc_dk.dk_label->d_partitions[i].p_offset);
2134 bad144intern(ace);
2139 aceperror(const struct ace_softc *ace)
2141 const char *devname = device_xname(ace->sc_dev);
2142 uint32_t Status = ace->sc_bio.r_error;
2157 struct ace_softc *ace = device_lookup_private(&ace_cd, ACEUNIT(dev));
2162 if ((ace->sc_flags & ACEF_LOADED) == 0)
2165 error = disk_ioctl(&ace->sc_dk, dev, xfer, addr, flag, l);
2174 ace->sc_dk.dk_cpulabel->bad = *(struct dkbad *)addr;
2175 ace->sc_dk.dk_label->d_flags |= D_BADSECT;
2176 bad144intern(ace);
2190 mutex_enter(&ace->sc_dk.dk_openlock);
2191 ace->sc_flags |= ACEF_LABELLING;
2193 error = setdisklabel(ace->sc_dk.dk_label,
2194 lp, /*ace->sc_dk.dk_openmask : */0,
2195 ace->sc_dk.dk_cpulabel);
2199 acestrategy, ace->sc_dk.dk_label,
2200 ace->sc_dk.dk_cpulabel);
2203 ace->sc_flags &= ~ACEF_LABELLING;
2204 mutex_exit(&ace->sc_dk.dk_openlock);
2210 ace->sc_flags |= ACEF_KLABEL;
2212 ace->sc_flags &= ~ACEF_KLABEL;
2219 ace->sc_flags |= ACEF_WLABEL;
2221 ace->sc_flags &= ~ACEF_WLABEL;
2225 acegetdefaultlabel(ace, (struct disklabel *)addr);
2236 strlcpy(dks->dks_name, bufq_getstrategyname(ace->sc_q),
2263 old = ace->sc_q;
2265 ace->sc_q = new;
2287 return sysace_send_config(ace,(uint32_t*)pt->data,pt->com);
2304 struct ace_softc *ace;
2310 ace = device_lookup_private(&ace_cd, ACEUNIT(dev));
2311 if (ace == NULL)
2315 omask = ace->sc_dk.dk_openmask & (1 << part);
2319 if (ace->sc_dk.dk_label->d_partitions[part].p_fstype != FS_SWAP)
2322 size = ace->sc_dk.dk_label->d_partitions[part].p_size *
2323 (ace->sc_dk.dk_label->d_secsize / DEV_BSIZE);
2339 struct ace_softc *ace; /* disk unit to do the I/O */
2349 ace = device_lookup_private(&ace_cd, ACEUNIT(dev));
2350 if (ace == NULL)
2356 lp = ace->sc_dk.dk_label;
2369 ace->sc_bp = NULL;
2370 ace->sc_bio.blkno = blkno;
2371 ace->sc_bio.flags = ATA_POLL;
2372 ace->sc_bio.nbytes = nblks * lp->d_secsize;
2373 ace->sc_bio.databuf = va;
2375 ace->active_xfer = bp;
2376 wakeup(&ace->ch_thread);
2378 switch(ace->sc_bio.error) {
2395 device_printf(ace->sc_dev, ": dump addr %p, size %zu blkno %llx\n",
2411 bad144intern(struct ace_softc *ace)
2413 struct dkbad *bt = &ace->sc_dk.dk_cpulabel->bad;
2414 struct disklabel *lp = ace->sc_dk.dk_label;
2422 ace->sc_bio.badsect[i] =
2428 ace->sc_bio.badsect[i] = -1;
2433 ace_set_geometry(struct ace_softc *ace)
2435 struct disk_geom *dg = &ace->sc_dk.dk_geom;
2439 dg->dg_secperunit = ace->sc_capacity;
2441 dg->dg_nsectors = ace->sc_params.CurrentSectorsPerTrack;
2442 dg->dg_ntracks = ace->sc_params.CurrentNumberOfHeads;
2444 disk_set_info(ace->sc_dev, &ace->sc_dk, ST506);