Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions awkernel_drivers/src/pcie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,13 @@ struct UnknownDevice {

impl PCIeDevice for UnknownDevice {
fn device_name(&self) -> Cow<'static, str> {
let bfd = format!(
let bdf = format!(
"{:04x}:{:02x}:{:02x}.{:01x}",
self.segment_group, self.bus_number, self.device_number, self.function_number
);

let name = format!(
"{bfd}: Vendor ID = {:04x}, Device ID = {:04x}, PCIe Class = {:?}",
"{bdf}: Vendor ID = {:04x}, Device ID = {:04x}, PCIe Class = {:?}",
self.vendor, self.id, self.pcie_class,
);
name.into()
Expand Down Expand Up @@ -503,8 +503,8 @@ impl PCIeBus {
impl PCIeDevice for PCIeBus {
fn device_name(&self) -> Cow<'static, str> {
if let Some(info) = self.info.as_ref() {
let bfd = info.get_bfd();
let name = format!("{bfd}: Bridge, Bus #{:02x}", self.bus_number);
let bdf = info.get_bdf();
let name = format!("{bdf}: Bridge, Bus #{:02x}", self.bus_number);
name.into()
} else {
let name = format!("Bus #{:02x}", self.bus_number);
Expand Down Expand Up @@ -549,7 +549,7 @@ fn print_pcie_devices(device: &dyn PCIeDevice, f: &mut fmt::Formatter, indent: u
ChildDevice::Unattached(info) => {
let name = format!(
"{}: Vendor ID = {:04x}, Device ID = {:04x}, PCIe Class = {:?}, bridge = {:?}-{:?}-{:?}",
info.get_bfd(),
info.get_bdf(),
info.vendor,
info.id,
info.pcie_class,
Expand Down Expand Up @@ -925,8 +925,8 @@ impl PCIeInfo {
}
}

/// Get the information for PCIe device as BFD format.
pub fn get_bfd(&self) -> String {
/// Get the information for PCIe device as BDF format.
pub fn get_bdf(&self) -> String {
format!(
"{:04x}:{:02x}:{:02x}.{:01x}",
self.segment_group, self.bus_number, self.device_number, self.function_number
Expand Down
18 changes: 9 additions & 9 deletions awkernel_drivers/src/pcie/intel/igb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ fn allocate_msix(
que: &[Queue],
) -> Result<PCIeInt, IgbDriverErr> {
let segment_number = info.segment_group as usize;
let bfd = info.get_bfd();
let bdf = info.get_bdf();

let msix = info
.get_msix_mut()
Expand All @@ -1790,7 +1790,7 @@ fn allocate_msix(
}

for q in que.iter() {
let irq_name_rxtx = format!("{}-{}-RxTx{}", DEVICE_SHORT_NAME, bfd, q.me);
let irq_name_rxtx = format!("{}-{}-RxTx{}", DEVICE_SHORT_NAME, bdf, q.me);
let mut irq_rxtx = msix
.register_handler(
irq_name_rxtx.into(),
Expand All @@ -1806,7 +1806,7 @@ fn allocate_msix(
irqs.push((irq_rxtx, IRQRxTxLink::RxTx(q.me)));
}

let irq_name_tx = format!("{DEVICE_SHORT_NAME}-{bfd}-Other");
let irq_name_tx = format!("{DEVICE_SHORT_NAME}-{bdf}-Other");
let mut irq_other = msix
.register_handler(
irq_name_tx.into(),
Expand Down Expand Up @@ -1839,7 +1839,7 @@ fn allocate_msi(info: &mut PCIeInfo) -> Result<PCIeInt, IgbDriverErr> {
}

let segment_number = info.get_segment_group() as usize;
let irq_name = format!("{}-{}", DEVICE_SHORT_NAME, info.get_bfd());
let irq_name = format!("{}-{}", DEVICE_SHORT_NAME, info.get_bdf());

if let Some(msi) = info.get_msi_mut() {
msi.disable();
Expand Down Expand Up @@ -1990,12 +1990,12 @@ fn disable_aspm(hw: &mut igb_hw::IgbHw, info: &mut PCIeInfo) {
//===========================================================================
impl PCIeDevice for Igb {
fn device_name(&self) -> Cow<'static, str> {
let (mac_type, bfd) = {
let (mac_type, bdf) = {
let inner = self.inner.read();
(inner.hw.get_mac_type(), inner.info.get_bfd())
(inner.hw.get_mac_type(), inner.info.get_bdf())
};

let name = format!("{bfd}: {DEVICE_NAME} ({mac_type:?})");
let name = format!("{bdf}: {DEVICE_NAME} ({mac_type:?})");
name.into()
}

Expand All @@ -2017,8 +2017,8 @@ impl NetDevice for Igb {
}

fn device_short_name(&self) -> Cow<'static, str> {
let bfd = self.inner.read().info.get_bfd();
let name = format!("{DEVICE_SHORT_NAME}-{bfd}");
let bdf = self.inner.read().info.get_bdf();
let name = format!("{DEVICE_SHORT_NAME}-{bdf}");
name.into()
}

Expand Down
12 changes: 6 additions & 6 deletions awkernel_drivers/src/pcie/intel/igc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ impl Igc {

impl PCIeDevice for Igc {
fn device_name(&self) -> Cow<'static, str> {
let bfd = {
let bdf = {
let inner = self.inner.read();
inner.info.get_bfd()
inner.info.get_bdf()
};

let name = format!("{bfd}: {DEVICE_NAME}");
let name = format!("{bdf}: {DEVICE_NAME}");
name.into()
}

Expand Down Expand Up @@ -1012,7 +1012,7 @@ fn igc_is_valid_ether_addr(addr: &[u8; 6]) -> bool {
/// This function initialize IRQs for the IGC device,
/// and returns IRQs for the Rx/Tx queues and an IRQ for events.
fn igc_allocate_pci_resources(info: &mut PCIeInfo) -> Result<(Vec<IRQ>, IRQ), PCIeDeviceErr> {
let bfd = info.get_bfd();
let bdf = info.get_bdf();
let segment_number = info.segment_group as usize;

let msix = info.get_msix_mut().ok_or(PCIeDeviceErr::InitFailure)?;
Expand All @@ -1036,7 +1036,7 @@ fn igc_allocate_pci_resources(info: &mut PCIeInfo) -> Result<(Vec<IRQ>, IRQ), PC
let mut irqs_queues = Vec::with_capacity(nqueues as usize);

for q in 0..nqueues {
let irq_name_rxtx = format!("{DEVICE_SHORT_NAME}-{bfd}-RxTx{q}");
let irq_name_rxtx = format!("{DEVICE_SHORT_NAME}-{bdf}-RxTx{q}");
let mut irq_rxtx = msix
.register_handler(
irq_name_rxtx.into(),
Expand All @@ -1053,7 +1053,7 @@ fn igc_allocate_pci_resources(info: &mut PCIeInfo) -> Result<(Vec<IRQ>, IRQ), PC
}

// Initialize the IRQs for the events.
let irq_name_other = format!("{DEVICE_SHORT_NAME}-{bfd}-Other");
let irq_name_other = format!("{DEVICE_SHORT_NAME}-{bdf}-Other");
let mut irq_other = msix
.register_handler(
irq_name_other.into(),
Expand Down
18 changes: 9 additions & 9 deletions awkernel_drivers/src/pcie/intel/ixgbe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1918,7 +1918,7 @@ fn allocate_msix(
que: &[Queue],
) -> Result<PCIeInt, IxgbeDriverErr> {
let segment_number = info.segment_group as usize;
let bfd = info.get_bfd();
let bdf = info.get_bdf();

let msix = info
.get_msix_mut()
Expand All @@ -1927,7 +1927,7 @@ fn allocate_msix(
let mut irqs = Vec::new();

for q in que.iter() {
let irq_name_rxtx = format!("{}-{}-RxTx{}", DEVICE_SHORT_NAME, bfd, q.me);
let irq_name_rxtx = format!("{}-{}-RxTx{}", DEVICE_SHORT_NAME, bdf, q.me);
let mut irq_rxtx = msix
.register_handler(
irq_name_rxtx.into(),
Expand All @@ -1943,7 +1943,7 @@ fn allocate_msix(
irqs.push((irq_rxtx, IRQRxTxLink::RxTx(q.me)));
}

let irq_name_tx = format!("{DEVICE_SHORT_NAME}-{bfd}-Other");
let irq_name_tx = format!("{DEVICE_SHORT_NAME}-{bdf}-Other");
let mut irq_other = msix
.register_handler(
irq_name_tx.into(),
Expand Down Expand Up @@ -1976,7 +1976,7 @@ fn allocate_msi(info: &mut PCIeInfo) -> Result<PCIeInt, IxgbeDriverErr> {
}

let segment_number = info.get_segment_group() as usize;
let irq_name = format!("{}-{}", DEVICE_SHORT_NAME, info.get_bfd());
let irq_name = format!("{}-{}", DEVICE_SHORT_NAME, info.get_bdf());

if let Some(msi) = info.get_msi_mut() {
msi.disable();
Expand Down Expand Up @@ -2046,12 +2046,12 @@ fn allocate_queue(info: &PCIeInfo, que_id: usize) -> Result<Queue, IxgbeDriverEr
//===========================================================================
impl PCIeDevice for Ixgbe {
fn device_name(&self) -> Cow<'static, str> {
let (mac_type, bfd) = {
let (mac_type, bdf) = {
let inner = self.inner.read();
(inner.hw.get_mac_type(), inner.info.get_bfd())
(inner.hw.get_mac_type(), inner.info.get_bdf())
};

let name = format!("{bfd}: {DEVICE_NAME} ({mac_type:?})");
let name = format!("{bdf}: {DEVICE_NAME} ({mac_type:?})");
name.into()
}

Expand All @@ -2072,8 +2072,8 @@ impl NetDevice for Ixgbe {
}

fn device_short_name(&self) -> Cow<'static, str> {
let bfd = self.inner.read().info.get_bfd();
let name = format!("{DEVICE_SHORT_NAME}-{bfd}");
let bdf = self.inner.read().info.get_bdf();
let name = format!("{DEVICE_SHORT_NAME}-{bdf}");
name.into()
}

Expand Down
12 changes: 6 additions & 6 deletions awkernel_drivers/src/pcie/nvme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,11 +776,11 @@ impl NvmeInner {

fn allocate_msix(&mut self) -> Result<PCIeInt, NvmeDriverErr> {
let segment_group = self.info.get_segment_group();
let bfd = self.info.get_bfd();
let bdf = self.info.get_bdf();

let msix = self.info.get_msix_mut().ok_or(NvmeDriverErr::InitFailure)?;

let irq_name = format!("{DEVICE_SHORT_NAME}-{bfd}-0");
let irq_name = format!("{DEVICE_SHORT_NAME}-{bdf}-0");
// Register single interrupt for both admin and I/O queues (like OpenBSD)
// ENHANCE: It better to use a separate interrupt vector for I/O queues
let mut irq = msix
Expand Down Expand Up @@ -820,13 +820,13 @@ impl NvmeInner {
}

let segment_group = self.info.get_segment_group();
let bfd = self.info.get_bfd();
let bdf = self.info.get_bdf();

let msi = self.info.get_msi_mut().ok_or(NvmeDriverErr::InitFailure)?;

msi.disable();

let irq_name = format!("{DEVICE_SHORT_NAME}-{bfd}-0");
let irq_name = format!("{DEVICE_SHORT_NAME}-{bdf}-0");
let mut irq = msi
.register_handler(
irq_name.into(),
Expand Down Expand Up @@ -989,8 +989,8 @@ impl Nvme {
impl PCIeDevice for Nvme {
fn device_name(&self) -> alloc::borrow::Cow<'static, str> {
let inner = self.inner.read();
let bfd = inner.info.get_bfd();
let name = format!("{bfd}:{DEVICE_NAME}");
let bdf = inner.info.get_bdf();
let name = format!("{bdf}:{DEVICE_NAME}");
name.into()
}
}
Expand Down
4 changes: 2 additions & 2 deletions awkernel_drivers/src/pcie/virtio/virtio_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,12 +883,12 @@ impl VirtioNetInner {
irq_type: IRQType,
) -> Result<IRQ, VirtioDriverErr> {
let segment_number = self.info.segment_group as usize;
let bfd = self.info.get_bfd();
let bdf = self.info.get_bdf();
let msix = self
.info
.get_msix_mut()
.ok_or(VirtioDriverErr::InitFailure)?;
let irq_name = format!("{DEVICE_SHORT_NAME}-{bfd}-{idx}");
let irq_name = format!("{DEVICE_SHORT_NAME}-{bdf}-{idx}");
let mut irq_new = msix
.register_handler(
irq_name.into(),
Expand Down
12 changes: 6 additions & 6 deletions docs/internal/PCIe.html
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ <h2 id="pciebus"><a class="header" href="#pciebus">PCIeBus</a></h2>
</span>impl PCIeDevice for PCIeBus {
fn device_name(&amp;self) -&gt; Cow&lt;'static, str&gt; {
if let Some(info) = self.info.as_ref() {
let bfd = info.get_bfd();
let name = format!("{bfd}: Bridge, Bus #{:02x}", self.bus_number);
let bdf = info.get_bdf();
let name = format!("{bdf}: Bridge, Bus #{:02x}", self.bus_number);
name.into()
} else {
let name = format!("Bus #{:02x}", self.bus_number);
Expand Down Expand Up @@ -295,7 +295,7 @@ <h2 id="pcieinfo"><a class="header" href="#pcieinfo">PCIeInfo</a></h2>
<tr><td><code>fn from_addr(...)</code></td><td>Construct the <code>PCIeInfo</code> structure using virtual address.</td></tr>
<tr><td><code>fn new(...)</code></td><td>Construct the <code>PCIeInfo</code> structure.</td></tr>
<tr><td><code>fn init_base_address(&amp;mut self, ranges: &amp;mut [PCIeRange])</code></td><td>Initialize the base address of the <code>PCIeInfo</code> based on the PCIe memory range.</td></tr>
<tr><td><code>pub fn get_bfd(&amp;self)</code></td><td>Get PCIe information in BDF (Bus, Device, Function) format.</td></tr>
<tr><td><code>pub fn get_bdf(&amp;self)</code></td><td>Get PCIe information in BDF (Bus, Device, Function) format.</td></tr>
<tr><td><code>pub fn get_secondary_bus(&amp;self)</code></td><td>Get the number of the PCIe secondary bus.</td></tr>
<tr><td><code>pub fn get_device_name(&amp;self)</code></td><td>Get the name of the PCIe device.</td></tr>
<tr><td><code>pub fn get_class(&amp;self)</code></td><td>Get the PCIe device classification.</td></tr>
Expand Down Expand Up @@ -375,13 +375,13 @@ <h2 id="unknowndevice"><a class="header" href="#unknowndevice">UnknownDevice</a>
</span><span class="boring">fn main() {
</span>impl PCIeDevice for PCIeBus {
fn device_name(&amp;self) -&gt; Cow&lt;'static, str&gt; {
let bfd = format!(
let bdf = format!(
"{:04x}:{:02x}:{:02x}.{:01x}",
self.segment_group, self.bus_number, self.device_number, self.function_number
);

let name = format!(
"{bfd}: Vendor ID = {:04x}, Device ID = {:04x}, PCIe Class = {:?}",
"{bdf}: Vendor ID = {:04x}, Device ID = {:04x}, PCIe Class = {:?}",
self.vendor, self.id, self.pcie_class,
);
name.into()
Expand Down Expand Up @@ -650,7 +650,7 @@ <h3 id="print_pcie_devices"><a class="header" href="#print_pcie_devices">print_p
ChildDevice::Unattached(info) =&gt; {
let name = format!(
"{}: Vendor ID = {:04x}, Device ID = {:04x}, PCIe Class = {:?}, bridge = {:?}-{:?}-{:?}",
info.get_bfd(),
info.get_bdf(),
info.vendor,
info.id,
info.pcie_class,
Expand Down
12 changes: 6 additions & 6 deletions docs/print.html
Original file line number Diff line number Diff line change
Expand Up @@ -1712,8 +1712,8 @@ <h2 id="pciebus"><a class="header" href="#pciebus">PCIeBus</a></h2>
</span>impl PCIeDevice for PCIeBus {
fn device_name(&amp;self) -&gt; Cow&lt;'static, str&gt; {
if let Some(info) = self.info.as_ref() {
let bfd = info.get_bfd();
let name = format!("{bfd}: Bridge, Bus #{:02x}", self.bus_number);
let bdf = info.get_bdf();
let name = format!("{bdf}: Bridge, Bus #{:02x}", self.bus_number);
name.into()
} else {
let name = format!("Bus #{:02x}", self.bus_number);
Expand Down Expand Up @@ -1772,7 +1772,7 @@ <h2 id="pcieinfo"><a class="header" href="#pcieinfo">PCIeInfo</a></h2>
<tr><td><code>fn from_addr(...)</code></td><td>Construct the <code>PCIeInfo</code> structure using virtual address.</td></tr>
<tr><td><code>fn new(...)</code></td><td>Construct the <code>PCIeInfo</code> structure.</td></tr>
<tr><td><code>fn init_base_address(&amp;mut self, ranges: &amp;mut [PCIeRange])</code></td><td>Initialize the base address of the <code>PCIeInfo</code> based on the PCIe memory range.</td></tr>
<tr><td><code>pub fn get_bfd(&amp;self)</code></td><td>Get PCIe information in BDF (Bus, Device, Function) format.</td></tr>
<tr><td><code>pub fn get_bdf(&amp;self)</code></td><td>Get PCIe information in BDF (Bus, Device, Function) format.</td></tr>
<tr><td><code>pub fn get_secondary_bus(&amp;self)</code></td><td>Get the number of the PCIe secondary bus.</td></tr>
<tr><td><code>pub fn get_device_name(&amp;self)</code></td><td>Get the name of the PCIe device.</td></tr>
<tr><td><code>pub fn get_class(&amp;self)</code></td><td>Get the PCIe device classification.</td></tr>
Expand Down Expand Up @@ -1852,13 +1852,13 @@ <h2 id="unknowndevice"><a class="header" href="#unknowndevice">UnknownDevice</a>
</span><span class="boring">fn main() {
</span>impl PCIeDevice for PCIeBus {
fn device_name(&amp;self) -&gt; Cow&lt;'static, str&gt; {
let bfd = format!(
let bdf = format!(
"{:04x}:{:02x}:{:02x}.{:01x}",
self.segment_group, self.bus_number, self.device_number, self.function_number
);

let name = format!(
"{bfd}: Vendor ID = {:04x}, Device ID = {:04x}, PCIe Class = {:?}",
"{bdf}: Vendor ID = {:04x}, Device ID = {:04x}, PCIe Class = {:?}",
self.vendor, self.id, self.pcie_class,
);
name.into()
Expand Down Expand Up @@ -2127,7 +2127,7 @@ <h3 id="print_pcie_devices"><a class="header" href="#print_pcie_devices">print_p
ChildDevice::Unattached(info) =&gt; {
let name = format!(
"{}: Vendor ID = {:04x}, Device ID = {:04x}, PCIe Class = {:?}, bridge = {:?}-{:?}-{:?}",
info.get_bfd(),
info.get_bdf(),
info.vendor,
info.id,
info.pcie_class,
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

Loading
Loading