xref: /linux/drivers/char/ipmi/ipmi_si_parisc.c (revision d0300e5e8d2fb74852f8116f26546e12cfa66735)
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 	io.si_type	= SI_KCS;
14 	io.addr_source	= SI_DEVICETREE;
15 	io.addr_type	= IPMI_MEM_ADDR_SPACE;
16 	io.addr_data	= dev->hpa.start;
17 	io.regsize	= 1;
18 	io.regspacing	= 1;
19 	io.regshift	= 0;
20 	io.irq		= 0; /* no interrupt */
21 	io.irq_setup	= NULL;
22 	io.dev		= &dev->dev;
23 
24 	dev_dbg(&dev->dev, "addr 0x%lx\n", io.addr_data);
25 
26 	return ipmi_si_add_smi(&io);
27 }
28 
29 static int __exit ipmi_parisc_remove(struct parisc_device *dev)
30 {
31 	return ipmi_si_remove_by_dev(&dev->dev);
32 }
33 
34 static const struct parisc_device_id ipmi_parisc_tbl[] __initconst = {
35 	{ HPHW_MC, HVERSION_REV_ANY_ID, 0x004, 0xC0 },
36 	{ 0, }
37 };
38 
39 MODULE_DEVICE_TABLE(parisc, ipmi_parisc_tbl);
40 
41 static struct parisc_driver ipmi_parisc_driver __refdata = {
42 	.name =		"ipmi",
43 	.id_table =	ipmi_parisc_tbl,
44 	.probe =	ipmi_parisc_probe,
45 	.remove =	__exit_p(ipmi_parisc_remove),
46 };
47 
48 void ipmi_si_parisc_init(void)
49 {
50 	register_parisc_driver(&ipmi_parisc_driver);
51 	parisc_registered = true;
52 }
53 
54 void ipmi_si_parisc_shutdown(void)
55 {
56 	if (parisc_registered)
57 		unregister_parisc_driver(&ipmi_parisc_driver);
58 }
59