linux/drivers/pci/hotplug/shpchp.h

/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Standard Hot Plug Controller Driver
 *
 * Copyright (C) 1995,2001 Compaq Computer Corporation
 * Copyright (C) 2001 Greg Kroah-Hartman ([email protected])
 * Copyright (C) 2001 IBM
 * Copyright (C) 2003-2004 Intel Corporation
 *
 * All rights reserved.
 *
 * Send feedback to <[email protected]>,<[email protected]>
 *
 */
#ifndef _SHPCHP_H
#define _SHPCHP_H

#include <linux/types.h>
#include <linux/pci.h>
#include <linux/pci_hotplug.h>
#include <linux/delay.h>
#include <linux/sched/signal.h>	/* signal_pending(), struct timer_list */
#include <linux/mutex.h>
#include <linux/workqueue.h>

#if !defined(MODULE)
	#define MY_NAME
#else
	#define MY_NAME
#endif

extern bool shpchp_poll_mode;
extern int shpchp_poll_time;
extern bool shpchp_debug;

#define dbg(format, arg...)
#define err(format, arg...)
#define info(format, arg...)
#define warn(format, arg...)

#define ctrl_dbg(ctrl, format, arg...)
#define ctrl_err(ctrl, format, arg...)
#define ctrl_info(ctrl, format, arg...)
#define ctrl_warn(ctrl, format, arg...)


#define SLOT_NAME_SIZE
struct slot {};

struct event_info {};

struct controller {};

/* Define AMD SHPC ID  */
#define PCI_DEVICE_ID_AMD_POGO_7458

/* AMD PCI-X bridge registers */
#define PCIX_MEM_BASE_LIMIT_OFFSET
#define PCIX_MISCII_OFFSET
#define PCIX_MISC_BRIDGE_ERRORS_OFFSET

/* AMD PCIX_MISCII masks and offsets */
#define PERRNONFATALENABLE_MASK
#define PERRFATALENABLE_MASK
#define PERRFLOODENABLE_MASK
#define SERRNONFATALENABLE_MASK
#define SERRFATALENABLE_MASK

/* AMD PCIX_MISC_BRIDGE_ERRORS masks and offsets */
#define PERR_OBSERVED_MASK

/* AMD PCIX_MEM_BASE_LIMIT masks */
#define RSE_MASK

#define INT_BUTTON_IGNORE
#define INT_PRESENCE_ON
#define INT_PRESENCE_OFF
#define INT_SWITCH_CLOSE
#define INT_SWITCH_OPEN
#define INT_POWER_FAULT
#define INT_POWER_FAULT_CLEAR
#define INT_BUTTON_PRESS
#define INT_BUTTON_RELEASE
#define INT_BUTTON_CANCEL

#define STATIC_STATE
#define BLINKINGON_STATE
#define BLINKINGOFF_STATE
#define POWERON_STATE
#define POWEROFF_STATE

/* Error messages */
#define INTERLOCK_OPEN
#define ADD_NOT_SUPPORTED
#define CARD_FUNCTIONING
#define ADAPTER_NOT_SAME
#define NO_ADAPTER_PRESENT
#define NOT_ENOUGH_RESOURCES
#define DEVICE_TYPE_NOT_SUPPORTED
#define WRONG_BUS_FREQUENCY
#define POWER_FAILURE

int __must_check shpchp_create_ctrl_files(struct controller *ctrl);
void shpchp_remove_ctrl_files(struct controller *ctrl);
int shpchp_sysfs_enable_slot(struct slot *slot);
int shpchp_sysfs_disable_slot(struct slot *slot);
u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl);
u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl);
u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl);
u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl);
int shpchp_configure_device(struct slot *p_slot);
void shpchp_unconfigure_device(struct slot *p_slot);
void cleanup_slots(struct controller *ctrl);
void shpchp_queue_pushbutton_work(struct work_struct *work);
int shpc_init(struct controller *ctrl, struct pci_dev *pdev);

static inline const char *slot_name(struct slot *slot)
{}

struct ctrl_reg {} __attribute__ ((packed));

/* offsets to the controller registers based on the above structure layout */
enum ctrl_offsets {};

static inline struct slot *get_slot(struct hotplug_slot *hotplug_slot)
{}

static inline struct slot *shpchp_find_slot(struct controller *ctrl, u8 device)
{}

static inline void amd_pogo_errata_save_misc_reg(struct slot *p_slot)
{}

static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot)
{}

int shpchp_power_on_slot(struct slot *slot);
int shpchp_slot_enable(struct slot *slot);
int shpchp_slot_disable(struct slot *slot);
int shpchp_set_bus_speed_mode(struct slot *slot, enum pci_bus_speed speed);
int shpchp_get_power_status(struct slot *slot, u8 *status);
int shpchp_get_attention_status(struct slot *slot, u8 *status);
int shpchp_set_attention_status(struct slot *slot, u8 status);
int shpchp_get_latch_status(struct slot *slot, u8 *status);
int shpchp_get_adapter_status(struct slot *slot, u8 *status);
int shpchp_get_adapter_speed(struct slot *slot, enum pci_bus_speed *speed);
int shpchp_get_prog_int(struct slot *slot, u8 *prog_int);
int shpchp_query_power_fault(struct slot *slot);
void shpchp_green_led_on(struct slot *slot);
void shpchp_green_led_off(struct slot *slot);
void shpchp_green_led_blink(struct slot *slot);
void shpchp_release_ctlr(struct controller *ctrl);
int shpchp_check_cmd_status(struct controller *ctrl);

#endif				/* _SHPCHP_H */