diff options
author | Kristian Høgsberg <krh@redhat.com> | 2006-12-13 23:50:41 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2006-12-13 23:50:41 -0500 |
commit | 2b0f3720581a6441e2e6b332d4a786357e9a6946 (patch) | |
tree | a1ffdc0750c9211ea1d407424706932c1f761a42 | |
parent | 5d0148312b98d2dee399fa20f87f66190eeba51b (diff) |
Don't break down on big payloads.
-rw-r--r-- | nosy-dump.c | 14 | ||||
-rw-r--r-- | nosy.c | 18 |
2 files changed, 26 insertions, 6 deletions
diff --git a/nosy-dump.c b/nosy-dump.c index 993043f..17c1456 100644 --- a/nosy-dump.c +++ b/nosy-dump.c @@ -626,12 +626,20 @@ unsigned int get_bits(struct link_packet *packet, int offset, int width) void dump_data(unsigned char *data, int length) { - int i; + int i, print_length; + + if (length > 128) + print_length = 128; + else + print_length = length; - for (i = 0; i < length; i++) + for (i = 0; i < print_length; i++) printf("%s%02hhx", (i % 4 == 0 && i != 0) ? " " : "", data[byte_index(i)]); + + if (print_length < length) + printf(" (%d more bytes)", length - print_length); } static void @@ -913,7 +921,7 @@ int main(int argc, const char *argv[]) setvbuf(stdout, NULL, _IOLBF, BUFSIZ); if (1) { - unsigned long buf[1024]; + unsigned long buf[128 * 1024]; unsigned int filter; int length; @@ -529,6 +529,7 @@ remove_card(struct pci_dev *dev) kfree(lynx); } +#define RCV_BUFFER_SIZE (16 * 1024) #define FAIL(s, args...) \ do { \ @@ -540,7 +541,8 @@ static int __devinit add_card(struct pci_dev *dev, const struct pci_device_id *unused) { struct pcilynx *lynx; - int err; + u32 p, end; + int err, i; err = -ENXIO; @@ -572,7 +574,7 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused) lynx->rcv_pcl = pci_alloc_consistent(lynx->pci_device, sizeof(struct pcl), &lynx->rcv_pcl_bus); - lynx->rcv_buffer = pci_alloc_consistent(lynx->pci_device, PAGE_SIZE, + lynx->rcv_buffer = pci_alloc_consistent(lynx->pci_device, RCV_BUFFER_SIZE, &lynx->rcv_buffer_bus); if (lynx->rcv_start_pcl == NULL || lynx->rcv_pcl == NULL || @@ -583,8 +585,18 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused) lynx->rcv_start_pcl->next = lynx->rcv_pcl_bus; lynx->rcv_pcl->next = PCL_NEXT_INVALID; lynx->rcv_pcl->async_error_next = PCL_NEXT_INVALID; - lynx->rcv_pcl->buffer[0].control = PCL_CMD_RCV | PCL_BIGENDIAN | 2048; + + lynx->rcv_pcl->buffer[0].control = + PCL_CMD_RCV | PCL_BIGENDIAN | 2044; lynx->rcv_pcl->buffer[0].pointer = lynx->rcv_buffer_bus + 4; + p = lynx->rcv_buffer_bus + 2048; + end = lynx->rcv_buffer_bus + RCV_BUFFER_SIZE; + for (i = 1; p < end; i++, p += 2048) { + lynx->rcv_pcl->buffer[i].control = + PCL_CMD_RCV | PCL_BIGENDIAN | 2048; + lynx->rcv_pcl->buffer[i].pointer = p; + } + lynx->rcv_pcl->buffer[i - 1].control |= PCL_LAST_BUFF; reg_set_bits(lynx, MISC_CONTROL, MISC_CONTROL_SWRESET); /* Fix buggy cards with autoboot pin not tied low: */ |