override the tag. usb_block_allocmem allocates a new tag, which when we

go looking for free fragments won't match.  Since we never free this, we
can "throw away" the tag.  This is very dirty, and needs to be reimplemented
properly, but fixes performance problems with uhci.

Also assert that when we overlay a structure on some space, that the
space is large enough for the structure.
This commit is contained in:
John-Mark Gurney 2003-07-21 02:41:01 +00:00
parent 432b45de08
commit 9e17948f72
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=117815

View File

@ -84,7 +84,7 @@ extern int usbdebug;
#endif
#define USB_MEM_SMALL 64
#define USB_MEM_CHUNKS (PAGE_SIZE / 64)
#define USB_MEM_CHUNKS (PAGE_SIZE / USB_MEM_SMALL)
#define USB_MEM_BLOCK (USB_MEM_SMALL * USB_MEM_CHUNKS)
/* This struct is overlayed on free fragments. */
@ -256,6 +256,10 @@ usb_allocmem(usbd_bus_handle bus, size_t size, size_t align, usb_dma_t *p)
return (err);
}
b->fullblock = 0;
/* XXX - override the tag, ok since we never free it */
b->tag = tag;
KASSERT(sizeof *f <= USB_MEM_SMALL, ("USB_MEM_SMALL(%d) is too small for struct usb_frag_dma(%d)\n",
USB_MEM_SMALL, sizeof *f));
for (i = 0; i < USB_MEM_BLOCK; i += USB_MEM_SMALL) {
f = (struct usb_frag_dma *)((char *)b->kaddr + i);
f->block = b;