aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorpixo <pixo@pixo-LIFEBOOK-E8310.(none)>2011-03-23 03:08:08 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-05 00:33:27 -0400
commit14e5d8ef5beedf47005b1433096c0e30815da9b3 (patch)
tree1e87e7ac01095f4201e98cf5ebfc3ed4181fa129 /drivers/staging
parentea4fca42b9ba61c68f77a783fcae13368a71b6bc (diff)
staging: ft1000-pcmcia: Fix ft1000_dnld() to work also on 64bit architectures.
Firmware file needs to be read by 4bytes also on 64 bit architectures. Change long type to u32 and also extend checking. Tested on 32 and also 64 bit architectures. Signed-off-by: Stano Lanci <chl.pixo@gmail.com> Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com> Tested-by: Stano Lanci <chl.pixo@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c
index b0729fc3c89..fb375ea26dd 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c
@@ -95,47 +95,47 @@ void put_request_value(struct net_device *dev, long lvalue);
95USHORT hdr_checksum(PPSEUDO_HDR pHdr); 95USHORT hdr_checksum(PPSEUDO_HDR pHdr);
96 96
97typedef struct _DSP_FILE_HDR { 97typedef struct _DSP_FILE_HDR {
98 long build_date; 98 u32 build_date;
99 long dsp_coff_date; 99 u32 dsp_coff_date;
100 long loader_code_address; 100 u32 loader_code_address;
101 long loader_code_size; 101 u32 loader_code_size;
102 long loader_code_end; 102 u32 loader_code_end;
103 long dsp_code_address; 103 u32 dsp_code_address;
104 long dsp_code_size; 104 u32 dsp_code_size;
105 long dsp_code_end; 105 u32 dsp_code_end;
106 long reserved[8]; 106 u32 reserved[8];
107} __attribute__ ((packed)) DSP_FILE_HDR, *PDSP_FILE_HDR; 107} __attribute__ ((packed)) DSP_FILE_HDR, *PDSP_FILE_HDR;
108 108
109typedef struct _DSP_FILE_HDR_5 { 109typedef struct _DSP_FILE_HDR_5 {
110 long version_id; // Version ID of this image format. 110 u32 version_id; // Version ID of this image format.
111 long package_id; // Package ID of code release. 111 u32 package_id; // Package ID of code release.
112 long build_date; // Date/time stamp when file was built. 112 u32 build_date; // Date/time stamp when file was built.
113 long commands_offset; // Offset to attached commands in Pseudo Hdr format. 113 u32 commands_offset; // Offset to attached commands in Pseudo Hdr format.
114 long loader_offset; // Offset to bootloader code. 114 u32 loader_offset; // Offset to bootloader code.
115 long loader_code_address; // Start address of bootloader. 115 u32 loader_code_address; // Start address of bootloader.
116 long loader_code_end; // Where bootloader code ends. 116 u32 loader_code_end; // Where bootloader code ends.
117 long loader_code_size; 117 u32 loader_code_size;
118 long version_data_offset; // Offset were scrambled version data begins. 118 u32 version_data_offset; // Offset were scrambled version data begins.
119 long version_data_size; // Size, in words, of scrambled version data. 119 u32 version_data_size; // Size, in words, of scrambled version data.
120 long nDspImages; // Number of DSP images in file. 120 u32 nDspImages; // Number of DSP images in file.
121} __attribute__ ((packed)) DSP_FILE_HDR_5, *PDSP_FILE_HDR_5; 121} __attribute__ ((packed)) DSP_FILE_HDR_5, *PDSP_FILE_HDR_5;
122 122
123typedef struct _DSP_IMAGE_INFO { 123typedef struct _DSP_IMAGE_INFO {
124 long coff_date; // Date/time when DSP Coff image was built. 124 u32 coff_date; // Date/time when DSP Coff image was built.
125 long begin_offset; // Offset in file where image begins. 125 u32 begin_offset; // Offset in file where image begins.
126 long end_offset; // Offset in file where image begins. 126 u32 end_offset; // Offset in file where image begins.
127 long run_address; // On chip Start address of DSP code. 127 u32 run_address; // On chip Start address of DSP code.
128 long image_size; // Size of image. 128 u32 image_size; // Size of image.
129 long version; // Embedded version # of DSP code. 129 u32 version; // Embedded version # of DSP code.
130} __attribute__ ((packed)) DSP_IMAGE_INFO, *PDSP_IMAGE_INFO; 130} __attribute__ ((packed)) DSP_IMAGE_INFO, *PDSP_IMAGE_INFO;
131 131
132typedef struct _DSP_IMAGE_INFO_V6 { 132typedef struct _DSP_IMAGE_INFO_V6 {
133 long coff_date; // Date/time when DSP Coff image was built. 133 u32 coff_date; // Date/time when DSP Coff image was built.
134 long begin_offset; // Offset in file where image begins. 134 u32 begin_offset; // Offset in file where image begins.
135 long end_offset; // Offset in file where image begins. 135 u32 end_offset; // Offset in file where image begins.
136 long run_address; // On chip Start address of DSP code. 136 u32 run_address; // On chip Start address of DSP code.
137 long image_size; // Size of image. 137 u32 image_size; // Size of image.
138 long version; // Embedded version # of DSP code. 138 u32 version; // Embedded version # of DSP code.
139 unsigned short checksum; // Dsp File checksum 139 unsigned short checksum; // Dsp File checksum
140 unsigned short pad1; 140 unsigned short pad1;
141} __attribute__ ((packed)) DSP_IMAGE_INFO_V6, *PDSP_IMAGE_INFO_V6; 141} __attribute__ ((packed)) DSP_IMAGE_INFO_V6, *PDSP_IMAGE_INFO_V6;
@@ -846,8 +846,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)
846 break; 846 break;
847 847
848 case STATE_DONE_DWNLD: 848 case STATE_DONE_DWNLD:
849 if (((UINT) (pUcFile) - (UINT) pFileStart) >= 849 if (((unsigned long) (pUcFile) - (unsigned long) pFileStart) >=
850 (UINT) FileLength) { 850 (unsigned long) FileLength) {
851 uiState = STATE_DONE_FILE; 851 uiState = STATE_DONE_FILE;
852 break; 852 break;
853 } 853 }
@@ -901,11 +901,11 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)
901 &info->prov_list); 901 &info->prov_list);
902 // Move to next entry if available 902 // Move to next entry if available
903 pUcFile = 903 pUcFile =
904 (UCHAR *) ((UINT) pUcFile + 904 (UCHAR *) ((unsigned long) pUcFile +
905 (UINT) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(PSEUDO_HDR)); 905 (unsigned long) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(PSEUDO_HDR));
906 if ((UINT) (pUcFile) - 906 if ((unsigned long) (pUcFile) -
907 (UINT) (pFileStart) >= 907 (unsigned long) (pFileStart) >=
908 (UINT) FileLength) { 908 (unsigned long) FileLength) {
909 uiState = 909 uiState =
910 STATE_DONE_FILE; 910 STATE_DONE_FILE;
911 } 911 }