Lines Matching refs:io
60 struct si_sm_io *io = context; in ipmi_acpi_gpe() local
62 ipmi_si_irq_handler(io->irq, io->irq_handler_data); in ipmi_acpi_gpe()
66 static void acpi_gpe_irq_cleanup(struct si_sm_io *io) in acpi_gpe_irq_cleanup() argument
68 if (!io->irq) in acpi_gpe_irq_cleanup()
71 ipmi_irq_start_cleanup(io); in acpi_gpe_irq_cleanup()
72 acpi_remove_gpe_handler(NULL, io->irq, &ipmi_acpi_gpe); in acpi_gpe_irq_cleanup()
75 static int acpi_gpe_irq_setup(struct si_sm_io *io) in acpi_gpe_irq_setup() argument
79 if (!io->irq) in acpi_gpe_irq_setup()
83 io->irq, in acpi_gpe_irq_setup()
86 io); in acpi_gpe_irq_setup()
88 dev_warn(io->dev, in acpi_gpe_irq_setup()
90 io->irq); in acpi_gpe_irq_setup()
91 io->irq = 0; in acpi_gpe_irq_setup()
95 io->irq_cleanup = acpi_gpe_irq_cleanup; in acpi_gpe_irq_setup()
96 ipmi_irq_finish_setup(io); in acpi_gpe_irq_setup()
97 dev_info(io->dev, "Using ACPI GPE %d\n", io->irq); in acpi_gpe_irq_setup()
102 static void ipmi_set_addr_data_and_space(struct resource *r, struct si_sm_io *io) in ipmi_set_addr_data_and_space() argument
105 io->addr_space = IPMI_IO_ADDR_SPACE; in ipmi_set_addr_data_and_space()
107 io->addr_space = IPMI_MEM_ADDR_SPACE; in ipmi_set_addr_data_and_space()
108 io->addr_data = r->start; in ipmi_set_addr_data_and_space()
113 struct si_sm_io *io) in ipmi_get_info_from_resources() argument
122 ipmi_set_addr_data_and_space(res, io); in ipmi_get_info_from_resources()
124 io->regspacing = DEFAULT_REGSPACING; in ipmi_get_info_from_resources()
127 if (res_second->start > io->addr_data) in ipmi_get_info_from_resources()
128 io->regspacing = res_second->start - io->addr_data; in ipmi_get_info_from_resources()
136 struct si_sm_io io; in platform_ipmi_probe() local
158 memset(&io, 0, sizeof(io)); in platform_ipmi_probe()
159 io.addr_source = addr_source; in platform_ipmi_probe()
167 io.si_type = type; in platform_ipmi_probe()
176 io.regsize = DEFAULT_REGSIZE; in platform_ipmi_probe()
179 io.regsize = regsize; in platform_ipmi_probe()
181 io.regshift = 0; in platform_ipmi_probe()
184 io.regshift = regshift; in platform_ipmi_probe()
186 if (!ipmi_get_info_from_resources(pdev, &io)) in platform_ipmi_probe()
191 io.slave_addr = 0x20; in platform_ipmi_probe()
193 io.slave_addr = slave_addr; in platform_ipmi_probe()
195 io.irq = platform_get_irq_optional(pdev, 0); in platform_ipmi_probe()
196 if (io.irq > 0) in platform_ipmi_probe()
197 io.irq_setup = ipmi_std_irq_setup; in platform_ipmi_probe()
199 io.irq = 0; in platform_ipmi_probe()
201 io.dev = &pdev->dev; in platform_ipmi_probe()
205 (io.addr_space == IPMI_IO_ADDR_SPACE) ? "io" : "mem", in platform_ipmi_probe()
206 io.addr_data, io.regsize, io.regspacing, io.irq); in platform_ipmi_probe()
208 ipmi_si_add_smi(&io); in platform_ipmi_probe()
228 struct si_sm_io io; in of_ipmi_probe() local
271 memset(&io, 0, sizeof(io)); in of_ipmi_probe()
272 io.si_type = (enum si_type) match->data; in of_ipmi_probe()
273 io.addr_source = SI_DEVICETREE; in of_ipmi_probe()
274 io.irq_setup = ipmi_std_irq_setup; in of_ipmi_probe()
276 ipmi_set_addr_data_and_space(&resource, &io); in of_ipmi_probe()
278 io.regsize = regsize ? be32_to_cpup(regsize) : DEFAULT_REGSIZE; in of_ipmi_probe()
279 io.regspacing = regspacing ? be32_to_cpup(regspacing) : DEFAULT_REGSPACING; in of_ipmi_probe()
280 io.regshift = regshift ? be32_to_cpup(regshift) : 0; in of_ipmi_probe()
282 io.irq = irq_of_parse_and_map(pdev->dev.of_node, 0); in of_ipmi_probe()
283 io.dev = &pdev->dev; in of_ipmi_probe()
286 io.addr_data, io.regsize, io.regspacing, io.irq); in of_ipmi_probe()
288 return ipmi_si_add_smi(&io); in of_ipmi_probe()
299 static int find_slave_address(struct si_sm_io *io, int slave_addr) in find_slave_address() argument
303 slave_addr = ipmi_dmi_get_slave_addr(io->si_type, in find_slave_address()
304 io->addr_space, in find_slave_address()
305 io->addr_data); in find_slave_address()
314 struct si_sm_io io; in acpi_ipmi_probe() local
327 memset(&io, 0, sizeof(io)); in acpi_ipmi_probe()
328 io.addr_source = SI_ACPI; in acpi_ipmi_probe()
331 io.addr_info.acpi_info.acpi_handle = handle; in acpi_ipmi_probe()
342 io.si_type = SI_KCS; in acpi_ipmi_probe()
345 io.si_type = SI_SMIC; in acpi_ipmi_probe()
348 io.si_type = SI_BT; in acpi_ipmi_probe()
357 io.dev = dev; in acpi_ipmi_probe()
358 io.regsize = DEFAULT_REGSIZE; in acpi_ipmi_probe()
359 io.regshift = 0; in acpi_ipmi_probe()
361 res = ipmi_get_info_from_resources(pdev, &io); in acpi_ipmi_probe()
368 io.irq = tmp; in acpi_ipmi_probe()
369 io.irq_setup = acpi_gpe_irq_setup; in acpi_ipmi_probe()
374 io.irq = irq; in acpi_ipmi_probe()
375 io.irq_setup = ipmi_std_irq_setup; in acpi_ipmi_probe()
379 io.slave_addr = find_slave_address(&io, io.slave_addr); in acpi_ipmi_probe()
382 res, io.regsize, io.regspacing, io.irq); in acpi_ipmi_probe()
386 return ipmi_si_add_smi(&io); in acpi_ipmi_probe()