diff --git a/qdf/inc/qdf_hang_event_notifier.h b/qdf/inc/qdf_hang_event_notifier.h new file mode 100644 index 000000000000..f13787393948 --- /dev/null +++ b/qdf/inc/qdf_hang_event_notifier.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2020, 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_hang_event_notifier + * This file provides OS dependent QDF notifier call for hang event + */ + +#ifndef QDF_HANG_EVENT_NOTIFIER_H +#define QDF_HANG_EVENT_NOTIFIER_H + +#include + +#define QDF_HANG_EVENT_VERSION "1.0" +#define QDF_HANG_EVENT_DATA_SIZE 784 + +/** + * qdf_notifier_data - Private data for notifier data + * @hang_data: Data filled by notifier + * @offset: Current offset of the hang data buffer + */ +struct qdf_notifer_data { + uint8_t *hang_data; + unsigned int offset; +}; + +#ifdef WLAN_HANG_EVENT +/** + * qdf_hang_event_register_notifier() - Hang data notifier register + * @nb: Notifier block + * + * This function registers notifier block for the hang data notifier chain + * the registered function will be invoked when the hang data notifier call + * is invoked. + * + * Return: QDF_STATUS + */ +QDF_STATUS qdf_hang_event_register_notifier(qdf_notif_block *nb); + +/** + * qdf_hang_event_unregister_notifier() - Hang data notifier unregister + * @nb: Notifier block + * + * This function unregisters notifier block for the hang data notifier chain. + * + * Return: QDF_STATUS + */ +QDF_STATUS qdf_hang_event_unregister_notifier(qdf_notif_block *nb); + +/** + * qdf_hang_event_notifier_call() - Hang data notifier register + * @v: state + * @data: Private data for this notifier chain + * + * This function when invoked will call the functions registered with this + * notifier chain. + * + * Return: QDF_STATUS + */ +QDF_STATUS qdf_hang_event_notifier_call(unsigned long v, void *data); +#else +static inline +QDF_STATUS qdf_hang_event_register_notifier(qdf_notif_block *nb) +{ + return QDF_STATUS_SUCCESS; +} + +static inline +QDF_STATUS qdf_hang_event_unregister_notifier(qdf_notif_block *nb) +{ + return QDF_STATUS_SUCCESS; +} + +static inline +QDF_STATUS qdf_hang_event_notifier_call(unsigned long v, void *data) +{ + return QDF_STATUS_SUCCESS; +} +#endif +#endif diff --git a/qdf/src/qdf_hang_event_notifier.c b/qdf/src/qdf_hang_event_notifier.c new file mode 100644 index 000000000000..09b1761b6517 --- /dev/null +++ b/qdf/src/qdf_hang_event_notifier.c @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2020, 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_hang_event_notifier + * This file provides OS dependent QDF notifier call for hang event + */ + +#include +#include +#include + +static qdf_atomic_notifier_init(qdf_hang_event_notif_head) + +QDF_STATUS qdf_hang_event_register_notifier(qdf_notif_block *nb) +{ + return qdf_register_atomic_notifier_chain(&qdf_hang_event_notif_head, + nb); +} + +QDF_STATUS qdf_hang_event_unregister_notifier(qdf_notif_block *nb) +{ + return qdf_unregister_atomic_notifier_chain(&qdf_hang_event_notif_head, + nb); +} + +QDF_STATUS qdf_hang_event_notifier_call(unsigned long v, void *data) +{ + return qdf_atomic_notfier_call(&qdf_hang_event_notif_head, + v, data); +} diff --git a/qdf/src/qdf_notifier.c b/qdf/src/qdf_notifier.c index c460647a8c59..6351831e98ff 100644 --- a/qdf/src/qdf_notifier.c +++ b/qdf/src/qdf_notifier.c @@ -39,11 +39,11 @@ QDF_STATUS qdf_unregister_blocking_notifier_chain(qdf_blocking_notif_head *head, } QDF_STATUS qdf_blocking_notfier_call(qdf_blocking_notif_head *head, - unsigned long v, void *data) + unsigned long state, void *data) { int ret; - ret = __qdf_blocking_notfier_call(head, v, data); + ret = __qdf_blocking_notfier_call(head, state, data); return qdf_status_from_os_return(ret); }