reenable forgotten memory deallocations

This commit is contained in:
Markus Fröschle
2021-07-17 23:06:22 +02:00
parent da982d1e5c
commit 253ba1aec1

View File

@@ -105,7 +105,7 @@ static inline void writel(uint32_t value, volatile uint32_t *address)
struct pci_device_id ohci_usb_pci_table[] = struct pci_device_id ohci_usb_pci_table[] =
{ {
{ {
PCI_VENDOR_ID_AL, PCI_VENDOR_ID_AL,
PCI_DEVICE_ID_AL_M5237, PCI_DEVICE_ID_AL_M5237,
PCI_ANY_ID, PCI_ANY_ID,
@@ -113,8 +113,8 @@ struct pci_device_id ohci_usb_pci_table[] =
PCI_CLASS_SERIAL_USB_OHCI, PCI_CLASS_SERIAL_USB_OHCI,
0, 0,
0 0
}, /* ULI1575 PCI OHCI module ids */ }, /* ULI1575 PCI OHCI module ids */
{ {
PCI_VENDOR_ID_NEC, PCI_VENDOR_ID_NEC,
PCI_DEVICE_ID_NEC_USB, PCI_DEVICE_ID_NEC_USB,
PCI_ANY_ID, PCI_ANY_ID,
@@ -122,8 +122,8 @@ struct pci_device_id ohci_usb_pci_table[] =
PCI_CLASS_SERIAL_USB_OHCI, PCI_CLASS_SERIAL_USB_OHCI,
0, 0,
0 0
}, /* NEC PCI OHCI module ids */ }, /* NEC PCI OHCI module ids */
{ {
PCI_VENDOR_ID_NEC, PCI_VENDOR_ID_NEC,
PCI_DEVICE_ID_NEC_USB_A, PCI_DEVICE_ID_NEC_USB_A,
PCI_ANY_ID, PCI_ANY_ID,
@@ -131,8 +131,8 @@ struct pci_device_id ohci_usb_pci_table[] =
PCI_CLASS_SERIAL_USB_OHCI, PCI_CLASS_SERIAL_USB_OHCI,
0, 0,
0 0
}, /* NEC PCI OHCI module ids */ }, /* NEC PCI OHCI module ids */
{ {
PCI_VENDOR_ID_PHILIPS, PCI_VENDOR_ID_PHILIPS,
PCI_DEVICE_ID_PHILIPS_ISP1561, PCI_DEVICE_ID_PHILIPS_ISP1561,
PCI_ANY_ID, PCI_ANY_ID,
@@ -140,9 +140,9 @@ struct pci_device_id ohci_usb_pci_table[] =
PCI_CLASS_SERIAL_USB_OHCI, PCI_CLASS_SERIAL_USB_OHCI,
0, 0,
0 0
}, /* Philips 1561 PCI OHCI module ids */ }, /* Philips 1561 PCI OHCI module ids */
/* Please add supported PCI OHCI controller ids here */ /* Please add supported PCI OHCI controller ids here */
{ {
0, 0,
0, 0,
0, 0,
@@ -150,12 +150,12 @@ struct pci_device_id ohci_usb_pci_table[] =
0, 0,
0, 0,
0 0
} }
}; };
/* global ohci_t */ /* global ohci_t */
static ohci_t gohci[10]; static ohci_t gohci[10];
int ohci_inited; static int ohci_inited;
static inline uint32_t roothub_a(volatile ohci_t *ohci) { return readl(&ohci->regs->roothub.a); } static inline uint32_t roothub_a(volatile ohci_t *ohci) { return readl(&ohci->regs->roothub.a); }
static inline uint32_t roothub_b(volatile ohci_t *ohci) { return readl(&ohci->regs->roothub.b); } static inline uint32_t roothub_b(volatile ohci_t *ohci) { return readl(&ohci->regs->roothub.b); }
@@ -287,7 +287,7 @@ void write_registers(volatile ohci_t *ohci)
void dump_hcca(ohci_t *ohci) void dump_hcca(ohci_t *ohci)
{ {
struct ohci_hcca *hcca = ohci->hcca; volatile struct ohci_hcca *hcca = ohci->hcca;
dbg("hcca pad1: 0x%lx\r\n", hcca->pad1); dbg("hcca pad1: 0x%lx\r\n", hcca->pad1);
dbg("hcca frame no: 0x%x\r\n", hcca->frame_no); dbg("hcca frame no: 0x%x\r\n", hcca->frame_no);
@@ -299,6 +299,7 @@ void dump_hcca(ohci_t *ohci)
hexdump(hcca->reserved_for_hc, sizeof(hcca->reserved_for_hc)); hexdump(hcca->reserved_for_hc, sizeof(hcca->reserved_for_hc));
#endif #endif
} }
static struct td *ptd; static struct td *ptd;
/* TDs ... */ /* TDs ... */
@@ -345,7 +346,7 @@ static void urb_free_priv(volatile urb_priv_t *urb)
} }
} }
} }
/* FIXME: driver_mem_free(urb); */ driver_mem_free(urb);
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
@@ -366,8 +367,8 @@ static void pkt_print(ohci_t *ohci, urb_priv_t *purb, struct usb_device *dev,
usb_pipedevice(pipe), usb_pipedevice(pipe),
usb_pipeendpoint(pipe), usb_pipeendpoint(pipe),
usb_pipeout(pipe)? 'O': 'I', usb_pipeout(pipe)? 'O': 'I',
usb_pipetype(pipe) < 2 ? \ usb_pipetype(pipe) < 2 ?
(usb_pipeint(pipe)? "INTR": "ISOC"): \ (usb_pipeint(pipe) ? "INTR": "ISOC") :
(usb_pipecontrol(pipe)? "CTRL": "BULK"), (usb_pipecontrol(pipe)? "CTRL": "BULK"),
(purb ? purb->actual_length : 0), (purb ? purb->actual_length : 0),
transfer_len, dev->status); transfer_len, dev->status);
@@ -521,8 +522,8 @@ static void ohci_dump_roothub(ohci_t *controller, int verbose)
temp = roothub_a(controller); temp = roothub_a(controller);
(void) temp; (void) temp;
// ndp = (temp & RH_A_NDP); ndp = (temp & RH_A_NDP);
ndp = controller->ndp; // ndp = controller->ndp;
if (verbose) if (verbose)
{ {
dbg("roothub.a: %08x POTPGT=%d%s%s%s%s%s NDP=%d\r\n", temp, dbg("roothub.a: %08x POTPGT=%d%s%s%s%s%s NDP=%d\r\n", temp,
@@ -1454,14 +1455,14 @@ static unsigned char root_hub_str_index1[] =
#define OK(x) len = (x); break #define OK(x) len = (x); break
#ifdef DEBUG_OHCI #ifdef DEBUG_OHCI
#define WR_RH_STAT(x) { err("WR:status %#8x", (x)); writel((x), &ohci->regs->roothub.status); } #define WR_RH_STAT(x) { inf("WR:status %#8x", (x)); writel((x), &ohci->regs->roothub.status); }
#define WR_RH_PORTSTAT(x) { err("WR:portstatus[%d] %#8x", wIndex - 1, (x)); writel((x), &ohci->regs->roothub.portstatus[wIndex - 1]); } #define WR_RH_PORTSTAT(x) { inf("WR:portstatus[%d] %#8x", wIndex - 1, (x)); writel((x), &ohci->regs->roothub.portstatus[wIndex - 1]); }
#else #else
#define WR_RH_STAT(x) { writel((x), &ohci->regs->roothub.status); } #define WR_RH_STAT(x) { writel((x), &ohci->regs->roothub.status); }
#define WR_RH_PORTSTAT(x) { writel((x), &ohci->regs->roothub.portstatus[wIndex - 1]); } #define WR_RH_PORTSTAT(x) { writel((x), &ohci->regs->roothub.portstatus[wIndex - 1]); }
#endif #endif
#define RD_RH_STAT roothub_status(ohci) #define RD_RH_STAT roothub_status(ohci)
#define RD_RH_PORTSTAT roothub_portstatus(ohci, wIndex-1) #define RD_RH_PORTSTAT roothub_portstatus(ohci, wIndex - 1)
/* request to virtual root hub */ /* request to virtual root hub */
@@ -1501,7 +1502,7 @@ static int ohci_submit_rh_msg(volatile ohci_t *ohci, struct usb_device *dev, uin
int len = 0; int len = 0;
int stat = 0; int stat = 0;
uint32_t datab[4]; uint32_t datab[4];
uint8_t *data_buf = (uint8_t *)datab; uint8_t *data_buf = (uint8_t *) datab;
uint16_t bmRType_bReq; uint16_t bmRType_bReq;
uint16_t wValue; uint16_t wValue;
uint16_t wIndex; uint16_t wIndex;
@@ -1512,7 +1513,7 @@ static int ohci_submit_rh_msg(volatile ohci_t *ohci, struct usb_device *dev, uin
#else #else
if (ohci->irq) if (ohci->irq)
{ {
wait_ms(10); wait_ms(1);
} }
#endif #endif
@@ -1540,23 +1541,23 @@ static int ohci_submit_rh_msg(volatile ohci_t *ohci, struct usb_device *dev, uin
* RH_OTHER | RH_CLASS almost ever means HUB_PORT here * RH_OTHER | RH_CLASS almost ever means HUB_PORT here
*/ */
case RH_GET_STATUS: case RH_GET_STATUS:
*(uint16_t *) data_buf = swpw(1); * (uint16_t *) data_buf = swpw(1);
OK(2); OK(2);
case RH_GET_STATUS | RH_INTERFACE: case RH_GET_STATUS | RH_INTERFACE:
*(uint16_t *) data_buf = swpw(0); * (uint16_t *) data_buf = swpw(0);
OK(2); OK(2);
case RH_GET_STATUS | RH_ENDPOINT: case RH_GET_STATUS | RH_ENDPOINT:
*(uint16_t *) data_buf = swpw(0); * (uint16_t *) data_buf = swpw(0);
OK(2); OK(2);
case RH_GET_STATUS | RH_CLASS: case RH_GET_STATUS | RH_CLASS:
*(uint32_t *) data_buf = swpl(RD_RH_STAT & ~(RH_HS_CRWE | RH_HS_DRWE)); * (uint32_t *) data_buf = swpl(RD_RH_STAT & ~(RH_HS_CRWE | RH_HS_DRWE));
OK(4); OK(4);
case RH_GET_STATUS | RH_OTHER | RH_CLASS: case RH_GET_STATUS | RH_OTHER | RH_CLASS:
*(uint32_t *) data_buf = swpl(RD_RH_PORTSTAT); * (uint32_t *) data_buf = swpl(RD_RH_PORTSTAT);
OK(4); OK(4);
case RH_CLEAR_FEATURE | RH_ENDPOINT: case RH_CLEAR_FEATURE | RH_ENDPOINT:
@@ -1767,7 +1768,7 @@ static int submit_common_msg(volatile ohci_t *ohci, struct usb_device *dev, uint
#else #else
if (ohci->irq) if (ohci->irq)
{ {
wait_us(10); wait_ms(1);
} }
#endif #endif
@@ -1841,7 +1842,7 @@ static int submit_common_msg(volatile ohci_t *ohci, struct usb_device *dev, uint
if (--timeout) if (--timeout)
{ {
wait_ms(10); wait_ms(1);
// if (!urb->finished) // if (!urb->finished)
// xprintf("*\r\n"); // xprintf("*\r\n");
} }
@@ -2289,17 +2290,17 @@ static void hc_free_buffers(volatile ohci_t *ohci)
{ {
if (ohci->td_unaligned != NULL) if (ohci->td_unaligned != NULL)
{ {
/* FIXME: driver_mem_free(ohci->td_unaligned); */ driver_mem_free(ohci->td_unaligned);
ohci->td_unaligned = NULL; ohci->td_unaligned = NULL;
} }
if (ohci->ohci_dev_unaligned != NULL) if (ohci->ohci_dev_unaligned != NULL)
{ {
/* FIXME: driver_mem_free(ohci->ohci_dev_unaligned); */ driver_mem_free(ohci->ohci_dev_unaligned);
ohci->ohci_dev_unaligned = NULL; ohci->ohci_dev_unaligned = NULL;
} }
if (ohci->hcca_unaligned != NULL) if (ohci->hcca_unaligned != NULL)
{ {
/* FIXME: driver_mem_free(ohci->hcca_unaligned); */ driver_mem_free(ohci->hcca_unaligned);
ohci->hcca_unaligned = NULL; ohci->hcca_unaligned = NULL;
} }
} }