Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame^] | 1 | /* |
| 2 | <:copyright-BRCM:2016:DUAL/GPL:standard |
| 3 | |
| 4 | Broadcom Proprietary and Confidential.(c) 2016 Broadcom |
| 5 | All Rights Reserved |
| 6 | |
| 7 | Unless you and Broadcom execute a separate written software license |
| 8 | agreement governing use of this software, this software is licensed |
| 9 | to you under the terms of the GNU General Public License version 2 |
| 10 | (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, |
| 11 | with the following added to such license: |
| 12 | |
| 13 | As a special exception, the copyright holders of this software give |
| 14 | you permission to link this software with independent modules, and |
| 15 | to copy and distribute the resulting executable under terms of your |
| 16 | choice, provided that you also meet, for each linked independent |
| 17 | module, the terms and conditions of the license of that module. |
| 18 | An independent module is a module which is not derived from this |
| 19 | software. The special exception does not apply to any modifications |
| 20 | of the software. |
| 21 | |
| 22 | Not withstanding the above, under no circumstances may you combine |
| 23 | this software in any way with any other Broadcom software provided |
| 24 | under a license other than the GPL, without Broadcom's express prior |
| 25 | written consent. |
| 26 | |
| 27 | :> |
| 28 | */ |
| 29 | #include "bcmos_system.h" |
| 30 | |
| 31 | /* Map error code to error string */ |
| 32 | const char *bcmos_strerror(bcmos_errno err) |
| 33 | { |
| 34 | static const char *errstr[] = { |
| 35 | [-BCM_ERR_OK] = "OK", |
| 36 | [-BCM_ERR_IN_PROGRESS] = "In progress", |
| 37 | [-BCM_ERR_PARM] = "Error in parameters", |
| 38 | [-BCM_ERR_NOMEM] = "No memory", |
| 39 | [-BCM_ERR_NORES] = "No resources", |
| 40 | [-BCM_ERR_INTERNAL] = "Internal error", |
| 41 | [-BCM_ERR_NOENT] = "Entry doesn't exist", |
| 42 | [-BCM_ERR_NODEV] = "Device doesn't exist", |
| 43 | [-BCM_ERR_ALREADY] = "Entry already exists", |
| 44 | [-BCM_ERR_RANGE] = "Out of range", |
| 45 | [-BCM_ERR_PERM] = "No permission to perform an operation", |
| 46 | [-BCM_ERR_NOT_SUPPORTED] = "Operation is not supported", |
| 47 | [-BCM_ERR_PARSE] = "Parsing error", |
| 48 | [-BCM_ERR_INVALID_OP] = "Invalid operation", |
| 49 | [-BCM_ERR_IO] = "I/O error", |
| 50 | [-BCM_ERR_STATE] = "Object is in bad state", |
| 51 | [-BCM_ERR_DELETED] = "Object is deleted", |
| 52 | [-BCM_ERR_TOO_MANY] = "Too many objects", |
| 53 | [-BCM_ERR_NO_MORE] = "No more entries", |
| 54 | [-BCM_ERR_OVERFLOW] = "Buffer overflow", |
| 55 | [-BCM_ERR_COMM_FAIL] = "Communication failure", |
| 56 | [-BCM_ERR_NOT_CONNECTED] = "No connection with the target system", |
| 57 | [-BCM_ERR_SYSCALL_ERR] = "System call returned error", |
| 58 | [-BCM_ERR_MSG_ERROR] = "Received message is insane", |
| 59 | [-BCM_ERR_TOO_MANY_REQS] = "Too many outstanding requests", |
| 60 | [-BCM_ERR_TIMEOUT] = "Operation timed out", |
| 61 | [-BCM_ERR_TOO_MANY_FRAGS] = "Too many fragments", |
| 62 | [-BCM_ERR_NULL] = "Got NULL pointer", |
| 63 | [-BCM_ERR_READ_ONLY] = "Attempt to set read-only parameter", |
| 64 | [-BCM_ERR_ONU_ERR_RESP] = "ONU returned an error response", |
| 65 | [-BCM_ERR_MANDATORY_PARM_IS_MISSING] = "Mandatory parameter is missing", |
| 66 | [-BCM_ERR_KEY_RANGE] = "Key field out of range", |
| 67 | [-BCM_ERR_QUEUE_EMPTY] = "Rx of PCIe empty", |
| 68 | [-BCM_ERR_QUEUE_FULL] = "Tx of PCIe full", |
| 69 | [-BCM_ERR_TOO_LONG] = "Processing is taking too long, but will finish eventually", |
| 70 | [-BCM_ERR_INSUFFICIENT_LIST_MEM] = "Insufficient list memory provided", |
| 71 | |
| 72 | [-BCM_ERR_OUT_OF_SYNC] = "Sequence number or operation step was out of sync", |
| 73 | [-BCM_ERR_CHECKSUM] = "Checksum error", |
| 74 | [-BCM_ERR_IMAGE_TYPE] = "Unsupported file/image type", |
| 75 | [-BCM_ERR_INCOMPLETE_TERMINATION] = "Incomplete premature termination", |
| 76 | }; |
| 77 | static const char *unknown = "*unknown*"; |
| 78 | |
| 79 | if ((unsigned)(-err) >= sizeof(errstr)/sizeof(errstr[0]) || !errstr[-err]) |
| 80 | return unknown; |
| 81 | return errstr[-err]; |
| 82 | } |
| 83 | |
| 84 | #ifdef __KERNEL__ |
| 85 | EXPORT_SYMBOL(bcmos_strerror); |
| 86 | #endif |