1 
2 #include <linux/module.h>
3 #include <asm/hardware.h>	/* for register_parisc_driver() stuff */
4 #include <asm/parisc-device.h>
5 #include "ipmi_si.h"
6 
7 static bool parisc_registered;
8 
9 static int __init ipmi_parisc_probe(struct parisc_device *dev)
10 {
11 	struct si_sm_io io;
12 
13 	memset(&io, 0, sizeof(io));
14 
15 	io.si_type	= SI_KCS;
16 	io.addr_source	= SI_DEVICETREE;
17 	io.addr_type	= IPMI_MEM_ADDR_SPACE;
18 	io.addr_data	= dev->hpa.start;
19 	io.regsize	= 1;
20 	io.regspacing	= 1;
21 	io.regshift	= 0;
22 	io.irq		= 0; /* no interrupt */
23 	io.irq_setup	= NULL;
24 	io.dev		= &dev->dev;
25 
26 	dev_dbg(&dev->dev, "addr 0x%lx\n", io.addr_data);
27 
28 	return ipmi_si_add_smi(&io);
29 }
30 
31 static int __exit ipmi_parisc_remove(struct parisc_device *dev)
32 {
33 	return ipmi_si_remove_by_dev(&dev->dev);
34 }
35 
36 static const struct parisc_device_id ipmi_parisc_tbl[] __initconst = {
37 	{ HPHW_MC, HVERSION_REV_ANY_ID, 0x004, 0xC0 },
38 	{ 0, }
39 };
40 
41 MODULE_DEVICE_TABLE(parisc, ipmi_parisc_tbl);
42 
43 static struct parisc_driver ipmi_parisc_driver __refdata = {
44 	.name =		"ipmi",
45 	.id_table =	ipmi_parisc_tbl,
46 	.probe =	ipmi_parisc_probe,
47 	.remove =	__exit_p(ipmi_parisc_remove),
48 };
49 
50 void ipmi_si_parisc_init(void)
51 {
52 	register_parisc_driver(&ipmi_parisc_driver);
53 	parisc_registered = true;
54 }
55 
56 void ipmi_si_parisc_shutdown(void)
57 {
58 	if (parisc_registered)
59 		unregister_parisc_driver(&ipmi_parisc_driver);
60 }
61