Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp604778ybl; Fri, 23 Aug 2019 05:50:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPP4hiBLxU5GEVDqdnJRhPb+kmwp1Yr6MVHHbA1GK8lwq1dFUDjbysSC2qgqYnu8Xj1kai X-Received: by 2002:a65:4489:: with SMTP id l9mr3925263pgq.207.1566564658921; Fri, 23 Aug 2019 05:50:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566564658; cv=none; d=google.com; s=arc-20160816; b=rP02Q4MBYjTSoyYyIKpugO96e8N9JGFLiP97OrJvnV+5C8U9t/Oq97vOTbJz0WJND0 9ysAu9kU8eLM8bRn+GaSljdzzR9yjhL9JP9GlGTFhV62EdPYpRGzA99oTFF5E9Q5l1Pg 2O/biOlxKvvxqsZiflw8JIX7LlAbttC9mx0Eet4O7OAOfzfsUePBCCyij4Fwoz4OJ6U+ ioZPQJHjUcmNDHpW9EhY+4zh9PG4G0XDx7NEfWuLdMOSqD3vHPuViAczeIxBF/Tx7pe7 4HHESRnZyzBSP/T+jJXa07ke/NTGahqPe6P8gikGRVkQMGQDUmxQETv9KPrNUOHG31eP z6Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=/tIfWiDT7rhi/abpdmQcXHDvll3scxVbBQp4igt8ciU=; b=amjBfUjph+214ZHs53cRjPY4aZGF0nB+h1ej3ZwOLS0ztGPrdVye9AvqSpZqzvkOhX FH04sKnelg1kQ04eOnAK1DGSEL9nSgNdv3DW3LdQu2juxJwxkMGCZbMjRf0JeOfIzb/D hL2ppmEUADYdBYOt3jwOhbzBC10LhYBOxLKHpT6cS4soLOm6gTNZb0+AMHZKGlIDWZeX BcWOG+aZJY7tSIVvUAcOGAl2FIexNyma31dAp0TjK8OXg/iHyIgE5dghwNdcc+1cpBA7 mJ785wedfktEHzji5Omi4XftSl8pJ3rkhN3GBwALzf5AkRrMe9c96DVG3goeHvPD+qW8 mHWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=bqniYupz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bb14si2211644pjb.66.2019.08.23.05.50.42; Fri, 23 Aug 2019 05:50:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=bqniYupz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404380AbfHVTZY (ORCPT + 99 others); Thu, 22 Aug 2019 15:25:24 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:37174 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404320AbfHVTZT (ORCPT ); Thu, 22 Aug 2019 15:25:19 -0400 Received: by mail-pf1-f195.google.com with SMTP id y9so4246596pfl.4 for ; Thu, 22 Aug 2019 12:25:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/tIfWiDT7rhi/abpdmQcXHDvll3scxVbBQp4igt8ciU=; b=bqniYupzhzFo73B02qXJRg6LDQw9VxDM0+7esSTGT6Ps6bYVMkEekcpx31lkcFmWkv 7SNJN6qVa3moqhjKAOIFDDCoSXg40jxDKh07tXdmszoHWAyUwJ3p9Ul7phjSkTMOoPf9 DRDocSsYUeMKoF7drMnUNK+sSXyjh1FDCJvoQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/tIfWiDT7rhi/abpdmQcXHDvll3scxVbBQp4igt8ciU=; b=tm6YPZVH5WlkvMcP3484HtT/I8dCY+c+WFsiTp4bCbyTLgPZanEkclDtC3yQjbCw9M c5ATYLnVkPC3hdaJiQWlbAHKFBrvxTCqAgbawJNada9kgxsNR6CD8gROb5Cb4i64fbgk sm9bbst0PbKuiPQlb0WFo7FH+tj4kkZdbAh2/dv0tz2FTOhMBtfoHvPsItyvFyf1URNz J1EpS2PHiyu5qvIGacQejSTytSCYJyRoychv0u9SU2NIiVJWn84rBcL1W4bTchTwZO3T RuqLMuDd7qcDn84qFOX0SwRHJw2Ge8Ie/gkQkP6ky5IUq6he9tCESXRRRhCAmHsN+txg mrqw== X-Gm-Message-State: APjAAAV9MKMt5soL5eNW6PABfdj9y6fxcGLuenMmTeBYOe4f6H298xPo Z7WHbVnK0jjnBLZyg50pYaTY/w== X-Received: by 2002:a17:90a:2767:: with SMTP id o94mr1264139pje.25.1566501918992; Thu, 22 Aug 2019 12:25:18 -0700 (PDT) Received: from lbrmn-lnxub113.broadcom.net ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id c12sm198018pfc.22.2019.08.22.12.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2019 12:25:18 -0700 (PDT) From: Scott Branden To: Luis Chamberlain , Greg Kroah-Hartman , David Brown , Alexander Viro , Shuah Khan , bjorn.andersson@linaro.org, Shuah Khan , Arnd Bergmann Cc: "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-fsdevel@vger.kernel.org, BCM Kernel Feedback , Olof Johansson , Andrew Morton , Dan Carpenter , Colin Ian King , Kees Cook , Takashi Iwai , linux-kselftest@vger.kernel.org, Scott Branden Subject: [PATCH 5/7] bcm-vk: add bcm_vk UAPI Date: Thu, 22 Aug 2019 12:24:49 -0700 Message-Id: <20190822192451.5983-6-scott.branden@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190822192451.5983-1-scott.branden@broadcom.com> References: <20190822192451.5983-1-scott.branden@broadcom.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add user space api for bcm-vk driver. Signed-off-by: Scott Branden --- include/uapi/linux/misc/bcm_vk.h | 88 ++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 include/uapi/linux/misc/bcm_vk.h diff --git a/include/uapi/linux/misc/bcm_vk.h b/include/uapi/linux/misc/bcm_vk.h new file mode 100644 index 000000000000..df7dfd7f0702 --- /dev/null +++ b/include/uapi/linux/misc/bcm_vk.h @@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ +/* + * Copyright(c) 2018 Broadcom + */ + +#ifndef __UAPI_LINUX_MISC_BCM_VK_H +#define __UAPI_LINUX_MISC_BCM_VK_H + +#include +#include + +struct vk_metadata { + /* struct version, always backwards compatible */ + __u32 version; + + /* Version 0 fields */ + __u32 card_status; +#define VK_CARD_STATUS_FASTBOOT_READY BIT(0) +#define VK_CARD_STATUS_FWLOADER_READY BIT(1) + + __u32 firmware_version; + __u32 fw_status; + /* End version 0 fields */ + + __u64 reserved[14]; + /* Total of 16*u64 for all versions */ +}; + +struct vk_image { + __u32 type; /* Type of image */ +#define VK_IMAGE_TYPE_BOOT1 1 /* 1st stage (load to SRAM) */ +#define VK_IMAGE_TYPE_BOOT2 2 /* 2nd stage (load to DDR) */ + char filename[64]; /* Filename of image */ +}; + +/* default firmware images names */ +#define VK_BOOT1_DEF_FILENAME "vk-boot1.bin" +#define VK_BOOT2_DEF_FILENAME "vk-boot2.bin" + +struct vk_access { + __u8 barno; /* BAR number to use */ + __u8 type; /* Type of access */ +#define VK_ACCESS_READ 0 +#define VK_ACCESS_WRITE 1 + __u32 len; /* length of data */ + __u64 offset; /* offset in BAR */ + __u32 *data; /* where to read/write data to */ +}; + +struct vk_reset { + __u32 arg1; + __u32 arg2; +}; + +#define VK_MAGIC 0x5E + +/* Get metadata from Valkyrie (firmware version, card status, etc) */ +#define VK_IOCTL_GET_METADATA _IOR(VK_MAGIC, 0x1, struct vk_metadata) + +/* Load image to Valkyrie */ +#define VK_IOCTL_LOAD_IMAGE _IOW(VK_MAGIC, 0x2, struct vk_image) + +/* Read data from Valkyrie */ +#define VK_IOCTL_ACCESS_BAR _IOWR(VK_MAGIC, 0x3, struct vk_access) + +/* Send Reset to Valkyrie */ +#define VK_IOCTL_RESET _IOW(VK_MAGIC, 0x4, struct vk_reset) + +/* + * message block - basic unit in the message where a message's size is always + * N x sizeof(basic_block) + */ +struct vk_msg_blk { + __u8 function_id; +#define VK_FID_TRANS_BUF 5 +#define VK_FID_SHUTDOWN 8 + __u8 size; + __u16 queue_id:4; + __u16 msg_id:12; + __u32 context_id; + __u32 args[2]; +#define VK_CMD_PLANES_MASK 0x000F /* number of planes to up/download */ +#define VK_CMD_UPLOAD 0x0400 /* memory transfer to vk */ +#define VK_CMD_DOWNLOAD 0x0500 /* memory transfer from vk */ +#define VK_CMD_MASK 0x0F00 /* command mask */ +}; + +#endif /* __UAPI_LINUX_MISC_BCM_VK_H */ -- 2.17.1