mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
qcacmn: Abstraction mechanism for OS API's
Provide support for abstraction layer for OS API's. Change-Id: I1f51350c2ae4c35330aa7355e9cd20fa28aad194 CRs-Fixed: 2222560
This commit is contained in:
parent
8e3eb14984
commit
008baa9b4d
11 changed files with 966 additions and 2 deletions
10
qdf/Kbuild
10
qdf/Kbuild
|
|
@ -15,6 +15,7 @@ INCS += -Iinclude/nbuf -Iinclude/net -Iinclude/os
|
|||
INCS += -Inbuf/linux -Inet/linux -Ios/linux
|
||||
INCS += -I$(WLAN_TOP)/../../include
|
||||
INCS += -I$(WLAN_TOP)/cmn_dev/qdf/inc
|
||||
INCS += -I$(WLAN_TOP)/cmn_dev/qal/inc
|
||||
INCS += -I$(WLAN_TOP)/cmn_dev/qdf/linux/src
|
||||
INCS += -I$(obj)/$(HOST_CMN_CONVG_PTT)/inc \
|
||||
-I$(obj)/$(HOST_CMN_CONVG_NLINK)/inc \
|
||||
|
|
@ -34,22 +35,27 @@ endif
|
|||
|
||||
qdf-objs := \
|
||||
linux/src/qdf_defer.o \
|
||||
linux/src/qdf_dev.o \
|
||||
linux/src/qdf_event.o \
|
||||
linux/src/qdf_file.o \
|
||||
linux/src/qdf_list.o \
|
||||
linux/src/qdf_lock.o \
|
||||
linux/src/qdf_mc_timer.o \
|
||||
linux/src/qdf_mem.o \
|
||||
linux/src/qdf_module.o \
|
||||
linux/src/qdf_net_if.o \
|
||||
linux/src/qdf_nbuf.o \
|
||||
linux/src/qdf_perf.o \
|
||||
linux/src/qdf_threads.o \
|
||||
linux/src/qdf_trace.o \
|
||||
linux/src/qdf_file.o \
|
||||
linux/src/qdf_vfs.o \
|
||||
src/qdf_flex_mem.o \
|
||||
src/qdf_parse.o \
|
||||
src/qdf_str.o \
|
||||
src/qdf_types.o \
|
||||
$(HOST_CMN_CONVG_NLINK)/src/wlan_nlink_srv.o
|
||||
$(HOST_CMN_CONVG_NLINK)/src/wlan_nlink_srv.o \
|
||||
$(HOST_CMN_CONVG_SRC)/qal/linux/src/qal_devcfg.o \
|
||||
$(HOST_CMN_CONVG_SRC)/qal/linux/src/qal_vbus_dev.o \
|
||||
#linux/src/qdf_net.o \
|
||||
#linux/src/qdf_net_event.o \
|
||||
#linux/src/qdf_net_ioctl.o
|
||||
|
|
|
|||
85
qdf/inc/qdf_dev.h
Normal file
85
qdf/inc/qdf_dev.h
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: qdf_dev
|
||||
* QCA driver framework (QDF) device management APIs
|
||||
*/
|
||||
|
||||
#if !defined(__QDF_DEV_H)
|
||||
#define __QDF_DEV_H
|
||||
|
||||
/* Include Files */
|
||||
#include <qdf_types.h>
|
||||
|
||||
struct qdf_cpu_mask;
|
||||
struct qdf_devm;
|
||||
|
||||
/**
|
||||
* qdf_dev_alloc_mem() - allocate memory
|
||||
* @qdfdev: Device handle
|
||||
* @mrptr: Pointer to the allocated memory
|
||||
* @reqsize: Allocation request in bytes
|
||||
* @mask: Property mask to be associated to the allocated memory
|
||||
*
|
||||
* This function will acquire memory to be associated with a device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_dev_alloc_mem(qdf_device_t qdfdev, struct qdf_devm **mrptr,
|
||||
uint32_t reqsize, uint32_t mask);
|
||||
|
||||
/**
|
||||
* qdf_dev_release_mem() - release memory
|
||||
* @qdfdev: Device handle
|
||||
* @mrptr: Pointer to the allocated memory
|
||||
*
|
||||
* This function will acquire memory to be associated with a device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_dev_release_mem(qdf_device_t qdfdev, struct qdf_devm *mrptr);
|
||||
|
||||
/**
|
||||
* qdf_dev_modify_irq() - modify irq
|
||||
* @irnum: irq number
|
||||
* @cmask: Bitmap to be cleared for the property mask
|
||||
* @smask: Bitmap to be set for the property mask
|
||||
*
|
||||
* This function will acquire memory to be associated with a device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_dev_modify_irq_status(uint32_t irnum, unsigned long cmask,
|
||||
unsigned long smask);
|
||||
|
||||
/**
|
||||
* qdf_dev_set_irq_affinity() - set irq affinity
|
||||
* @irnum: irq number
|
||||
* @cpmask: cpu affinity bitmap
|
||||
*
|
||||
* This function will set the affinity level for an irq
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_dev_set_irq_affinity(uint32_t irnum, struct qdf_cpu_mask *cpmask);
|
||||
#endif
|
||||
42
qdf/inc/qdf_net_if.h
Normal file
42
qdf/inc/qdf_net_if.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: qdf_net_if
|
||||
* QCA driver framework (QDF) network interface management APIs
|
||||
*/
|
||||
|
||||
#if !defined(__QDF_NET_IF_H)
|
||||
#define __QDF_NET_IF_H
|
||||
|
||||
/* Include Files */
|
||||
#include <qdf_types.h>
|
||||
|
||||
struct qdf_net_if;
|
||||
|
||||
/**
|
||||
* qdf_net_if_create_dummy_if() - create dummy interface
|
||||
* @nif: interface handle
|
||||
*
|
||||
* This function will create a dummy network interface
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_net_if_create_dummy_if(struct qdf_net_if *nif);
|
||||
#endif
|
||||
85
qdf/inc/qdf_vfs.h
Normal file
85
qdf/inc/qdf_vfs.h
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: qdf_vfs
|
||||
* QCA driver framework (QDF) virtual filesystem management APIs
|
||||
*/
|
||||
|
||||
#if !defined(__QDF_VFS_H)
|
||||
#define __QDF_VFS_H
|
||||
|
||||
/* Include Files */
|
||||
#include <qdf_types.h>
|
||||
|
||||
struct qdf_vfs_attr;
|
||||
struct qdf_vf_bin_attr;
|
||||
struct qdf_dev_obj;
|
||||
|
||||
/**
|
||||
* qdf_vfs_set_file_attributes() - set file attributes
|
||||
* @devobj: Device object
|
||||
* @attr: File attribute
|
||||
*
|
||||
* This function will set the attributes of a file
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_vfs_set_file_attributes(struct qdf_dev_obj *devobj,
|
||||
struct qdf_vfs_attr *attr);
|
||||
|
||||
/**
|
||||
* qdf_vfs_clear_file_attributes() - clear file attributes
|
||||
* @devobj: Device object
|
||||
* @attr: File attribute
|
||||
*
|
||||
* This function will clear the attributes of a file
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_vfs_clear_file_attributes(struct qdf_dev_obj *devobj,
|
||||
struct qdf_vfs_attr *attr);
|
||||
|
||||
/**
|
||||
* qdf_vfs_create_binfile() - create binfile
|
||||
* @devobj: Device object
|
||||
* @attr: File attribute
|
||||
*
|
||||
* This function will create a binary file
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_vfs_create_binfile(struct qdf_dev_obj *devobj,
|
||||
struct qdf_vf_bin_attr *attr);
|
||||
|
||||
/**
|
||||
* qdf_vfs_delete_binfile() - delete binfile
|
||||
* @devobj: Device object
|
||||
* @attr: File attribute
|
||||
*
|
||||
* This function will delete a binary file
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_vfs_delete_binfile(struct qdf_dev_obj *devobj,
|
||||
struct qdf_vf_bin_attr *attr);
|
||||
#endif
|
||||
91
qdf/linux/src/qdf_dev.c
Normal file
91
qdf/linux/src/qdf_dev.c
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: qdf_dev
|
||||
* This file provides OS dependent device related APIs
|
||||
*/
|
||||
|
||||
#include "qdf_dev.h"
|
||||
#include "qdf_mem.h"
|
||||
#include "qdf_util.h"
|
||||
#include "qdf_module.h"
|
||||
#include <linux/irq.h>
|
||||
|
||||
QDF_STATUS
|
||||
qdf_dev_alloc_mem(qdf_device_t qdfdev, struct qdf_devm **mrptr,
|
||||
uint32_t reqsize, uint32_t mask)
|
||||
{
|
||||
struct qdf_devm *mptr;
|
||||
|
||||
if (!qdfdev)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
mptr = devm_kzalloc(qdfdev->dev, reqsize, mask);
|
||||
|
||||
if (!mrptr)
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
|
||||
*mrptr = mptr;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_dev_alloc_mem);
|
||||
|
||||
QDF_STATUS
|
||||
qdf_dev_release_mem(qdf_device_t qdfdev, struct qdf_devm *mrptr)
|
||||
{
|
||||
if (!mrptr)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
devm_kfree(qdfdev->dev, mrptr);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_dev_release_mem);
|
||||
|
||||
QDF_STATUS
|
||||
qdf_dev_modify_irq_status(uint32_t irnum, unsigned long cmask,
|
||||
unsigned long smask)
|
||||
{
|
||||
if (irnum <= 0)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
irq_modify_status(irnum, cmask, smask);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_dev_modify_irq_status);
|
||||
|
||||
QDF_STATUS
|
||||
qdf_dev_set_irq_affinity(uint32_t irnum, struct qdf_cpu_mask *cpmask)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (irnum <= 0)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = irq_set_affinity_hint(irnum, (struct cpumask *)cpmask);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_dev_set_irq_affinity);
|
||||
43
qdf/linux/src/qdf_net_if.c
Normal file
43
qdf/linux/src/qdf_net_if.c
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: qdf_net_if
|
||||
* This file provides OS dependent network interface related APIs
|
||||
*/
|
||||
|
||||
#include "qdf_net_if.h"
|
||||
#include "qdf_types.h"
|
||||
#include "qdf_module.h"
|
||||
#include "qdf_util.h"
|
||||
#include <linux/netdevice.h>
|
||||
|
||||
QDF_STATUS
|
||||
qdf_net_if_create_dummy_if(struct qdf_net_if *nif)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!nif)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = init_dummy_netdev((struct net_device *)nif);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_net_if_create_dummy_if);
|
||||
90
qdf/linux/src/qdf_vfs.c
Normal file
90
qdf/linux/src/qdf_vfs.c
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: qdf_vfs
|
||||
* This file provides OS dependent virtual fiesystem APIs
|
||||
*/
|
||||
|
||||
#include "qdf_vfs.h"
|
||||
#include "qdf_util.h"
|
||||
#include "qdf_module.h"
|
||||
#include <linux/string.h>
|
||||
#include <linux/kobject.h>
|
||||
|
||||
QDF_STATUS
|
||||
qdf_vfs_set_file_attributes(struct qdf_dev_obj *devobj,
|
||||
struct qdf_vfs_attr *attr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!devobj || !attr)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = sysfs_create_group((struct kobject *)devobj,
|
||||
(struct attribute_group *)attr);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_vfs_set_file_attributes);
|
||||
|
||||
QDF_STATUS
|
||||
qdf_vfs_clear_file_attributes(struct qdf_dev_obj *devobj,
|
||||
struct qdf_vfs_attr *attr)
|
||||
{
|
||||
if (!devobj || !attr)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
sysfs_remove_group((struct kobject *)devobj,
|
||||
(struct attribute_group *)attr);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_vfs_clear_file_attributes);
|
||||
|
||||
QDF_STATUS
|
||||
qdf_vfs_create_binfile(struct qdf_dev_obj *devobj, struct qdf_vf_bin_attr *attr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!devobj || !attr)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = sysfs_create_bin_file((struct kobject *)devobj,
|
||||
(struct bin_attribute *)attr);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_vfs_create_binfile);
|
||||
|
||||
QDF_STATUS
|
||||
qdf_vfs_delete_binfile(struct qdf_dev_obj *devobj, struct qdf_vf_bin_attr *attr)
|
||||
{
|
||||
if (!devobj || !attr)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
sysfs_remove_bin_file((struct kobject *)devobj,
|
||||
(struct bin_attribute *)attr);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_vfs_delete_binfile);
|
||||
Loading…
Reference in a new issue