Skip to content

Commit d8dd7af

Browse files
committed
uefi: Add bitflags for PciRootBridgeIoProtocolAttribute
1 parent d8cf52c commit d8dd7af

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

uefi-raw/src/protocol/pci/root_bridge.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use crate::table::boot::{AllocateType, MemoryType};
44
use crate::{Handle, PhysicalAddress, Status, newtype_enum};
5+
use bitflags::bitflags;
56
use core::ffi::c_void;
67
use uguid::{Guid, guid};
78

@@ -37,6 +38,29 @@ newtype_enum! {
3738
}
3839
}
3940

41+
bitflags! {
42+
/// Describes PCI I/O Protocol Attribute bitflags specified in UEFI specification.
43+
/// https://uefi.org/specs/UEFI/2.10_A/14_Protocols_PCI_Bus_Support.html
44+
#[repr(transparent)]
45+
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
46+
pub struct PciRootBridgeIoProtocolAttribute: u64 {
47+
const PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO = 0x0001;
48+
const PCI_ATTRIBUTE_ISA_IO = 0x0002;
49+
const PCI_ATTRIBUTE_VGA_PALETTE_IO = 0x0004;
50+
const PCI_ATTRIBUTE_VGA_MEMORY = 0x0008;
51+
const PCI_ATTRIBUTE_VGA_IO = 0x0010;
52+
const PCI_ATTRIBUTE_IDE_PRIMARY_IO = 0x0020;
53+
const PCI_ATTRIBUTE_IDE_SECONDARY_IO = 0x0040;
54+
const PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE = 0x0080;
55+
const PCI_ATTRIBUTE_MEMORY_CACHED = 0x0800;
56+
const PCI_ATTRIBUTE_MEMORY_DISABLE = 0x1000;
57+
const PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE = 0x8000;
58+
const PCI_ATTRIBUTE_ISA_IO_16 = 0x10000;
59+
const PCI_ATTRIBUTE_VGA_PALETTE_IO_16 = 0x20000;
60+
const PCI_ATTRIBUTE_VGA_IO_16 = 0x40000;
61+
}
62+
}
63+
4064
#[derive(Debug)]
4165
#[repr(C)]
4266
pub struct PciRootBridgeIoAccess {

xtask/src/check_raw.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,9 @@ fn check_macro(item: &ItemMacro, src: &Path) -> Result<(), Error> {
389389
let attrs = parse_attrs(&attrs.0, src)?;
390390

391391
let reprs = get_reprs(&attrs);
392+
if reprs.is_empty() {
393+
return Err(Error::new(ErrorKind::MissingRepr, src, mac));
394+
}
392395
let allowed_reprs: &[&[Repr]] = &[&[Repr::Transparent]];
393396
if !allowed_reprs.contains(&reprs.as_slice()) {
394397
return Err(Error::new(ErrorKind::ForbiddenRepr(reprs), src, mac));

0 commit comments

Comments
 (0)