1
0
Fork 0
alistair23-linux/drivers/staging/gasket/gasket_constants.h

48 lines
1.2 KiB
C
Raw Normal View History

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2018 Google, Inc. */
drivers/staging: Gasket driver framework + Apex driver The Gasket (Google ASIC Software, Kernel Extensions, and Tools) kernel framework is a generic, flexible system that supports thin kernel drivers. Gasket kernel drivers are expected to handle opening and closing devices, mmap'ing BAR space as requested, a small selection of ioctls, and handling page table translation (covered below). Any other functions should be handled by userspace code. The Gasket common module is not enough to run a device. In order to customize the Gasket code for a given piece of hardware, a device specific module must be created. At a minimum, this module must define a struct gasket_driver_desc containing the device-specific data for use by the framework; in addition, the module must declare an __init function that calls gasket_register_device with the module's gasket_driver_desc struct. Finally, the driver must define an exit function that calls gasket_unregister_device with the module's gasket_driver_desc struct. One of the core assumptions of the Gasket framework is that precisely one process is allowed to have an open write handle to the device node at any given time. (That process may, once it has one write handle, open any number of additional write handles.) This is accomplished by tracking open and close data for each driver instance. Signed-off-by: Rob Springer <rspringer@google.com> Signed-off-by: John Joseph <jnjoseph@google.com> Signed-off-by: Simon Que <sque@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-29 20:49:38 -06:00
#ifndef __GASKET_CONSTANTS_H__
#define __GASKET_CONSTANTS_H__
#define GASKET_FRAMEWORK_VERSION "1.1.2"
drivers/staging: Gasket driver framework + Apex driver The Gasket (Google ASIC Software, Kernel Extensions, and Tools) kernel framework is a generic, flexible system that supports thin kernel drivers. Gasket kernel drivers are expected to handle opening and closing devices, mmap'ing BAR space as requested, a small selection of ioctls, and handling page table translation (covered below). Any other functions should be handled by userspace code. The Gasket common module is not enough to run a device. In order to customize the Gasket code for a given piece of hardware, a device specific module must be created. At a minimum, this module must define a struct gasket_driver_desc containing the device-specific data for use by the framework; in addition, the module must declare an __init function that calls gasket_register_device with the module's gasket_driver_desc struct. Finally, the driver must define an exit function that calls gasket_unregister_device with the module's gasket_driver_desc struct. One of the core assumptions of the Gasket framework is that precisely one process is allowed to have an open write handle to the device node at any given time. (That process may, once it has one write handle, open any number of additional write handles.) This is accomplished by tracking open and close data for each driver instance. Signed-off-by: Rob Springer <rspringer@google.com> Signed-off-by: John Joseph <jnjoseph@google.com> Signed-off-by: Simon Que <sque@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-29 20:49:38 -06:00
/*
* The maximum number of simultaneous device types supported by the framework.
*/
#define GASKET_FRAMEWORK_DESC_MAX 2
/* The maximum devices per each type. */
#define GASKET_DEV_MAX 256
/* The number of supported (and possible) PCI BARs. */
#define GASKET_NUM_BARS 6
/* The number of supported Gasket page tables per device. */
#define GASKET_MAX_NUM_PAGE_TABLES 1
/* Maximum length of device names (driver name + minor number suffix + NULL). */
#define GASKET_NAME_MAX 32
/* Device status enumeration. */
enum gasket_status {
/*
* A device is DEAD if it has not been initialized or has had an error.
*/
GASKET_STATUS_DEAD = 0,
/*
* A device is LAMED if the hardware is healthy but the kernel was
* unable to enable some functionality (e.g. interrupts).
*/
GASKET_STATUS_LAMED,
/* A device is ALIVE if it is ready for operation. */
GASKET_STATUS_ALIVE,
/*
* This status is set when the driver is exiting and waiting for all
* handles to be closed.
*/
GASKET_STATUS_DRIVER_EXIT,
};
#endif