staging: fsl-mc: module loading support, fixes, and cleanup
cover staging: fsl-mc: module loading support, fixes, and cleanup
This patch series does some cleanup and further sets the stage for additional fsl-mc device drivers.
-Patches 1-4 add missing fsl-mc support for modalias and udev-based
module loading of drivers.
-Patch 5 exports a function some drivers rely on.
-Patch 6 makes a needed helper function visible to the dprc driver. -Patch 7 fixes a bug where an asymmetry existed in how mc_io structs
were destroyed.
-Patch 8 fixes a bug where an irq free was missing in the dprc driver. -Patch 9 fixes a bug where there was an ordering issue with how resources
were freed.
-Patch 10 fixes a bug with how hwirq numbers were determined, which
prevented more than one dprc from being used by the kernel
-Patch 11 is a cleanup patch to improve the readability/maintainability of
the functions that build/parse MC commands. It uses structs instead of the previous shift/mask macros. This sets the precedence we want other new drivers to follow.
Bharat Bhushan (1):
staging: fsl-mc: fix asymmetry in destroy of mc_io
Ioana Radulescu (1):
staging: fsl-mc: convert mc command build/parse to use C structs
Stuart Yoder (9):
staging: fsl-mc: add support for the modalias sysfs attribute
staging: fsl-mc: implement uevent callback and set the modalias
staging: fsl-mc: clean up the device id struct
staging: fsl-mc: add support for device table matching
staging: fsl-mc: export mc_get_version
staging: fsl-mc: make fsl_mc_is_root_dprc() global
staging: fsl-mc: dprc: add missing irq free
staging: fsl-mc: dprc: fix ordering problem freeing resources in
remove of dprc
staging: fsl-mc: properly set hwirq in msi set_desc
drivers/staging/fsl-mc/bus/dpbp.c | 132 ++++-- drivers/staging/fsl-mc/bus/dpmcp-cmd.h | 86 +++- drivers/staging/fsl-mc/bus/dpmcp.c | 89 ++-- drivers/staging/fsl-mc/bus/dpmng-cmd.h | 12 +- drivers/staging/fsl-mc/bus/dpmng.c | 15 +- drivers/staging/fsl-mc/bus/dprc-cmd.h | 379 +++++++++++++++- drivers/staging/fsl-mc/bus/dprc-driver.c | 20 +- drivers/staging/fsl-mc/bus/dprc.c | 715 ++++++++++-------------------- drivers/staging/fsl-mc/bus/mc-allocator.c | 2 +- drivers/staging/fsl-mc/bus/mc-bus.c | 71 ++- drivers/staging/fsl-mc/bus/mc-msi.c | 17 +- drivers/staging/fsl-mc/bus/mc-sys.c | 46 +- drivers/staging/fsl-mc/include/dpbp-cmd.h | 125 +++++- drivers/staging/fsl-mc/include/mc-cmd.h | 91 ++-- drivers/staging/fsl-mc/include/mc.h | 21 +- include/linux/mod_devicetable.h | 16 + scripts/mod/devicetable-offsets.c | 4 + scripts/mod/file2alias.c | 12 + 18 files changed, 1175 insertions(+), 678 deletions(-)
Signature · 1 line
1.9.0
PATCH 1/11 staging: fsl-mc: add support for the modalias sysfs attribute
In order to support uevent based module loading implement modalias support for the fsl-mc bus driver. Aliases are based on vendor and object/device id and are of the form "fsl-mc:vNdN".
--- drivers/staging/fsl-mc/bus/mc-bus.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/staging/fsl-mc/bus/mc-bus.c +25 -0
@@ -82,10 +82,35 @@ static int fsl_mc_bus_uevent(struct device *dev, struct kobj_uevent_env *env)return 0 ; } +static ssize_t modalias_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct fsl_mc_device *mc_dev =to_fsl_mc_device (dev); + +return sprintf (buf,"fsl-mc:v%08Xd%s\n" , mc_dev->obj_desc.vendor, + mc_dev->obj_desc.type); +} +static DEVICE_ATTR_RO (modalias); + +static struct attribute *fsl_mc_dev_attrs[] = { + &dev_attr_modalias.attr, +NULL , +}; + +static const struct attribute_group fsl_mc_dev_group = { + .attrs = fsl_mc_dev_attrs, +}; + +static const struct attribute_group *fsl_mc_dev_groups[] = { + &fsl_mc_dev_group, +NULL , +}; +struct bus_type fsl_mc_bus_type = { .name ="fsl-mc" , .match = fsl_mc_bus_match, .uevent = fsl_mc_bus_uevent, + .dev_groups = fsl_mc_dev_groups, };EXPORT_SYMBOL_GPL (fsl_mc_bus_type);
Signature · 1 line
1.9.0
PATCH 2/11 staging: fsl-mc: implement uevent callback and set the modalias
In reply to Stuart YoderReplace placeholder code in the uevent callback to properly set the MODALIAS env variable.
--- drivers/staging/fsl-mc/bus/mc-bus.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/fsl-mc/bus/mc-bus.c +7 -1
@@ -78,7 +78,13 @@ out:*/ static int fsl_mc_bus_uevent (struct device *dev,struct kobj_uevent_env *env) { -pr_debug ("%s invoked\n" , __func__); +struct fsl_mc_device *mc_dev =to_fsl_mc_device (dev); + +if (add_uevent_var (env,"MODALIAS=fsl-mc:v%08Xd%s" , + mc_dev->obj_desc.vendor, + mc_dev->obj_desc.type)) +return -ENOMEM ; +return 0 ; }
Signature · 1 line
1.9.0
PATCH 3/11 staging: fsl-mc: clean up the device id struct
In reply to Stuart Yoder-rename the struct used for fsl-mc device ids to be more
consistent with other busses
-remove the now obsolete and unused version fields
--- drivers/staging/fsl-mc/bus/dprc-driver.c | 2 +- drivers/staging/fsl-mc/bus/mc-allocator.c | 2 +- drivers/staging/fsl-mc/bus/mc-bus.c | 2 +- drivers/staging/fsl-mc/include/mc.h | 10 +++------- 4 files changed, 6 insertions(+), 10 deletions(-)
drivers/staging/fsl-mc/bus/dprc-driver.c +1 -1
@@ -805,7 +805,7 @@ static int dprc_remove(struct fsl_mc_device *mc_dev)return 0 ; } -static const struct fsl_mc_device_match_id match_id_table[] = { +static const struct fsl_mc_device_id match_id_table[] = { { .vendor =FSL_MC_VENDOR_FREESCALE , .obj_type ="dprc" },
drivers/staging/fsl-mc/bus/mc-allocator.c +1 -1
@@ -717,7 +717,7 @@ static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)return 0 ; } -static const struct fsl_mc_device_match_id match_id_table[] = { +static const struct fsl_mc_device_id match_id_table[] = { { .vendor =FSL_MC_VENDOR_FREESCALE , .obj_type ="dpbp" ,
drivers/staging/fsl-mc/bus/mc-bus.c +1 -1
@@ -36,7 +36,7 @@ static bool fsl_mc_is_root_dprc(struct device *dev);*/ static int fsl_mc_bus_match (struct device *dev,struct device_driver *drv) { -const struct fsl_mc_device_match_id *id; +const struct fsl_mc_device_id *id;struct fsl_mc_device *mc_dev =to_fsl_mc_device (dev);struct fsl_mc_driver *mc_drv =to_fsl_mc_driver (drv);bool found = false;
drivers/staging/fsl-mc/include/mc.h +3 -7
@@ -39,7 +39,7 @@ struct fsl_mc_bus;*/ struct fsl_mc_driver {struct device_driver driver; -const struct fsl_mc_device_match_id *match_id_table; +const struct fsl_mc_device_id *match_id_table;int (*probe)(struct fsl_mc_device *dev);int (*remove)(struct fsl_mc_device *dev);void (*shutdown)(struct fsl_mc_device *dev);
@@ -51,20 +51,16 @@ struct fsl_mc_driver { container_of(_drv, struct fsl_mc_driver, driver)/** -* struct fsl_mc_device_match_id - MC object device Id entry for driver matching +* struct fsl_mc_device_id - MC object device Id entry for driver matching * @vendor: vendor ID * @obj_type: MC object type -* @ver_major: MC object version major number -* @ver_minor: MC object version minor number * * Type of entries in the "device Id" table for MC object devices supported by * a MC object device driver. The last entry of the table has vendor set to 0x0 */ -struct fsl_mc_device_match_id { +struct fsl_mc_device_id {u16 vendor;const char obj_type[16 ]; -u32 ver_major; -u32 ver_minor; };/**
Signature · 1 line
1.9.0
Re: [PATCH 03/11] staging: fsl-mc: clean up the device id struct
Quoted 4 lines · Stuart Yoder
(quoted diff) +0
-2-rename the struct used for fsl-mc device ids to be more consistent with other busses -remove the now obsolete and unused version fields
Quoted 8 lines
Signed-off-by Stuart Yoder <[email protected]>--- drivers/staging/fsl-mc/bus/dprc-driver.c | 2 +- drivers/staging/fsl-mc/bus/mc-allocator.c | 2 +- drivers/staging/fsl-mc/bus/mc-bus.c | 2 +- drivers/staging/fsl-mc/include/mc.h | 10 +++------- 4 files changed, 6 insertions(+), 10 deletions(-)
Quoted 76 lines
drivers/staging/fsl-mc/bus/dprc-driver.c +1
-1@@ -805,7 +805,7 @@ static int dprc_remove(struct fsl_mc_device *mc_dev)return 0 ; } -static const struct fsl_mc_device_match_id match_id_table[] = { +static const struct fsl_mc_device_id match_id_table[] = { { .vendor =FSL_MC_VENDOR_FREESCALE , .obj_type ="dprc" },drivers/staging/fsl-mc/bus/mc-allocator.c +1
-1@@ -717,7 +717,7 @@ static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)return 0 ; } -static const struct fsl_mc_device_match_id match_id_table[] = { +static const struct fsl_mc_device_id match_id_table[] = { { .vendor =FSL_MC_VENDOR_FREESCALE , .obj_type ="dpbp" ,drivers/staging/fsl-mc/bus/mc-bus.c +1
-1@@ -36,7 +36,7 @@ static bool fsl_mc_is_root_dprc(struct device *dev);*/ static int fsl_mc_bus_match (struct device *dev,struct device_driver *drv) { -const struct fsl_mc_device_match_id *id; +const struct fsl_mc_device_id *id;struct fsl_mc_device *mc_dev =to_fsl_mc_device (dev);struct fsl_mc_driver *mc_drv =to_fsl_mc_driver (drv);bool found = false;drivers/staging/fsl-mc/include/mc.h +3
-7@@ -39,7 +39,7 @@ struct fsl_mc_bus;*/ struct fsl_mc_driver {struct device_driver driver; -const struct fsl_mc_device_match_id *match_id_table; +const struct fsl_mc_device_id *match_id_table;int (*probe)(struct fsl_mc_device *dev);int (*remove)(struct fsl_mc_device *dev);void (*shutdown)(struct fsl_mc_device *dev);@@ -51,20 +51,16 @@ struct fsl_mc_driver { container_of(_drv, struct fsl_mc_driver, driver)/** -* struct fsl_mc_device_match_id - MC object device Id entry for driver matching +* struct fsl_mc_device_id - MC object device Id entry for driver matching * @vendor: vendor ID * @obj_type: MC object type -* @ver_major: MC object version major number -* @ver_minor: MC object version minor number * * Type of entries in the "device Id" table for MC object devices supported by * a MC object device driver. The last entry of the table has vendor set to 0x0 */ -struct fsl_mc_device_match_id { +struct fsl_mc_device_id {u16 vendor;const char obj_type[16 ]; -u32 ver_major; -u32 ver_minor; };/**
PATCH 4/11 staging: fsl-mc: add support for device table matching
In reply to Stuart YoderMove the definition of fsl_mc_device_id to its proper location in mod_devicetable.h, and add fsl-mc bus support to devicetable-offsets.c and file2alias.c to enable device table matching. With this patch udev based module loading of fsl-mc drivers is supported.
--- drivers/staging/fsl-mc/include/mc.h | 13 ------------- include/linux/mod_devicetable.h | 16 ++++++++++++++++ scripts/mod/devicetable-offsets.c | 4 ++++ scripts/mod/file2alias.c | 12 ++++++++++++ 4 files changed, 32 insertions(+), 13 deletions(-)
drivers/staging/fsl-mc/include/mc.h +0 -13
@@ -51,19 +51,6 @@ struct fsl_mc_driver { container_of(_drv, struct fsl_mc_driver, driver)/** -* struct fsl_mc_device_id - MC object device Id entry for driver matching -* @vendor: vendor ID -* @obj_type: MC object type -* -* Type of entries in the "device Id" table for MC object devices supported by -* a MC object device driver. The last entry of the table has vendor set to 0x0 - */ -struct fsl_mc_device_id { -u16 vendor; -const char obj_type[16 ]; -}; - -/** * enum fsl_mc_pool_type - Types of allocatable MC bus resources * * Entries in these enum are used as indices in the array of resource
include/linux/mod_devicetable.h +16 -0
@@ -657,4 +657,20 @@ struct ulpi_device_id { kernel_ulong_t driver_data; }; +/** +* struct fsl_mc_device_id - MC object device identifier +* @vendor: vendor ID +* @obj_type: MC object type +* @ver_major: MC object version major number +* @ver_minor: MC object version minor number +* +* Type of entries in the "device Id" table for MC object devices supported by +* a MC object device driver. The last entry of the table has vendor set to 0x0 +*/ +struct fsl_mc_device_id { +__u16 vendor; +const char obj_type[16 ]; +}; + +#endif /* LINUX_MOD_DEVICETABLE_H */
scripts/mod/devicetable-offsets.c +4 -0
@@ -202,5 +202,9 @@ int main(void)DEVID_FIELD (hda_device_id, rev_id);DEVID_FIELD (hda_device_id, api_version); +DEVID (fsl_mc_device_id); +DEVID_FIELD (fsl_mc_device_id, vendor); +DEVID_FIELD (fsl_mc_device_id, obj_type); +return 0 ; }
scripts/mod/file2alias.c +12 -0
@@ -1289,6 +1289,18 @@ static int do_hda_entry(const char *filename, void *symval, char *alias) }ADD_TO_DEVTABLE ("hdaudio" , hda_device_id, do_hda_entry); +/* Looks like: fsl-mc:vNdN */ +static int do_fsl_mc_entry (const char *filename,void *symval, +char *alias) +{ +DEF_FIELD (symval, fsl_mc_device_id, vendor); +DEF_FIELD_ADDR (symval, fsl_mc_device_id, obj_type); + +sprintf (alias,"fsl-mc:v%08Xd%s" , vendor, *obj_type); +return 1 ; +} +ADD_TO_DEVTABLE ("fslmc" , fsl_mc_device_id, do_fsl_mc_entry); +/* Does namelen bytes of name exactly match the symbol? */ static bool sym_is (const char *name,unsigned namelen,const char *symbol) {
Signature · 1 line
1.9.0
PATCH 5/11 staging: fsl-mc: export mc_get_version
In reply to Stuart Yodersome drivers (built as modules) rely on mc_get_version()
--- drivers/staging/fsl-mc/bus/dpmng.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/fsl-mc/bus/dpmng.c +1 -0
@@ -67,6 +67,7 @@ int mc_get_version(struct fsl_mc_io *mc_io,return 0 ; } +EXPORT_SYMBOL (mc_get_version);/** * dpmng_get_container_id() - Get container ID associated with a given portal.
Signature · 1 line
1.9.0
PATCH 6/11 staging: fsl-mc: make fsl_mc_is_root_dprc() global
In reply to Stuart Yodermake fsl_mc_is_root_dprc() global so that the dprc driver can use it
--- drivers/staging/fsl-mc/bus/mc-bus.c | 28 +++++++++++++--------------- drivers/staging/fsl-mc/include/mc.h | 2 ++ 2 files changed, 15 insertions(+), 15 deletions(-)
drivers/staging/fsl-mc/bus/mc-bus.c +13 -15
@@ -24,8 +24,6 @@static struct kmem_cache *mc_dev_cache; -static bool fsl_mc_is_root_dprc (struct device *dev); -/** * fsl_mc_bus_match - device to driver matching callback * @dev: the MC object device structure to match against
@@ -247,19 +245,6 @@ static void fsl_mc_get_root_dprc(struct device *dev, } } -/** -* fsl_mc_is_root_dprc - function to check if a given device is a root dprc -*/ -static bool fsl_mc_is_root_dprc (struct device *dev) -{ -struct device *root_dprc_dev; - -fsl_mc_get_root_dprc (dev, &root_dprc_dev); -if (!root_dprc_dev) -return false; -return dev == root_dprc_dev; -} -static int get_dprc_attr (struct fsl_mc_io *mc_io,int container_id,struct dprc_attributes *attr) {
@@ -424,6 +409,19 @@ error_cleanup_regions: }/** +* fsl_mc_is_root_dprc - function to check if a given device is a root dprc +*/ +bool fsl_mc_is_root_dprc (struct device *dev) +{ +struct device *root_dprc_dev; + +fsl_mc_get_root_dprc (dev, &root_dprc_dev); +if (!root_dprc_dev) +return false; +return dev == root_dprc_dev; +} + +/** * Add a newly discovered MC object device to be visible in Linux */ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
drivers/staging/fsl-mc/include/mc.h +2 -0
@@ -207,6 +207,8 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev);void fsl_mc_free_irqs (struct fsl_mc_device *mc_dev); +bool fsl_mc_is_root_dprc (struct device *dev); +extern struct bus_type fsl_mc_bus_type;#endif /* _FSL_MC_H_ */
Signature · 1 line
1.9.0
Re: [PATCH 06/11] staging: fsl-mc: make fsl_mc_is_root_dprc() global
Quoted 49 lines · Stuart Yoder
make
fsl_mc_is_root_dprc()global so that the dprc driver can use itSigned-off-by Stuart Yoder <[email protected]>--- drivers/staging/fsl-mc/bus/mc-bus.c | 28 +++++++++++++--------------- drivers/staging/fsl-mc/include/mc.h | 2 ++ 2 files changed, 15 insertions(+), 15 deletions(-)drivers/staging/fsl-mc/bus/mc-bus.c +3
-15@@ -24,8 +24,6 @@static struct kmem_cache *mc_dev_cache; -static bool fsl_mc_is_root_dprc (struct device *dev); -/** * fsl_mc_bus_match - device to driver matching callback * @dev: the MC object device structure to match against @@ -247,19 +245,6 @@ static void fsl_mc_get_root_dprc(struct device *dev, } } -/** -* fsl_mc_is_root_dprc - function to check if a given device is a root dprc -*/ -static bool fsl_mc_is_root_dprc (struct device *dev) -{ -struct device *root_dprc_dev; - -fsl_mc_get_root_dprc (dev, &root_dprc_dev); -if (!root_dprc_dev) -return false; -return dev == root_dprc_dev; -} -static int get_dprc_attr (struct fsl_mc_io *mc_io,int container_id,struct dprc_attributes *attr) {@@ -424,6 +409,19 @@ error_cleanup_regions: }/** +* fsl_mc_is_root_dprc - function to check if a given device is a root dprc +*/ +bool fsl_mc_is_root_dprc (struct device *dev)
drivers/staging/fsl-mc/bus/mc-bus.c error_cleanup_regions: · line 424
Quoted 10 lines
drivers/staging/fsl-mc/bus/mc-bus.c +10
-0+{ +struct device *root_dprc_dev; + +fsl_mc_get_root_dprc (dev, &root_dprc_dev); +if (!root_dprc_dev) +return false; +return dev == root_dprc_dev; +} + +/**
Is there any reason why apart from deleting "static" you move fsl_mc_is_root to a different line?
Regards,
Matthias
Quoted 17 lines
drivers/staging/fsl-mc/bus/mc-bus.c +0
-0* Add a newly discovered MC object device to be visible in Linux */ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,drivers/staging/fsl-mc/include/mc.h +2
-0@@ -207,6 +207,8 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev);void fsl_mc_free_irqs (struct fsl_mc_device *mc_dev); +bool fsl_mc_is_root_dprc (struct device *dev); +extern struct bus_type fsl_mc_bus_type;#endif /* _FSL_MC_H_ */
RE: [PATCH 06/11] staging: fsl-mc: make fsl_mc_is_root_dprc() global
Quoted 65 lines
-----Original Message-----
From: Matthias Brugger [mailto:[email protected]]
Sent: Wednesday, June 29, 2016 9:17 AM
To: Stuart Yoder <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Jose Rivera <[email protected]>; [email protected]; Yang-Leo Li <[email protected]>
Subject: Re: [PATCH 06/11] staging: fsl-mc: makefsl_mc_is_root_dprc()globalQuoted 54 lines · Stuart Yoder
make
fsl_mc_is_root_dprc()global so that the dprc driver can use itSigned-off-by Stuart Yoder <[email protected]>--- drivers/staging/fsl-mc/bus/mc-bus.c | 28 +++++++++++++--------------- drivers/staging/fsl-mc/include/mc.h | 2 ++ 2 files changed, 15 insertions(+), 15 deletions(-)drivers/staging/fsl-mc/bus/mc-bus.c +8
-15@@ -24,8 +24,6 @@static struct kmem_cache *mc_dev_cache; -static bool fsl_mc_is_root_dprc (struct device *dev); -/** * fsl_mc_bus_match - device to driver matching callback * @dev: the MC object device structure to match against @@ -247,19 +245,6 @@ static void fsl_mc_get_root_dprc(struct device *dev, } } -/** -* fsl_mc_is_root_dprc - function to check if a given device is a root dprc -*/ -static bool fsl_mc_is_root_dprc (struct device *dev) -{ -struct device *root_dprc_dev; - -fsl_mc_get_root_dprc (dev, &root_dprc_dev); -if (!root_dprc_dev) -return false; -return dev == root_dprc_dev; -} -static int get_dprc_attr (struct fsl_mc_io *mc_io,int container_id,struct dprc_attributes *attr) {@@ -424,6 +409,19 @@ error_cleanup_regions: }/** +* fsl_mc_is_root_dprc - function to check if a given device is a root dprc +*/ +bool fsl_mc_is_root_dprc (struct device *dev) +{ +struct device *root_dprc_dev; + +fsl_mc_get_root_dprc (dev, &root_dprc_dev); +if (!root_dprc_dev)
Quoted 8 lines
drivers/staging/fsl-mc/bus/mc-bus.c error_cleanup_regions: · line 424
Quoted 5 lines
drivers/staging/fsl-mc/bus/mc-bus.c +5
-0+return false; +return dev == root_dprc_dev; +} + +/** Is there any reason why apart from deleting "static" you move
fsl_mc_is_rootto a different line?
I moved it just to keep internal consistency inside the source file where all the static functions were grouped together in the first part of the file, and public functions were in the second part.
Stuart
Matthias Brugger
Reviewed-byRe: [PATCH 06/11] staging: fsl-mc: make fsl_mc_is_root_dprc() global
Quoted 74 lines · Stuart Yoder
Quoted 65 lines
-----Original Message-----
From: Matthias Brugger [mailto:[email protected]]
Sent: Wednesday, June 29, 2016 9:17 AM
To: Stuart Yoder <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Jose Rivera <[email protected]>; [email protected]; Yang-Leo Li <[email protected]>
Subject: Re: [PATCH 06/11] staging: fsl-mc: makefsl_mc_is_root_dprc()globalQuoted 54 lines · Stuart Yoder
make
fsl_mc_is_root_dprc()global so that the dprc driver can use itSigned-off-by Stuart Yoder <[email protected]>--- drivers/staging/fsl-mc/bus/mc-bus.c | 28 +++++++++++++--------------- drivers/staging/fsl-mc/include/mc.h | 2 ++ 2 files changed, 15 insertions(+), 15 deletions(-)drivers/staging/fsl-mc/bus/mc-bus.c +8
-15@@ -24,8 +24,6 @@static struct kmem_cache *mc_dev_cache; -static bool fsl_mc_is_root_dprc (struct device *dev); -/** * fsl_mc_bus_match - device to driver matching callback * @dev: the MC object device structure to match against @@ -247,19 +245,6 @@ static void fsl_mc_get_root_dprc(struct device *dev, } } -/** -* fsl_mc_is_root_dprc - function to check if a given device is a root dprc -*/ -static bool fsl_mc_is_root_dprc (struct device *dev) -{ -struct device *root_dprc_dev; - -fsl_mc_get_root_dprc (dev, &root_dprc_dev); -if (!root_dprc_dev) -return false; -return dev == root_dprc_dev; -} -static int get_dprc_attr (struct fsl_mc_io *mc_io,int container_id,struct dprc_attributes *attr) {@@ -424,6 +409,19 @@ error_cleanup_regions: }/** +* fsl_mc_is_root_dprc - function to check if a given device is a root dprc +*/ +bool fsl_mc_is_root_dprc (struct device *dev) +{ +struct device *root_dprc_dev; + +fsl_mc_get_root_dprc (dev, &root_dprc_dev); +if (!root_dprc_dev)Quoted 8 lines
drivers/staging/fsl-mc/bus/mc-bus.c error_cleanup_regions: · line 424
Quoted 5 lines
drivers/staging/fsl-mc/bus/mc-bus.c +5
-0+return false; +return dev == root_dprc_dev; +} + +/** Is there any reason why apart from deleting "static" you move
fsl_mc_is_rootto a different line?
Quoted 4 lines
I moved it just to keep internal consistency inside the source file where all the static functions were grouped together in the first part of the file, and public functions were in the second part.
Ok, thanks for clarification.
PATCH 7/11 staging: fsl-mc: fix asymmetry in destroy of mc_io
In reply to Stuart YoderFrom: Bharat Bhushan <[email protected]>
An mc_io represents a mapped MC portal. Previously, an mc_io was created for the root dprc in fsl_mc_bus_probe() and for child dprcs in dprc_probe(). But the free of that data structure happened in the general bus remove callback. This asymmetry resulted in some bugs due to unwanted destroys of mc_io object in some scenarios (e.g. vfio).
Fix this bug by making things symmetric-- mc_io created in fsl_mc_bus_probe() is freed in fsl_mc_bus_remove(). The mc_io created in dprc_probe() is freed in dprc_remove().
--- drivers/staging/fsl-mc/bus/dprc-driver.c | 5 +++++ drivers/staging/fsl-mc/bus/mc-bus.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/staging/fsl-mc/bus/dprc-driver.c +5 -0
@@ -801,6 +801,11 @@ static int dprc_remove(struct fsl_mc_device *mc_dev)dev_set_msi_domain (&mc_dev->dev,NULL ); } +if (!fsl_mc_is_root_dprc (&mc_dev->dev)) { +fsl_destroy_mc_io (mc_dev->mc_io); + mc_dev->mc_io =NULL ; + } +dev_info (&mc_dev->dev,"DPRC device unbound from driver" );return 0 ; }
drivers/staging/fsl-mc/bus/mc-bus.c +4 -4
@@ -579,10 +579,6 @@ void fsl_mc_device_remove(struct fsl_mc_device *mc_dev)if (strcmp (mc_dev->obj_desc.type,"dprc" ) ==0 ) { mc_bus =to_fsl_mc_bus (mc_dev); -if (mc_dev->mc_io) { -fsl_destroy_mc_io (mc_dev->mc_io); - mc_dev->mc_io =NULL ; - }if (fsl_mc_is_root_dprc (&mc_dev->dev)) {if (atomic_read (&root_dprc_count) >0 )
@@ -810,6 +806,10 @@ static int fsl_mc_bus_remove(struct platform_device *pdev)return -EINVAL ;fsl_mc_device_remove (mc->root_mc_bus_dev); + +fsl_destroy_mc_io (mc->root_mc_bus_dev->mc_io); + mc->root_mc_bus_dev->mc_io =NULL ; +dev_info (&pdev->dev,"Root MC bus device removed" );return 0 ; }
Signature · 1 line
1.9.0
PATCH 8/11 staging: fsl-mc: dprc: add missing irq free
In reply to Stuart Yoderadd missing free of the Linux irq when tearing down interrupts
--- drivers/staging/fsl-mc/bus/dprc-driver.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/staging/fsl-mc/bus/dprc-driver.c +5 -0
@@ -760,7 +760,12 @@ error_cleanup_msi_domain:*/ static void dprc_teardown_irq (struct fsl_mc_device *mc_dev) { +struct fsl_mc_device_irq *irq = mc_dev->irqs[0 ]; + (void )disable_dprc_irq (mc_dev); + +devm_free_irq (&mc_dev->dev, irq->msi_desc->irq, &mc_dev->dev); +fsl_mc_free_irqs (mc_dev); }
Signature · 1 line
1.9.0
PATCH 9/11 staging: fsl-mc: dprc: fix ordering problem freeing resources in remove of dprc
In reply to Stuart YoderWhen unbinding a dprc from the dprc driver the cleanup of the resource pools must happen after irq pool cleanup is done.
--- drivers/staging/fsl-mc/bus/dprc-driver.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/fsl-mc/bus/dprc-driver.c +6 -4
@@ -796,16 +796,18 @@ static int dprc_remove(struct fsl_mc_device *mc_dev)dprc_teardown_irq (mc_dev);device_for_each_child (&mc_dev->dev,NULL , __fsl_mc_device_remove); -dprc_cleanup_all_resource_pools (mc_dev); - error =dprc_close (mc_dev->mc_io,0 , mc_dev->mc_handle); -if (error <0 ) -dev_err (&mc_dev->dev,"dprc_close() failed: %d\n" , error);if (dev_get_msi_domain (&mc_dev->dev)) {fsl_mc_cleanup_irq_pool (mc_bus);dev_set_msi_domain (&mc_dev->dev,NULL ); } +dprc_cleanup_all_resource_pools (mc_dev); + + error =dprc_close (mc_dev->mc_io,0 , mc_dev->mc_handle); +if (error <0 ) +dev_err (&mc_dev->dev,"dprc_close() failed: %d\n" , error); +if (!fsl_mc_is_root_dprc (&mc_dev->dev)) {fsl_destroy_mc_io (mc_dev->mc_io); mc_dev->mc_io =NULL ;
Signature · 1 line
1.9.0
PATCH 10/11 staging: fsl-mc: properly set hwirq in msi set_desc
In reply to Stuart YoderFor an MSI domain the hwirq is an arbitrary but unique id to identify an interrupt. Previously the hwirq was set to the MSI index of the interrupt, but that only works if there is one DPRC. Additional DPRCs require an expanded namespace. Use both the ICID (which is unique per DPRC) and the MSI index to compose a hwirq value.
--- drivers/staging/fsl-mc/bus/mc-msi.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/staging/fsl-mc/bus/mc-msi.c +16 -1
@@ -20,11 +20,26 @@#include "../include/mc-sys.h" #include "dprc-cmd.h" +/* +* Generate a unique ID identifying the interrupt (only used within the MSI +* irqdomain. Combine the icid with the interrupt index. +*/ +static irq_hw_number_t fsl_mc_domain_calc_hwirq (struct fsl_mc_device *dev, +struct msi_desc *desc) +{ +/* +* Make the base hwirq value for ICID*10000 so it is readable +* as a decimal value in /proc/interrupts. +*/ +return (irq_hw_number_t)(desc->fsl_mc.msi_index + (dev->icid *10000 )); +} +static void fsl_mc_msi_set_desc (msi_alloc_info_t *arg,struct msi_desc *desc) { arg->desc = desc; - arg->hwirq = (irq_hw_number_t )desc->fsl_mc.msi_index; + arg->hwirq =fsl_mc_domain_calc_hwirq (to_fsl_mc_device (desc->dev), + desc); }static void fsl_mc_msi_update_dom_ops (struct msi_domain_info *info)
Signature · 1 line
1.9.0
PATCH 11/11 staging: fsl-mc: convert mc command build/parse to use C structs
In reply to Stuart YoderFrom: Ioana Radulescu <[email protected]>
The layer abstracting the building of commands and extracting responses is currently based on macros that shift and mask the command fields and requires exposing offset/size values as macro parameters and makes the code harder to read.
For clarity and maintainability, instead use an implementation based on mapping the MC command definitions to C structures. These structures contain the hardware command fields (which are naturally-aligned) and individual fields are little-endian ordering (the byte ordering of the hardware).
As such, there is no need to perform the conversion between core and hardware (LE) endianness in mc_send_command(), but instead each individual field in a command will be converted separately if needed by the function building the command or extracting the response.
This patch does not introduce functional changes, both the hardware ABIs and the APIs exposed for the DPAA2 objects remain the same.
--- drivers/staging/fsl-mc/bus/dpbp.c | 132 ++++-- drivers/staging/fsl-mc/bus/dpmcp-cmd.h | 86 +++- drivers/staging/fsl-mc/bus/dpmcp.c | 89 ++-- drivers/staging/fsl-mc/bus/dpmng-cmd.h | 12 +- drivers/staging/fsl-mc/bus/dpmng.c | 14 +- drivers/staging/fsl-mc/bus/dprc-cmd.h | 379 +++++++++++++++- drivers/staging/fsl-mc/bus/dprc.c | 715 ++++++++++-------------------- drivers/staging/fsl-mc/bus/mc-sys.c | 46 +- drivers/staging/fsl-mc/include/dpbp-cmd.h | 125 +++++- drivers/staging/fsl-mc/include/mc-cmd.h | 91 ++-- 10 files changed, 1056 insertions(+), 633 deletions(-)
drivers/staging/fsl-mc/bus/dpbp.c +84 -48
@@ -1,4 +1,4 @@ -/* Copyright 2013-2014 Freescale Semiconductor Inc. +/* Copyright 2013-2016 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met:
@@ -57,12 +57,14 @@ int dpbp_open(struct fsl_mc_io *mc_io, u16 *token) {struct mc_command cmd = {0 }; +struct dpbp_cmd_open *cmd_params;int err;/* prepare command */ cmd.header =mc_encode_cmd_header (DPBP_CMDID_OPEN , cmd_flags,0 ); - cmd.params[0 ] |=mc_enc (0 ,32 , dpbp_id); + cmd_params = (struct dpbp_cmd_open *)cmd.params; + cmd_params->dpbp_id =cpu_to_le32 (dpbp_id);/* send command to mc*/ err =mc_send_command (mc_io, &cmd);
@@ -70,7 +72,7 @@ int dpbp_open(struct fsl_mc_io *mc_io,return err;/* retrieve response parameters */ - *token =MC_CMD_HDR_READ_TOKEN (cmd.header); + *token =mc_cmd_hdr_read_token (&cmd);return err; }
@@ -143,7 +145,7 @@ int dpbp_create(struct fsl_mc_io *mc_io,return err;/* retrieve response parameters */ - *token =MC_CMD_HDR_READ_TOKEN (cmd.header); + *token =mc_cmd_hdr_read_token (&cmd);return 0 ; }
@@ -231,6 +233,7 @@ int dpbp_is_enabled(struct fsl_mc_io *mc_io, int *en) {struct mc_command cmd = {0 }; +struct dpbp_rsp_is_enabled *rsp_params;int err;/* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, cmd_flags,
@@ -242,7 +245,8 @@ int dpbp_is_enabled(struct fsl_mc_io *mc_io,return err;/* retrieve response parameters */ - *en = (int )mc_dec (cmd.params[0 ],0 ,1 ); + rsp_params = (struct dpbp_rsp_is_enabled *)cmd.params; + *en = rsp_params->enabled &DPBP_ENABLE ;return 0 ; }
@@ -286,14 +290,16 @@ int dpbp_set_irq(struct fsl_mc_io *mc_io, struct dpbp_irq_cfg *irq_cfg) {struct mc_command cmd = {0 }; +struct dpbp_cmd_set_irq *cmd_params;/* prepare command */ cmd.header =mc_encode_cmd_header (DPBP_CMDID_SET_IRQ , cmd_flags, token); - cmd.params[0 ] |=mc_enc (0 ,8 , irq_index); - cmd.params[0 ] |=mc_enc (32 ,32 , irq_cfg->val); - cmd.params[1 ] |=mc_enc (0 ,64 , irq_cfg->addr); - cmd.params[2 ] |=mc_enc (0 ,32 , irq_cfg->irq_num); + cmd_params = (struct dpbp_cmd_set_irq *)cmd.params; + cmd_params->irq_index = irq_index; + cmd_params->irq_val =cpu_to_le32 (irq_cfg->val); + cmd_params->irq_addr =cpu_to_le64 (irq_cfg->addr); + cmd_params->irq_num =cpu_to_le32 (irq_cfg->irq_num);/* send command to mc*/ return mc_send_command (mc_io, &cmd);
@@ -319,12 +325,15 @@ int dpbp_get_irq(struct fsl_mc_io *mc_io, struct dpbp_irq_cfg *irq_cfg) {struct mc_command cmd = {0 }; +struct dpbp_cmd_get_irq *cmd_params; +struct dpbp_rsp_get_irq *rsp_params;int err;/* prepare command */ cmd.header =mc_encode_cmd_header (DPBP_CMDID_GET_IRQ , cmd_flags, token); - cmd.params[0 ] |=mc_enc (32 ,8 , irq_index); + cmd_params = (struct dpbp_cmd_get_irq *)cmd.params; + cmd_params->irq_index = irq_index;/* send command to mc*/ err =mc_send_command (mc_io, &cmd);
@@ -332,10 +341,12 @@ int dpbp_get_irq(struct fsl_mc_io *mc_io,return err;/* retrieve response parameters */ - irq_cfg->val = (u32 )mc_dec (cmd.params[0 ],0 ,32 ); - irq_cfg->addr = (u64 )mc_dec (cmd.params[1 ],0 ,64 ); - irq_cfg->irq_num = (int )mc_dec (cmd.params[2 ],0 ,32 ); - *type = (int )mc_dec (cmd.params[2 ],32 ,32 ); + rsp_params = (struct dpbp_rsp_get_irq *)cmd.params; + irq_cfg->val =le32_to_cpu (rsp_params->irq_val); + irq_cfg->addr =le64_to_cpu (rsp_params->irq_addr); + irq_cfg->irq_num =le32_to_cpu (rsp_params->irq_num); + *type =le32_to_cpu (rsp_params->type); +return 0 ; }
@@ -361,12 +372,14 @@ int dpbp_set_irq_enable(struct fsl_mc_io *mc_io, u8 en) {struct mc_command cmd = {0 }; +struct dpbp_cmd_set_irq_enable *cmd_params;/* prepare command */ cmd.header =mc_encode_cmd_header (DPBP_CMDID_SET_IRQ_ENABLE , cmd_flags, token); - cmd.params[0 ] |=mc_enc (0 ,8 , en); - cmd.params[0 ] |=mc_enc (32 ,8 , irq_index); + cmd_params = (struct dpbp_cmd_set_irq_enable *)cmd.params; + cmd_params->enable = en &DPBP_ENABLE ; + cmd_params->irq_index = irq_index;/* send command to mc*/ return mc_send_command (mc_io, &cmd);
@@ -389,12 +402,15 @@ int dpbp_get_irq_enable(struct fsl_mc_io *mc_io, u8 *en) {struct mc_command cmd = {0 }; +struct dpbp_cmd_get_irq_enable *cmd_params; +struct dpbp_rsp_get_irq_enable *rsp_params;int err;/* prepare command */ cmd.header =mc_encode_cmd_header (DPBP_CMDID_GET_IRQ_ENABLE , cmd_flags, token); - cmd.params[0 ] |=mc_enc (32 ,8 , irq_index); + cmd_params = (struct dpbp_cmd_get_irq_enable *)cmd.params; + cmd_params->irq_index = irq_index;/* send command to mc*/ err =mc_send_command (mc_io, &cmd);
@@ -402,7 +418,8 @@ int dpbp_get_irq_enable(struct fsl_mc_io *mc_io,return err;/* retrieve response parameters */ - *en = (u8 )mc_dec (cmd.params[0 ],0 ,8 ); + rsp_params = (struct dpbp_rsp_get_irq_enable *)cmd.params; + *en = rsp_params->enabled &DPBP_ENABLE ;return 0 ; }
@@ -429,12 +446,14 @@ int dpbp_set_irq_mask(struct fsl_mc_io *mc_io, u32 mask) {struct mc_command cmd = {0 }; +struct dpbp_cmd_set_irq_mask *cmd_params;/* prepare command */ cmd.header =mc_encode_cmd_header (DPBP_CMDID_SET_IRQ_MASK , cmd_flags, token); - cmd.params[0 ] |=mc_enc (0 ,32 , mask); - cmd.params[0 ] |=mc_enc (32 ,8 , irq_index); + cmd_params = (struct dpbp_cmd_set_irq_mask *)cmd.params; + cmd_params->mask =cpu_to_le32 (mask); + cmd_params->irq_index = irq_index;/* send command to mc*/ return mc_send_command (mc_io, &cmd);
@@ -460,12 +479,15 @@ int dpbp_get_irq_mask(struct fsl_mc_io *mc_io, u32 *mask) {struct mc_command cmd = {0 }; +struct dpbp_cmd_get_irq_mask *cmd_params; +struct dpbp_rsp_get_irq_mask *rsp_params;int err;/* prepare command */ cmd.header =mc_encode_cmd_header (DPBP_CMDID_GET_IRQ_MASK , cmd_flags, token); - cmd.params[0 ] |=mc_enc (32 ,8 , irq_index); + cmd_params = (struct dpbp_cmd_get_irq_mask *)cmd.params; + cmd_params->irq_index = irq_index;/* send command to mc*/ err =mc_send_command (mc_io, &cmd);
@@ -473,7 +495,9 @@ int dpbp_get_irq_mask(struct fsl_mc_io *mc_io,return err;/* retrieve response parameters */ - *mask = (u32 )mc_dec (cmd.params[0 ],0 ,32 ); + rsp_params = (struct dpbp_rsp_get_irq_mask *)cmd.params; + *mask =le32_to_cpu (rsp_params->mask); +return 0 ; }
@@ -497,13 +521,16 @@ int dpbp_get_irq_status(struct fsl_mc_io *mc_io, u32 *status) {struct mc_command cmd = {0 }; +struct dpbp_cmd_get_irq_status *cmd_params; +struct dpbp_rsp_get_irq_status *rsp_params;int err;/* prepare command */ cmd.header =mc_encode_cmd_header (DPBP_CMDID_GET_IRQ_STATUS , cmd_flags, token); - cmd.params[0 ] |=mc_enc (0 ,32 , *status); - cmd.params[0 ] |=mc_enc (32 ,8 , irq_index); + cmd_params = (struct dpbp_cmd_get_irq_status *)cmd.params; + cmd_params->status =cpu_to_le32 (*status); + cmd_params->irq_index = irq_index;/* send command to mc*/ err =mc_send_command (mc_io, &cmd);
@@ -511,7 +538,9 @@ int dpbp_get_irq_status(struct fsl_mc_io *mc_io,return err;/* retrieve response parameters */ - *status = (u32 )mc_dec (cmd.params[0 ],0 ,32 ); + rsp_params = (struct dpbp_rsp_get_irq_status *)cmd.params; + *status =le32_to_cpu (rsp_params->status); +return 0 ; }
@@ -535,12 +564,14 @@ int dpbp_clear_irq_status(struct fsl_mc_io *mc_io, u32 status) {struct mc_command cmd = {0 }; +struct dpbp_cmd_clear_irq_status *cmd_params;/* prepare command */ cmd.header =mc_encode_cmd_header (DPBP_CMDID_CLEAR_IRQ_STATUS , cmd_flags, token); - cmd.params[0 ] |=mc_enc (0 ,32 , status); - cmd.params[0 ] |=mc_enc (32 ,8 , irq_index); + cmd_params = (struct dpbp_cmd_clear_irq_status *)cmd.params; + cmd_params->status =cpu_to_le32 (status); + cmd_params->irq_index = irq_index;/* send command to mc*/ return mc_send_command (mc_io, &cmd);
@@ -562,6 +593,7 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io, struct dpbp_attr *attr) {struct mc_command cmd = {0 }; +struct dpbp_rsp_get_attributes *rsp_params;int err;/* prepare command */
@@ -574,10 +606,12 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,return err;/* retrieve response parameters */ - attr->bpid = (u16 )mc_dec (cmd.params[0 ],16 ,16 ); - attr->id = (int )mc_dec (cmd.params[0 ],32 ,32 ); - attr->version.major = (u16 )mc_dec (cmd.params[1 ],0 ,16 ); - attr->version.minor = (u16 )mc_dec (cmd.params[1 ],16 ,16 ); + rsp_params = (struct dpbp_rsp_get_attributes *)cmd.params; + attr->bpid =le16_to_cpu (rsp_params->bpid); + attr->id =le32_to_cpu (rsp_params->id); + attr->version.major =le16_to_cpu (rsp_params->version_major); + attr->version.minor =le16_to_cpu (rsp_params->version_minor); +return 0 ; }EXPORT_SYMBOL (dpbp_get_attributes);
@@ -597,19 +631,19 @@ int dpbp_set_notifications(struct fsl_mc_io *mc_io, struct dpbp_notification_cfg *cfg) {struct mc_command cmd = {0 }; +struct dpbp_cmd_set_notifications *cmd_params;/* prepare command */ cmd.header =mc_encode_cmd_header (DPBP_CMDID_SET_NOTIFICATIONS , - cmd_flags, - token); - - cmd.params[0 ] |=mc_enc (0 ,32 , cfg->depletion_entry); - cmd.params[0 ] |=mc_enc (32 ,32 , cfg->depletion_exit); - cmd.params[1 ] |=mc_enc (0 ,32 , cfg->surplus_entry); - cmd.params[1 ] |=mc_enc (32 ,32 , cfg->surplus_exit); - cmd.params[2 ] |=mc_enc (0 ,16 , cfg->options); - cmd.params[3 ] |=mc_enc (0 ,64 , cfg->message_ctx); - cmd.params[4 ] |=mc_enc (0 ,64 , cfg->message_iova); + cmd_flags, token); + cmd_params = (struct dpbp_cmd_set_notifications *)cmd.params; + cmd_params->depletion_entry =cpu_to_le32 (cfg->depletion_entry); + cmd_params->depletion_exit =cpu_to_le32 (cfg->depletion_exit); + cmd_params->surplus_entry =cpu_to_le32 (cfg->surplus_entry); + cmd_params->surplus_exit =cpu_to_le32 (cfg->surplus_exit); + cmd_params->options =cpu_to_le16 (cfg->options); + cmd_params->message_ctx =cpu_to_le64 (cfg->message_ctx); + cmd_params->message_iova =cpu_to_le64 (cfg->message_iova);/* send command to mc*/ return mc_send_command (mc_io, &cmd);
@@ -630,6 +664,7 @@ int dpbp_get_notifications(struct fsl_mc_io *mc_io, struct dpbp_notification_cfg *cfg) {struct mc_command cmd = {0 }; +struct dpbp_rsp_get_notifications *rsp_params;int err;/* prepare command */
@@ -643,13 +678,14 @@ int dpbp_get_notifications(struct fsl_mc_io *mc_io,return err;/* retrieve response parameters */ - cfg->depletion_entry = (u32 )mc_dec (cmd.params[0 ],0 ,32 ); - cfg->depletion_exit = (u32 )mc_dec (cmd.params[0 ],32 ,32 ); - cfg->surplus_entry = (u32 )mc_dec (cmd.params[1 ],0 ,32 ); - cfg->surplus_exit = (u32 )mc_dec (cmd.params[1 ],32 ,32 ); - cfg->options = (u16 )mc_dec (cmd.params[2 ],0 ,16 ); - cfg->message_ctx = (u64 )mc_dec (cmd.params[3 ],0 ,64 ); - cfg->message_iova = (u64 )mc_dec (cmd.params[4 ],0 ,64 ); + rsp_params = (struct dpbp_rsp_get_notifications *)cmd.params; + cfg->depletion_entry =le32_to_cpu (rsp_params->depletion_entry); + cfg->depletion_exit =le32_to_cpu (rsp_params->depletion_exit); + cfg->surplus_entry =le32_to_cpu (rsp_params->surplus_entry); + cfg->surplus_exit =le32_to_cpu (rsp_params->surplus_exit); + cfg->options =le16_to_cpu (rsp_params->options); + cfg->message_ctx =le64_to_cpu (rsp_params->message_ctx); + cfg->message_iova =le64_to_cpu (rsp_params->message_iova);return 0 ; }
drivers/staging/fsl-mc/bus/dpmcp-cmd.h +85 -1
93 lines not on this page · raw message
drivers/staging/fsl-mc/bus/dpmcp.c +62 -27
235 lines not on this page · raw message
drivers/staging/fsl-mc/bus/dpmng-cmd.h +11 -1
@@ -1,4 +1,4 @@ -/* Copyright 2013-2014 Freescale Semiconductor Inc. +/* Copyright 2013-2016 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met:
@@ -44,4 +44,14 @@#define DPMNG_CMDID_GET_CONT_ID 0x830#define DPMNG_CMDID_GET_VERSION 0x831 +struct dpmng_rsp_get_container_id { +__le32 container_id; +}; + +struct dpmng_rsp_get_version { +__le32 revision; +__le32 version_major; +__le32 version_minor; +}; +#endif /* __FSL_DPMNG_CMD_H */
drivers/staging/fsl-mc/bus/dpmng.c +9 -5
@@ -1,4 +1,4 @@ -/* Copyright 2013-2014 Freescale Semiconductor Inc. +/* Copyright 2013-2016 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met:
@@ -48,6 +48,7 @@ int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info) {struct mc_command cmd = {0 }; +struct dpmng_rsp_get_version *rsp_params;int err;/* prepare command */
@@ -61,9 +62,10 @@ int mc_get_version(struct fsl_mc_io *mc_io,return err;/* retrieve response parameters */ - mc_ver_info->revision =mc_dec (cmd.params[0 ],0 ,32 ); - mc_ver_info->major =mc_dec (cmd.params[0 ],32 ,32 ); - mc_ver_info->minor =mc_dec (cmd.params[1 ],0 ,32 ); + rsp_params = (struct dpmng_rsp_get_version *)cmd.params; + mc_ver_info->revision =le32_to_cpu (rsp_params->revision); + mc_ver_info->major =le32_to_cpu (rsp_params->version_major); + mc_ver_info->minor =le32_to_cpu (rsp_params->version_minor);return 0 ; }
@@ -82,6 +84,7 @@ int dpmng_get_container_id(struct fsl_mc_io *mc_io, int *container_id) {struct mc_command cmd = {0 }; +struct dpmng_rsp_get_container_id *rsp_params;int err;/* prepare command */
@@ -95,7 +98,8 @@ int dpmng_get_container_id(struct fsl_mc_io *mc_io,return err;/* retrieve response parameters */ - *container_id =mc_dec (cmd.params[0 ],0 ,32 ); + rsp_params = (struct dpmng_rsp_get_container_id *)cmd.params; + *container_id =le32_to_cpu (rsp_params->container_id);return 0 ; }
drivers/staging/fsl-mc/bus/dprc-cmd.h +378 -1
386 lines not on this page · raw message
drivers/staging/fsl-mc/bus/dprc.c +240 -475
1,150 lines not on this page · raw message
drivers/staging/fsl-mc/bus/mc-sys.c +29 -17
89 lines not on this page · raw message
drivers/staging/fsl-mc/include/dpbp-cmd.h +124 -1
132 lines not on this page · raw message
drivers/staging/fsl-mc/include/mc-cmd.h +34 -57
112 lines not on this page · raw message
Signature · 1 line
1.9.0