Recognize the integrated USB controllers of Sun PCIO-2 chips which

are used onboard in most of the newer PCI-based sun4u machines
(cosmetic change as they were also already probed as generic OHCI
without this). Detect whether their intpin register is valid and
correct it if necessary, i.e. set the respective IVAR to the right
value for allocating the IRQ resource, as some of them come up
having it set to 0 (mainly those used in Blade 100 and the first
one on AX1105 boards). This fixes attaching affected controllers.
Correcting the intpin value might be better off in the PCI code
via a quirk table but on the other hand gem(4) and hem(4) also
correct it themselves and at least for the USB controller part
the intpin register is truely hardwired to 0 and can't be changed.
This means that we would have to hook up the quirk information
in a lot of places in the PCI code (i.e. whenever the value of the
intpin register is read from or written to the pci_devinfo of the
respective device) in order to do it the right way.

MFC after:	1 month
This commit is contained in:
Marius Strobl 2005-05-19 23:00:46 +00:00
parent a30881c7d7
commit cf87ad7afd

View File

@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$");
#define PCI_OHCI_VENDORID_NVIDIA2 0x10DE
#define PCI_OHCI_VENDORID_OPTI 0x1045
#define PCI_OHCI_VENDORID_SIS 0x1039
#define PCI_OHCI_VENDORID_SUN 0x108e
#define PCI_OHCI_DEVICEID_ALADDIN_V 0x523710b9
static const char *ohci_device_aladdin_v = "AcerLabs M5237 (Aladdin-V) USB controller";
@ -112,6 +113,9 @@ static const char *ohci_device_sis5571 = "SiS 5571 USB controller";
#define PCI_OHCI_DEVICEID_KEYLARGO 0x0019106b
static const char *ohci_device_keylargo = "Apple KeyLargo USB controller";
#define PCI_OHCI_DEVICEID_PCIO2USB 0x1103108e
static const char *ohci_device_pcio2usb = "Sun PCIO-2 USB controller";
static const char *ohci_device_generic = "OHCI (generic) USB controller";
#define PCI_OHCI_BASE_REG 0x10
@ -184,6 +188,8 @@ ohci_pci_match(device_t self)
return (ohci_device_sis5571);
case PCI_OHCI_DEVICEID_KEYLARGO:
return (ohci_device_keylargo);
case PCI_OHCI_DEVICEID_PCIO2USB:
return (ohci_device_pcio2usb);
default:
if (pci_get_class(self) == PCIC_SERIALBUS
&& pci_get_subclass(self) == PCIS_SERIALBUS_USB
@ -220,6 +226,14 @@ ohci_pci_attach(device_t self)
pci_enable_busmaster(self);
/*
* Some Sun PCIO-2 USB controllers have their intpin register
* bogusly set to 0, although it should be 4. Correct that.
*/
if (pci_get_devid(self) == PCI_OHCI_DEVICEID_PCIO2USB &&
pci_get_intpin(self) == 0)
pci_set_intpin(self, 4);
rid = PCI_CBMEM;
sc->io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid,
RF_ACTIVE);