Linux Audio

Check our new training course

Loading...
v3.1
 
  1/*
  2 * CompactPCI Hot Plug Core Functions
  3 *
  4 * Copyright (C) 2002 SOMA Networks, Inc.
  5 * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
  6 * Copyright (C) 2001 IBM Corp.
  7 *
  8 * All rights reserved.
  9 *
 10 * This program is free software; you can redistribute it and/or modify
 11 * it under the terms of the GNU General Public License as published by
 12 * the Free Software Foundation; either version 2 of the License, or (at
 13 * your option) any later version.
 14 *
 15 * This program is distributed in the hope that it will be useful, but
 16 * WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
 18 * NON INFRINGEMENT.  See the GNU General Public License for more
 19 * details.
 20 *
 21 * You should have received a copy of the GNU General Public License
 22 * along with this program; if not, write to the Free Software
 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 24 *
 25 * Send feedback to <scottm@somanetworks.com>
 26 */
 27
 28#ifndef _CPCI_HOTPLUG_H
 29#define _CPCI_HOTPLUG_H
 30
 31#include <linux/types.h>
 32#include <linux/pci.h>
 33#include <linux/pci_hotplug.h>
 34
 35/* PICMG 2.1 R2.0 HS CSR bits: */
 36#define HS_CSR_INS	0x0080
 37#define HS_CSR_EXT	0x0040
 38#define HS_CSR_PI	0x0030
 39#define HS_CSR_LOO	0x0008
 40#define HS_CSR_PIE	0x0004
 41#define HS_CSR_EIM	0x0002
 42#define HS_CSR_DHA	0x0001
 43
 44struct slot {
 45	u8 number;
 46	unsigned int devfn;
 47	struct pci_bus *bus;
 48	struct pci_dev *dev;
 
 
 49	unsigned int extracting;
 50	struct hotplug_slot *hotplug_slot;
 51	struct list_head slot_list;
 52};
 53
 54struct cpci_hp_controller_ops {
 55	int (*query_enum) (void);
 56	int (*enable_irq) (void);
 57	int (*disable_irq) (void);
 58	int (*check_irq) (void *dev_id);
 59	int (*hardware_test) (struct slot* slot, u32 value);
 60	u8  (*get_power) (struct slot* slot);
 61	int (*set_power) (struct slot* slot, int value);
 62};
 63
 64struct cpci_hp_controller {
 65	unsigned int irq;
 66	unsigned long irq_flags;
 67	char *devname;
 68	void *dev_id;
 69	char *name;
 70	struct cpci_hp_controller_ops *ops;
 71};
 72
 73static inline const char *slot_name(struct slot *slot)
 74{
 75	return hotplug_slot_name(slot->hotplug_slot);
 76}
 77
 78extern int cpci_hp_register_controller(struct cpci_hp_controller *controller);
 79extern int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
 80extern int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
 81extern int cpci_hp_unregister_bus(struct pci_bus *bus);
 82extern int cpci_hp_start(void);
 83extern int cpci_hp_stop(void);
 
 
 
 
 
 
 
 
 84
 85/*
 86 * Internal function prototypes, these functions should not be used by
 87 * board/chassis drivers.
 88 */
 89extern u8 cpci_get_attention_status(struct slot *slot);
 90extern u8 cpci_get_latch_status(struct slot *slot);
 91extern u8 cpci_get_adapter_status(struct slot *slot);
 92extern u16 cpci_get_hs_csr(struct slot * slot);
 93extern int cpci_set_attention_status(struct slot *slot, int status);
 94extern int cpci_check_and_clear_ins(struct slot * slot);
 95extern int cpci_check_ext(struct slot * slot);
 96extern int cpci_clear_ext(struct slot * slot);
 97extern int cpci_led_on(struct slot * slot);
 98extern int cpci_led_off(struct slot * slot);
 99extern int cpci_configure_slot(struct slot *slot);
100extern int cpci_unconfigure_slot(struct slot *slot);
 
 
 
 
 
 
101
102#endif	/* _CPCI_HOTPLUG_H */
v6.2
  1/* SPDX-License-Identifier: GPL-2.0+ */
  2/*
  3 * CompactPCI Hot Plug Core Functions
  4 *
  5 * Copyright (C) 2002 SOMA Networks, Inc.
  6 * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
  7 * Copyright (C) 2001 IBM Corp.
  8 *
  9 * All rights reserved.
 10 *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 11 * Send feedback to <scottm@somanetworks.com>
 12 */
 13
 14#ifndef _CPCI_HOTPLUG_H
 15#define _CPCI_HOTPLUG_H
 16
 17#include <linux/types.h>
 18#include <linux/pci.h>
 19#include <linux/pci_hotplug.h>
 20
 21/* PICMG 2.1 R2.0 HS CSR bits: */
 22#define HS_CSR_INS	0x0080
 23#define HS_CSR_EXT	0x0040
 24#define HS_CSR_PI	0x0030
 25#define HS_CSR_LOO	0x0008
 26#define HS_CSR_PIE	0x0004
 27#define HS_CSR_EIM	0x0002
 28#define HS_CSR_DHA	0x0001
 29
 30struct slot {
 31	u8 number;
 32	unsigned int devfn;
 33	struct pci_bus *bus;
 34	struct pci_dev *dev;
 35	unsigned int latch_status:1;
 36	unsigned int adapter_status:1;
 37	unsigned int extracting;
 38	struct hotplug_slot hotplug_slot;
 39	struct list_head slot_list;
 40};
 41
 42struct cpci_hp_controller_ops {
 43	int (*query_enum)(void);
 44	int (*enable_irq)(void);
 45	int (*disable_irq)(void);
 46	int (*check_irq)(void *dev_id);
 47	int (*hardware_test)(struct slot *slot, u32 value);
 48	u8  (*get_power)(struct slot *slot);
 49	int (*set_power)(struct slot *slot, int value);
 50};
 51
 52struct cpci_hp_controller {
 53	unsigned int irq;
 54	unsigned long irq_flags;
 55	char *devname;
 56	void *dev_id;
 57	char *name;
 58	struct cpci_hp_controller_ops *ops;
 59};
 60
 61static inline const char *slot_name(struct slot *slot)
 62{
 63	return hotplug_slot_name(&slot->hotplug_slot);
 64}
 65
 66static inline struct slot *to_slot(struct hotplug_slot *hotplug_slot)
 67{
 68	return container_of(hotplug_slot, struct slot, hotplug_slot);
 69}
 70
 71int cpci_hp_register_controller(struct cpci_hp_controller *controller);
 72int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
 73int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
 74int cpci_hp_unregister_bus(struct pci_bus *bus);
 75int cpci_hp_start(void);
 76int cpci_hp_stop(void);
 77
 78/* Global variables */
 79extern int cpci_debug;
 80
 81/*
 82 * Internal function prototypes, these functions should not be used by
 83 * board/chassis drivers.
 84 */
 85u8 cpci_get_attention_status(struct slot *slot);
 86u8 cpci_get_latch_status(struct slot *slot);
 87u8 cpci_get_adapter_status(struct slot *slot);
 88u16 cpci_get_hs_csr(struct slot *slot);
 89int cpci_set_attention_status(struct slot *slot, int status);
 90int cpci_check_and_clear_ins(struct slot *slot);
 91int cpci_check_ext(struct slot *slot);
 92int cpci_clear_ext(struct slot *slot);
 93int cpci_led_on(struct slot *slot);
 94int cpci_led_off(struct slot *slot);
 95int cpci_configure_slot(struct slot *slot);
 96int cpci_unconfigure_slot(struct slot *slot);
 97
 98#ifdef CONFIG_HOTPLUG_PCI_CPCI
 99int cpci_hotplug_init(int debug);
100#else
101static inline int cpci_hotplug_init(int debug) { return 0; }
102#endif
103
104#endif	/* _CPCI_HOTPLUG_H */