| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2011 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: nexus_generic_driver.h $ |
|---|
| 39 | * $brcm_Revision: 2 $ |
|---|
| 40 | * $brcm_Date: 8/10/11 4:32p $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: Platform (private) |
|---|
| 44 | * Common part of all kernel drivers |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /nexus/platforms/97400/src/linuxkernel/nexus_generic_driver.h $ |
|---|
| 49 | * |
|---|
| 50 | * 2 8/10/11 4:32p erickson |
|---|
| 51 | * SW7420-1148: add trusted boolean to nexus_generic_driver_open to |
|---|
| 52 | * prevent non-root from initializing nexus |
|---|
| 53 | * |
|---|
| 54 | * 1 5/3/11 5:10p erickson |
|---|
| 55 | * SW7420-1819: repartition so NFE is a standard feature |
|---|
| 56 | * |
|---|
| 57 | ***************************************************************************/ |
|---|
| 58 | #ifndef NEXUS_GENERIC_DRIVER_H_ |
|---|
| 59 | #define NEXUS_GENERIC_DRIVER_H_ |
|---|
| 60 | |
|---|
| 61 | #define NEXUS_DRIVER_MAJOR 33 |
|---|
| 62 | |
|---|
| 63 | struct nexus_generic_driver_init_settings |
|---|
| 64 | { |
|---|
| 65 | struct { |
|---|
| 66 | unsigned offset; /* physical address */ |
|---|
| 67 | unsigned size; |
|---|
| 68 | } region[16]; |
|---|
| 69 | |
|---|
| 70 | unsigned max_dcache_line_size; /* to ensure nexus heap allocations are cache coherent */ |
|---|
| 71 | }; |
|---|
| 72 | |
|---|
| 73 | int nexus_generic_driver_init(const struct nexus_generic_driver_init_settings *settings); |
|---|
| 74 | void nexus_generic_driver_uninit(void); |
|---|
| 75 | |
|---|
| 76 | int nexus_generic_driver_open( |
|---|
| 77 | unsigned module, /* driver can open multiple modules, each given a unique module id */ |
|---|
| 78 | void **context, /* [out] storage for generic driver context */ |
|---|
| 79 | unsigned process_id, /* does not have to be actual OS process_id. will correspond to terminate_process(process_id). */ |
|---|
| 80 | bool trusted /* generally, true for root, false for non-root */ |
|---|
| 81 | ); |
|---|
| 82 | void nexus_generic_driver_close(unsigned module, void *context, bool abnormal_termination); |
|---|
| 83 | int nexus_generic_driver_validate_mmap(unsigned module, void *context, unsigned offset, unsigned size); |
|---|
| 84 | int nexus_generic_driver_ioctl(unsigned module, void *context, unsigned int cmd, unsigned long arg); |
|---|
| 85 | void nexus_generic_driver_read_register(uint32_t addr, uint32_t *p_value); |
|---|
| 86 | void nexus_generic_driver_write_register(uint32_t addr, uint32_t value); |
|---|
| 87 | |
|---|
| 88 | #endif |
|---|