ucode_loader.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright (c) 2010 Broadcom Corporation
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  11. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  13. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #include <defs.h>
  17. #include "types.h"
  18. #include <ucode_loader.h>
  19. enum {
  20. D11UCODE_NAMETAG_START = 0,
  21. D11LCN0BSINITVALS24,
  22. D11LCN0INITVALS24,
  23. D11LCN1BSINITVALS24,
  24. D11LCN1INITVALS24,
  25. D11LCN2BSINITVALS24,
  26. D11LCN2INITVALS24,
  27. D11N0ABSINITVALS16,
  28. D11N0BSINITVALS16,
  29. D11N0INITVALS16,
  30. D11UCODE_OVERSIGHT16_MIMO,
  31. D11UCODE_OVERSIGHT16_MIMOSZ,
  32. D11UCODE_OVERSIGHT24_LCN,
  33. D11UCODE_OVERSIGHT24_LCNSZ,
  34. D11UCODE_OVERSIGHT_BOMMAJOR,
  35. D11UCODE_OVERSIGHT_BOMMINOR
  36. };
  37. int brcms_ucode_data_init(struct brcms_info *wl, struct brcms_ucode *ucode)
  38. {
  39. int rc;
  40. rc = brcms_check_firmwares(wl);
  41. rc = rc < 0 ? rc :
  42. brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn0bsinitvals24,
  43. D11LCN0BSINITVALS24);
  44. rc = rc < 0 ?
  45. rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn0initvals24,
  46. D11LCN0INITVALS24);
  47. rc = rc < 0 ?
  48. rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn1bsinitvals24,
  49. D11LCN1BSINITVALS24);
  50. rc = rc < 0 ?
  51. rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn1initvals24,
  52. D11LCN1INITVALS24);
  53. rc = rc < 0 ? rc :
  54. brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn2bsinitvals24,
  55. D11LCN2BSINITVALS24);
  56. rc = rc < 0 ?
  57. rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn2initvals24,
  58. D11LCN2INITVALS24);
  59. rc = rc < 0 ?
  60. rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11n0absinitvals16,
  61. D11N0ABSINITVALS16);
  62. rc = rc < 0 ?
  63. rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11n0bsinitvals16,
  64. D11N0BSINITVALS16);
  65. rc = rc < 0 ?
  66. rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11n0initvals16,
  67. D11N0INITVALS16);
  68. rc = rc < 0 ?
  69. rc : brcms_ucode_init_buf(wl, (void **)&ucode->bcm43xx_16_mimo,
  70. D11UCODE_OVERSIGHT16_MIMO);
  71. rc = rc < 0 ?
  72. rc : brcms_ucode_init_uint(wl, &ucode->bcm43xx_16_mimosz,
  73. D11UCODE_OVERSIGHT16_MIMOSZ);
  74. rc = rc < 0 ?
  75. rc : brcms_ucode_init_buf(wl, (void **)&ucode->bcm43xx_24_lcn,
  76. D11UCODE_OVERSIGHT24_LCN);
  77. rc = rc < 0 ?
  78. rc : brcms_ucode_init_uint(wl, &ucode->bcm43xx_24_lcnsz,
  79. D11UCODE_OVERSIGHT24_LCNSZ);
  80. rc = rc < 0 ?
  81. rc : brcms_ucode_init_buf(wl, (void **)&ucode->bcm43xx_bommajor,
  82. D11UCODE_OVERSIGHT_BOMMAJOR);
  83. rc = rc < 0 ?
  84. rc : brcms_ucode_init_buf(wl, (void **)&ucode->bcm43xx_bomminor,
  85. D11UCODE_OVERSIGHT_BOMMINOR);
  86. return rc;
  87. }
  88. void brcms_ucode_data_free(struct brcms_ucode *ucode)
  89. {
  90. brcms_ucode_free_buf((void *)ucode->d11lcn0bsinitvals24);
  91. brcms_ucode_free_buf((void *)ucode->d11lcn0initvals24);
  92. brcms_ucode_free_buf((void *)ucode->d11lcn1bsinitvals24);
  93. brcms_ucode_free_buf((void *)ucode->d11lcn1initvals24);
  94. brcms_ucode_free_buf((void *)ucode->d11lcn2bsinitvals24);
  95. brcms_ucode_free_buf((void *)ucode->d11lcn2initvals24);
  96. brcms_ucode_free_buf((void *)ucode->d11n0absinitvals16);
  97. brcms_ucode_free_buf((void *)ucode->d11n0bsinitvals16);
  98. brcms_ucode_free_buf((void *)ucode->d11n0initvals16);
  99. brcms_ucode_free_buf((void *)ucode->bcm43xx_16_mimo);
  100. brcms_ucode_free_buf((void *)ucode->bcm43xx_24_lcn);
  101. brcms_ucode_free_buf((void *)ucode->bcm43xx_bommajor);
  102. brcms_ucode_free_buf((void *)ucode->bcm43xx_bomminor);
  103. }