static char ohci_driver_name[] = KBUILD_MODNAME;
-#define PCI_DEVICE_ID_AGERE_FW643 0x5901
#define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380
#define PCI_DEVICE_ID_TI_TSB12LV22 0x8009
/* In case of multiple matches in ohci_quirks[], only the first one is used. */
static const struct {
- unsigned short vendor, device, revision, flags;
+ unsigned short vendor, device, flags;
} ohci_quirks[] = {
- {PCI_VENDOR_ID_AL, PCI_ANY_ID, PCI_ANY_ID,
- QUIRK_CYCLE_TIMER},
-
- {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, PCI_ANY_ID,
- QUIRK_BE_HEADERS},
-
- {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6,
- QUIRK_NO_MSI},
-
- {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID,
- QUIRK_NO_MSI},
-
- {PCI_VENDOR_ID_NEC, PCI_ANY_ID, PCI_ANY_ID,
- QUIRK_CYCLE_TIMER},
-
- {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID,
- QUIRK_CYCLE_TIMER},
-
- {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID,
- QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A},
-
- {PCI_VENDOR_ID_TI, PCI_ANY_ID, PCI_ANY_ID,
- QUIRK_RESET_PACKET},
-
- {PCI_VENDOR_ID_VIA, PCI_ANY_ID, PCI_ANY_ID,
- QUIRK_CYCLE_TIMER | QUIRK_NO_MSI},
+ {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, QUIRK_CYCLE_TIMER |
+ QUIRK_RESET_PACKET |
+ QUIRK_NO_1394A},
+ {PCI_VENDOR_ID_TI, PCI_ANY_ID, QUIRK_RESET_PACKET},
+ {PCI_VENDOR_ID_AL, PCI_ANY_ID, QUIRK_CYCLE_TIMER},
+ {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, QUIRK_NO_MSI},
+ {PCI_VENDOR_ID_NEC, PCI_ANY_ID, QUIRK_CYCLE_TIMER},
+ {PCI_VENDOR_ID_VIA, PCI_ANY_ID, QUIRK_CYCLE_TIMER},
+ {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, QUIRK_CYCLE_TIMER},
+ {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, QUIRK_BE_HEADERS},
};
/* This overrides anything that was found in ohci_quirks[]. */
d = &ab->descriptor;
if (d->res_count == 0) {
- size_t size, size2, rest, pktsize, size3, offset;
+ size_t size, rest, offset;
dma_addr_t start_bus;
void *start;
*/
offset = offsetof(struct ar_buffer, data);
- start = ab;
+ start = buffer = ab;
start_bus = le32_to_cpu(ab->descriptor.data_address) - offset;
- buffer = ab->data;
ab = ab->next;
d = &ab->descriptor;
- size = start + PAGE_SIZE - ctx->pointer;
- /* valid buffer data in the next page */
+ size = buffer + PAGE_SIZE - ctx->pointer;
rest = le16_to_cpu(d->req_count) - le16_to_cpu(d->res_count);
- /* what actually fits in this page */
- size2 = min(rest, (size_t)PAGE_SIZE - offset - size);
memmove(buffer, ctx->pointer, size);
- memcpy(buffer + size, ab->data, size2);
-
- while (size > 0) {
- void *next = handle_ar_packet(ctx, buffer);
- pktsize = next - buffer;
- if (pktsize >= size) {
- /*
- * We have handled all the data that was
- * originally in this page, so we can now
- * continue in the next page.
- */
- buffer = next;
- break;
- }
- /* move the next packet to the start of the buffer */
- memmove(buffer, next, size + size2 - pktsize);
- size -= pktsize;
- /* fill up this page again */
- size3 = min(rest - size2,
- (size_t)PAGE_SIZE - offset - size - size2);
- memcpy(buffer + size + size2,
- (void *) ab->data + size2, size3);
- size2 += size3;
- }
-
- if (rest > 0) {
- /* handle the packets that are fully in the next page */
- buffer = (void *) ab->data +
- (buffer - (start + offset + size));
- end = (void *) ab->data + rest;
+ memcpy(buffer + size, ab->data, rest);
+ ctx->current_buffer = ab;
+ ctx->pointer = (void *) ab->data + rest;
+ end = buffer + size + rest;
- while (buffer < end)
- buffer = handle_ar_packet(ctx, buffer);
-
- ctx->current_buffer = ab;
- ctx->pointer = end;
+ while (buffer < end)
+ buffer = handle_ar_packet(ctx, buffer);
- dma_free_coherent(ohci->card.device, PAGE_SIZE,
- start, start_bus);
- ar_context_add_page(ctx);
- } else {
- ctx->pointer = start + PAGE_SIZE;
- }
+ dma_free_coherent(ohci->card.device, PAGE_SIZE,
+ start, start_bus);
+ ar_context_add_page(ctx);
} else {
buffer = ctx->pointer;
ctx->pointer = end =
}
for (i = 0; i < ARRAY_SIZE(ohci_quirks); i++)
- if ((ohci_quirks[i].vendor == dev->vendor) &&
- (ohci_quirks[i].device == (unsigned short)PCI_ANY_ID ||
- ohci_quirks[i].device == dev->device) &&
- (ohci_quirks[i].revision == (unsigned short)PCI_ANY_ID ||
- ohci_quirks[i].revision >= dev->revision)) {
+ if (ohci_quirks[i].vendor == dev->vendor &&
+ (ohci_quirks[i].device == dev->device ||
+ ohci_quirks[i].device == (unsigned short)PCI_ANY_ID)) {
ohci->quirks = ohci_quirks[i].flags;
break;
}