[package] unvram: make it work on bcm47xx, also look for /dev/mtdblockX
[openwrt.git] / package / broadcom-57xx / src / tcp_seg.c
1 /******************************************************************************/
2 /* */
3 /* Broadcom BCM5700 Linux Network Driver, Copyright (c) 2002 - 2004 Broadcom */
4 /* Corporation. */
5 /* All rights reserved. */
6 /* */
7 /* This program is free software; you can redistribute it and/or modify */
8 /* it under the terms of the GNU General Public License as published by */
9 /* the Free Software Foundation, located in the file LICENSE. */
10 /* */
11 /* History: */
12 /* */
13 /******************************************************************************/
14
15 #include "mm.h"
16
17 #ifdef INCLUDE_TCP_SEG_SUPPORT
18 #include "fw_stkoffld.h"
19 #include "fw_lso05.h"
20
21 LM_UINT32 LM_GetStkOffLdFirmwareSize(PLM_DEVICE_BLOCK pDevice)
22 {
23 LM_UINT32 FwSize;
24
25 if (T3_ASIC_REV(pDevice->ChipRevId) == T3_ASIC_REV_5750)
26 {
27 return 0;
28 }
29 if (T3_ASIC_REV(pDevice->ChipRevId) == T3_ASIC_REV_5705)
30 {
31 FwSize = (LM_UINT32)(t3StkOffLd05FwTextLen +
32 t3StkOffLd05FwRodataLen +
33 t3StkOffLd05FwDataLen +
34 t3StkOffLd05FwSbssLen +
35 t3StkOffLd05FwBssLen);
36 }
37 else
38 {
39 FwSize = (LM_UINT32)(t3StkOffLdFwTextLen +
40 t3StkOffLdFwRodataLen +
41 t3StkOffLdFwDataLen +
42 t3StkOffLdFwSbssLen +
43 t3StkOffLdFwBssLen);
44 }
45
46 return FwSize;
47 }
48
49 LM_STATUS LM_LoadStkOffLdFirmware(PLM_DEVICE_BLOCK pDevice)
50 {
51 T3_FWIMG_INFO FwImgInfo;
52 LM_UINT32 Cpu;
53
54 if (T3_ASIC_IS_575X_PLUS(pDevice->ChipRevId))
55 {
56 return LM_STATUS_SUCCESS;
57 }
58 if (T3_ASIC_REV(pDevice->ChipRevId) == T3_ASIC_REV_5705)
59 {
60 FwImgInfo.StartAddress = t3StkOffLd05FwStartAddr;
61 FwImgInfo.Text.Buffer = (PLM_UINT8)t3StkOffLd05FwText;
62 FwImgInfo.Text.Offset = t3StkOffLd05FwTextAddr;
63 FwImgInfo.Text.Length = t3StkOffLd05FwTextLen;
64 FwImgInfo.ROnlyData.Buffer = (PLM_UINT8)t3StkOffLd05FwRodata;
65 FwImgInfo.ROnlyData.Offset = t3StkOffLd05FwRodataAddr;
66 FwImgInfo.ROnlyData.Length = t3StkOffLd05FwRodataLen;
67 FwImgInfo.Data.Buffer = (PLM_UINT8)t3StkOffLd05FwData;
68 FwImgInfo.Data.Offset = t3StkOffLd05FwDataAddr;
69 FwImgInfo.Data.Length = t3StkOffLd05FwDataLen;
70 FwImgInfo.Sbss.Offset = t3StkOffLd05FwSbssAddr;
71 FwImgInfo.Sbss.Length = t3StkOffLd05FwSbssLen;
72 FwImgInfo.Bss.Offset = t3StkOffLd05FwBssAddr;
73 FwImgInfo.Bss.Length = t3StkOffLd05FwBssLen;
74 Cpu = T3_RX_CPU_ID;
75 }
76 else
77 {
78 FwImgInfo.StartAddress = t3StkOffLdFwStartAddr;
79 FwImgInfo.Text.Buffer = (PLM_UINT8)t3StkOffLdFwText;
80 FwImgInfo.Text.Offset = t3StkOffLdFwTextAddr;
81 FwImgInfo.Text.Length = t3StkOffLdFwTextLen;
82 FwImgInfo.ROnlyData.Buffer = (PLM_UINT8)t3StkOffLdFwRodata;
83 FwImgInfo.ROnlyData.Offset = t3StkOffLdFwRodataAddr;
84 FwImgInfo.ROnlyData.Length = t3StkOffLdFwRodataLen;
85 FwImgInfo.Data.Buffer = (PLM_UINT8)t3StkOffLdFwData;
86 FwImgInfo.Data.Offset = t3StkOffLdFwDataAddr;
87 FwImgInfo.Data.Length = t3StkOffLdFwDataLen;
88 FwImgInfo.Sbss.Offset = t3StkOffLdFwSbssAddr;
89 FwImgInfo.Sbss.Length = t3StkOffLdFwSbssLen;
90 FwImgInfo.Bss.Offset = t3StkOffLdFwBssAddr;
91 FwImgInfo.Bss.Length = t3StkOffLdFwBssLen;
92 Cpu = T3_TX_CPU_ID;
93 }
94
95 if (LM_LoadFirmware(pDevice,
96 &FwImgInfo,
97 Cpu,
98 Cpu) != LM_STATUS_SUCCESS)
99 {
100 return LM_STATUS_FAILURE;
101 }
102
103 return LM_STATUS_SUCCESS;
104 }
105
106 #endif /* INCLUDE_TCP_SEG_SUPPORT */
This page took 0.054095 seconds and 5 git commands to generate.