platform driver: don't copy list-model elements

Issue #4317
This commit is contained in:
Norman Feske 2023-10-27 16:33:25 +02:00 committed by Christian Helmuth
parent 6e0d44397f
commit b7b74e62a0
6 changed files with 29 additions and 33 deletions

View File

@ -300,7 +300,7 @@ bool Driver::pci_device_matches(Session_policy const & policy,
vendor_t vendor_id = node.attribute_value<vendor_t>("vendor_id", 0); vendor_t vendor_id = node.attribute_value<vendor_t>("vendor_id", 0);
device_t device_id = node.attribute_value<device_t>("device_id", 0); device_t device_id = node.attribute_value<device_t>("device_id", 0);
dev.for_pci_config([&] (Device::Pci_config const cfg) dev.for_pci_config([&] (Device::Pci_config const & cfg)
{ {
if ((pci_class_code_alias(cfg.class_code) == class_code) || if ((pci_class_code_alias(cfg.class_code) == class_code) ||
(vendor_id == cfg.vendor_id && device_id == cfg.device_id)) (vendor_id == cfg.vendor_id && device_id == cfg.device_id))
@ -317,7 +317,7 @@ void Driver::pci_device_specific_info(Device const & dev,
Device_model & model, Device_model & model,
Xml_generator & xml) Xml_generator & xml)
{ {
dev.for_pci_config([&] (Device::Pci_config const cfg) dev.for_pci_config([&] (Device::Pci_config const & cfg)
{ {
Driver::pci_intel_graphics_info(cfg, env, model, xml); Driver::pci_intel_graphics_info(cfg, env, model, xml);
Driver::pci_virtio_info(dev, cfg, env, xml); Driver::pci_virtio_info(dev, cfg, env, xml);

View File

@ -16,14 +16,14 @@
namespace Driver { namespace Driver {
static void pci_ehci_quirks(Env &, Device const &, static void pci_ehci_quirks(Env &, Device const &,
Device::Pci_config, addr_t); Device::Pci_config const &, addr_t);
} }
void Driver::pci_ehci_quirks(Env & env, void Driver::pci_ehci_quirks(Env & env,
Device const & dev, Device const & dev,
Device::Pci_config cfg, Device::Pci_config const & cfg,
addr_t base) addr_t base)
{ {
enum { EHCI_CLASS_CODE = 0xc0320 }; enum { EHCI_CLASS_CODE = 0xc0320 };

View File

@ -15,13 +15,11 @@
#include <device.h> #include <device.h>
namespace Driver { namespace Driver {
static void pci_hd_audio_quirks(Device::Pci_config cfg, static void pci_hd_audio_quirks(Device::Pci_config const &, Pci::Config &);
Pci::Config & config);
} }
void Driver::pci_hd_audio_quirks(Device::Pci_config cfg, void Driver::pci_hd_audio_quirks(Device::Pci_config const & cfg, Pci::Config & config)
Pci::Config & config)
{ {
enum { HDAUDIO_CLASS_CODE = 0x40300 }; enum { HDAUDIO_CLASS_CODE = 0x40300 };

View File

@ -16,10 +16,10 @@
#include <device.h> #include <device.h>
namespace Driver { namespace Driver {
void pci_intel_graphics_info(Device::Pci_config cfg, void pci_intel_graphics_info(Device::Pci_config const & cfg,
Env & env, Env & env,
Device_model & model, Device_model & model,
Xml_generator & xml); Xml_generator & xml);
} }
@ -75,10 +75,10 @@ static inline unsigned pci_intel_graphics_generation(Pci::device_t id)
}; };
void Driver::pci_intel_graphics_info(Device::Pci_config cfg, void Driver::pci_intel_graphics_info(Device::Pci_config const & cfg,
Env & env, Env & env,
Device_model & model, Device_model & model,
Xml_generator & xml) Xml_generator & xml)
{ {
enum { enum {
GPU_CLASS_MASK = 0xff0000, GPU_CLASS_MASK = 0xff0000,
@ -101,7 +101,7 @@ void Driver::pci_intel_graphics_info(Device::Pci_config cfg,
/* find host bridge */ /* find host bridge */
model.for_each([&] (Device const & dev) { model.for_each([&] (Device const & dev) {
dev.for_pci_config([&] (Device::Pci_config const cfg) { dev.for_pci_config([&] (Device::Pci_config const &cfg) {
if (cfg.bus_num || cfg.dev_num || cfg.func_num) if (cfg.bus_num || cfg.dev_num || cfg.func_num)
return; return;

View File

@ -17,14 +17,14 @@
namespace Driver { namespace Driver {
static void pci_uhci_quirks(Env &, Device const &, static void pci_uhci_quirks(Env &, Device const &,
Device::Pci_config, addr_t); Device::Pci_config const &, addr_t);
} }
void Driver::pci_uhci_quirks(Env & env, void Driver::pci_uhci_quirks(Env & env,
Device const & dev, Device const & dev,
Device::Pci_config cfg, Device::Pci_config const & cfg,
addr_t base) addr_t base)
{ {
enum { UHCI_CLASS_CODE = 0xc0300 }; enum { UHCI_CLASS_CODE = 0xc0300 };

View File

@ -16,17 +16,15 @@
#include <device.h> #include <device.h>
namespace Driver { namespace Driver {
void pci_virtio_info(Device const & dev, void pci_virtio_info(Device const &, Device::Pci_config const &, Env &,
Device::Pci_config cfg, Xml_generator &);
Env & env,
Xml_generator & xml);
} }
void Driver::pci_virtio_info(Device const & dev, void Driver::pci_virtio_info(Device const & dev,
Device::Pci_config cfg, Device::Pci_config const & cfg,
Env & env, Env & env,
Xml_generator & xml) Xml_generator & xml)
{ {
enum { VENDOR_RED_HAT = 0x1af4 }; enum { VENDOR_RED_HAT = 0x1af4 };