1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
|
/* $OpenBSD: drm_linux.h,v 1.63 2017/09/05 03:06:26 jsg Exp $ */
/*
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _DRM_LINUX_H_
#define _DRM_LINUX_H_
#include <sys/param.h>
#include <sys/atomic.h>
#include <sys/errno.h>
#include <sys/kernel.h>
#include <sys/signalvar.h>
#include <sys/stdint.h>
#include <sys/systm.h>
#include <sys/task.h>
#include <sys/time.h>
#include <sys/timeout.h>
#include <sys/tree.h>
#include <uvm/uvm_extern.h>
#include <ddb/db_var.h>
#include <dev/i2c/i2cvar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/drm/linux_types.h>
#include <dev/pci/drm/drm_linux_atomic.h>
#include <dev/pci/drm/drm_linux_list.h>
/* The Linux code doesn't meet our usual standards! */
#ifdef __clang__
#pragma clang diagnostic ignored "-Wenum-conversion"
#pragma clang diagnostic ignored "-Winitializer-overrides"
#pragma clang diagnostic ignored "-Wtautological-compare"
#pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
#pragma clang diagnostic ignored "-Wunused-const-variable"
#endif
typedef int irqreturn_t;
enum irqreturn {
IRQ_NONE = 0,
IRQ_HANDLED = 1
};
typedef int8_t s8;
typedef uint8_t u8;
typedef int16_t s16;
typedef uint16_t u16;
typedef int32_t s32;
typedef uint32_t u32;
typedef int64_t s64;
typedef uint64_t u64;
#define U64_C(x) UINT64_C(x)
#define U64_MAX UINT64_MAX
typedef uint16_t __le16;
typedef uint16_t __be16;
typedef uint32_t __le32;
typedef uint32_t __be32;
typedef bus_addr_t dma_addr_t;
typedef bus_addr_t phys_addr_t;
typedef bus_addr_t resource_size_t;
typedef off_t loff_t;
#define __force
#define __always_unused __unused
#define __read_mostly
#define __iomem
#define __must_check
#define __init
#define __exit
#define __printf(x, y)
#define barrier() __asm __volatile("" : : : "memory");
#define uninitialized_var(x) x
#if BYTE_ORDER == BIG_ENDIAN
#define __BIG_ENDIAN
#else
#define __LITTLE_ENDIAN
#endif
#define le16_to_cpu(x) letoh16(x)
#define le32_to_cpu(x) letoh32(x)
#define cpu_to_le16(x) htole16(x)
#define cpu_to_le32(x) htole32(x)
#define be32_to_cpup(x) betoh32(*x)
static inline uint8_t
hweight8(uint32_t x)
{
x = (x & 0x55) + ((x & 0xaa) >> 1);
x = (x & 0x33) + ((x & 0xcc) >> 2);
x = (x + (x >> 4)) & 0x0f;
return (x);
}
static inline uint16_t
hweight16(uint32_t x)
{
x = (x & 0x5555) + ((x & 0xaaaa) >> 1);
x = (x & 0x3333) + ((x & 0xcccc) >> 2);
x = (x + (x >> 4)) & 0x0f0f;
x = (x + (x >> 8)) & 0x00ff;
return (x);
}
static inline uint32_t
hweight32(uint32_t x)
{
x = (x & 0x55555555) + ((x & 0xaaaaaaaa) >> 1);
x = (x & 0x33333333) + ((x & 0xcccccccc) >> 2);
x = (x + (x >> 4)) & 0x0f0f0f0f;
x = (x + (x >> 8));
x = (x + (x >> 16)) & 0x000000ff;
return x;
}
static inline uint32_t
hweight64(uint64_t x)
{
x = (x & 0x5555555555555555ULL) + ((x & 0xaaaaaaaaaaaaaaaaULL) >> 1);
x = (x & 0x3333333333333333ULL) + ((x & 0xccccccccccccccccULL) >> 2);
x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0fULL;
x = (x + (x >> 8));
x = (x + (x >> 16));
x = (x + (x >> 32)) & 0x000000ff;
return x;
}
#define lower_32_bits(n) ((u32)(n))
#define upper_32_bits(_val) ((u32)(((_val) >> 16) >> 16))
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) -1)
#define BIT(x) (1UL << x)
#define BITS_TO_LONGS(x) howmany((x), 8 * sizeof(long))
#define DECLARE_BITMAP(x, y) unsigned long x[BITS_TO_LONGS(y)];
#define bitmap_empty(p, n) (find_first_bit(p, n) == n)
#define GENMASK(h, l) ((~0U >> (32 - h -1)) & (~0U << l))
static inline void
bitmap_set(void *p, int b, u_int n)
{
u_int end = b + n;
for (; b < end; b++)
__set_bit(b, p);
}
static inline void
bitmap_zero(void *p, u_int n)
{
u_int *ptr = p;
u_int b;
for (b = 0; b < n; b += 32)
ptr[b >> 5] = 0;
}
static inline void
bitmap_or(void *d, void *s1, void *s2, u_int n)
{
u_int *dst = d;
u_int *src1 = s1;
u_int *src2 = s2;
u_int b;
for (b = 0; b < n; b += 32)
dst[b >> 5] = src1[b >> 5] | src2[b >> 5];
}
static inline int
bitmap_weight(void *p, u_int n)
{
u_int *ptr = p;
u_int b;
int sum = 0;
for (b = 0; b < n; b += 32)
sum += hweight32(ptr[b >> 5]);
return sum;
}
#define DECLARE_HASHTABLE(name, bits) struct hlist_head name[1 << (bits)]
static inline void
__hash_init(struct hlist_head *table, u_int size)
{
u_int i;
for (i = 0; i < size; i++)
INIT_HLIST_HEAD(&table[i]);
}
static inline bool
__hash_empty(struct hlist_head *table, u_int size)
{
u_int i;
for (i = 0; i < size; i++) {
if (!hlist_empty(&table[i]))
return false;
}
return true;
}
#define __hash(table, key) &table[key % (nitems(table) - 1)]
#define hash_init(table) __hash_init(table, nitems(table))
#define hash_add(table, node, key) \
hlist_add_head(node, __hash(table, key))
#define hash_del(node) hlist_del_init(node)
#define hash_empty(table) __hash_empty(table, nitems(table))
#define hash_for_each_possible(table, obj, member, key) \
hlist_for_each_entry(obj, __hash(table, key), member)
#define hash_for_each_safe(table, i, tmp, obj, member) \
for (i = 0; i < nitems(table); i++) \
hlist_for_each_entry_safe(obj, tmp, &table[i], member)
#define ACCESS_ONCE(x) (x)
#define EXPORT_SYMBOL(x)
#define IS_ENABLED(x) x - 0
#define IS_BUILTIN(x) 1
struct device_node;
struct device_driver {
struct device *dev;
};
#define dev_get_drvdata(x) NULL
#define dev_set_drvdata(x, y)
#define dev_name(dev) ""
#define devm_kzalloc(x, y, z) kzalloc(y, z)
struct module;
#define MODULE_AUTHOR(x)
#define MODULE_DESCRIPTION(x)
#define MODULE_LICENSE(x)
#define MODULE_FIRMWARE(x)
#define MODULE_DEVICE_TABLE(x, y)
#define MODULE_PARM_DESC(parm, desc)
#define module_param_named(name, value, type, perm)
#define module_param_named_unsafe(name, value, type, perm)
#define module_param_unsafe(name, type, perm)
#define THIS_MODULE NULL
#define ARRAY_SIZE nitems
#define ERESTARTSYS EINTR
#define ETIME ETIMEDOUT
#define EREMOTEIO EIO
#define ENOTSUPP ENOTSUP
#define ENODATA ENOTSUP
#define ECHRNG EINVAL
#define KERN_INFO ""
#define KERN_WARNING ""
#define KERN_NOTICE ""
#define KERN_DEBUG ""
#define KERN_CRIT ""
#define KERN_ERR ""
#define KBUILD_MODNAME "drm"
#define UTS_RELEASE ""
#define TASK_COMM_LEN (MAXCOMLEN + 1)
#ifndef pr_fmt
#define pr_fmt(fmt) fmt
#endif
#define printk_once(fmt, arg...) ({ \
static int __warned; \
if (!__warned) { \
printf(fmt, ## arg); \
__warned = 1; \
} \
})
#define printk(fmt, arg...) printf(fmt, ## arg)
#define pr_warn(fmt, arg...) printf(pr_fmt(fmt), ## arg)
#define pr_warn_once(fmt, arg...) printk_once(pr_fmt(fmt), ## arg)
#define pr_notice(fmt, arg...) printf(pr_fmt(fmt), ## arg)
#define pr_crit(fmt, arg...) printf(pr_fmt(fmt), ## arg)
#define pr_err(fmt, arg...) printf(pr_fmt(fmt), ## arg)
#ifdef DRMDEBUG
#define pr_info(fmt, arg...) printf(pr_fmt(fmt), ## arg)
#define pr_info_once(fmt, arg...) printk_once(pr_fmt(fmt), ## arg)
#define pr_debug(fmt, arg...) printf(pr_fmt(fmt), ## arg)
#else
#define pr_info(fmt, arg...) do { } while(0)
#define pr_info_once(fmt, arg...) do { } while(0)
#define pr_debug(fmt, arg...) do { } while(0)
#endif
#define dev_warn(dev, fmt, arg...) \
printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg)
#define dev_notice(dev, fmt, arg...) \
printf("drm:pid%d:%s *NOTICE* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg)
#define dev_crit(dev, fmt, arg...) \
printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg)
#define dev_err(dev, fmt, arg...) \
printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg)
#ifdef DRMDEBUG
#define dev_info(dev, fmt, arg...) \
printf("drm: " fmt, ## arg)
#define dev_debug(dev, fmt, arg...) \
printf("drm:pid%d:%s *DEBUG* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg)
#else
#define dev_info(dev, fmt, arg...) \
do { } while(0)
#define dev_debug(dev, fmt, arg...) \
do { } while(0)
#endif
enum {
DUMP_PREFIX_NONE,
DUMP_PREFIX_ADDRESS,
DUMP_PREFIX_OFFSET
};
void print_hex_dump(const char *, const char *, int, int, int,
const void *, size_t, bool);
#define scnprintf(str, size, fmt, arg...) snprintf(str, size, fmt, ## arg)
#define unlikely(x) __builtin_expect(!!(x), 0)
#define likely(x) __builtin_expect(!!(x), 1)
#define BUG() \
do { \
panic("BUG at %s:%d", __FILE__, __LINE__); \
} while (0)
#ifndef DIAGNOSTIC
#define BUG_ON(x) ((void)(x))
#else
#define BUG_ON(x) KASSERT(!(x))
#endif
#define BUILD_BUG()
#define BUILD_BUG_ON(x) CTASSERT(!(x))
#define BUILD_BUG_ON_NOT_POWER_OF_2(x)
#define BUILD_BUG_ON_MSG(x, y)
#define WARN(condition, fmt...) ({ \
int __ret = !!(condition); \
if (__ret) \
printf(fmt); \
unlikely(__ret); \
})
#define WARN_ONCE(condition, fmt...) ({ \
static int __warned; \
int __ret = !!(condition); \
if (__ret && !__warned) { \
printf(fmt); \
__warned = 1; \
} \
unlikely(__ret); \
})
#define _WARN_STR(x) #x
#define WARN_ON(condition) ({ \
int __ret = !!(condition); \
if (__ret) \
printf("WARNING %s failed at %s:%d\n", \
_WARN_STR(condition), __FILE__, __LINE__); \
unlikely(__ret); \
})
#define WARN_ON_ONCE(condition) ({ \
static int __warned; \
int __ret = !!(condition); \
if (__ret && !__warned) { \
printf("WARNING %s failed at %s:%d\n", \
_WARN_STR(condition), __FILE__, __LINE__); \
__warned = 1; \
} \
unlikely(__ret); \
})
#define TP_PROTO(x...) x
#define DEFINE_EVENT(template, name, proto, args) \
static inline void trace_##name(proto) {}
#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
static inline void trace_##name(proto) {}
#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
static inline void trace_##name(proto) {}
#define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \
static inline void trace_##name(proto) {}
#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \
static inline void trace_##name(proto) {}
#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-ELAST)
static inline void *
ERR_PTR(long error)
{
return (void *) error;
}
static inline long
PTR_ERR(const void *ptr)
{
return (long) ptr;
}
static inline long
IS_ERR(const void *ptr)
{
return IS_ERR_VALUE((unsigned long)ptr);
}
static inline long
IS_ERR_OR_NULL(const void *ptr)
{
return !ptr || IS_ERR_VALUE((unsigned long)ptr);
}
static inline void *
ERR_CAST(const void *ptr)
{
return (void *)ptr;
}
static inline int
PTR_ERR_OR_ZERO(const void *ptr)
{
return IS_ERR(ptr)? PTR_ERR(ptr) : 0;
}
#define swap(a, b) \
do { __typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define container_of(ptr, type, member) ({ \
__typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
#ifndef __DECONST
#define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var))
#endif
typedef struct rwlock rwlock_t;
typedef struct mutex spinlock_t;
#define DEFINE_SPINLOCK(x) struct mutex x
#define DEFINE_MUTEX(x) struct rwlock x
static inline void
_spin_lock_irqsave(struct mutex *mtxp, __unused unsigned long flags
LOCK_FL_VARS)
{
_mtx_enter(mtxp LOCK_FL_ARGS);
}
static inline void
_spin_unlock_irqrestore(struct mutex *mtxp, __unused unsigned long flags
LOCK_FL_VARS)
{
_mtx_leave(mtxp LOCK_FL_ARGS);
}
#define spin_lock_irqsave(m, fl) \
_spin_lock_irqsave(m, fl LOCK_FILE_LINE)
#define spin_unlock_irqrestore(m, fl) \
_spin_unlock_irqrestore(m, fl LOCK_FILE_LINE)
#define spin_lock(mtxp) mtx_enter(mtxp)
#define spin_unlock(mtxp) mtx_leave(mtxp)
#define spin_lock_irq(mtxp) mtx_enter(mtxp)
#define spin_unlock_irq(mtxp) mtx_leave(mtxp)
#define assert_spin_locked(mtxp) MUTEX_ASSERT_LOCKED(mtxp)
#define mutex_lock_interruptible(rwl) -rw_enter(rwl, RW_WRITE | RW_INTR)
#define mutex_lock(rwl) rw_enter_write(rwl)
#define mutex_lock_nest_lock(rwl, sub) rw_enter_write(rwl)
#define mutex_trylock(rwl) (rw_enter(rwl, RW_WRITE | RW_NOSLEEP) == 0)
#define mutex_unlock(rwl) rw_exit_write(rwl)
#define mutex_is_locked(rwl) (rw_status(rwl) == RW_WRITE)
#define down_read(rwl) rw_enter_read(rwl)
#define up_read(rwl) rw_exit_read(rwl)
#define down_write(rwl) rw_enter_write(rwl)
#define up_write(rwl) rw_exit_write(rwl)
#define read_lock(rwl) rw_enter_read(rwl)
#define read_unlock(rwl) rw_exit_read(rwl)
#define write_lock(rwl) rw_enter_write(rwl)
#define write_unlock(rwl) rw_exit_write(rwl)
#define might_lock(lock)
#define lockdep_assert_held(lock) do { (void)(lock); } while(0)
#define IRQF_SHARED 0
#define local_irq_save(x) (x) = splhigh()
#define local_irq_restore(x) splx((x))
#define request_irq(irq, hdlr, flags, name, dev) (0)
#define free_irq(irq, dev)
#define synchronize_irq(x)
#define fence_wait(x, y)
#define fence_put(x)
struct wait_queue_head {
struct mutex lock;
unsigned int count;
};
typedef struct wait_queue_head wait_queue_head_t;
static inline void
init_waitqueue_head(wait_queue_head_t *wq)
{
mtx_init(&wq->lock, IPL_NONE);
wq->count = 0;
}
#define wait_event(wq, condition) \
do { \
struct sleep_state sls; \
\
KASSERT(!cold); \
if (condition) \
break; \
atomic_inc_int(&(wq).count); \
sleep_setup(&sls, &wq, 0, "drmwe"); \
sleep_finish(&sls, !(condition)); \
atomic_dec_int(&(wq).count); \
} while (!(condition))
#define __wait_event_timeout(wq, condition, ret) \
do { \
struct sleep_state sls; \
int deadline, __error; \
\
KASSERT(!cold); \
atomic_inc_int(&(wq).count); \
sleep_setup(&sls, &wq, 0, "drmwet"); \
sleep_setup_timeout(&sls, ret); \
deadline = ticks + ret; \
sleep_finish(&sls, !(condition)); \
ret = deadline - ticks; \
__error = sleep_finish_timeout(&sls); \
atomic_dec_int(&(wq).count); \
if (ret < 0 || __error == EWOULDBLOCK) \
ret = 0; \
if (ret == 0 && (condition)) { \
ret = 1; \
break; \
} \
} while (ret > 0 && !(condition))
#define wait_event_timeout(wq, condition, timo) \
({ \
long __ret = timo; \
if (!(condition)) \
__wait_event_timeout(wq, condition, __ret); \
__ret; \
})
#define __wait_event_interruptible_timeout(wq, condition, ret) \
do { \
struct sleep_state sls; \
int deadline, __error, __error1; \
\
KASSERT(!cold); \
atomic_inc_int(&(wq).count); \
sleep_setup(&sls, &wq, PCATCH, "drmweti"); \
sleep_setup_timeout(&sls, ret); \
sleep_setup_signal(&sls, PCATCH); \
deadline = ticks + ret; \
sleep_finish(&sls, !(condition)); \
ret = deadline - ticks; \
__error1 = sleep_finish_timeout(&sls); \
__error = sleep_finish_signal(&sls); \
atomic_dec_int(&(wq).count); \
if (ret < 0 || __error1 == EWOULDBLOCK) \
ret = 0; \
if (__error == ERESTART) \
ret = -ERESTARTSYS; \
else if (__error) \
ret = -__error; \
if (ret == 0 && (condition)) { \
ret = 1; \
break; \
} \
} while (ret > 0 && !(condition))
#define wait_event_interruptible_timeout(wq, condition, timo) \
({ \
long __ret = timo; \
if (!(condition)) \
__wait_event_interruptible_timeout(wq, condition, __ret); \
__ret; \
})
#define wake_up(x) wakeup(x)
#define wake_up_all(x) wakeup(x)
#define wake_up_all_locked(x) wakeup(x)
#define wake_up_interruptible(x) wakeup(x)
#define waitqueue_active(wq) ((wq)->count > 0)
struct completion {
u_int done;
wait_queue_head_t wait;
};
#define INIT_COMPLETION(x) ((x).done = 0)
static inline void
init_completion(struct completion *x)
{
x->done = 0;
mtx_init(&x->wait.lock, IPL_NONE);
}
static inline u_long
_wait_for_completion_interruptible_timeout(struct completion *x, u_long timo
LOCK_FL_VARS)
{
int ret;
_mtx_enter(&x->wait.lock LOCK_FL_ARGS);
while (x->done == 0) {
ret = msleep(x, &x->wait.lock, PCATCH, "wfcit", timo);
if (ret) {
_mtx_leave(&x->wait.lock LOCK_FL_ARGS);
return (ret == EWOULDBLOCK) ? 0 : -ret;
}
}
return 1;
}
#define wait_for_completion_interruptible_timeout(x, timo) \
_wait_for_completion_interruptible_timeout(x, timo LOCK_FILE_LINE)
static inline void
_complete_all(struct completion *x LOCK_FL_VARS)
{
_mtx_enter(&x->wait.lock LOCK_FL_ARGS);
x->done = 1;
_mtx_leave(&x->wait.lock LOCK_FL_ARGS);
wakeup(x);
}
#define complete_all(x) _complete_all(x LOCK_FILE_LINE)
struct workqueue_struct;
#define system_wq (struct workqueue_struct *)systq
#define system_long_wq (struct workqueue_struct *)systq
static inline struct workqueue_struct *
alloc_ordered_workqueue(const char *name, int flags)
{
struct taskq *tq = taskq_create(name, 1, IPL_TTY, 0);
return (struct workqueue_struct *)tq;
}
static inline void
destroy_workqueue(struct workqueue_struct *wq)
{
taskq_destroy((struct taskq *)wq);
}
struct work_struct {
struct task task;
struct taskq *tq;
};
typedef void (*work_func_t)(struct work_struct *);
static inline void
INIT_WORK(struct work_struct *work, work_func_t func)
{
work->tq = systq;
task_set(&work->task, (void (*)(void *))func, work);
}
#define INIT_WORK_ONSTACK(x, y) INIT_WORK((x), (y))
static inline bool
queue_work(struct workqueue_struct *wq, struct work_struct *work)
{
work->tq = (struct taskq *)wq;
return task_add(work->tq, &work->task);
}
static inline void
cancel_work_sync(struct work_struct *work)
{
task_del(work->tq, &work->task);
}
struct delayed_work {
struct work_struct work;
struct timeout to;
struct taskq *tq;
};
static inline struct delayed_work *
to_delayed_work(struct work_struct *work)
{
return container_of(work, struct delayed_work, work);
}
static void
__delayed_work_tick(void *arg)
{
struct delayed_work *dwork = arg;
task_add(dwork->tq, &dwork->work.task);
}
static inline void
INIT_DELAYED_WORK(struct delayed_work *dwork, work_func_t func)
{
INIT_WORK(&dwork->work, func);
timeout_set(&dwork->to, __delayed_work_tick, &dwork->work);
}
static inline bool
schedule_work(struct work_struct *work)
{
return task_add(work->tq, &work->task);
}
static inline bool
schedule_delayed_work(struct delayed_work *dwork, int jiffies)
{
dwork->tq = systq;
return timeout_add(&dwork->to, jiffies);
}
static inline bool
queue_delayed_work(struct workqueue_struct *wq,
struct delayed_work *dwork, int jiffies)
{
dwork->tq = (struct taskq *)wq;
return timeout_add(&dwork->to, jiffies);
}
static inline bool
mod_delayed_work(struct workqueue_struct *wq,
struct delayed_work *dwork, int jiffies)
{
dwork->tq = (struct taskq *)wq;
return (timeout_add(&dwork->to, jiffies) == 0);
}
static inline bool
cancel_delayed_work(struct delayed_work *dwork)
{
if (timeout_del(&dwork->to))
return true;
return task_del(dwork->tq, &dwork->work.task);
}
static inline bool
cancel_delayed_work_sync(struct delayed_work *dwork)
{
if (timeout_del(&dwork->to))
return true;
return task_del(dwork->tq, &dwork->work.task);
}
void flush_workqueue(struct workqueue_struct *);
void flush_work(struct work_struct *);
void flush_delayed_work(struct delayed_work *);
#define flush_scheduled_work() flush_workqueue(system_wq)
#define destroy_work_on_stack(x)
typedef void *async_cookie_t;
#define async_schedule(func, data) (func)((data), NULL)
#define local_irq_disable() disable_intr()
#define local_irq_enable() enable_intr()
#define setup_timer(x, y, z) timeout_set((x), (void (*)(void *))(y), (void *)(z))
#define mod_timer(x, y) timeout_add((x), (y - jiffies))
#define mod_timer_pinned(x, y) timeout_add((x), (y - jiffies))
#define del_timer_sync(x) timeout_del((x))
#define timer_pending(x) timeout_pending((x))
#define cond_resched() sched_pause(yield)
#define drm_need_resched() \
(curcpu()->ci_schedstate.spc_schedflags & SPCF_SHOULDYIELD)
#define TASK_UNINTERRUPTIBLE 0
#define TASK_INTERRUPTIBLE PCATCH
#define signal_pending_state(x, y) CURSIG(curproc)
#define NSEC_PER_USEC 1000L
#define NSEC_PER_MSEC 1000000L
#define NSEC_PER_SEC 1000000000L
#define KHZ2PICOS(a) (1000000000UL/(a))
extern struct timespec ns_to_timespec(const int64_t);
extern int64_t timeval_to_ns(const struct timeval *);
extern int64_t timeval_to_us(const struct timeval *);
extern struct timeval ns_to_timeval(const int64_t);
static inline struct timespec
timespec_sub(struct timespec t1, struct timespec t2)
{
struct timespec diff;
timespecsub(&t1, &t2, &diff);
return diff;
}
#define time_in_range(x, min, max) ((x) >= (min) && (x) <= (max))
extern volatile unsigned long jiffies;
#undef HZ
#define HZ hz
#define MAX_JIFFY_OFFSET ((INT_MAX >> 1) - 1)
static inline unsigned long
round_jiffies_up(unsigned long j)
{
return roundup(j, hz);
}
static inline unsigned long
round_jiffies_up_relative(unsigned long j)
{
return roundup(j, hz);
}
#define jiffies_to_msecs(x) (((uint64_t)(x)) * 1000 / hz)
#define jiffies_to_usecs(x) (((uint64_t)(x)) * 1000000 / hz)
#define msecs_to_jiffies(x) (((uint64_t)(x)) * hz / 1000)
#define nsecs_to_jiffies64(x) (((uint64_t)(x)) * hz / 1000000000)
#define get_jiffies_64() jiffies
#define time_after(a,b) ((long)(b) - (long)(a) < 0)
#define time_after_eq(a,b) ((long)(b) - (long)(a) <= 0)
#define get_seconds() time_second
#define getrawmonotonic(x) nanouptime(x)
static inline void
set_normalized_timespec(struct timespec *ts, time_t sec, int64_t nsec)
{
while (nsec > NSEC_PER_SEC) {
nsec -= NSEC_PER_SEC;
sec++;
}
ts->tv_sec = sec;
ts->tv_nsec = nsec;
}
static inline int64_t
timespec_to_ns(const struct timespec *ts)
{
return ((ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec);
}
static inline unsigned long
timespec_to_jiffies(const struct timespec *ts)
{
long long to_ticks;
to_ticks = (long long)hz * ts->tv_sec + ts->tv_nsec / (tick * 1000);
if (to_ticks > INT_MAX)
to_ticks = INT_MAX;
return ((int)to_ticks);
}
static inline int
timespec_valid(const struct timespec *ts)
{
if (ts->tv_sec < 0 || ts->tv_sec > 100000000 ||
ts->tv_nsec < 0 || ts->tv_nsec >= 1000000000)
return (0);
return (1);
}
typedef struct timeval ktime_t;
static inline struct timeval
ktime_get(void)
{
struct timeval tv;
getmicrouptime(&tv);
return tv;
}
static inline struct timeval
ktime_get_monotonic_offset(void)
{
struct timeval tv = {0, 0};
return tv;
}
static inline int64_t
ktime_to_us(struct timeval tv)
{
return timeval_to_us(&tv);
}
static inline int64_t
ktime_to_ns(struct timeval tv)
{
return timeval_to_ns(&tv);
}
static inline int64_t
ktime_get_raw_ns(void)
{
return ktime_to_ns(ktime_get());
}
#define ktime_to_timeval(tv) (tv)
static inline struct timeval
ktime_sub(struct timeval a, struct timeval b)
{
struct timeval res;
timersub(&a, &b, &res);
return res;
}
static inline struct timeval
ktime_add_ns(struct timeval tv, int64_t ns)
{
return ns_to_timeval(timeval_to_ns(&tv) + ns);
}
static inline struct timeval
ktime_sub_ns(struct timeval tv, int64_t ns)
{
return ns_to_timeval(timeval_to_ns(&tv) - ns);
}
static inline int64_t
ktime_us_delta(struct timeval a, struct timeval b)
{
return ktime_to_us(ktime_sub(a, b));
}
#define ktime_mono_to_real(x) (x)
#define ktime_get_real() ktime_get()
#define do_gettimeofday(tv) getmicrouptime(tv)
#define GFP_ATOMIC M_NOWAIT
#define GFP_NOWAIT M_NOWAIT
#define GFP_KERNEL (M_WAITOK | M_CANFAIL)
#define GFP_TEMPORARY (M_WAITOK | M_CANFAIL)
#define GFP_HIGHUSER 0
#define GFP_DMA32 0
#define __GFP_NOWARN 0
#define __GFP_NORETRY 0
#define __GFP_ZERO M_ZERO
static inline void *
kmalloc(size_t size, int flags)
{
return malloc(size, M_DRM, flags);
}
static inline void *
kmalloc_array(size_t n, size_t size, int flags)
{
if (n == 0 || SIZE_MAX / n < size)
return NULL;
return malloc(n * size, M_DRM, flags);
}
static inline void *
kcalloc(size_t n, size_t size, int flags)
{
if (n == 0 || SIZE_MAX / n < size)
return NULL;
return malloc(n * size, M_DRM, flags | M_ZERO);
}
static inline void *
kzalloc(size_t size, int flags)
{
return malloc(size, M_DRM, flags | M_ZERO);
}
static inline void
kfree(const void *objp)
{
free((void *)objp, M_DRM, 0);
}
static inline void *
kmemdup(const void *src, size_t len, int flags)
{
void *p = malloc(len, M_DRM, flags);
if (p)
memcpy(p, src, len);
return (p);
}
static inline char *
kasprintf(int flags, const char *fmt, ...)
{
char *buf;
size_t len;
va_list ap;
va_start(ap, fmt);
len = vsnprintf(NULL, 0, fmt, ap);
va_end(ap);
buf = kmalloc(len, flags);
if (buf) {
va_start(ap, fmt);
vsnprintf(buf, len, fmt, ap);
va_end(ap);
}
return buf;
}
static inline void *
vzalloc(unsigned long size)
{
return malloc(size, M_DRM, M_WAITOK | M_CANFAIL | M_ZERO);
}
static inline void
vfree(void *objp)
{
free(objp, M_DRM, 0);
}
struct kref {
uint32_t refcount;
};
static inline void
kref_init(struct kref *ref)
{
ref->refcount = 1;
}
static inline void
kref_get(struct kref *ref)
{
atomic_inc_int(&ref->refcount);
}
static inline int
kref_get_unless_zero(struct kref *ref)
{
if (ref->refcount != 0) {
atomic_inc_int(&ref->refcount);
return (1);
} else {
return (0);
}
}
static inline void
kref_put(struct kref *ref, void (*release)(struct kref *ref))
{
if (atomic_dec_int_nv(&ref->refcount) == 0)
release(ref);
}
static inline void
kref_sub(struct kref *ref, unsigned int v, void (*release)(struct kref *ref))
{
if (atomic_sub_int_nv(&ref->refcount, v) == 0)
release(ref);
}
static inline int
kref_put_mutex(struct kref *kref, void (*release)(struct kref *kref),
struct rwlock *lock)
{
if (!atomic_add_unless(&kref->refcount, -1, 1)) {
rw_enter_write(lock);
if (likely(atomic_dec_and_test(&kref->refcount))) {
release(kref);
return 1;
}
rw_exit_write(lock);
return 0;
}
return 0;
}
struct kobject {
struct kref kref;
struct kobj_type *type;
};
struct kobj_type {
void (*release)(struct kobject *);
};
static inline void
kobject_init(struct kobject *obj, struct kobj_type *type)
{
kref_init(&obj->kref);
obj->type = type;
}
static inline int
kobject_init_and_add(struct kobject *obj, struct kobj_type *type,
struct kobject *parent, const char *fmt, ...)
{
kobject_init(obj, type);
return (0);
}
static inline struct kobject *
kobject_get(struct kobject *obj)
{
if (obj != NULL)
kref_get(&obj->kref);
return (obj);
}
static inline void
kobject_release(struct kref *ref)
{
struct kobject *obj = container_of(ref, struct kobject, kref);
if (obj->type && obj->type->release)
obj->type->release(obj);
}
static inline void
kobject_put(struct kobject *obj)
{
if (obj != NULL)
kref_put(&obj->kref, kobject_release);
}
static inline void
kobject_del(struct kobject *obj)
{
}
struct idr_entry {
SPLAY_ENTRY(idr_entry) entry;
int id;
void *ptr;
};
struct idr {
SPLAY_HEAD(idr_tree, idr_entry) tree;
};
void idr_init(struct idr *);
void idr_preload(unsigned int);
int idr_alloc(struct idr *, void *, int, int, unsigned int);
#define idr_preload_end()
void *idr_find(struct idr *, int);
void *idr_replace(struct idr *, void *ptr, int);
void idr_remove(struct idr *, int);
void idr_destroy(struct idr *);
int idr_for_each(struct idr *, int (*)(int, void *, void *), void *);
void *idr_get_next(struct idr *, int *);
#define idr_for_each_entry(idp, entry, id) \
for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; id++)
struct ida {
int counter;
};
void ida_init(struct ida *);
void ida_destroy(struct ida *);
int ida_simple_get(struct ida *, unsigned int, unsigned nt, int);
void ida_remove(struct ida *, int);
struct notifier_block {
void *notifier_call;
};
#define register_reboot_notifier(x)
#define unregister_reboot_notifier(x)
#define SYS_RESTART 0
#define min_t(t, a, b) ({ \
t __min_a = (a); \
t __min_b = (b); \
__min_a < __min_b ? __min_a : __min_b; })
#define max_t(t, a, b) ({ \
t __max_a = (a); \
t __max_b = (b); \
__max_a > __max_b ? __max_a : __max_b; })
#define clamp_t(t, x, a, b) min_t(t, max_t(t, x, a), b)
#define clamp(x, a, b) clamp_t(__typeof(x), x, a, b)
#define min3(x, y, z) MIN(x, MIN(y, z))
#define do_div(n, base) ({ \
uint32_t __base = (base); \
uint32_t __rem = ((uint64_t)(n)) % __base; \
(n) = ((uint64_t)(n)) / __base; \
__rem; \
})
static inline uint64_t
div_u64(uint64_t x, uint32_t y)
{
return (x / y);
}
static inline int64_t
div_s64(int64_t x, int64_t y)
{
return (x / y);
}
static inline uint64_t
div64_u64(uint64_t x, uint64_t y)
{
return (x / y);
}
static inline uint64_t
div64_u64_rem(uint64_t x, uint64_t y, uint64_t *rem)
{
*rem = x % y;
return (x / y);
}
static inline int64_t
div64_s64(int64_t x, int64_t y)
{
return (x / y);
}
#define mult_frac(x, n, d) (((x) * (n)) / (d))
static inline int64_t
abs64(int64_t x)
{
return (x < 0 ? -x : x);
}
static inline unsigned long
__copy_to_user(void *to, const void *from, unsigned len)
{
if (copyout(from, to, len))
return len;
return 0;
}
static inline unsigned long
copy_to_user(void *to, const void *from, unsigned len)
{
return __copy_to_user(to, from, len);
}
static inline unsigned long
__copy_from_user(void *to, const void *from, unsigned len)
{
if (copyin(from, to, len))
return len;
return 0;
}
static inline unsigned long
copy_from_user(void *to, const void *from, unsigned len)
{
return __copy_from_user(to, from, len);
}
#define get_user(x, ptr) -copyin(ptr, &(x), sizeof(x))
#define put_user(x, ptr) -copyout(&(x), ptr, sizeof(x))
#define console_lock()
#define console_trylock() 1
#define console_unlock()
#ifndef PCI_MEM_START
#define PCI_MEM_START 0
#endif
#ifndef PCI_MEM_END
#define PCI_MEM_END 0xffffffff
#endif
enum dmi_field {
DMI_NONE,
DMI_BIOS_VENDOR,
DMI_BIOS_VERSION,
DMI_BIOS_DATE,
DMI_SYS_VENDOR,
DMI_PRODUCT_NAME,
DMI_PRODUCT_VERSION,
DMI_PRODUCT_SERIAL,
DMI_PRODUCT_UUID,
DMI_BOARD_VENDOR,
DMI_BOARD_NAME,
DMI_BOARD_VERSION,
DMI_BOARD_SERIAL,
DMI_BOARD_ASSET_TAG,
DMI_CHASSIS_VENDOR,
DMI_CHASSIS_TYPE,
DMI_CHASSIS_VERSION,
DMI_CHASSIS_SERIAL,
DMI_CHASSIS_ASSET_TAG,
DMI_STRING_MAX,
};
struct dmi_strmatch {
unsigned char slot;
char substr[79];
};
struct dmi_system_id {
int (*callback)(const struct dmi_system_id *);
const char *ident;
struct dmi_strmatch matches[4];
};
#define DMI_MATCH(a, b) {(a), (b)}
#define DMI_EXACT_MATCH(a, b) {(a), (b)}
int dmi_check_system(const struct dmi_system_id *);
struct resource {
u_long start;
};
struct pci_bus {
pci_chipset_tag_t pc;
unsigned char number;
};
struct pci_dev {
struct pci_bus _bus;
struct pci_bus *bus;
unsigned int devfn;
uint16_t vendor;
uint16_t device;
uint16_t subsystem_vendor;
uint16_t subsystem_device;
uint8_t revision;
pci_chipset_tag_t pc;
pcitag_t tag;
struct pci_softc *pci;
int irq;
int msi_enabled;
};
#define PCI_ANY_ID (uint16_t) (~0U)
#define PCI_VENDOR_ID_ASUSTEK PCI_VENDOR_ASUSTEK
#define PCI_VENDOR_ID_ATI PCI_VENDOR_ATI
#define PCI_VENDOR_ID_DELL PCI_VENDOR_DELL
#define PCI_VENDOR_ID_HP PCI_VENDOR_HP
#define PCI_VENDOR_ID_IBM PCI_VENDOR_IBM
#define PCI_VENDOR_ID_INTEL PCI_VENDOR_INTEL
#define PCI_VENDOR_ID_SONY PCI_VENDOR_SONY
#define PCI_VENDOR_ID_VIA PCI_VENDOR_VIATECH
#define PCI_DEVICE_ID_ATI_RADEON_QY PCI_PRODUCT_ATI_RADEON_QY
#define PCI_DEVFN(slot, func) ((slot) << 3 | (func))
#define PCI_SLOT(devfn) ((devfn) >> 3)
#define PCI_FUNC(devfn) ((devfn) & 0x7)
#define pci_dev_put(x)
static inline int
pci_read_config_dword(struct pci_dev *pdev, int reg, u32 *val)
{
*val = pci_conf_read(pdev->pc, pdev->tag, reg);
return 0;
}
static inline int
pci_read_config_word(struct pci_dev *pdev, int reg, u16 *val)
{
uint32_t v;
v = pci_conf_read(pdev->pc, pdev->tag, (reg & ~0x2));
*val = (v >> ((reg & 0x2) * 8));
return 0;
}
static inline int
pci_read_config_byte(struct pci_dev *pdev, int reg, u8 *val)
{
uint32_t v;
v = pci_conf_read(pdev->pc, pdev->tag, (reg & ~0x3));
*val = (v >> ((reg & 0x3) * 8));
return 0;
}
static inline int
pci_write_config_dword(struct pci_dev *pdev, int reg, u32 val)
{
pci_conf_write(pdev->pc, pdev->tag, reg, val);
return 0;
}
static inline int
pci_write_config_word(struct pci_dev *pdev, int reg, u16 val)
{
uint32_t v;
v = pci_conf_read(pdev->pc, pdev->tag, (reg & ~0x2));
v &= ~(0xffff << ((reg & 0x2) * 8));
v |= (val << ((reg & 0x2) * 8));
pci_conf_write(pdev->pc, pdev->tag, (reg & ~0x2), v);
return 0;
}
static inline int
pci_write_config_byte(struct pci_dev *pdev, int reg, u8 val)
{
uint32_t v;
v = pci_conf_read(pdev->pc, pdev->tag, (reg & ~0x3));
v &= ~(0xff << ((reg & 0x3) * 8));
v |= (val << ((reg & 0x3) * 8));
pci_conf_write(pdev->pc, pdev->tag, (reg & ~0x3), v);
return 0;
}
static inline int
pci_bus_read_config_word(struct pci_bus *bus, unsigned int devfn,
int reg, u16 *val)
{
pcitag_t tag = pci_make_tag(bus->pc, bus->number,
PCI_SLOT(devfn), PCI_FUNC(devfn));
uint32_t v;
v = pci_conf_read(bus->pc, tag, (reg & ~0x2));
*val = (v >> ((reg & 0x2) * 8));
return 0;
}
static inline int
pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn,
int reg, u8 *val)
{
pcitag_t tag = pci_make_tag(bus->pc, bus->number,
PCI_SLOT(devfn), PCI_FUNC(devfn));
uint32_t v;
v = pci_conf_read(bus->pc, tag, (reg & ~0x3));
*val = (v >> ((reg & 0x3) * 8));
return 0;
}
#define pci_set_master(x)
#define pci_enable_msi(x)
#define pci_disable_msi(x)
typedef enum {
PCI_D0,
PCI_D1,
PCI_D2,
PCI_D3hot,
PCI_D3cold
} pci_power_t;
#define pci_save_state(x)
#define pci_enable_device(x) 0
#define pci_disable_device(x)
static inline int
vga_client_register(struct pci_dev *a, void *b, void *c, void *d)
{
return -ENODEV;
}
#if defined(__amd64__) || defined(__i386__)
#define AGP_USER_MEMORY 0
#define AGP_USER_CACHED_MEMORY BUS_DMA_COHERENT
#define PCI_DMA_BIDIRECTIONAL 0
static inline dma_addr_t
pci_map_page(struct pci_dev *pdev, struct vm_page *page, unsigned long offset, size_t size, int direction)
{
return VM_PAGE_TO_PHYS(page);
}
static inline void
pci_unmap_page(struct pci_dev *pdev, dma_addr_t dma_address, size_t size, int direction)
{
}
static inline int
pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
{
return 0;
}
#define dma_set_coherent_mask(x, y)
#define VGA_RSRC_LEGACY_IO 0x01
void vga_get_uninterruptible(struct pci_dev *, int);
void vga_put(struct pci_dev *, int);
#define vga_switcheroo_register_client(a, b, c) 0
#define vga_switcheroo_unregister_client(a)
#define vga_switcheroo_process_delayed_switch()
#endif
struct i2c_algorithm;
#define I2C_FUNC_I2C 0
#define I2C_FUNC_SMBUS_EMUL 0
#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0
#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0
#define I2C_FUNC_10BIT_ADDR 0
struct i2c_adapter {
struct i2c_controller ic;
char name[48];
const struct i2c_algorithm *algo;
void *algo_data;
int retries;
void *data;
};
#define I2C_NAME_SIZE 20
struct i2c_msg {
uint16_t addr;
uint16_t flags;
uint16_t len;
uint8_t *buf;
};
#define I2C_M_RD 0x0001
#define I2C_M_NOSTART 0x0002
struct i2c_algorithm {
u32 (*functionality)(struct i2c_adapter *);
int (*master_xfer)(struct i2c_adapter *, struct i2c_msg *, int);
};
int i2c_transfer(struct i2c_adapter *, struct i2c_msg *, int);
#define i2c_add_adapter(x) 0
#define i2c_del_adapter(x)
static inline void *
i2c_get_adapdata(struct i2c_adapter *adap)
{
return adap->data;
}
static inline void
i2c_set_adapdata(struct i2c_adapter *adap, void *data)
{
adap->data = data;
}
#define memcpy_toio(d, s, n) memcpy(d, s, n)
#define memcpy_fromio(d, s, n) memcpy(d, s, n)
#define memset_io(d, b, n) memset(d, b, n)
static inline u32
ioread32(const volatile void __iomem *addr)
{
return (*(volatile uint32_t *)addr);
}
static inline u64
ioread64(const volatile void __iomem *addr)
{
return (*(volatile uint64_t *)addr);
}
static inline void
iowrite32(u32 val, volatile void __iomem *addr)
{
*(volatile uint32_t *)addr = val;
}
#define readl(p) ioread32(p)
#define writel(v, p) iowrite32(v, p)
#define readq(p) ioread64(p)
#define page_to_phys(page) (VM_PAGE_TO_PHYS(page))
#define page_to_pfn(pp) (VM_PAGE_TO_PHYS(pp) / PAGE_SIZE)
#define offset_in_page(off) ((off) & PAGE_MASK)
#define set_page_dirty(page) atomic_clearbits_int(&page->pg_flags, PG_CLEAN)
#define VERIFY_READ 0x1
#define VERIFY_WRITE 0x2
static inline int
access_ok(int type, const void *addr, unsigned long size)
{
return true;
}
#define CAP_SYS_ADMIN 0x1
static inline int
capable(int cap)
{
KASSERT(cap == CAP_SYS_ADMIN);
return suser(curproc, 0);
}
typedef int pgprot_t;
#define pgprot_val(v) (v)
#define PAGE_KERNEL 0
void *kmap(struct vm_page *);
void kunmap(void *addr);
void *vmap(struct vm_page **, unsigned int, unsigned long, pgprot_t);
void vunmap(void *, size_t);
#define round_up(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
#define round_down(x, y) (((x) / (y)) * (y))
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
#define DIV_ROUND_UP(x, y) (((x) + ((y) - 1)) / (y))
#define DIV_ROUND_UP_ULL(x, y) DIV_ROUND_UP(x, y)
#define DIV_ROUND_CLOSEST(x, y) (((x) + ((y) / 2)) / (y))
#define DIV_ROUND_CLOSEST_ULL(x, y) DIV_ROUND_CLOSEST(x, y)
static inline unsigned long
roundup_pow_of_two(unsigned long x)
{
return (1UL << flsl(x - 1));
}
#define is_power_of_2(x) (x != 0 && (((x) - 1) & (x)) == 0)
#define PAGE_ALIGN(addr) (((addr) + PAGE_MASK) & ~PAGE_MASK)
#define IS_ALIGNED(x, y) (((x) & ((y) - 1)) == 0)
static __inline void
udelay(unsigned long usecs)
{
DELAY(usecs);
}
static __inline void
ndelay(unsigned long nsecs)
{
DELAY(max(nsecs / 1000, 1));
}
static __inline void
usleep_range(unsigned long min, unsigned long max)
{
DELAY(min);
}
static __inline void
mdelay(unsigned long msecs)
{
int loops = msecs;
while (loops--)
DELAY(1000);
}
static __inline void
cpu_relax(void)
{
CPU_BUSY_CYCLE();
if (cold) {
delay(tick);
jiffies++;
}
}
#define cpu_relax_lowlatency() CPU_BUSY_CYCLE()
#define cpu_has_pat 1
#define cpu_has_clflush 1
static inline uint32_t ror32(uint32_t word, unsigned int shift)
{
return (word >> shift) | (word << (32 - shift));
}
static inline int
irqs_disabled(void)
{
return (cold);
}
static inline int
in_dbg_master(void)
{
#ifdef DDB
return (db_is_active);
#endif
return (0);
}
#define oops_in_progress in_dbg_master()
static inline int
power_supply_is_system_supplied(void)
{
/* XXX return 0 if on battery */
return (1);
}
#define pm_qos_update_request(x, y)
#define pm_qos_remove_request(x)
#define _U 0x01
#define _L 0x02
#define _N 0x04
#define _S 0x08
#define _P 0x10
#define _C 0x20
#define _X 0x40
#define _B 0x80
static inline int
isascii(int c)
{
return ((unsigned int)c <= 0177);
}
static inline int
isprint(int c)
{
if (c == -1)
return (0);
if ((unsigned char)c >= 040 && (unsigned char)c <= 0176)
return (1);
return (0);
}
#ifdef __macppc__
static __inline int
of_machine_is_compatible(const char *model)
{
extern char *hw_prod;
return (strcmp(model, hw_prod) == 0);
}
#endif
typedef unsigned int gfp_t;
struct vm_page *alloc_pages(unsigned int, unsigned int);
void __free_pages(struct vm_page *, unsigned int);
static inline struct vm_page *
alloc_page(unsigned int gfp_mask)
{
return alloc_pages(gfp_mask, 0);
}
static inline void
__free_page(struct vm_page *page)
{
return __free_pages(page, 0);
}
static inline unsigned int
get_order(size_t size)
{
return flsl((size - 1) >> PAGE_SHIFT);
}
#if defined(__i386__) || defined(__amd64__)
#define _PAGE_PRESENT PG_V
#define _PAGE_RW PG_RW
#define _PAGE_PAT PG_PAT
#define _PAGE_PWT PG_WT
#define _PAGE_PCD PG_N
static inline void
pagefault_disable(void)
{
KASSERT(curcpu()->ci_inatomic == 0);
curcpu()->ci_inatomic = 1;
}
static inline void
pagefault_enable(void)
{
KASSERT(curcpu()->ci_inatomic == 1);
curcpu()->ci_inatomic = 0;
}
static inline int
pagefault_disabled(void)
{
return curcpu()->ci_inatomic;
}
static inline void *
kmap_atomic(struct vm_page *pg)
{
vaddr_t va;
#if defined (__HAVE_PMAP_DIRECT)
va = pmap_map_direct(pg);
#else
extern vaddr_t pmap_tmpmap_pa(paddr_t);
va = pmap_tmpmap_pa(VM_PAGE_TO_PHYS(pg));
#endif
return (void *)va;
}
static inline void
kunmap_atomic(void *addr)
{
#if defined (__HAVE_PMAP_DIRECT)
pmap_unmap_direct((vaddr_t)addr);
#else
extern void pmap_tmpunmap_pa(void);
pmap_tmpunmap_pa();
#endif
}
static inline unsigned long
__copy_to_user_inatomic(void *to, const void *from, unsigned len)
{
struct cpu_info *ci = curcpu();
int inatomic = ci->ci_inatomic;
int error;
ci->ci_inatomic = 1;
error = copyout(from, to, len);
ci->ci_inatomic = inatomic;
return (error ? len : 0);
}
static inline unsigned long
__copy_from_user_inatomic(void *to, const void *from, unsigned len)
{
struct cpu_info *ci = curcpu();
int inatomic = ci->ci_inatomic;
int error;
ci->ci_inatomic = 1;
error = copyin(from, to, len);
ci->ci_inatomic = inatomic;
return (error ? len : 0);
}
static inline unsigned long
__copy_from_user_inatomic_nocache(void *to, const void *from, unsigned len)
{
return __copy_from_user_inatomic(to, from, len);
}
#endif
struct fb_var_screeninfo {
int pixclock;
};
struct fb_info {
struct fb_var_screeninfo var;
void *par;
};
#define FB_BLANK_UNBLANK 0
#define FB_BLANK_NORMAL 1
#define FB_BLANK_HSYNC_SUSPEND 2
#define FB_BLANK_VSYNC_SUSPEND 3
#define FB_BLANK_POWERDOWN 4
#define FBINFO_STATE_RUNNING 0
#define FBINFO_STATE_SUSPENDED 1
#define framebuffer_alloc(flags, device) \
kzalloc(sizeof(struct fb_info), GFP_KERNEL)
struct address_space;
#define unmap_mapping_range(mapping, holebegin, holeend, even_cows)
/*
* ACPI types and interfaces.
*/
typedef size_t acpi_size;
typedef int acpi_status;
struct acpi_table_header;
#define ACPI_SUCCESS(x) ((x) == 0)
#define AE_NOT_FOUND 0x0005
acpi_status acpi_get_table_with_size(const char *, int, struct acpi_table_header **, acpi_size *);
#define acpi_video_register()
#define acpi_video_unregister()
struct backlight_device;
struct backlight_properties {
int type;
int max_brightness;
int brightness;
int power;
};
struct backlight_ops {
int (*update_status)(struct backlight_device *);
int (*get_brightness)(struct backlight_device *);
};
struct backlight_device {
const struct backlight_ops *ops;
struct backlight_properties props;
struct task task;
void *data;
};
#define bl_get_data(bd) (bd)->data
#define BACKLIGHT_RAW 0
#define BACKLIGHT_FIRMWARE 1
struct backlight_device *backlight_device_register(const char *, void *,
void *, const struct backlight_ops *, struct backlight_properties *);
void backlight_device_unregister(struct backlight_device *);
static inline void
backlight_update_status(struct backlight_device *bd)
{
bd->ops->update_status(bd);
}
void backlight_schedule_update_status(struct backlight_device *);
#define MIPI_DSI_V_SYNC_START 0x01
#define MIPI_DSI_V_SYNC_END 0x11
#define MIPI_DSI_H_SYNC_START 0x21
#define MIPI_DSI_H_SYNC_END 0x31
#define MIPI_DSI_COLOR_MODE_OFF 0x02
#define MIPI_DSI_COLOR_MODE_ON 0x12
#define MIPI_DSI_SHUTDOWN_PERIPHERAL 0x22
#define MIPI_DSI_TURN_ON_PERIPHERAL 0x32
#define MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM 0x03
#define MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM 0x13
#define MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM 0x23
#define MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM 0x04
#define MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM 0x14
#define MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM 0x24
#define MIPI_DSI_DCS_SHORT_WRITE 0x05
#define MIPI_DSI_DCS_SHORT_WRITE_PARAM 0x15
#define MIPI_DSI_DCS_READ 0x06
#define MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE 0x37
#define MIPI_DSI_END_OF_TRANSMISSION 0x08
#define MIPI_DSI_NULL_PACKET 0x09
#define MIPI_DSI_BLANKING_PACKET 0x19
#define MIPI_DSI_GENERIC_LONG_WRITE 0x29
#define MIPI_DSI_DCS_LONG_WRITE 0x39
#define MIPI_DSI_LOOSELY_PACKED_PIXEL_STREAM_YCBCR20 0x0c
#define MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR24 0x1c
#define MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16 0x2c
#define MIPI_DSI_PACKED_PIXEL_STREAM_30 0x0d
#define MIPI_DSI_PACKED_PIXEL_STREAM_36 0x1d
#define MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12 0x3d
#define MIPI_DSI_PACKED_PIXEL_STREAM_16 0x0e
#define MIPI_DSI_PACKED_PIXEL_STREAM_18 0x1e
#define MIPI_DSI_PIXEL_STREAM_3BYTE_18 0x2e
#define MIPI_DSI_PACKED_PIXEL_STREAM_24 0x3e
#define MIPI_DCS_NOP 0x00
#define MIPI_DCS_SOFT_RESET 0x01
#define MIPI_DCS_GET_POWER_MODE 0x0a
#define MIPI_DCS_GET_PIXEL_FORMAT 0x0c
#define MIPI_DCS_ENTER_SLEEP_MODE 0x10
#define MIPI_DCS_EXIT_SLEEP_MODE 0x11
#define MIPI_DCS_SET_DISPLAY_OFF 0x28
#define MIPI_DCS_SET_DISPLAY_ON 0x29
#define MIPI_DCS_SET_COLUMN_ADDRESS 0x2a
#define MIPI_DCS_SET_PAGE_ADDRESS 0x2b
#define MIPI_DCS_SET_TEAR_OFF 0x34
#define MIPI_DCS_SET_TEAR_ON 0x35
#define MIPI_DCS_SET_PIXEL_FORMAT 0x3a
struct pwm_device;
static inline struct pwm_device *
pwm_get(struct device *dev, const char *consumer)
{
return ERR_PTR(-ENODEV);
}
static inline void
pwm_put(struct pwm_device *pwm)
{
}
static inline unsigned int
pwm_get_duty_cycle(const struct pwm_device *pwm)
{
return 0;
}
static inline int
pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
{
return -EINVAL;
}
static inline int
pwm_enable(struct pwm_device *pwm)
{
return -EINVAL;
}
static inline void
pwm_disable(struct pwm_device *pwm)
{
}
struct scatterlist {
dma_addr_t dma_address;
unsigned int offset;
unsigned int length;
};
struct sg_table {
struct scatterlist *sgl;
unsigned int nents;
unsigned int orig_nents;
};
struct sg_page_iter {
struct scatterlist *sg;
unsigned int sg_pgoffset;
unsigned int __nents;
};
int sg_alloc_table(struct sg_table *, unsigned int, gfp_t);
void sg_free_table(struct sg_table *);
#define sg_mark_end(x)
static __inline void
__sg_page_iter_start(struct sg_page_iter *iter, struct scatterlist *sgl,
unsigned int nents, unsigned long pgoffset)
{
iter->sg = sgl;
iter->sg_pgoffset = pgoffset - 1;
iter->__nents = nents;
}
static inline bool
__sg_page_iter_next(struct sg_page_iter *iter)
{
iter->sg_pgoffset++;
while (iter->__nents > 0 &&
iter->sg_pgoffset >= (iter->sg->length / PAGE_SIZE)) {
iter->sg_pgoffset -= (iter->sg->length / PAGE_SIZE);
iter->sg++;
iter->__nents--;
}
return (iter->__nents > 0);
}
static inline paddr_t
sg_page_iter_dma_address(struct sg_page_iter *iter)
{
return iter->sg->dma_address + (iter->sg_pgoffset << PAGE_SHIFT);
}
static inline struct vm_page *
sg_page_iter_page(struct sg_page_iter *iter)
{
return PHYS_TO_VM_PAGE(sg_page_iter_dma_address(iter));
}
static inline struct vm_page *
sg_page(struct scatterlist *sgl)
{
return PHYS_TO_VM_PAGE(sgl->dma_address);
}
#define sg_dma_address(sg) ((sg)->dma_address)
#define sg_dma_len(sg) ((sg)->length)
#define for_each_sg_page(sgl, iter, nents, pgoffset) \
__sg_page_iter_start((iter), (sgl), (nents), (pgoffset)); \
while (__sg_page_iter_next(iter))
size_t sg_copy_from_buffer(struct scatterlist *, unsigned int,
const void *, size_t);
struct firmware {
const u8 *data;
};
static inline int
request_firmware(const struct firmware **fw, const char *name,
struct device *device)
{
return -EINVAL;
}
#define request_firmware_nowait(a, b, c, d, e, f, g) -EINVAL
static inline void
release_firmware(const struct firmware *fw)
{
}
void *memchr_inv(const void *, int, size_t);
#endif
|