xref: /illumos-gate/usr/src/uts/intel/io/imc/imcstub.c (revision b8052df9f609edb713f6828c9eecc3d7be19dfb3)
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 2019 Joyent, Inc.
14  */
15 
16 /*
17  * This is a stub driver that is used by the main imcstub driver to attach
18  * component PCI devices so that it can access their dev_info_t.
19  */
20 
21 #include <sys/conf.h>
22 #include <sys/devops.h>
23 #include <sys/modctl.h>
24 #include <sys/ddi.h>
25 #include <sys/sunddi.h>
26 
27 #include "imc.h"
28 
29 
30 static int
31 imcstub_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
32 {
33 	return (imc_attach_stub(dip, cmd));
34 }
35 
36 static int
37 imcstub_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
38 {
39 	return (imc_detach_stub(dip, cmd));
40 }
41 
42 static struct dev_ops imcstub_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 = imcstub_attach,
49 	.devo_detach = imcstub_detach,
50 	.devo_reset = nodev,
51 	.devo_quiesce = ddi_quiesce_not_needed
52 };
53 
54 static struct modldrv imcstub_modldrv = {
55 	.drv_modops = &mod_driverops,
56 	.drv_linkinfo = "IMC Stub driver",
57 	.drv_dev_ops = &imcstub_dev_ops
58 };
59 
60 static struct modlinkage imcstub_modlinkage = {
61 	.ml_rev = MODREV_1,
62 	.ml_linkage = { &imcstub_modldrv, NULL }
63 };
64 
65 int
66 _init(void)
67 {
68 	return (mod_install(&imcstub_modlinkage));
69 }
70 
71 int
72 _info(struct modinfo *modinfop)
73 {
74 	return (mod_info(&imcstub_modlinkage, modinfop));
75 }
76 
77 int
78 _fini(void)
79 {
80 	return (mod_remove(&imcstub_modlinkage));
81 }
82