Chameleon

Chameleon Commit Details

Date:2010-07-21 04:41:42 (13 years 9 months ago)
Author:Evan Lojewski
Commit:191
Parents: 190
Message:Updated usb code, default is enabled.
Changes:
M/branches/meklort/i386/libsaio/usb.c

File differences

branches/meklort/i386/libsaio/usb.c
3535
3636
3737
38
3839
3940
41
4042
4143
4244
4345
4446
4547
48
4649
47
50
51
4852
4953
5054
......
5559
5660
5761
58
59
60
61
6262
6363
64
6465
6566
67
6668
6769
6870
6971
7072
71
73
7274
73
75
7476
7577
7678
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
79
80
81
9282
93
9483
84
9585
96
86
87
9788
98
99
100
101
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
102104
103105
104
105
106
106107
107108
108109
......
123124
124125
125126
127
126128
127129
128130
int ehci_acquire (pci_dt_t *pci_dev);
int uhci_reset (pci_dt_t *pci_dev);
// Add usb device to the list
void notify_usb_dev(pci_dt_t *pci_dev)
{
struct pciList* current = usbList;
if(!usbList)
{
usbList = (struct pciList*)malloc(sizeof(struct pciList));
usbList->next = NULL;
usbList->pciDev = pci_dev;
}
else {
else
{
while(current != NULL && current->next != NULL)
{
current = current->next;
current->pciDev = pci_dev;
current->next = NULL;
}
}
// Loop through the list and call the apropriate patch function
int usb_loop()
{
int retVal = 1;
bool fix_ehci, fix_uhci, fix_usb, fix_legacy;
fix_ehci = fix_uhci = fix_usb = fix_legacy = true;
if (!getBoolForKey(kUSBBusFix, &fix_usb, &bootInfo->bootConfig))
if (getBoolForKey(kUSBBusFix, &fix_usb, &bootInfo->bootConfig))
{
fix_ehci = fix_uhci = fix_legacy = true;// Enable all if none set
fix_ehci = fix_uhci = fix_legacy = fix_usb;// Enable all if none set
}
else
{
if(!getBoolForKey(kEHCIacquire, &fix_ehci, &bootInfo->bootConfig))
{
fix_ehci = false;
}
if(!getBoolForKey(kUHCIreset, &fix_uhci, &bootInfo->bootConfig))
{
fix_uhci = false;
}
if(!getBoolForKey(kLegacyOff, &fix_legacy, &bootInfo->bootConfig))
{
fix_legacy = false;
}
getBoolForKey(kEHCIacquire, &fix_ehci, &bootInfo->bootConfig);
getBoolForKey(kUHCIreset, &fix_uhci, &bootInfo->bootConfig);
getBoolForKey(kLegacyOff, &fix_legacy, &bootInfo->bootConfig);
}
struct pciList* current = usbList;
while(current)
while(current && current->next)
{
if(fix_uhci) uhci_reset(current->pciDev);
if(fix_ehci) ehci_acquire(current->pciDev);
//if(fix_legacy) legacy_off(current->pciDev);
switch (pci_config_read8(current->pciDev->dev.addr, PCI_CLASS_PROG))
{
// EHCI
case 0x20:
if(fix_ehci) retVal &= ehci_acquire(current->pciDev);
if(fix_legacy) retVal &= legacy_off(current->pciDev);
break;
// UHCI
case 0x00:
if (fix_uhci) retVal &= uhci_reset(current->pciDev);
break;
}
current = current->next;
}
return 1;
return retVal;
}
int legacy_off (pci_dt_t *pci_dev)
pci_dev->vendor_id, pci_dev->device_id,
pci_dev->dev.bits.bus, pci_dev->dev.bits.dev, pci_dev->dev.bits.func);
// capaddr = Capability Registers = dev.addr + offset stored in dev.addr + 0x10 (USBBASE)
capaddr = pci_config_read32(pci_dev->dev.addr, 0x10);

Archive Download the corresponding diff file

Revision: 191