Ray Mack(deleted)
|
Re: Alloc Mem error with Intel i350 (e1000 device)
|
Ray Mack(deleted)
11/04/2014 6:24 PM
post112261
|
Re: Alloc Mem error with Intel i350 (e1000 device)
OK, so I am a newbie at PCI interrupts. The INT Line A was a red herring.
I was not able to see exactly where we changed from top down to bottom up allocation. Somewhere in our code we removed
a RSRCDBMGR_FLAG_TOPDOWN flag from a rsrcdbmgr request. The need may no longer be necessary since the code below fixes
the real problem. We have another issue in our hardware that forces me to grab extra memory and allocate bottom up in
order to create a hole in the PCI memory.
In the file src/hardware/pci/"your bsp"/server.c you want to find the function scan_windows() function. In my case "
your bsp" is "adi" since we are using their Cinnamon Bay board. Here is the new code to force the bus map to reserve
the right amount of memory for later when the allocation of resources happens when the E1000 driver attempts to allocate
the ethernet controller from the PCI server:
if (verbose)
pci_slogf (_SLOGC_PCI, _SLOG_INFO, "MEM 0x%llx 0x%llx %s", PCI_MEM_ADDR (addr64), size, addr64 & 0x08 ? "pref" : "")
;
BaseReg->Address = device_enabled ? addr64 : (addr64 &= 0x0f);
if (! device_enabled) {
PCI_write_config32 (bus, devfn, Offset, 1, (char *)&addr64);
if (reg_64) {
addr64 >>= 32;
PCI_write_config32 (bus, devfn, Offset + 4, 1, (char *)&addr64);
}
}
else {
uint64_t Address;
(*pci_drivers->entry->map_addr) (ll_handle, addr64, &Address, (uint32_t) BaseReg->Flags | PCI_MAP_ADDR_CPU);
original_size = size;
if ((size % 0x100000) > 0)
{
size += 0x100000;
size &= 0xfff00000;
}
if (alloc_resource (PCI_MEM_ADDR (Address), (uint32_t) size, RSRCDBMGR_PCI_MEMORY, bus,
(BaseReg->Flags & PCI_MEM_PREFETCH) ? 1 : 0)) {
pci_slogf (_SLOGC_PCI, _SLOG_ERROR, "%s: Alloc failed 0x%llx - Size 0x%llx",
__FUNCTION__, Address, size);
// BaseReg->Address = 0;
// BaseReg->Flags &= ~PCI_DEVICE_ENABLED;
// dword = 0;
// PCI_write_config32 (bus, devfn, Offset, 1, (char *)&dword);
}
// else {
BaseReg->Address = Address;
BaseReg->Flags |= PCI_DEVICE_ENABLED;
}
}
}
The new code you want adjusts the variable size to be on the first 1MB boundary above what you really need. ("
original_size" is a debug variable used to compare what the chip says vs. what we end up using).
|
|
|