aboutsummaryrefslogtreecommitdiffstats
path: root/sys/openbsd
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@basename.se>2019-04-04 20:22:49 +0200
committerDmitry Vyukov <dvyukov@google.com>2019-04-05 10:22:46 +0200
commit5701183bd373a3c3c96a86010b67bfecfbddb485 (patch)
tree933c6d04c2a47d6e44fc50449aceed0ddc3ce8db /sys/openbsd
parent3635d6e6786f8dde2a460758b5d8be9428cb7e2b (diff)
sys/openbsd: add pci descriptions
Diffstat (limited to 'sys/openbsd')
-rw-r--r--sys/openbsd/dev_pci.txt33
-rw-r--r--sys/openbsd/dev_pci_amd64.const7
-rw-r--r--sys/openbsd/gen/amd64.go57
3 files changed, 96 insertions, 1 deletions
diff --git a/sys/openbsd/dev_pci.txt b/sys/openbsd/dev_pci.txt
new file mode 100644
index 000000000..b91058003
--- /dev/null
+++ b/sys/openbsd/dev_pci.txt
@@ -0,0 +1,33 @@
+# Copyright 2019 syzkaller project authors. All rights reserved.
+# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+
+include <sys/types.h>
+include <sys/pciio.h>
+include <fcntl.h>
+
+resource fd_pci[fd]
+
+openat$pci(fd const[AT_FDCWD], file ptr[in, string["/dev/pci"]], flags flags[open_flags], mode const[0]) fd_pci
+
+ioctl$PCIOCREAD(fd fd_pci, cmd const[PCIOCREAD], arg ptr[out, pci_io])
+ioctl$PCIOCWRITE(fd fd_pci, cmd const[PCIOCWRITE], arg ptr[in, pci_io])
+ioctl$PCIOCGETROM(fd fd_pci, cmd const[PCIOCGETROM], arg ptr[out, pci_rom])
+
+pci_io {
+ pi_sel pcisel
+ pi_reg int32
+ pi_width int32
+ pi_data int32
+}
+
+pci_rom {
+ pr_sel pcisel
+ pr_romlen len[pr_rom, int32]
+ pr_rom ptr[out, array[int32]]
+}
+
+pcisel {
+ pc_bus int8
+ pc_dev int8
+ pc_func int8
+}
diff --git a/sys/openbsd/dev_pci_amd64.const b/sys/openbsd/dev_pci_amd64.const
new file mode 100644
index 000000000..0466fc6cf
--- /dev/null
+++ b/sys/openbsd/dev_pci_amd64.const
@@ -0,0 +1,7 @@
+# AUTOGENERATED FILE
+AT_FDCWD = 18446744073709551516
+PCIOCGETROM = 3222302725
+PCIOCREAD = 3222302722
+PCIOCWRITE = 3222302723
+SYS_ioctl = 54
+SYS_openat = 321
diff --git a/sys/openbsd/gen/amd64.go b/sys/openbsd/gen/amd64.go
index dbaa4371f..f6fd1d48d 100644
--- a/sys/openbsd/gen/amd64.go
+++ b/sys/openbsd/gen/amd64.go
@@ -15,6 +15,7 @@ var resources_amd64 = []*ResourceDesc{
{Name: "fd_bpf", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_bpf"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
{Name: "fd_dir", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_dir"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
{Name: "fd_kqueue", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_kqueue"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
+ {Name: "fd_pci", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_pci"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
{Name: "fd_tty", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_tty"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
{Name: "fd_wsdisplay", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_wsdisplay"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
{Name: "fd_wskbd", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_wskbd"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
@@ -221,6 +222,36 @@ var structDescs_amd64 = []*KeyedStruct{
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "pad0", TypeSize: 8}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "pad1", TypeSize: 8}}},
}}},
+ {Key: StructKey{Name: "pci_io"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "pci_io", TypeSize: 16}, Fields: []Type{
+ &StructType{Key: StructKey{Name: "pcisel"}, FldName: "pi_sel"},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 1}}, IsPad: true},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "pi_reg", TypeSize: 4}}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "pi_width", TypeSize: 4}}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "pi_data", TypeSize: 4}}},
+ }}},
+ {Key: StructKey{Name: "pci_io", Dir: 1}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "pci_io", TypeSize: 16, ArgDir: 1}, Fields: []Type{
+ &StructType{Key: StructKey{Name: "pcisel", Dir: 1}, FldName: "pi_sel"},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 1}}, IsPad: true},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "pi_reg", TypeSize: 4, ArgDir: 1}}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "pi_width", TypeSize: 4, ArgDir: 1}}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "pi_data", TypeSize: 4, ArgDir: 1}}},
+ }}},
+ {Key: StructKey{Name: "pci_rom", Dir: 1}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "pci_rom", TypeSize: 16, ArgDir: 1}, Fields: []Type{
+ &StructType{Key: StructKey{Name: "pcisel", Dir: 1}, FldName: "pr_sel"},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 1}}, IsPad: true},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "pr_romlen", TypeSize: 4, ArgDir: 1}}, Buf: "pr_rom"},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "pr_rom", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", ArgDir: 1, IsVarlen: true}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}},
+ }}},
+ {Key: StructKey{Name: "pcisel"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "pcisel", TypeSize: 3}, Fields: []Type{
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "pc_bus", TypeSize: 1}}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "pc_dev", TypeSize: 1}}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "pc_func", TypeSize: 1}}},
+ }}},
+ {Key: StructKey{Name: "pcisel", Dir: 1}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "pcisel", TypeSize: 3, ArgDir: 1}, Fields: []Type{
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "pc_bus", TypeSize: 1, ArgDir: 1}}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "pc_dev", TypeSize: 1, ArgDir: 1}}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "pc_func", TypeSize: 1, ArgDir: 1}}},
+ }}},
{Key: StructKey{Name: "pipefd", Dir: 1}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "pipefd", TypeSize: 8, ArgDir: 1}, Fields: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "rfd", TypeSize: 4, ArgDir: 1}},
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "wfd", TypeSize: 4, ArgDir: 1}},
@@ -1056,6 +1087,21 @@ var syscalls_amd64 = []*Syscall{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd_wsdisplay", FldName: "fd", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 536890179},
}},
+ {NR: 54, Name: "ioctl$PCIOCGETROM", CallName: "ioctl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd_pci", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 3222302725},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "arg", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "pci_rom", Dir: 1}}},
+ }},
+ {NR: 54, Name: "ioctl$PCIOCREAD", CallName: "ioctl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd_pci", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 3222302722},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "arg", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "pci_io", Dir: 1}}},
+ }},
+ {NR: 54, Name: "ioctl$PCIOCWRITE", CallName: "ioctl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd_pci", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 3222302723},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "arg", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "pci_io"}}},
+ }},
{NR: 54, Name: "ioctl$TIOCCBRK", CallName: "ioctl", MissingArgs: 1, Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd_tty", FldName: "fd", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 536900730},
@@ -1548,6 +1594,12 @@ var syscalls_amd64 = []*Syscall{
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 8, 512, 1024, 2048, 16, 32, 256, 65536, 128, 128, 128, 32768, 131072, 64}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "mode", TypeSize: 8}}},
}, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "ret", TypeSize: 4, ArgDir: 1}}},
+ {NR: 321, Name: "openat$pci", CallName: "openat", Args: []Type{
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "fd", TypeSize: 8}}, Val: 18446744073709551516},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "file", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", TypeSize: 9}, Kind: 2, Values: []string{"/dev/pci\x00"}}},
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 8, 512, 1024, 2048, 16, 32, 256, 65536, 128, 128, 128, 32768, 131072, 64}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "mode", TypeSize: 8}}},
+ }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "fd_pci", FldName: "ret", TypeSize: 4, ArgDir: 1}}},
{NR: 321, Name: "openat$tty", CallName: "openat", Args: []Type{
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "fd", TypeSize: 8}}, Val: 18446744073709551516},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "file", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", TypeSize: 9}, Kind: 2, Values: []string{"/dev/tty\x00"}}},
@@ -2252,6 +2304,9 @@ var consts_amd64 = []ConstValue{
{Name: "O_SYNC", Value: 128},
{Name: "O_TRUNC", Value: 1024},
{Name: "O_WRONLY", Value: 1},
+ {Name: "PCIOCGETROM", Value: 3222302725},
+ {Name: "PCIOCREAD", Value: 3222302722},
+ {Name: "PCIOCWRITE", Value: 3222302723},
{Name: "POLLERR", Value: 8},
{Name: "POLLHUP", Value: 16},
{Name: "POLLIN", Value: 1},
@@ -2603,4 +2658,4 @@ var consts_amd64 = []ConstValue{
{Name: "__MAP_NOREPLACE", Value: 2048},
}
-const revision_amd64 = "9fc67a9064cfaddb0ab19eb767a060a0050eee68"
+const revision_amd64 = "66d66a3830b5b4fd591a3693f4ba004395ee7fb6"