4 * Copyright 2007, Broadcom Corporation
7 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
8 * the contents of this file may not be disclosed to third parties, copied
9 * or duplicated in any form, in whole or in part, without the prior
10 * written permission of Broadcom Corporation.
22 #include <ndiserrmap.h>
25 static NDIS_STATUS ndisbcmerrormap
[] = \
26 { NDIS_STATUS_SUCCESS
, /* 0 */
27 NDIS_STATUS_FAILURE
, /* BCME_ERROR */
28 NDIS_STATUS_INVALID_DATA
, /* BCME_BADARG */
29 NDIS_STATUS_INVALID_DATA
, /* BCME_BADOPTION */
30 NDIS_STATUS_INVALID_DATA
, /* BCME_NOTUP */
31 NDIS_STATUS_INVALID_DATA
, /* BCME_NOTDOWN */
32 NDIS_STATUS_INVALID_DATA
, /* BCME_NOTAP */
33 NDIS_STATUS_INVALID_DATA
, /* BCME_NOTSTA */
34 NDIS_STATUS_INVALID_DATA
, /* BCME_BADKEYIDX */
35 NDIS_STATUS_INVALID_DATA
, /* BCME_RADIOOFF */
36 NDIS_STATUS_INVALID_DATA
, /* BCME_NOTBANDLOCKED */
37 NDIS_STATUS_INVALID_DATA
, /* BCME_NOCLK */
38 NDIS_STATUS_INVALID_DATA
, /* BCME_BADRATESET */
39 NDIS_STATUS_INVALID_DATA
, /* BCME_BADBAND */
40 NDIS_STATUS_INVALID_LENGTH
, /* BCME_BUFTOOSHORT */
41 NDIS_STATUS_INVALID_LENGTH
, /* BCME_BUFTOOLONG */
42 NDIS_STATUS_INVALID_DATA
, /* BCME_BUSY */
43 NDIS_STATUS_INVALID_DATA
, /* BCME_NOTASSOCIATED */
44 NDIS_STATUS_INVALID_LENGTH
, /* BCME_BADSSIDLEN */
45 NDIS_STATUS_INVALID_DATA
, /* BCME_OUTOFRANGECHAN */
46 NDIS_STATUS_INVALID_DATA
, /* BCME_BADCHAN */
47 NDIS_STATUS_INVALID_DATA
, /* BCME_BADADDR */
48 NDIS_STATUS_RESOURCES
, /* BCME_NORESOURCE */
49 NDIS_STATUS_NOT_SUPPORTED
, /* BCME_UNSUPPORTED */
50 NDIS_STATUS_INVALID_LENGTH
, /* BCME_BADLENGTH */
51 NDIS_STATUS_ADAPTER_NOT_READY
, /* BCME_NOTREADY */
52 NDIS_STATUS_FAILURE
, /* BCME_NOTPERMITTED */
53 NDIS_STATUS_RESOURCES
, /* BCME_NOMEM */
54 NDIS_STATUS_INVALID_DATA
, /* BCME_ASSOCIATED */
55 NDIS_STATUS_INVALID_DATA
, /* BCME_RANGE */
56 NDIS_STATUS_INVALID_DATA
, /* BCME_NOTFOUND */
57 NDIS_STATUS_INVALID_DATA
, /* BCME_WME_NOT_ENABLED */
58 NDIS_STATUS_INVALID_DATA
, /* BCME_TSPEC_NOTFOUND */
59 NDIS_STATUS_INVALID_DATA
, /* BCME_ACM_NOTSUPPORTED */
60 NDIS_STATUS_INVALID_DATA
, /* BCME_NOT_WME_ASSOCIATION */
61 NDIS_STATUS_FAILURE
, /* BCME_SDIO_ERROR */
62 NDIS_STATUS_FAILURE
, /* BCME_DONGLE_DOWN */
63 NDIS_STATUS_FAILURE
/* BCME_VERSION */
65 /* When an new error code is added to bcmutils.h, add os
66 * spcecific error translation here as well
68 /* check if BCME_LAST changed since the last time this function was updated */
70 #error "You need to add a OS error translation in the ndisbcmerrormap \
71 for new error code defined in bcmuitls.h"
72 #endif /* BCME_LAST != -37 */
76 ndisstatus2bcmerror(NDIS_STATUS status
)
78 int i
, array_size
= ARRAYSIZE(ndisbcmerrormap
);
80 ASSERT(ABS(BCME_LAST
) == (array_size
- 1));
82 for (i
= 0; i
< array_size
; i
++)
83 if (ndisbcmerrormap
[i
] == status
)
86 if (status
== NDIS_STATUS_INVALID_OID
)
87 return BCME_UNSUPPORTED
;
93 bcmerror2ndisstatus(int bcmerror
)
97 else if (bcmerror
< BCME_LAST
)
98 bcmerror
= BCME_ERROR
;
100 /* Array bounds covered by ASSERT in osl_attach */
101 return ndisbcmerrormap
[-bcmerror
];