Improve ck804 IOAPIC and HPET resource handling.
Signed-off-by: Jonathan Kollasch <jakllsch@kollasch.net> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6429 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
a73ffa0a3e
commit
fadb004359
|
@ -104,15 +104,6 @@ static void rom_dummy_write(device_t dev)
|
||||||
pci_write_config8(dev, 0x6d, new);
|
pci_write_config8(dev, 0x6d, new);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void enable_hpet(struct device *dev)
|
|
||||||
{
|
|
||||||
unsigned long hpet_address;
|
|
||||||
|
|
||||||
pci_write_config32(dev, 0x44, 0xfed00001);
|
|
||||||
hpet_address = pci_read_config32(dev, 0x44) & 0xfffffffe;
|
|
||||||
printk(BIOS_DEBUG, "Enabling HPET @0x%lx\n", hpet_address);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned pm_base = 0;
|
unsigned pm_base = 0;
|
||||||
|
|
||||||
static void lpc_init(device_t dev)
|
static void lpc_init(device_t dev)
|
||||||
|
@ -130,12 +121,6 @@ static void lpc_init(device_t dev)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Posted memory write enable */
|
|
||||||
byte = pci_read_config8(dev, 0x46);
|
|
||||||
pci_write_config8(dev, 0x46, byte | (1 << 0));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Power after power fail */
|
/* Power after power fail */
|
||||||
on = CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL;
|
on = CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL;
|
||||||
get_option(&on, "power_on_after_fail");
|
get_option(&on, "power_on_after_fail");
|
||||||
|
@ -166,12 +151,6 @@ static void lpc_init(device_t dev)
|
||||||
pci_write_config8(dev, 0xe8, byte);
|
pci_write_config8(dev, 0xe8, byte);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable Error reporting. */
|
|
||||||
/* Set up sync flood detected. */
|
|
||||||
byte = pci_read_config8(dev, 0x47);
|
|
||||||
byte |= (1 << 1);
|
|
||||||
pci_write_config8(dev, 0x47, byte);
|
|
||||||
|
|
||||||
/* Set up NMI on errors. */
|
/* Set up NMI on errors. */
|
||||||
byte = inb(0x70); /* RTC70 */
|
byte = inb(0x70); /* RTC70 */
|
||||||
byte_old = byte;
|
byte_old = byte;
|
||||||
|
@ -190,9 +169,6 @@ static void lpc_init(device_t dev)
|
||||||
/* Initialize ISA DMA. */
|
/* Initialize ISA DMA. */
|
||||||
isa_dma_init();
|
isa_dma_init();
|
||||||
|
|
||||||
/* Initialize the High Precision Event Timers (HPET). */
|
|
||||||
enable_hpet(dev);
|
|
||||||
|
|
||||||
rom_dummy_write(dev);
|
rom_dummy_write(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,6 +181,9 @@ static void ck804_lpc_read_resources(device_t dev)
|
||||||
/* We got one for APIC, or one more for TRAP. */
|
/* We got one for APIC, or one more for TRAP. */
|
||||||
pci_dev_read_resources(dev);
|
pci_dev_read_resources(dev);
|
||||||
|
|
||||||
|
/* HPET */
|
||||||
|
pci_get_resource(dev, 0x44);
|
||||||
|
|
||||||
/* Get resource for ACPI, SYSTEM_CONTROL, ANALOG_CONTROL. */
|
/* Get resource for ACPI, SYSTEM_CONTROL, ANALOG_CONTROL. */
|
||||||
for (index = 0x60; index <= 0x68; index += 4) /* We got another 3. */
|
for (index = 0x60; index <= 0x68; index += 4) /* We got another 3. */
|
||||||
pci_get_resource(dev, index);
|
pci_get_resource(dev, index);
|
||||||
|
@ -223,10 +202,42 @@ static void ck804_lpc_read_resources(device_t dev)
|
||||||
res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
|
res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
|
||||||
IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
|
IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
|
||||||
|
|
||||||
res = new_resource(dev, 3); /* IOAPIC */
|
if (dev->device != PCI_DEVICE_ID_NVIDIA_CK804_SLAVE) {
|
||||||
res->base = IO_APIC_ADDR;
|
res = find_resource(dev, 0x14); /* IOAPIC */
|
||||||
res->size = 0x00001000;
|
if (res) {
|
||||||
res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
|
res->base = IO_APIC_ADDR;
|
||||||
|
res->flags |= IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = find_resource(dev, 0x44); /* HPET */
|
||||||
|
if (res) {
|
||||||
|
res->base = 0xfed00000;
|
||||||
|
res->flags |= IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ck804_lpc_set_resources(device_t dev)
|
||||||
|
{
|
||||||
|
struct resource *res;
|
||||||
|
|
||||||
|
pci_dev_set_resources(dev);
|
||||||
|
|
||||||
|
/* APIC */
|
||||||
|
res = find_resource(dev, 0x14);
|
||||||
|
if (res) {
|
||||||
|
pci_write_config32(dev, 0x14, res->base);
|
||||||
|
res->flags |= IORESOURCE_STORED;
|
||||||
|
report_resource_stored(dev, res, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* HPET */
|
||||||
|
res = find_resource(dev, 0x44);
|
||||||
|
if (res) {
|
||||||
|
pci_write_config32(dev, 0x44, res->base|1);
|
||||||
|
res->flags |= IORESOURCE_STORED;
|
||||||
|
report_resource_stored(dev, res, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -299,7 +310,7 @@ static void ck804_lpc_enable_resources(device_t dev)
|
||||||
|
|
||||||
static struct device_operations lpc_ops = {
|
static struct device_operations lpc_ops = {
|
||||||
.read_resources = ck804_lpc_read_resources,
|
.read_resources = ck804_lpc_read_resources,
|
||||||
.set_resources = pci_dev_set_resources,
|
.set_resources = ck804_lpc_set_resources,
|
||||||
.enable_resources = ck804_lpc_enable_resources,
|
.enable_resources = ck804_lpc_enable_resources,
|
||||||
.init = lpc_init,
|
.init = lpc_init,
|
||||||
.scan_bus = scan_static_bus,
|
.scan_bus = scan_static_bus,
|
||||||
|
|
Loading…
Reference in New Issue