freebsd_network: Handle 64 bit memory BARs.

This adds the upper 32 bits for address and size.

Change-Id: I2f776c7b8b72ecefca9f3b93d9c42912666a41e2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3026
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Michael Lotz 2020-07-11 23:49:55 +02:00 committed by waddlesplash
parent 8827bb6d89
commit b0a3a5c9bc
1 changed files with 7 additions and 2 deletions

View File

@ -113,8 +113,8 @@ static int
bus_alloc_mem_resource(device_t dev, struct resource *res, pci_info *info,
int bar_index)
{
uint32 addr = info->u.h0.base_registers[bar_index];
uint32 size = info->u.h0.base_register_sizes[bar_index];
phys_addr_t addr = info->u.h0.base_registers[bar_index];
uint64 size = info->u.h0.base_register_sizes[bar_index];
uchar flags = info->u.h0.base_register_flags[bar_index];
// reject empty regions
@ -127,6 +127,11 @@ bus_alloc_mem_resource(device_t dev, struct resource *res, pci_info *info,
// TODO: check flags & PCI_address_prefetchable ?
if ((flags & PCI_address_type) == PCI_address_type_64) {
addr |= (uint64)info->u.h0.base_registers[bar_index + 1] << 32;
size |= (uint64)info->u.h0.base_register_sizes[bar_index + 1] << 32;
}
// enable this I/O resource
if (pci_enable_io(dev, SYS_RES_MEMORY) != 0)
return -1;