Home | History | Annotate | Line # | Download | only in mba
hp.c revision 1.48.18.1
      1  1.48.18.1       tls /*	$NetBSD: hp.c,v 1.48.18.1 2012/12/02 05:46:39 tls Exp $ */
      2        1.1     ragge /*
      3        1.4     ragge  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
      4        1.1     ragge  * All rights reserved.
      5        1.1     ragge  *
      6        1.1     ragge  * Redistribution and use in source and binary forms, with or without
      7        1.1     ragge  * modification, are permitted provided that the following conditions
      8        1.1     ragge  * are met:
      9        1.1     ragge  * 1. Redistributions of source code must retain the above copyright
     10        1.1     ragge  *    notice, this list of conditions and the following disclaimer.
     11        1.1     ragge  * 2. Redistributions in binary form must reproduce the above copyright
     12        1.1     ragge  *    notice, this list of conditions and the following disclaimer in the
     13        1.1     ragge  *    documentation and/or other materials provided with the distribution.
     14        1.1     ragge  * 3. All advertising materials mentioning features or use of this software
     15        1.1     ragge  *    must display the following acknowledgement:
     16        1.4     ragge  *      This product includes software developed at Ludd, University of
     17        1.4     ragge  *      Lule}, Sweden and its contributors.
     18        1.1     ragge  * 4. The name of the author may not be used to endorse or promote products
     19        1.1     ragge  *    derived from this software without specific prior written permission
     20        1.1     ragge  *
     21        1.1     ragge  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22        1.1     ragge  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23        1.1     ragge  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24        1.1     ragge  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25        1.1     ragge  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26        1.1     ragge  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27        1.1     ragge  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28        1.1     ragge  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29        1.1     ragge  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30        1.1     ragge  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31        1.1     ragge  */
     32        1.1     ragge 
     33        1.4     ragge /*
     34        1.4     ragge  * Simple device driver routine for massbuss disks.
     35        1.4     ragge  * TODO:
     36        1.4     ragge  *  Fix support for Standard DEC BAD144 bad block forwarding.
     37        1.4     ragge  *  Be able to to handle soft/hard transfer errors.
     38        1.4     ragge  *  Handle non-data transfer interrupts.
     39        1.4     ragge  *  Autoconfiguration of disk drives 'on the fly'.
     40        1.4     ragge  *  Handle disk media changes.
     41        1.4     ragge  *  Dual-port operations should be supported.
     42        1.4     ragge  */
     43       1.35     lukem 
     44       1.35     lukem #include <sys/cdefs.h>
     45  1.48.18.1       tls __KERNEL_RCSID(0, "$NetBSD: hp.c,v 1.48.18.1 2012/12/02 05:46:39 tls Exp $");
     46       1.35     lukem 
     47        1.2   mycroft #include <sys/param.h>
     48        1.8     ragge #include <sys/systm.h>
     49       1.48      matt #include <sys/bus.h>
     50       1.48      matt #include <sys/cpu.h>
     51        1.4     ragge #include <sys/device.h>
     52        1.4     ragge #include <sys/disklabel.h>
     53        1.4     ragge #include <sys/disk.h>
     54        1.4     ragge #include <sys/dkio.h>
     55        1.4     ragge #include <sys/buf.h>
     56       1.37      yamt #include <sys/bufq.h>
     57        1.4     ragge #include <sys/stat.h>
     58        1.4     ragge #include <sys/ioccom.h>
     59        1.2   mycroft #include <sys/fcntl.h>
     60       1.24     ragge #include <sys/conf.h>
     61       1.30  jdolecek #include <sys/event.h>
     62       1.48      matt #include <sys/syslog.h>
     63        1.4     ragge 
     64        1.4     ragge #include <vax/mba/mbavar.h>
     65        1.2   mycroft #include <vax/mba/mbareg.h>
     66        1.4     ragge #include <vax/mba/hpreg.h>
     67        1.3   mycroft 
     68       1.24     ragge #include "ioconf.h"
     69       1.16       jtk #include "locators.h"
     70       1.16       jtk 
     71       1.46      matt struct hp_softc {
     72       1.46      matt 	device_t sc_dev;
     73       1.46      matt 	struct disk sc_disk;
     74       1.24     ragge 	bus_space_tag_t sc_iot;
     75       1.24     ragge 	bus_space_handle_t sc_ioh;
     76       1.46      matt 	struct mba_device sc_md;	/* Common struct used by mbaqueue. */
     77       1.46      matt 	int sc_wlabel;			/* Disklabel area is writable */
     78        1.4     ragge };
     79        1.1     ragge 
     80       1.46      matt int     hpmatch(device_t, cfdata_t, void *);
     81       1.46      matt void    hpattach(device_t, device_t, void *);
     82       1.24     ragge void	hpstart(struct mba_device *);
     83       1.24     ragge int	hpattn(struct mba_device *);
     84       1.24     ragge enum	xfer_action hpfinish(struct mba_device *, int, int *);
     85        1.1     ragge 
     86       1.46      matt CFATTACH_DECL_NEW(hp, sizeof(struct hp_softc),
     87       1.29   thorpej     hpmatch, hpattach, NULL, NULL);
     88       1.17   thorpej 
     89       1.46      matt static dev_type_open(hpopen);
     90       1.46      matt static dev_type_close(hpclose);
     91       1.46      matt static dev_type_read(hpread);
     92       1.46      matt static dev_type_write(hpwrite);
     93       1.46      matt static dev_type_ioctl(hpioctl);
     94       1.46      matt static dev_type_strategy(hpstrategy);
     95       1.46      matt static dev_type_size(hppsize);
     96       1.26   gehenna 
     97       1.26   gehenna const struct bdevsw hp_bdevsw = {
     98       1.46      matt 	.d_open = hpopen,
     99       1.46      matt 	.d_close = hpclose,
    100       1.46      matt 	.d_strategy = hpstrategy,
    101       1.46      matt 	.d_ioctl = hpioctl,
    102       1.46      matt 	.d_dump = nulldump,
    103       1.46      matt 	.d_psize = hppsize,
    104       1.46      matt 	.d_flag = D_DISK
    105       1.26   gehenna };
    106       1.26   gehenna 
    107       1.26   gehenna const struct cdevsw hp_cdevsw = {
    108       1.46      matt 	.d_open = hpopen,
    109       1.46      matt 	.d_close = hpclose,
    110       1.46      matt 	.d_read = hpread,
    111       1.46      matt 	.d_write = hpwrite,
    112       1.46      matt 	.d_ioctl = hpioctl,
    113       1.46      matt 	.d_stop = nostop,
    114       1.46      matt 	.d_tty = notty,
    115       1.46      matt 	.d_poll = nopoll,
    116       1.46      matt 	.d_mmap = nommap,
    117       1.46      matt 	.d_kqfilter = nokqfilter,
    118       1.46      matt 	.d_flag = D_DISK
    119       1.26   gehenna };
    120       1.26   gehenna 
    121  1.48.18.1       tls const struct dkdriver hp_dkdriver = { hpstrategy, minphys };
    122  1.48.18.1       tls 
    123       1.24     ragge #define HP_WCSR(reg, val) \
    124       1.24     ragge 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, (reg), (val))
    125       1.24     ragge #define HP_RCSR(reg) \
    126       1.24     ragge 	bus_space_read_4(sc->sc_iot, sc->sc_ioh, (reg))
    127       1.24     ragge 
    128        1.1     ragge 
    129        1.4     ragge /*
    130        1.4     ragge  * Check if this is a disk drive; done by checking type from mbaattach.
    131        1.4     ragge  */
    132        1.4     ragge int
    133       1.46      matt hpmatch(device_t parent, cfdata_t cf, void *aux)
    134        1.4     ragge {
    135       1.46      matt 	struct mba_attach_args * const ma = aux;
    136        1.1     ragge 
    137       1.16       jtk 	if (cf->cf_loc[MBACF_DRIVE] != MBACF_DRIVE_DEFAULT &&
    138       1.24     ragge 	    cf->cf_loc[MBACF_DRIVE] != ma->ma_unit)
    139        1.4     ragge 		return 0;
    140        1.1     ragge 
    141       1.24     ragge 	if (ma->ma_devtyp != MB_RP)
    142        1.4     ragge 		return 0;
    143        1.1     ragge 
    144        1.4     ragge 	return 1;
    145        1.1     ragge }
    146        1.1     ragge 
    147        1.4     ragge /*
    148        1.4     ragge  * Disk drive found; fake a disklabel and try to read the real one.
    149        1.4     ragge  * If the on-disk label can't be read; we lose.
    150        1.4     ragge  */
    151        1.4     ragge void
    152       1.46      matt hpattach(device_t parent, device_t self, void *aux)
    153        1.4     ragge {
    154       1.46      matt 	struct hp_softc * const sc = device_private(self);
    155       1.46      matt 	struct mba_softc * const ms = device_private(parent);
    156       1.46      matt 	struct mba_attach_args * const ma = aux;
    157       1.46      matt 	struct disklabel *dl;
    158       1.46      matt 	const char *msg;
    159        1.4     ragge 
    160       1.46      matt 	sc->sc_dev = self;
    161       1.24     ragge 	sc->sc_iot = ma->ma_iot;
    162       1.24     ragge 	sc->sc_ioh = ma->ma_ioh;
    163       1.46      matt 
    164        1.4     ragge 	/*
    165        1.4     ragge 	 * Init the common struct for both the adapter and its slaves.
    166        1.4     ragge 	 */
    167       1.38      yamt 	bufq_alloc(&sc->sc_md.md_q, "disksort", BUFQ_SORT_CYLINDER);
    168       1.46      matt 	sc->sc_md.md_softc = sc;		/* Pointer to this softc */
    169       1.46      matt 	sc->sc_md.md_mba = ms;			/* Pointer to parent softc */
    170        1.4     ragge 	sc->sc_md.md_start = hpstart;		/* Disk start routine */
    171        1.4     ragge 	sc->sc_md.md_attn = hpattn;		/* Disk attention routine */
    172        1.4     ragge 	sc->sc_md.md_finish = hpfinish;		/* Disk xfer finish routine */
    173        1.4     ragge 
    174       1.24     ragge 	ms->sc_md[ma->ma_unit] = &sc->sc_md;	/* Per-unit backpointer */
    175        1.1     ragge 
    176        1.4     ragge 	/*
    177        1.4     ragge 	 * Init and attach the disk structure.
    178        1.4     ragge 	 */
    179  1.48.18.1       tls 	disk_init(&sc->sc_disk, device_xname(sc->sc_dev), &hp_dkdriver);
    180        1.4     ragge 	disk_attach(&sc->sc_disk);
    181        1.1     ragge 
    182        1.4     ragge 	/*
    183        1.4     ragge 	 * Fake a disklabel to be able to read in the real label.
    184        1.4     ragge 	 */
    185        1.4     ragge 	dl = sc->sc_disk.dk_label;
    186        1.1     ragge 
    187        1.4     ragge 	dl->d_secsize = DEV_BSIZE;
    188        1.4     ragge 	dl->d_ntracks = 1;
    189        1.4     ragge 	dl->d_nsectors = 32;
    190        1.4     ragge 	dl->d_secpercyl = 32;
    191        1.1     ragge 
    192        1.4     ragge 	/*
    193        1.4     ragge 	 * Read in label.
    194        1.4     ragge 	 */
    195       1.40   thorpej 	if ((msg = readdisklabel(makedev(0, device_unit(self) * 8), hpstrategy,
    196        1.4     ragge 	    dl, NULL)) != NULL)
    197       1.12  christos 		printf(": %s", msg);
    198       1.12  christos 	printf(": %s, size = %d sectors\n", dl->d_typename, dl->d_secperunit);
    199        1.4     ragge }
    200        1.4     ragge 
    201        1.4     ragge 
    202        1.4     ragge void
    203       1.24     ragge hpstrategy(struct buf *bp)
    204        1.1     ragge {
    205       1.46      matt 	struct hp_softc *sc;
    206       1.46      matt 	struct buf *gp;
    207       1.21   thorpej 	struct disklabel *lp;
    208       1.46      matt 	int unit, s, err;
    209        1.4     ragge 
    210        1.4     ragge 	unit = DISKUNIT(bp->b_dev);
    211       1.46      matt 	sc = device_lookup_private(&hp_cd, unit);
    212       1.21   thorpej 	lp = sc->sc_disk.dk_label;
    213        1.4     ragge 
    214       1.34   thorpej 	err = bounds_check_with_label(&sc->sc_disk, bp, sc->sc_wlabel);
    215       1.32    bouyer 	if (err <= 0)
    216        1.4     ragge 		goto done;
    217       1.21   thorpej 
    218       1.21   thorpej 	bp->b_rawblkno =
    219       1.21   thorpej 	    bp->b_blkno + lp->d_partitions[DISKPART(bp->b_dev)].p_offset;
    220       1.21   thorpej 	bp->b_cylinder = bp->b_rawblkno / lp->d_secpercyl;
    221       1.21   thorpej 
    222        1.4     ragge 	s = splbio();
    223        1.4     ragge 
    224       1.47      yamt 	gp = bufq_peek(sc->sc_md.md_q);
    225       1.47      yamt 	bufq_put(sc->sc_md.md_q, bp);
    226        1.4     ragge 	if (gp == 0)
    227        1.4     ragge 		mbaqueue(&sc->sc_md);
    228        1.4     ragge 
    229        1.4     ragge 	splx(s);
    230        1.4     ragge 	return;
    231        1.4     ragge 
    232        1.4     ragge done:
    233        1.4     ragge 	bp->b_resid = bp->b_bcount;
    234        1.4     ragge 	biodone(bp);
    235        1.4     ragge }
    236        1.1     ragge 
    237        1.1     ragge /*
    238        1.4     ragge  * Start transfer on given disk. Called from mbastart().
    239        1.1     ragge  */
    240        1.4     ragge void
    241       1.46      matt hpstart(struct mba_device *md)
    242        1.4     ragge {
    243       1.46      matt 	struct hp_softc * const sc = md->md_softc;
    244       1.46      matt 	struct disklabel * const lp = sc->sc_disk.dk_label;
    245       1.47      yamt 	struct buf *bp = bufq_peek(md->md_q);
    246        1.4     ragge 	unsigned bn, cn, sn, tn;
    247        1.4     ragge 
    248        1.4     ragge 	/*
    249        1.4     ragge 	 * Collect statistics.
    250        1.4     ragge 	 */
    251        1.4     ragge 	disk_busy(&sc->sc_disk);
    252       1.42        he 	iostat_seek(sc->sc_disk.dk_stats);
    253        1.4     ragge 
    254       1.21   thorpej 	bn = bp->b_rawblkno;
    255        1.4     ragge 	if (bn) {
    256        1.4     ragge 		cn = bn / lp->d_secpercyl;
    257        1.4     ragge 		sn = bn % lp->d_secpercyl;
    258        1.4     ragge 		tn = sn / lp->d_nsectors;
    259        1.4     ragge 		sn = sn % lp->d_nsectors;
    260        1.4     ragge 	} else
    261        1.4     ragge 		cn = sn = tn = 0;
    262        1.4     ragge 
    263       1.24     ragge 	HP_WCSR(HP_DC, cn);
    264       1.24     ragge 	HP_WCSR(HP_DA, (tn << 8) | sn);
    265        1.4     ragge 	if (bp->b_flags & B_READ)
    266       1.24     ragge 		HP_WCSR(HP_CS1, HPCS_READ);
    267        1.4     ragge 	else
    268       1.24     ragge 		HP_WCSR(HP_CS1, HPCS_WRITE);
    269        1.4     ragge }
    270        1.4     ragge 
    271        1.4     ragge int
    272       1.39  christos hpopen(dev_t dev, int flag, int fmt, struct lwp *l)
    273        1.4     ragge {
    274       1.46      matt 	struct hp_softc *sc;
    275       1.46      matt 	int	part = DISKPART(dev);
    276        1.4     ragge 
    277       1.46      matt 	sc = device_lookup_private(&hp_cd, DISKUNIT(dev));
    278       1.46      matt 	if (sc == NULL)
    279        1.4     ragge 		return ENXIO;
    280        1.4     ragge 
    281        1.5     ragge 	if (part >= sc->sc_disk.dk_label->d_npartitions)
    282        1.4     ragge 		return ENXIO;
    283        1.4     ragge 
    284        1.4     ragge 	switch (fmt) {
    285       1.46      matt 	case S_IFCHR:
    286        1.4     ragge 		sc->sc_disk.dk_copenmask |= (1 << part);
    287        1.4     ragge 		break;
    288        1.4     ragge 
    289       1.46      matt 	case S_IFBLK:
    290        1.4     ragge 		sc->sc_disk.dk_bopenmask |= (1 << part);
    291        1.4     ragge 		break;
    292        1.1     ragge 	}
    293        1.4     ragge 	sc->sc_disk.dk_openmask =
    294        1.4     ragge 	    sc->sc_disk.dk_copenmask | sc->sc_disk.dk_bopenmask;
    295        1.4     ragge 
    296        1.4     ragge 	return 0;
    297        1.4     ragge }
    298        1.4     ragge 
    299        1.4     ragge int
    300       1.39  christos hpclose(dev_t dev, int flag, int fmt, struct lwp *l)
    301        1.4     ragge {
    302       1.46      matt 	struct hp_softc * const sc = device_lookup_private(&hp_cd, DISKUNIT(dev));
    303       1.46      matt 	const int part = DISKPART(dev);
    304        1.4     ragge 
    305        1.4     ragge 	switch (fmt) {
    306       1.46      matt 	case S_IFCHR:
    307        1.4     ragge 		sc->sc_disk.dk_copenmask &= ~(1 << part);
    308        1.4     ragge 		break;
    309        1.4     ragge 
    310       1.46      matt 	case S_IFBLK:
    311        1.4     ragge 		sc->sc_disk.dk_bopenmask &= ~(1 << part);
    312        1.4     ragge 		break;
    313        1.1     ragge 	}
    314        1.4     ragge 	sc->sc_disk.dk_openmask =
    315        1.4     ragge 	    sc->sc_disk.dk_copenmask | sc->sc_disk.dk_bopenmask;
    316        1.4     ragge 
    317        1.4     ragge 	return 0;
    318        1.4     ragge }
    319        1.1     ragge 
    320        1.4     ragge int
    321       1.43  christos hpioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
    322        1.4     ragge {
    323       1.46      matt 	struct hp_softc * const sc = device_lookup_private(&hp_cd, DISKUNIT(dev));
    324       1.46      matt 	struct disklabel * const lp = sc->sc_disk.dk_label;
    325        1.5     ragge 	int	error;
    326        1.1     ragge 
    327        1.4     ragge 	switch (cmd) {
    328       1.46      matt 	case DIOCGDINFO:
    329       1.46      matt 		*(struct disklabel *)addr = *lp;
    330        1.4     ragge 		return 0;
    331        1.4     ragge 
    332       1.46      matt 	case DIOCGPART:
    333        1.4     ragge 		((struct partinfo *)addr)->disklab = lp;
    334        1.4     ragge 		((struct partinfo *)addr)->part =
    335        1.4     ragge 		    &lp->d_partitions[DISKPART(dev)];
    336        1.4     ragge 		break;
    337        1.4     ragge 
    338       1.46      matt 	case DIOCSDINFO:
    339        1.4     ragge 		if ((flag & FWRITE) == 0)
    340        1.4     ragge 			return EBADF;
    341        1.4     ragge 
    342        1.4     ragge 		return setdisklabel(lp, (struct disklabel *)addr, 0, 0);
    343        1.4     ragge 
    344       1.46      matt 	case DIOCWDINFO:
    345        1.4     ragge 		if ((flag & FWRITE) == 0)
    346        1.5     ragge 			error = EBADF;
    347        1.5     ragge 		else {
    348        1.5     ragge 			sc->sc_wlabel = 1;
    349        1.5     ragge 			error = writedisklabel(dev, hpstrategy, lp, 0);
    350        1.5     ragge 			sc->sc_wlabel = 0;
    351        1.5     ragge 		}
    352        1.5     ragge 		return error;
    353       1.46      matt 	case DIOCWLABEL:
    354        1.6     ragge 		if ((flag & FWRITE) == 0)
    355        1.6     ragge 			return EBADF;
    356        1.6     ragge 		sc->sc_wlabel = 1;
    357        1.6     ragge 		break;
    358        1.4     ragge 
    359        1.4     ragge 	default:
    360        1.4     ragge 		return ENOTTY;
    361        1.4     ragge 	}
    362        1.6     ragge 	return 0;
    363        1.1     ragge }
    364        1.1     ragge 
    365        1.1     ragge /*
    366        1.4     ragge  * Called when a transfer is finished. Check if transfer went OK,
    367        1.4     ragge  * Return info about what-to-do-now.
    368        1.1     ragge  */
    369        1.4     ragge enum xfer_action
    370       1.24     ragge hpfinish(struct mba_device *md, int mbasr, int *attn)
    371        1.1     ragge {
    372       1.46      matt 	struct hp_softc * const sc = md->md_softc;
    373       1.47      yamt 	struct buf *bp = bufq_peek(md->md_q);
    374       1.24     ragge 	int er1, er2, bc;
    375        1.4     ragge 	unsigned byte;
    376        1.4     ragge 
    377       1.24     ragge 	er1 = HP_RCSR(HP_ER1);
    378       1.24     ragge 	er2 = HP_RCSR(HP_ER2);
    379       1.24     ragge 	HP_WCSR(HP_ER1, 0);
    380       1.24     ragge 	HP_WCSR(HP_ER2, 0);
    381       1.24     ragge 
    382        1.4     ragge hper1:
    383        1.4     ragge 	switch (ffs(er1) - 1) {
    384        1.4     ragge 	case -1:
    385       1.24     ragge 		HP_WCSR(HP_ER1, 0);
    386        1.4     ragge 		goto hper2;
    387        1.4     ragge 
    388        1.4     ragge 	case HPER1_DCK: /* Corrected? data read. Just notice. */
    389       1.24     ragge 		bc = bus_space_read_4(md->md_mba->sc_iot,
    390       1.24     ragge 		    md->md_mba->sc_ioh, MBA_BC);
    391        1.4     ragge 		byte = ~(bc >> 16);
    392       1.36        pk 		diskerr(bp, hp_cd.cd_name, "soft ecc", LOG_PRINTF,
    393        1.4     ragge 		    btodb(bp->b_bcount - byte), sc->sc_disk.dk_label);
    394        1.4     ragge 		er1 &= ~(1<<HPER1_DCK);
    395        1.4     ragge 		break;
    396        1.4     ragge 
    397        1.4     ragge 	default:
    398       1.46      matt 		aprint_error_dev(sc->sc_dev, "drive error: er1 %x er2 %x\n",
    399       1.46      matt 		    er1, er2);
    400       1.24     ragge 		HP_WCSR(HP_ER1, 0);
    401       1.24     ragge 		HP_WCSR(HP_ER2, 0);
    402        1.4     ragge 		goto hper2;
    403        1.4     ragge 	}
    404        1.4     ragge 	goto hper1;
    405        1.1     ragge 
    406        1.4     ragge hper2:
    407        1.4     ragge 	mbasr &= ~(MBASR_DTBUSY|MBASR_DTCMP|MBASR_ATTN);
    408        1.4     ragge 	if (mbasr)
    409       1.46      matt 		aprint_error_dev(sc->sc_dev, "massbuss error: %x\n", mbasr);
    410        1.4     ragge 
    411       1.47      yamt 	bufq_peek(md->md_q)->b_resid = 0;
    412       1.47      yamt 	disk_unbusy(&sc->sc_disk, bufq_peek(md->md_q)->b_bcount,
    413       1.31       mrg 	    (bp->b_flags & B_READ));
    414        1.4     ragge 	return XFER_FINISH;
    415        1.1     ragge }
    416        1.1     ragge 
    417        1.1     ragge /*
    418        1.4     ragge  * Non-data transfer interrupt; like volume change.
    419        1.1     ragge  */
    420        1.4     ragge int
    421       1.24     ragge hpattn(struct mba_device *md)
    422        1.4     ragge {
    423       1.46      matt 	struct hp_softc * const sc = md->md_softc;
    424        1.4     ragge 	int	er1, er2;
    425        1.4     ragge 
    426       1.24     ragge         er1 = HP_RCSR(HP_ER1);
    427       1.24     ragge         er2 = HP_RCSR(HP_ER2);
    428        1.4     ragge 
    429       1.46      matt 	aprint_error_dev(sc->sc_dev, "Attention! er1 %x er2 %x\n", er1, er2);
    430        1.4     ragge 	return 0;
    431        1.4     ragge }
    432        1.4     ragge 
    433        1.4     ragge 
    434        1.4     ragge int
    435       1.46      matt hppsize(dev_t dev)
    436        1.1     ragge {
    437       1.46      matt 	struct hp_softc * const sc = device_lookup_private(&hp_cd, DISKUNIT(dev));
    438       1.46      matt 	const int part = DISKPART(dev);
    439        1.4     ragge 
    440       1.46      matt 	if (sc == NULL || part >= sc->sc_disk.dk_label->d_npartitions)
    441        1.4     ragge 		return -1;
    442        1.4     ragge 
    443       1.46      matt 	return sc->sc_disk.dk_label->d_partitions[part].p_size *
    444       1.15   thorpej 	    (sc->sc_disk.dk_label->d_secsize / DEV_BSIZE);
    445        1.4     ragge }
    446        1.1     ragge 
    447        1.4     ragge int
    448       1.24     ragge hpread(dev_t dev, struct uio *uio, int ioflag)
    449        1.4     ragge {
    450        1.4     ragge 	return (physio(hpstrategy, NULL, dev, B_READ, minphys, uio));
    451        1.1     ragge }
    452        1.1     ragge 
    453        1.4     ragge int
    454       1.24     ragge hpwrite(dev_t dev, struct uio *uio, int ioflag)
    455        1.1     ragge {
    456        1.4     ragge 	return (physio(hpstrategy, NULL, dev, B_WRITE, minphys, uio));
    457        1.1     ragge }
    458