|
@@ -33,6 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
33
|
33
|
#include <ipxe/uuid.h>
|
34
|
34
|
#include <ipxe/uri.h>
|
35
|
35
|
#include <ipxe/base16.h>
|
|
36
|
+#include <ipxe/pci.h>
|
36
|
37
|
#include <ipxe/init.h>
|
37
|
38
|
#include <ipxe/settings.h>
|
38
|
39
|
|
|
@@ -1857,6 +1858,52 @@ struct setting_type setting_type_uuid __setting_type = {
|
1857
|
1858
|
.format = format_uuid_setting,
|
1858
|
1859
|
};
|
1859
|
1860
|
|
|
1861
|
+/**
|
|
1862
|
+ * Parse PCI bus:dev.fn setting value
|
|
1863
|
+ *
|
|
1864
|
+ * @v value Formatted setting value
|
|
1865
|
+ * @v buf Buffer to contain raw value
|
|
1866
|
+ * @v len Length of buffer
|
|
1867
|
+ * @ret len Length of raw value, or negative error
|
|
1868
|
+ */
|
|
1869
|
+static int parse_busdevfn_setting ( const char *value __unused,
|
|
1870
|
+ void *buf __unused, size_t len __unused ) {
|
|
1871
|
+ return -ENOTSUP;
|
|
1872
|
+}
|
|
1873
|
+
|
|
1874
|
+/**
|
|
1875
|
+ * Format PCI bus:dev.fn setting value
|
|
1876
|
+ *
|
|
1877
|
+ * @v raw Raw setting value
|
|
1878
|
+ * @v raw_len Length of raw setting value
|
|
1879
|
+ * @v buf Buffer to contain formatted value
|
|
1880
|
+ * @v len Length of buffer
|
|
1881
|
+ * @ret len Length of formatted value, or negative error
|
|
1882
|
+ */
|
|
1883
|
+static int format_busdevfn_setting ( const void *raw, size_t raw_len, char *buf,
|
|
1884
|
+ size_t len ) {
|
|
1885
|
+ signed long dummy;
|
|
1886
|
+ unsigned long busdevfn;
|
|
1887
|
+ int check_len;
|
|
1888
|
+
|
|
1889
|
+ /* Extract numeric value */
|
|
1890
|
+ check_len = numeric_setting_value ( raw, raw_len, &dummy, &busdevfn );
|
|
1891
|
+ if ( check_len < 0 )
|
|
1892
|
+ return check_len;
|
|
1893
|
+ assert ( check_len == ( int ) raw_len );
|
|
1894
|
+
|
|
1895
|
+ /* Format value */
|
|
1896
|
+ return snprintf ( buf, len, "%02lx:%02lx.%lx", PCI_BUS ( busdevfn ),
|
|
1897
|
+ PCI_SLOT ( busdevfn ), PCI_FUNC ( busdevfn ) );
|
|
1898
|
+}
|
|
1899
|
+
|
|
1900
|
+/** PCI bus:dev.fn setting type */
|
|
1901
|
+struct setting_type setting_type_busdevfn __setting_type = {
|
|
1902
|
+ .name = "busdevfn",
|
|
1903
|
+ .parse = parse_busdevfn_setting,
|
|
1904
|
+ .format = format_busdevfn_setting,
|
|
1905
|
+};
|
|
1906
|
+
|
1860
|
1907
|
/******************************************************************************
|
1861
|
1908
|
*
|
1862
|
1909
|
* Setting expansion
|