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
This commit is contained in:
parent
a6b3965743
commit
6d307336b3
@ -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
|
||||
|
@ -97,6 +97,8 @@ union aac_statrequest {
|
||||
METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
#define FSACTL_LNX_SEND_LARGE_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2138, \
|
||||
METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define FSACTL_LNX_GET_FEATURES CTL_CODE(FILE_DEVICE_CONTROLLER, 2139, \
|
||||
METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
/* Why these don't follow the previous convention, I don't know */
|
||||
#define FSACTL_LNX_NULL_IO_TEST 0x43
|
||||
@ -134,6 +136,7 @@ union aac_statrequest {
|
||||
#define FSACTL_FORCE_DELETE_DISK _IO('8', 72)
|
||||
#define FSACTL_AIF_THREAD _IO('8', 79)
|
||||
#define FSACTL_SEND_LARGE_FIB _IO('8', 90)
|
||||
#define FSACTL_GET_FEATURES _IO('8', 91)
|
||||
|
||||
#define FSACTL_NULL_IO_TEST _IO('8', 67)
|
||||
#define FSACTL_SIM_IO_TEST _IO('8', 83)
|
||||
@ -182,4 +185,21 @@ struct aac_query_disk {
|
||||
char diskDeviceName[10];
|
||||
u_int32_t UnMapped;
|
||||
};
|
||||
|
||||
/* Features, asked from the tools to know if the driver
|
||||
* supports drives >2TB
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
u_int32_t largeLBA : 1; /* disk support greater 2TB */
|
||||
u_int32_t fReserved : 31;
|
||||
} fBits;
|
||||
u_int32_t fValue;
|
||||
} featuresState;
|
||||
|
||||
struct aac_features {
|
||||
featuresState feat;
|
||||
u_int32_t data[31];
|
||||
u_int32_t reserved[32];
|
||||
} __packed;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user