Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/vmm/amd/ivrs_drv.c
/*- | /*- | ||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD | * SPDX-License-Identifier: BSD-2-Clause-FreeBSD | ||||
* | * | ||||
* Copyright (c) 2016, Anish Gupta (anish@freebsd.org) | * Copyright (c) 2016, Anish Gupta (anish@freebsd.org) | ||||
* Copyright (c) 2021 The FreeBSD Foundation | |||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | ||||
* are met: | * are met: | ||||
* 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
* notice unmodified, this list of conditions, and the following | * notice unmodified, this list of conditions, and the following | ||||
* disclaimer. | * disclaimer. | ||||
Show All 26 Lines | |||||
#include <machine/vmparam.h> | #include <machine/vmparam.h> | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include <contrib/dev/acpica/include/acpi.h> | #include <contrib/dev/acpica/include/acpi.h> | ||||
#include <contrib/dev/acpica/include/accommon.h> | #include <contrib/dev/acpica/include/accommon.h> | ||||
#include <dev/acpica/acpivar.h> | #include <dev/acpica/acpivar.h> | ||||
#include <dev/pci/pcireg.h> | |||||
#include <dev/pci/pcivar.h> | |||||
jhb: Sorting nit | |||||
#include "io/iommu.h" | #include "io/iommu.h" | ||||
#include "amdvi_priv.h" | #include "amdvi_priv.h" | ||||
device_t *ivhd_devs; /* IVHD or AMD-Vi device list. */ | device_t *ivhd_devs; /* IVHD or AMD-Vi device list. */ | ||||
int ivhd_count; /* Number of IVHD header. */ | int ivhd_count; /* Number of IVHD header. */ | ||||
/* | /* | ||||
* Cached IVHD header list. | * Cached IVHD header list. | ||||
▲ Show 20 Lines • Show All 568 Lines • ▼ Show 20 Lines | ivhd_attach(device_t dev) | ||||
/* Make sure its same device for which attach is called. */ | /* Make sure its same device for which attach is called. */ | ||||
KASSERT((ivhd_devs[unit] == dev), | KASSERT((ivhd_devs[unit] == dev), | ||||
("Not same device old %p new %p", ivhd_devs[unit], dev)); | ("Not same device old %p new %p", ivhd_devs[unit], dev)); | ||||
softc = device_get_softc(dev); | softc = device_get_softc(dev); | ||||
softc->dev = dev; | softc->dev = dev; | ||||
ivhd = ivhd_hdrs[unit]; | ivhd = ivhd_hdrs[unit]; | ||||
KASSERT(ivhd, ("ivhd is NULL")); | KASSERT(ivhd, ("ivhd is NULL")); | ||||
softc->pci_dev = pci_find_bsf(PCI_RID2BUS(ivhd->Header.DeviceId), | |||||
PCI_RID2SLOT(ivhd->Header.DeviceId), | |||||
PCI_RID2FUNC(ivhd->Header.DeviceId)); | |||||
softc->ivhd_type = ivhd->Header.Type; | softc->ivhd_type = ivhd->Header.Type; | ||||
softc->pci_seg = ivhd->PciSegmentGroup; | softc->pci_seg = ivhd->PciSegmentGroup; | ||||
softc->pci_rid = ivhd->Header.DeviceId; | softc->pci_rid = ivhd->Header.DeviceId; | ||||
softc->ivhd_flag = ivhd->Header.Flags; | softc->ivhd_flag = ivhd->Header.Flags; | ||||
/* | /* | ||||
* On lgeacy IVHD type(0x10), it is documented as feature | * On lgeacy IVHD type(0x10), it is documented as feature | ||||
* but in newer type it is attribute. | * but in newer type it is attribute. | ||||
▲ Show 20 Lines • Show All 96 Lines • Show Last 20 Lines |
Sorting nit