|
Lines 35-40
Link Here
|
| 35 |
#include <sys/param.h> |
35 |
#include <sys/param.h> |
| 36 |
#include <sys/bus.h> |
36 |
#include <sys/bus.h> |
| 37 |
#include <sys/kernel.h> |
37 |
#include <sys/kernel.h> |
|
|
38 |
#include <sys/linker.h> |
| 38 |
#include <sys/lock.h> |
39 |
#include <sys/lock.h> |
| 39 |
#include <sys/malloc.h> |
40 |
#include <sys/malloc.h> |
| 40 |
#include <sys/module.h> |
41 |
#include <sys/module.h> |
|
Lines 46-51
Link Here
|
| 46 |
|
47 |
|
| 47 |
#include <machine/bus.h> |
48 |
#include <machine/bus.h> |
| 48 |
#include <machine/intr_machdep.h> |
49 |
#include <machine/intr_machdep.h> |
|
|
50 |
#include <machine/metadata.h> |
| 49 |
#include <machine/md_var.h> |
51 |
#include <machine/md_var.h> |
| 50 |
#include <machine/resource.h> |
52 |
#include <machine/resource.h> |
| 51 |
#include <x86/include/apicvar.h> |
53 |
#include <x86/include/apicvar.h> |
|
Lines 1332-1343
Link Here
|
| 1332 |
vmbus_get_mmio_res_pass(dev, parse_32); |
1334 |
vmbus_get_mmio_res_pass(dev, parse_32); |
| 1333 |
} |
1335 |
} |
| 1334 |
|
1336 |
|
|
|
1337 |
/* |
| 1338 |
* On Gen2 VMs, Hyper-V provides mmio space for framebuffer. |
| 1339 |
* This mmio address range is not useable for other PCI devices. |
| 1340 |
* Currently only efifb driver is using this range without reserving |
| 1341 |
* it from system. |
| 1342 |
* Therefore, vmbus driver reserves it before any other PCI devices |
| 1343 |
* drivers start to request mmio addresses. |
| 1344 |
*/ |
| 1345 |
static struct resource *hv_fb_res; |
| 1346 |
|
| 1335 |
static void |
1347 |
static void |
|
|
1348 |
vmbus_fb_mmio_res(device_t dev) |
| 1349 |
{ |
| 1350 |
struct efi_fb *efifb; |
| 1351 |
caddr_t kmdp; |
| 1352 |
|
| 1353 |
struct vmbus_softc *sc = device_get_softc(dev); |
| 1354 |
int rid = 0; |
| 1355 |
|
| 1356 |
kmdp = preload_search_by_type("elf kernel"); |
| 1357 |
if (kmdp == NULL) |
| 1358 |
kmdp = preload_search_by_type("elf64 kernel"); |
| 1359 |
efifb = (struct efi_fb *)preload_search_info(kmdp, |
| 1360 |
MODINFO_METADATA | MODINFOMD_EFI_FB); |
| 1361 |
if (efifb == NULL) { |
| 1362 |
if (bootverbose) |
| 1363 |
device_printf(dev, |
| 1364 |
"fb has no preloaded kernel efi information\n"); |
| 1365 |
/* We are on Gen1 VM, just return. */ |
| 1366 |
return; |
| 1367 |
} else { |
| 1368 |
if (bootverbose) |
| 1369 |
device_printf(dev, |
| 1370 |
"efifb: fb_addr: %#jx, size: %#jx, " |
| 1371 |
"actual size needed: 0x%x\n", |
| 1372 |
efifb->fb_addr, efifb->fb_size, |
| 1373 |
(int) efifb->fb_height * efifb->fb_width); |
| 1374 |
} |
| 1375 |
|
| 1376 |
hv_fb_res = pcib_host_res_alloc(&sc->vmbus_mmio_res, dev, |
| 1377 |
SYS_RES_MEMORY, &rid, |
| 1378 |
efifb->fb_addr, efifb->fb_addr + efifb->fb_size, efifb->fb_size, |
| 1379 |
RF_ACTIVE | rman_make_alignment_flags(PAGE_SIZE)); |
| 1380 |
|
| 1381 |
if (hv_fb_res && bootverbose) |
| 1382 |
device_printf(dev, |
| 1383 |
"successfully reserved memory for framebuffer " |
| 1384 |
"starting at %#jx, size %#jx\n", |
| 1385 |
efifb->fb_addr, efifb->fb_size); |
| 1386 |
} |
| 1387 |
|
| 1388 |
static void |
| 1336 |
vmbus_free_mmio_res(device_t dev) |
1389 |
vmbus_free_mmio_res(device_t dev) |
| 1337 |
{ |
1390 |
{ |
| 1338 |
struct vmbus_softc *sc = device_get_softc(dev); |
1391 |
struct vmbus_softc *sc = device_get_softc(dev); |
| 1339 |
|
1392 |
|
| 1340 |
pcib_host_res_free(dev, &sc->vmbus_mmio_res); |
1393 |
pcib_host_res_free(dev, &sc->vmbus_mmio_res); |
|
|
1394 |
|
| 1395 |
if (hv_fb_res) |
| 1396 |
hv_fb_res = NULL; |
| 1341 |
} |
1397 |
} |
| 1342 |
#endif /* NEW_PCIB */ |
1398 |
#endif /* NEW_PCIB */ |
| 1343 |
|
1399 |
|
|
Lines 1387-1392
Link Here
|
| 1387 |
|
1443 |
|
| 1388 |
#ifdef NEW_PCIB |
1444 |
#ifdef NEW_PCIB |
| 1389 |
vmbus_get_mmio_res(sc->vmbus_dev); |
1445 |
vmbus_get_mmio_res(sc->vmbus_dev); |
|
|
1446 |
vmbus_fb_mmio_res(sc->vmbus_dev); |
| 1390 |
#endif |
1447 |
#endif |
| 1391 |
|
1448 |
|
| 1392 |
sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; |
1449 |
sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; |