Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Union

Hardware

Public Union
std.os.uefi.device_path.DevicePath.Hardware
pub const Hardware = union(Subtype)

Fields

pci: *const PciDevicePath
pc_card: *const PcCardDevicePath
memory_mapped: *const MemoryMappedDevicePath
vendor: *const VendorDevicePath
controller: *const ControllerDevicePath
bmc: *const BmcDevicePath

Structs

Types

File

os/uefi/device_path.zig:24
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
    pub const Hardware = union(Subtype) {
        pci: *const PciDevicePath,
        pc_card: *const PcCardDevicePath,
        memory_mapped: *const MemoryMappedDevicePath,
        vendor: *const VendorDevicePath,
        controller: *const ControllerDevicePath,
        bmc: *const BmcDevicePath,

        pub const Subtype = enum(u8) {
            pci = 1,
            pc_card = 2,
            memory_mapped = 3,
            vendor = 4,
            controller = 5,
            bmc = 6,
            _,
        };

        pub const PciDevicePath = extern struct {
            type: DevicePath.Type,
            subtype: Subtype,
            length: u16 align(1),
            function: u8,
            device: u8,
        };

        comptime {
            assert(6 == @sizeOf(PciDevicePath));
            assert(1 == @alignOf(PciDevicePath));

            assert(0 == @offsetOf(PciDevicePath, "type"));
            assert(1 == @offsetOf(PciDevicePath, "subtype"));
            assert(2 == @offsetOf(PciDevicePath, "length"));
            assert(4 == @offsetOf(PciDevicePath, "function"));
            assert(5 == @offsetOf(PciDevicePath, "device"));
        }

        pub const PcCardDevicePath = extern struct {
            type: DevicePath.Type,
            subtype: Subtype,
            length: u16 align(1),
            function_number: u8,
        };

        comptime {
            assert(5 == @sizeOf(PcCardDevicePath));
            assert(1 == @alignOf(PcCardDevicePath));

            assert(0 == @offsetOf(PcCardDevicePath, "type"));
            assert(1 == @offsetOf(PcCardDevicePath, "subtype"));
            assert(2 == @offsetOf(PcCardDevicePath, "length"));
            assert(4 == @offsetOf(PcCardDevicePath, "function_number"));
        }

        pub const MemoryMappedDevicePath = extern struct {
            type: DevicePath.Type,
            subtype: Subtype,
            length: u16 align(1),
            memory_type: u32 align(1),
            start_address: u64 align(1),
            end_address: u64 align(1),
        };

        comptime {
            assert(24 == @sizeOf(MemoryMappedDevicePath));
            assert(1 == @alignOf(MemoryMappedDevicePath));

            assert(0 == @offsetOf(MemoryMappedDevicePath, "type"));
            assert(1 == @offsetOf(MemoryMappedDevicePath, "subtype"));
            assert(2 == @offsetOf(MemoryMappedDevicePath, "length"));
            assert(4 == @offsetOf(MemoryMappedDevicePath, "memory_type"));
            assert(8 == @offsetOf(MemoryMappedDevicePath, "start_address"));
            assert(16 == @offsetOf(MemoryMappedDevicePath, "end_address"));
        }

        pub const VendorDevicePath = extern struct {
            type: DevicePath.Type,
            subtype: Subtype,
            length: u16 align(1),
            vendor_guid: Guid align(1),
        };

        comptime {
            assert(20 == @sizeOf(VendorDevicePath));
            assert(1 == @alignOf(VendorDevicePath));

            assert(0 == @offsetOf(VendorDevicePath, "type"));
            assert(1 == @offsetOf(VendorDevicePath, "subtype"));
            assert(2 == @offsetOf(VendorDevicePath, "length"));
            assert(4 == @offsetOf(VendorDevicePath, "vendor_guid"));
        }

        pub const ControllerDevicePath = extern struct {
            type: DevicePath.Type,
            subtype: Subtype,
            length: u16 align(1),
            controller_number: u32 align(1),
        };

        comptime {
            assert(8 == @sizeOf(ControllerDevicePath));
            assert(1 == @alignOf(ControllerDevicePath));

            assert(0 == @offsetOf(ControllerDevicePath, "type"));
            assert(1 == @offsetOf(ControllerDevicePath, "subtype"));
            assert(2 == @offsetOf(ControllerDevicePath, "length"));
            assert(4 == @offsetOf(ControllerDevicePath, "controller_number"));
        }

        pub const BmcDevicePath = extern struct {
            type: DevicePath.Type,
            subtype: Subtype,
            length: u16 align(1),
            interface_type: u8,
            base_address: u64 align(1),
        };

        comptime {
            assert(13 == @sizeOf(BmcDevicePath));
            assert(1 == @alignOf(BmcDevicePath));

            assert(0 == @offsetOf(BmcDevicePath, "type"));
            assert(1 == @offsetOf(BmcDevicePath, "subtype"));
            assert(2 == @offsetOf(BmcDevicePath, "length"));
            assert(4 == @offsetOf(BmcDevicePath, "interface_type"));
            assert(5 == @offsetOf(BmcDevicePath, "base_address"));
        }
    }