linux/drivers/i2c/busses/i2c-piix4.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
    Copyright (c) 1998 - 2002 Frodo Looijaard <[email protected]> and
    Philip Edelbrock <[email protected]>

*/

/*
   Supports:
	Intel PIIX4, 440MX
	Serverworks OSB4, CSB5, CSB6, HT-1000, HT-1100
	ATI IXP200, IXP300, IXP400, SB600, SB700/SP5100, SB800
	AMD Hudson-2, ML, CZ
	Hygon CZ
	SMSC Victory66

   Note: we assume there can only be one device, with one or more
   SMBus interfaces.
   The device can register multiple i2c_adapters (up to PIIX4_MAX_ADAPTERS).
   For devices supporting multiple ports the i2c_adapter should provide
   an i2c_algorithm to access them.
*/

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/stddef.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include <linux/i2c-smbus.h>
#include <linux/slab.h>
#include <linux/dmi.h>
#include <linux/acpi.h>
#include <linux/io.h>


/* PIIX4 SMBus address offsets */
#define SMBHSTSTS
#define SMBHSLVSTS
#define SMBHSTCNT
#define SMBHSTCMD
#define SMBHSTADD
#define SMBHSTDAT0
#define SMBHSTDAT1
#define SMBBLKDAT
#define SMBSLVCNT
#define SMBSHDWCMD
#define SMBSLVEVT
#define SMBSLVDAT

/* count for request_region */
#define SMBIOSIZE

/* PCI Address Constants */
#define SMBBA
#define SMBHSTCFG
#define SMBSLVC
#define SMBSHDW1
#define SMBSHDW2
#define SMBREV

/* Other settings */
#define MAX_TIMEOUT
#define ENABLE_INT9

/* PIIX4 constants */
#define PIIX4_QUICK
#define PIIX4_BYTE
#define PIIX4_BYTE_DATA
#define PIIX4_WORD_DATA
#define PIIX4_BLOCK_DATA

/* Multi-port constants */
#define PIIX4_MAX_ADAPTERS
#define HUDSON2_MAIN_PORTS

/* SB800 constants */
#define SB800_PIIX4_SMB_IDX
#define SB800_PIIX4_SMB_MAP_SIZE

#define KERNCZ_IMC_IDX
#define KERNCZ_IMC_DATA

/*
 * SB800 port is selected by bits 2:1 of the smb_en register (0x2c)
 * or the smb_sel register (0x2e), depending on bit 0 of register 0x2f.
 * Hudson-2/Bolton port is always selected by bits 2:1 of register 0x2f.
 */
#define SB800_PIIX4_PORT_IDX
#define SB800_PIIX4_PORT_IDX_ALT
#define SB800_PIIX4_PORT_IDX_SEL
#define SB800_PIIX4_PORT_IDX_MASK
#define SB800_PIIX4_PORT_IDX_SHIFT

/* On kerncz and Hudson2, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */
#define SB800_PIIX4_PORT_IDX_KERNCZ
#define SB800_PIIX4_PORT_IDX_MASK_KERNCZ
#define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ

#define SB800_PIIX4_FCH_PM_ADDR
#define SB800_PIIX4_FCH_PM_SIZE

/* insmod parameters */

/* If force is set to anything different from 0, we forcibly enable the
   PIIX4. DANGEROUS! */
static int force;
module_param (force, int, 0);
MODULE_PARM_DESC();

/* If force_addr is set to anything different from 0, we forcibly enable
   the PIIX4 at the given address. VERY DANGEROUS! */
static int force_addr;
module_param_hw(force_addr, int, ioport, 0);
MODULE_PARM_DESC();

static int srvrworks_csb5_delay;
static struct pci_driver piix4_driver;

static const struct dmi_system_id piix4_dmi_blacklist[] =;

/* The IBM entry is in a separate table because we only check it
   on Intel-based systems */
static const struct dmi_system_id piix4_dmi_ibm[] =;

/*
 * SB800 globals
 */
static u8 piix4_port_sel_sb800;
static u8 piix4_port_mask_sb800;
static u8 piix4_port_shift_sb800;
static const char *piix4_main_port_names_sb800[PIIX4_MAX_ADAPTERS] =;
static const char *piix4_aux_port_name_sb800 =;

struct sb800_mmio_cfg {};

struct i2c_piix4_adapdata {};

static int piix4_sb800_region_request(struct device *dev,
				      struct sb800_mmio_cfg *mmio_cfg)
{}

static void piix4_sb800_region_release(struct device *dev,
				       struct sb800_mmio_cfg *mmio_cfg)
{}

static bool piix4_sb800_use_mmio(struct pci_dev *PIIX4_dev)
{}

static int piix4_setup(struct pci_dev *PIIX4_dev,
		       const struct pci_device_id *id)
{}

static int piix4_setup_sb800_smba(struct pci_dev *PIIX4_dev,
				  u8 smb_en,
				  u8 aux,
				  u8 *smb_en_status,
				  unsigned short *piix4_smba)
{}

static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
			     const struct pci_device_id *id, u8 aux)
{}

static int piix4_setup_aux(struct pci_dev *PIIX4_dev,
			   const struct pci_device_id *id,
			   unsigned short base_reg_addr)
{}

static int piix4_transaction(struct i2c_adapter *piix4_adapter)
{}

/* Return negative errno on error. */
static s32 piix4_access(struct i2c_adapter * adap, u16 addr,
		 unsigned short flags, char read_write,
		 u8 command, int size, union i2c_smbus_data * data)
{}

static uint8_t piix4_imc_read(uint8_t idx)
{}

static void piix4_imc_write(uint8_t idx, uint8_t value)
{}

static int piix4_imc_sleep(void)
{}

static void piix4_imc_wakeup(void)
{}

static int piix4_sb800_port_sel(u8 port, struct sb800_mmio_cfg *mmio_cfg)
{}

/*
 * Handles access to multiple SMBus ports on the SB800.
 * The port is selected by bits 2:1 of the smb_en register (0x2c).
 * Returns negative errno on error.
 *
 * Note: The selected port must be returned to the initial selection to avoid
 * problems on certain systems.
 */
static s32 piix4_access_sb800(struct i2c_adapter *adap, u16 addr,
		 unsigned short flags, char read_write,
		 u8 command, int size, union i2c_smbus_data *data)
{}

static u32 piix4_func(struct i2c_adapter *adapter)
{}

static const struct i2c_algorithm smbus_algorithm =;

static const struct i2c_algorithm piix4_smbus_algorithm_sb800 =;

static const struct pci_device_id piix4_ids[] =;

MODULE_DEVICE_TABLE (pci, piix4_ids);

static struct i2c_adapter *piix4_main_adapters[PIIX4_MAX_ADAPTERS];
static struct i2c_adapter *piix4_aux_adapter;
static int piix4_adapter_count;

static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba,
			     bool sb800_main, u8 port, bool notify_imc,
			     u8 hw_port_nr, const char *name,
			     struct i2c_adapter **padap)
{}

static int piix4_add_adapters_sb800(struct pci_dev *dev, unsigned short smba,
				    bool notify_imc)
{}

static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
{}

static void piix4_adap_remove(struct i2c_adapter *adap)
{}

static void piix4_remove(struct pci_dev *dev)
{}

static struct pci_driver piix4_driver =;

module_pci_driver();

MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();