Android-cuttlefish cvd tool
pci.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
18#include <string>
19
20#include "fmt/format.h"
21
22namespace cuttlefish {
23namespace pci {
24
25class Address {
26 public:
27 Address(unsigned int bus, unsigned int device, unsigned int function);
28
29 unsigned int Bus() const { return bus_; };
30 unsigned int Device() const { return device_; }
31 unsigned int Function() const { return function_; }
32 std::string Id() const {
33 return fmt::format("{:02x}:{:02x}.{:01x}", bus_, device_, function_);
34 }
35
36 private:
37 unsigned int bus_;
38 unsigned int device_;
39 unsigned int function_;
40};
41
42} // namespace pci
43} // namespace cuttlefish
Definition: pci.h:25
unsigned int Device() const
Definition: pci.h:30
Address(unsigned int bus, unsigned int device, unsigned int function)
Definition: pci.cpp:28
std::string Id() const
Definition: pci.h:32
unsigned int Bus() const
Definition: pci.h:29
unsigned int function_
Definition: pci.h:39
unsigned int Function() const
Definition: pci.h:31
unsigned int bus_
Definition: pci.h:37
unsigned int device_
Definition: pci.h:38
EventFormat format
Definition: kernel_log_server.cc:61
Definition: alloc_driver.h:21