1 #include <console/console.h>
4 #include <stream/read_bytes.h>
8 #ifndef CONFIG_ROM_STREAM_START
9 #define CONFIG_ROM_STREAM_START 0xffff0000UL
12 /* well, this is a mess, and it will get fixed, but not right away.
13 * until we stop using 'ld' for building the rom image, that is.
14 * problem is, that on the sc520, ROM_STREAM_START has to be at 0x2000000.
15 * but if you set CONFIG_ROM_STREAM_START to that, then ld will try to
16 * build a giant image: 0x0-0x2000000, i.e. almost 4 GB.
17 * so make this non-static, non-const for now.
21 /*static const */unsigned char *rom_start = (void *)CONFIG_ROM_STREAM_START;
22 /*static const */unsigned char *rom_end = (void *)(CONFIG_ROM_STREAM_START + PAYLOAD_SIZE - 1);
24 static const unsigned char *rom;
30 printk_debug("%6d:%s() - rom_stream: 0x%08lx - 0x%08lx\n",
31 __LINE__, __FUNCTION__,
32 (unsigned long)rom_start,
33 (unsigned long)rom_end);
38 void stream_fini(void)
43 byte_offset_t stream_skip(byte_offset_t count)
47 if ((rom + bytes) > rom_end) {
48 printk_warning("%6d:%s() - overflowed source buffer\n",
49 __LINE__, __FUNCTION__);
52 bytes = (rom_end - rom) + 1;
59 byte_offset_t stream_read(void *vdest, byte_offset_t count)
61 unsigned char *dest = vdest;
62 const unsigned char *src = rom;
65 bytes = stream_skip(count);
66 memcpy(dest, src, bytes);