Commit b381f783 authored by Denys Vlasenko's avatar Denys Vlasenko Committed by David S. Miller

liquidio: stop using huge static buffer, save 4096k in .data

Only compile-tested - I don't have the hardware.

>From code inspection, octeon_pci_write_core_mem() appears to be safe wrt
unaligned source. In any case, u8 fbuf[] was not guaranteed to be aligned
anyway.
Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
CC: Felix Manlunas <felix.manlunas@cavium.com>
CC: Prasad Kanneganti <prasad.kanneganti@cavium.com>
CC: Derek Chickles <derek.chickles@cavium.com>
CC: David Miller <davem@davemloft.net>
CC: netdev@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Acked-by: default avatarFelix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3d091982
...@@ -724,13 +724,11 @@ static int octeon_console_read(struct octeon_device *oct, u32 console_num, ...@@ -724,13 +724,11 @@ static int octeon_console_read(struct octeon_device *oct, u32 console_num,
} }
#define FBUF_SIZE (4 * 1024 * 1024) #define FBUF_SIZE (4 * 1024 * 1024)
u8 fbuf[FBUF_SIZE];
int octeon_download_firmware(struct octeon_device *oct, const u8 *data, int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
size_t size) size_t size)
{ {
int ret = 0; int ret = 0;
u8 *p = fbuf;
u32 crc32_result; u32 crc32_result;
u64 load_addr; u64 load_addr;
u32 image_len; u32 image_len;
...@@ -805,10 +803,8 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data, ...@@ -805,10 +803,8 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
else else
size = FBUF_SIZE; size = FBUF_SIZE;
memcpy(p, data, size);
/* download the image */ /* download the image */
octeon_pci_write_core_mem(oct, load_addr, p, (u32)size); octeon_pci_write_core_mem(oct, load_addr, data, (u32)size);
data += size; data += size;
rem -= (u32)size; rem -= (u32)size;
......
...@@ -167,10 +167,10 @@ octeon_pci_read_core_mem(struct octeon_device *oct, ...@@ -167,10 +167,10 @@ octeon_pci_read_core_mem(struct octeon_device *oct,
void void
octeon_pci_write_core_mem(struct octeon_device *oct, octeon_pci_write_core_mem(struct octeon_device *oct,
u64 coreaddr, u64 coreaddr,
u8 *buf, const u8 *buf,
u32 len) u32 len)
{ {
__octeon_pci_rw_core_mem(oct, coreaddr, buf, len, 0); __octeon_pci_rw_core_mem(oct, coreaddr, (u8 *)buf, len, 0);
} }
u64 octeon_read_device_mem64(struct octeon_device *oct, u64 coreaddr) u64 octeon_read_device_mem64(struct octeon_device *oct, u64 coreaddr)
......
...@@ -66,7 +66,7 @@ octeon_pci_read_core_mem(struct octeon_device *oct, ...@@ -66,7 +66,7 @@ octeon_pci_read_core_mem(struct octeon_device *oct,
void void
octeon_pci_write_core_mem(struct octeon_device *oct, octeon_pci_write_core_mem(struct octeon_device *oct,
u64 coreaddr, u64 coreaddr,
u8 *buf, const u8 *buf,
u32 len); u32 len);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment