move remaining routines into BaS.c (after copy to RAM)

This commit is contained in:
Markus Fröschle
2020-06-23 09:58:06 +02:00
parent 2801f78313
commit a8dfbb1ba7
2 changed files with 74 additions and 77 deletions

View File

@@ -49,6 +49,7 @@
#include "exceptions.h"
#include "net_timer.h"
#include "pci.h"
#include "usb.h"
#include "video.h"
#include "driver_mem.h"
@@ -772,6 +773,76 @@ void ide_init(void)
set_ide_access_mode();
}
/*
* probe for NEC compatible USB host controller and install if found
*/
void init_usb(void)
{
extern struct pci_device_id ohci_usb_pci_table[];
extern struct pci_device_id ehci_usb_pci_table[];
struct pci_device_id *board;
int32_t handle;
int usb_found = 0;
int index = 0;
/*
* disabled for now
*/
return;
inf("USB controller initialization:\r\n");
do
{
handle = pci_find_classcode(PCI_CLASS_SERIAL_USB | PCI_FIND_BASE_CLASS | PCI_FIND_SUB_CLASS, index++);
dbg("handle 0x%02x\r\n", handle);
if (handle > 0)
{
long id;
long pci_class;
xprintf("serial USB found at bus=0x%x, dev=0x%x, fnc=0x%x (0x%x)\r\n",
PCI_BUS_FROM_HANDLE(handle),
PCI_DEVICE_FROM_HANDLE(handle),
PCI_FUNCTION_FROM_HANDLE(handle),
handle);
id = swpl(pci_read_config_longword(handle, PCIIDR));
pci_class = swpl(pci_read_config_longword(handle, PCIREV));
if (pci_class >> 8 == PCI_CLASS_SERIAL_USB_EHCI)
{
board = ehci_usb_pci_table;
while (board->vendor)
{
if ((board->vendor == PCI_VENDOR_ID(id)) && board->device == PCI_DEVICE_ID(id))
{
if (usb_init(handle, board) >= 0)
{
usb_found++;
}
}
board++;
}
}
if (pci_class >> 8 == PCI_CLASS_SERIAL_USB_OHCI)
{
board = ohci_usb_pci_table;
while (board->vendor)
{
if ((board->vendor == PCI_VENDOR_ID(id)) && board->device == PCI_DEVICE_ID(id))
{
if (usb_init(handle, board) >= 0)
usb_found++;
}
board++;
}
}
}
} while (handle >= 0);
xprintf("finished (found %d USB controller(s))\r\n", usb_found);
}
/* Jump into the OS */
typedef void void_func(void);