enable device after configuration
This commit is contained in:
@@ -361,7 +361,17 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* disable device
|
||||
*/
|
||||
|
||||
value = swpl(pci_read_config_longword(handle, PCICSR));
|
||||
|
||||
pci_write_config_longword(handle, PCICSR, swpl(value));
|
||||
|
||||
int barnum = 0;
|
||||
uint16_t command_register = 0;
|
||||
|
||||
descriptors = resource_descriptors[index];
|
||||
for (i = 0; i < 6; i++) /* for all bars */
|
||||
{
|
||||
@@ -416,6 +426,8 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
|
||||
/* adjust memory adress for next turn */
|
||||
mem_address += size;
|
||||
|
||||
command_register |= 2;
|
||||
|
||||
/* index to next unused resource descriptor */
|
||||
barnum++;
|
||||
}
|
||||
@@ -440,6 +452,8 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
|
||||
|
||||
io_address += size;
|
||||
|
||||
command_register |= 1;
|
||||
|
||||
barnum++;
|
||||
}
|
||||
}
|
||||
@@ -449,15 +463,9 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
|
||||
descriptors[barnum - 1].flags |= FLG_LAST;
|
||||
|
||||
/*
|
||||
* enable device finally
|
||||
* enable device memory or I/O access
|
||||
*/
|
||||
value = swpl(pci_read_config_longword(handle, PCICSR));
|
||||
xprintf("device 0x%02x PCICSR = 0x%08x\r\n", handle, value);
|
||||
value = 0xffff0146;
|
||||
pci_write_config_longword(handle, PCICSR, swpl(value));
|
||||
|
||||
value = swpl(pci_read_config_longword(handle, PCICSR));
|
||||
xprintf("device 0x%02x PCICSR = 0x%08x\r\n", handle, value);
|
||||
pci_write_config_longword(handle, PCICSR, swpw(command_register));
|
||||
}
|
||||
|
||||
static void pci_bridge_config(uint16_t bus, uint16_t device, uint16_t function)
|
||||
|
||||
Reference in New Issue
Block a user