From 651661a7285cf06b7c5dcc9c04919360ec08fdfa Mon Sep 17 00:00:00 2001 From: Jens Taprogge Date: Tue, 4 Sep 2012 17:01:13 +0200 Subject: [PATCH] --- yaml --- r: 324795 b: refs/heads/master c: 849e0ad257d259b8443c63d74e3bcc32ebf336af h: refs/heads/master i: 324793: cf908833f15b9ad21c7531ae3fd00b2c3f3aa3f6 324791: 66cd8f579e7d199ee9cd006a876551df82185ca3 v: v3 --- [refs] | 2 +- trunk/drivers/staging/ipack/ipack.h | 26 ++++++++++++++++++++++++ trunk/drivers/staging/ipack/ipack_ids.h | 27 +++++++++++++++++++++++++ trunk/include/linux/mod_devicetable.h | 7 +++++++ trunk/scripts/mod/file2alias.c | 15 ++++++++++++++ 5 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 trunk/drivers/staging/ipack/ipack_ids.h diff --git a/[refs] b/[refs] index 4c03581b5c64..683b1762be69 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1f43d7bfac880f63320c4dcbb8f864112946337f +refs/heads/master: 849e0ad257d259b8443c63d74e3bcc32ebf336af diff --git a/trunk/drivers/staging/ipack/ipack.h b/trunk/drivers/staging/ipack/ipack.h index e3609b16368b..703142d1859b 100644 --- a/trunk/drivers/staging/ipack/ipack.h +++ b/trunk/drivers/staging/ipack/ipack.h @@ -9,6 +9,7 @@ * Software Foundation; version 2 of the License. */ +#include #include #define IPACK_IDPROM_OFFSET_I 0x01 @@ -95,6 +96,7 @@ struct ipack_driver_ops { */ struct ipack_driver { struct device_driver driver; + const struct ipack_device_id *id_table; struct ipack_driver_ops *ops; }; @@ -169,3 +171,27 @@ void ipack_driver_unregister(struct ipack_driver *edrv); */ struct ipack_device *ipack_device_register(struct ipack_bus_device *bus, int slot, int irqv); void ipack_device_unregister(struct ipack_device *dev); + +/** + * DEFINE_IPACK_DEVICE_TABLE - macro used to describe a IndustryPack table + * @_table: device table name + * + * This macro is used to create a struct ipack_device_id array (a device table) + * in a generic manner. + */ +#define DEFINE_IPACK_DEVICE_TABLE(_table) \ + const struct ipack_device_id _table[] __devinitconst + +/** + * IPACK_DEVICE - macro used to describe a specific IndustryPack device + * @_format: the format version (currently either 1 or 2, 8 bit value) + * @vend: the 8 or 24 bit IndustryPack Vendor ID + * @dev: the 8 or 16 bit IndustryPack Device ID + * + * This macro is used to create a struct ipack_device_id that matches a specific + * device. + */ +#define IPACK_DEVICE(_format, vend, dev) \ + .format = (_format), \ + .vendor = (vend), \ + .device = (dev) diff --git a/trunk/drivers/staging/ipack/ipack_ids.h b/trunk/drivers/staging/ipack/ipack_ids.h new file mode 100644 index 000000000000..ba85ec53b2c3 --- /dev/null +++ b/trunk/drivers/staging/ipack/ipack_ids.h @@ -0,0 +1,27 @@ +/* + * IndustryPack Fromat, Vendor and Device IDs. + */ + +/* ID section format versions */ +#define IPACK_ID_VERSION_INVALID 0x00 +#define IPACK_ID_VERSION_1 0x01 +#define IPACK_ID_VERSION_2 0x02 + +/* Vendors and devices. Sort key: vendor first, device next. */ +#define IPACK1_VENDOR_ID_RESERVED1 0x00 +#define IPACK1_VENDOR_ID_RESERVED2 0xFF +#define IPACK1_VENDOR_ID_UNREGISTRED01 0x01 +#define IPACK1_VENDOR_ID_UNREGISTRED02 0x02 +#define IPACK1_VENDOR_ID_UNREGISTRED03 0x03 +#define IPACK1_VENDOR_ID_UNREGISTRED04 0x04 +#define IPACK1_VENDOR_ID_UNREGISTRED05 0x05 +#define IPACK1_VENDOR_ID_UNREGISTRED06 0x06 +#define IPACK1_VENDOR_ID_UNREGISTRED07 0x07 +#define IPACK1_VENDOR_ID_UNREGISTRED08 0x08 +#define IPACK1_VENDOR_ID_UNREGISTRED09 0x09 +#define IPACK1_VENDOR_ID_UNREGISTRED10 0x0A +#define IPACK1_VENDOR_ID_UNREGISTRED11 0x0B +#define IPACK1_VENDOR_ID_UNREGISTRED12 0x0C +#define IPACK1_VENDOR_ID_UNREGISTRED13 0x0D +#define IPACK1_VENDOR_ID_UNREGISTRED14 0x0E +#define IPACK1_VENDOR_ID_UNREGISTRED15 0x0F diff --git a/trunk/include/linux/mod_devicetable.h b/trunk/include/linux/mod_devicetable.h index 6955045199b0..999c4c25fbf7 100644 --- a/trunk/include/linux/mod_devicetable.h +++ b/trunk/include/linux/mod_devicetable.h @@ -600,4 +600,11 @@ struct x86_cpu_id { #define X86_MODEL_ANY 0 #define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ +#define IPACK_ANY_ID (~0) +struct ipack_device_id { + __u8 format; /* Format version or IPACK_ANY_ID */ + __u32 vendor; /* Vendor ID or IPACK_ANY_ID */ + __u32 device; /* Device ID or IPACK_ANY_ID */ +}; + #endif /* LINUX_MOD_DEVICETABLE_H */ diff --git a/trunk/scripts/mod/file2alias.c b/trunk/scripts/mod/file2alias.c index 7ed6864ef65b..3c22bda8fdf3 100644 --- a/trunk/scripts/mod/file2alias.c +++ b/trunk/scripts/mod/file2alias.c @@ -966,6 +966,21 @@ static int do_isapnp_entry(const char *filename, } ADD_TO_DEVTABLE("isapnp", struct isapnp_device_id, do_isapnp_entry); +/* Looks like: "ipack:fNvNdN". */ +static int do_ipack_entry(const char *filename, + struct ipack_device_id *id, char *alias) +{ + id->vendor = TO_NATIVE(id->vendor); + id->device = TO_NATIVE(id->device); + strcpy(alias, "ipack:"); + ADD(alias, "f", id->format != IPACK_ANY_ID, id->format); + ADD(alias, "v", id->vendor != IPACK_ANY_ID, id->vendor); + ADD(alias, "d", id->device != IPACK_ANY_ID, id->device); + add_wildcard(alias); + return 1; +} +ADD_TO_DEVTABLE("ipack", struct ipack_device_id, do_ipack_entry); + /* * Append a match expression for a single masked hex digit. * outp points to a pointer to the character at which to append.