diff options
author | emaste <emaste@FreeBSD.org> | 2008-03-28 19:07:25 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2008-03-28 19:07:25 +0000 |
commit | 41514132ee0fa12f10de595e0d24397c257f31ca (patch) | |
tree | 26454ea9a77fab47cf6a404131c1c2fc28e2d206 /sys/dev/aac/aac.c | |
parent | d54973345880a74b27975dd7ea8b844ac061c923 (diff) | |
download | FreeBSD-src-41514132ee0fa12f10de595e0d24397c257f31ca.zip FreeBSD-src-41514132ee0fa12f10de595e0d24397c257f31ca.tar.gz |
Implement FSACTL_LNX_GET_FEATURES and FSACTL_GET_FEATURES ioctls. RAID
tools (e.g. arcconf) need this to be able to create arrays larger than 2TB.
Submitted by: Adaptec, via driver build 15317
Diffstat (limited to 'sys/dev/aac/aac.c')
-rw-r--r-- | sys/dev/aac/aac.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index eb88156..8f29262 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -226,6 +226,7 @@ static int aac_return_aif(struct aac_softc *sc, struct aac_fib_context *ctx, caddr_t uptr); static int aac_query_disk(struct aac_softc *sc, caddr_t uptr); static int aac_get_pci_info(struct aac_softc *sc, caddr_t uptr); +static int aac_supported_features(struct aac_softc *sc, caddr_t uptr); static void aac_ioctl_event(struct aac_softc *sc, struct aac_event *event, void *arg); static struct aac_mntinforesp * @@ -2979,6 +2980,12 @@ aac_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, d_thread_t *td) fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "FSACTL_GET_PCI_INFO"); error = aac_get_pci_info(sc, arg); break; + case FSACTL_GET_FEATURES: + arg = *(caddr_t*)arg; + case FSACTL_LNX_GET_FEATURES: + fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "FSACTL_GET_FEATURES"); + error = aac_supported_features(sc, arg); + break; default: fwprintf(sc, HBA_FLAGS_DBG_IOCTL_COMMANDS_B, "unsupported cmd 0x%lx\n", cmd); error = EINVAL; @@ -3479,6 +3486,43 @@ aac_get_pci_info(struct aac_softc *sc, caddr_t uptr) return (error); } +static int +aac_supported_features(struct aac_softc *sc, caddr_t uptr) +{ + struct aac_features f; + int error; + + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); + + if ((error = copyin(uptr, &f, sizeof (f))) != 0) + return (error); + + /* + * When the management driver receives FSACTL_GET_FEATURES ioctl with + * ALL zero in the featuresState, the driver will return the current + * state of all the supported features, the data field will not be + * valid. + * When the management driver receives FSACTL_GET_FEATURES ioctl with + * a specific bit set in the featuresState, the driver will return the + * current state of this specific feature and whatever data that are + * associated with the feature in the data field or perform whatever + * action needed indicates in the data field. + */ + if (f.feat.fValue == 0) { + f.feat.fBits.largeLBA = + (sc->flags & AAC_FLAGS_LBA_64BIT) ? 1 : 0; + /* TODO: In the future, add other features state here as well */ + } else { + if (f.feat.fBits.largeLBA) + f.feat.fBits.largeLBA = + (sc->flags & AAC_FLAGS_LBA_64BIT) ? 1 : 0; + /* TODO: Add other features state and data in the future */ + } + + error = copyout(&f, uptr, sizeof (f)); + return (error); +} + /* * Give the userland some information about the container. The AAC arch * expects the driver to be a SCSI passthrough type driver, so it expects |