1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
10 */
11
12 /*
13 * Copyright 2020 Oxide Computer Company
14 */
15
16 /*
17 * A stub driver for the AMD Zen Nexus. This is used to help us get all the
18 * relevant PCI devices into one place. See uts/intel/io/amdzen/amdzen.c for
19 * more details.
20 */
21
22 #include <sys/conf.h>
23 #include <sys/devops.h>
24 #include <sys/modctl.h>
25 #include <sys/ddi.h>
26 #include <sys/sunddi.h>
27
28 #include "amdzen.h"
29
30 static int
amdzen_stub_attach(dev_info_t * dip,ddi_attach_cmd_t cmd)31 amdzen_stub_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
32 {
33 return (amdzen_attach_stub(dip, cmd));
34 }
35
36 static int
amdzen_stub_detach(dev_info_t * dip,ddi_detach_cmd_t cmd)37 amdzen_stub_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
38 {
39 return (amdzen_detach_stub(dip, cmd));
40 }
41
42 static struct dev_ops amdzen_stub_dev_ops = {
43 .devo_rev = DEVO_REV,
44 .devo_refcnt = 0,
45 .devo_getinfo = nodev,
46 .devo_identify = nodev,
47 .devo_probe = nulldev,
48 .devo_attach = amdzen_stub_attach,
49 .devo_detach = amdzen_stub_detach,
50 .devo_reset = nodev,
51 .devo_quiesce = ddi_quiesce_not_needed
52 };
53
54 static struct modldrv amdzen_stub_modldrv = {
55 .drv_modops = &mod_driverops,
56 .drv_linkinfo = "AMD Zen Nexus Stub driver",
57 .drv_dev_ops = &amdzen_stub_dev_ops
58 };
59
60 static struct modlinkage amdzen_stub_modlinkage = {
61 .ml_rev = MODREV_1,
62 .ml_linkage = { &amdzen_stub_modldrv, NULL }
63 };
64
65 int
_init(void)66 _init(void)
67 {
68 return (mod_install(&amdzen_stub_modlinkage));
69 }
70
71 int
_info(struct modinfo * modinfop)72 _info(struct modinfo *modinfop)
73 {
74 return (mod_info(&amdzen_stub_modlinkage, modinfop));
75 }
76
77 int
_fini(void)78 _fini(void)
79 {
80 return (mod_remove(&amdzen_stub_modlinkage));
81 }
82