Changeset View
Changeset View
Standalone View
Standalone View
head/sys/mips/cavium/octeon_ebt3000_cf.c
Show First 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | static void cf_start (struct bio *bp) | ||||
cf_priv = bp->bio_to->geom->softc; | cf_priv = bp->bio_to->geom->softc; | ||||
/* | /* | ||||
* Handle actual I/O requests. The request is passed down through | * Handle actual I/O requests. The request is passed down through | ||||
* the bio struct. | * the bio struct. | ||||
*/ | */ | ||||
if(bp->bio_cmd & BIO_GETATTR) { | switch (bp->bio_cmd) { | ||||
case BIO_GETATTR: | |||||
if (g_handleattr_int(bp, "GEOM::fwsectors", cf_priv->drive_param.sec_track)) | if (g_handleattr_int(bp, "GEOM::fwsectors", cf_priv->drive_param.sec_track)) | ||||
return; | return; | ||||
if (g_handleattr_int(bp, "GEOM::fwheads", cf_priv->drive_param.heads)) | if (g_handleattr_int(bp, "GEOM::fwheads", cf_priv->drive_param.heads)) | ||||
return; | return; | ||||
g_io_deliver(bp, ENOIOCTL); | g_io_deliver(bp, ENOIOCTL); | ||||
return; | return; | ||||
} | |||||
if ((bp->bio_cmd & (BIO_READ | BIO_WRITE))) { | case BIO_READ: | ||||
if (bp->bio_cmd & BIO_READ) { | |||||
error = cf_cmd_read(bp->bio_length / cf_priv->drive_param.sector_size, | error = cf_cmd_read(bp->bio_length / cf_priv->drive_param.sector_size, | ||||
bp->bio_offset / cf_priv->drive_param.sector_size, bp->bio_data); | bp->bio_offset / cf_priv->drive_param.sector_size, bp->bio_data); | ||||
} else if (bp->bio_cmd & BIO_WRITE) { | break; | ||||
case BIO_WRITE: | |||||
error = cf_cmd_write(bp->bio_length / cf_priv->drive_param.sector_size, | error = cf_cmd_write(bp->bio_length / cf_priv->drive_param.sector_size, | ||||
bp->bio_offset/cf_priv->drive_param.sector_size, bp->bio_data); | bp->bio_offset/cf_priv->drive_param.sector_size, bp->bio_data); | ||||
} else { | break; | ||||
default: | |||||
printf("%s: unrecognized bio_cmd %x.\n", __func__, bp->bio_cmd); | printf("%s: unrecognized bio_cmd %x.\n", __func__, bp->bio_cmd); | ||||
error = ENOTSUP; | error = ENOTSUP; | ||||
break; | |||||
} | } | ||||
if (error != 0) { | if (error != 0) { | ||||
g_io_deliver(bp, error); | g_io_deliver(bp, error); | ||||
return; | return; | ||||
} | } | ||||
bp->bio_resid = 0; | bp->bio_resid = 0; | ||||
bp->bio_completed = bp->bio_length; | bp->bio_completed = bp->bio_length; | ||||
g_io_deliver(bp, 0); | g_io_deliver(bp, 0); | ||||
} | |||||
} | } | ||||
static int cf_ioctl (struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread *td) | static int cf_ioctl (struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread *td) | ||||
{ | { | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 481 Lines • Show Last 20 Lines |