summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2013-01-14 15:08:52 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-01-14 15:08:52 -0500
commit50c2f5e8f93c83ddb7fe74057db1e3030724ae6e (patch)
tree6c7f16224195283a6bbe334e19fd1e14a6aad8e6 /include
parent990debe2ca8379863709721926550a55f47f3880 (diff)
parentd3710e74cf329839dea8d13b1ad56e572b06b173 (diff)
Merge tag 'nfc-next-3.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next
Samuel Ortiz <sameo@linux.intel.com> says: "This is the first NFC patchset targeted at the 3.9 merge window. It brings the following goodies: - LLCP socket timestamping (To be used e.g with the recently released nfctool application for a more efficient skb timestamping when sniffing). - A pretty big pn533 rework from Waldemar, preparing the driver to support more flavours of pn533 based devices. - HCI changes from Eric in preparation for the microread driver support. - Some LLCP memory leak fixes, cleanups and slight improvements. - pn544 and nfcwilink move to the devm_kzalloc API. - An initial Secure Element (SE) API. - An nfc.h license change from the original author, allowing non GPL application code to safely include it." Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include')
-rw-r--r--include/net/nfc/hci.h22
-rw-r--r--include/net/nfc/nci_core.h1
-rw-r--r--include/net/nfc/nfc.h8
-rw-r--r--include/uapi/linux/nfc.h37
4 files changed, 53 insertions, 15 deletions
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index 671953e11575..b87a1692b086 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -57,8 +57,10 @@ struct nfc_hci_ops {
int (*tm_send)(struct nfc_hci_dev *hdev, struct sk_buff *skb);
int (*check_presence)(struct nfc_hci_dev *hdev,
struct nfc_target *target);
- void (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event,
- struct sk_buff *skb);
+ int (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event,
+ struct sk_buff *skb);
+ int (*enable_se)(struct nfc_dev *dev, u32 secure_element);
+ int (*disable_se)(struct nfc_dev *dev, u32 secure_element);
};
/* Pipes */
@@ -82,11 +84,23 @@ typedef int (*xmit) (struct sk_buff *skb, void *cb_data);
#define NFC_HCI_MAX_GATES 256
+/*
+ * These values can be specified by a driver to indicate it requires some
+ * adaptation of the HCI standard.
+ *
+ * NFC_HCI_QUIRK_SHORT_CLEAR - send HCI_ADM_CLEAR_ALL_PIPE cmd with no params
+ */
+enum {
+ NFC_HCI_QUIRK_SHORT_CLEAR = 0,
+};
+
struct nfc_hci_dev {
struct nfc_dev *ndev;
u32 max_data_link_payload;
+ bool shutting_down;
+
struct mutex msg_tx_mutex;
struct list_head msg_tx_queue;
@@ -129,12 +143,16 @@ struct nfc_hci_dev {
u8 *gb;
size_t gb_len;
+
+ unsigned long quirks;
};
/* hci device allocation */
struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
struct nfc_hci_init_data *init_data,
+ unsigned long quirks,
u32 protocols,
+ u32 supported_se,
const char *llc_name,
int tx_headroom,
int tx_tailroom,
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index d705d8674949..5bc0c460edc0 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -147,6 +147,7 @@ struct nci_dev {
/* ----- NCI Devices ----- */
struct nci_dev *nci_allocate_device(struct nci_ops *ops,
__u32 supported_protocols,
+ __u32 supported_se,
int tx_headroom,
int tx_tailroom);
void nci_free_device(struct nci_dev *ndev);
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index fce80b2f9be7..87a6417fc934 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -68,6 +68,8 @@ struct nfc_ops {
void *cb_context);
int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb);
int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target);
+ int (*enable_se)(struct nfc_dev *dev, u32 secure_element);
+ int (*disable_se)(struct nfc_dev *dev, u32 secure_element);
};
#define NFC_TARGET_IDX_ANY -1
@@ -109,12 +111,17 @@ struct nfc_dev {
struct nfc_genl_data genl_data;
u32 supported_protocols;
+ u32 supported_se;
+ u32 active_se;
+
int tx_headroom;
int tx_tailroom;
struct timer_list check_pres_timer;
struct work_struct check_pres_work;
+ bool shutting_down;
+
struct nfc_ops *ops;
};
#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev)
@@ -123,6 +130,7 @@ extern struct class nfc_class;
struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
u32 supported_protocols,
+ u32 supported_se,
int tx_headroom,
int tx_tailroom);
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 0e63cee8d810..7969f46f1bb3 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -5,20 +5,17 @@
* Lauro Ramos Venancio <lauro.venancio@openbossa.org>
* Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * 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.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * 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.
*/
#ifndef __LINUX_NFC_H
@@ -67,6 +64,11 @@
* subsequent CONNECT and CC messages.
* If one of the passed parameters is wrong none is set and -EINVAL is
* returned.
+ * @NFC_CMD_ENABLE_SE: Enable the physical link to a specific secure element.
+ * Once enabled a secure element will handle card emulation mode, i.e.
+ * starting a poll from a device which has a secure element enabled means
+ * we want to do SE based card emulation.
+ * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element.
*/
enum nfc_commands {
NFC_CMD_UNSPEC,
@@ -86,6 +88,8 @@ enum nfc_commands {
NFC_EVENT_TM_DEACTIVATED,
NFC_CMD_LLC_GET_PARAMS,
NFC_CMD_LLC_SET_PARAMS,
+ NFC_CMD_ENABLE_SE,
+ NFC_CMD_DISABLE_SE,
/* private: internal use only */
__NFC_CMD_AFTER_LAST
};
@@ -114,6 +118,7 @@ enum nfc_commands {
* @NFC_ATTR_LLC_PARAM_LTO: Link TimeOut parameter
* @NFC_ATTR_LLC_PARAM_RW: Receive Window size parameter
* @NFC_ATTR_LLC_PARAM_MIUX: MIU eXtension parameter
+ * @NFC_ATTR_SE: Available Secure Elements
*/
enum nfc_attrs {
NFC_ATTR_UNSPEC,
@@ -134,6 +139,7 @@ enum nfc_attrs {
NFC_ATTR_LLC_PARAM_LTO,
NFC_ATTR_LLC_PARAM_RW,
NFC_ATTR_LLC_PARAM_MIUX,
+ NFC_ATTR_SE,
/* private: internal use only */
__NFC_ATTR_AFTER_LAST
};
@@ -172,6 +178,11 @@ enum nfc_attrs {
#define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP)
#define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B)
+/* NFC Secure Elements */
+#define NFC_SE_NONE 0x0
+#define NFC_SE_UICC 0x1
+#define NFC_SE_EMBEDDED 0x2
+
struct sockaddr_nfc {
sa_family_t sa_family;
__u32 dev_idx;