coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
i210.c File Reference
#include "i210.h"
#include <device/device.h>
#include <console/console.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <device/pci_def.h>
#include <string.h>
#include <types.h>
#include <delay.h>
Include dependency graph for i210.c:

Go to the source code of this file.

Functions

static int wait_done (uint32_t *reg, uint32_t mask)
 
static uint32_t read_flash (struct device *dev, uint32_t address, uint32_t count, uint16_t *buffer)
 This function can read the configuration space of the MACPHY For this purpose, the EEPROM interface is used. More...
 
static uint32_t compute_checksum (struct device *dev, uint16_t *checksum)
 This function computes the checksum for the configuration space. More...
 
static uint32_t write_flash (struct device *dev, uint32_t address, uint32_t count, uint16_t *buffer)
 This function can write the configuration space of the MACPHY For this purpose, the EEPROM interface is used. More...
 
static uint32_t read_mac_adr (struct device *dev, uint8_t *mac_adr)
 This function can read the MAC address out of the MACPHY. More...
 
static uint32_t write_mac_adr (struct device *dev, uint8_t *mac_adr)
 This function can write the MAC address to the MACPHY. More...
 
static void init (struct device *dev)
 This function is the driver entry point for the init phase of the PCI bus allocator. More...
 
static void enable_bus_master (struct device *dev)
 

Variables

static struct device_operations i210_ops
 
static const unsigned short i210_device_ids [] = { 0x1537, 0x1538, 0x1533, 0 }
 
static const struct pci_driver i210_driver __pci_driver
 

Function Documentation

◆ compute_checksum()

static uint32_t compute_checksum ( struct device dev,
uint16_t checksum 
)
static

This function computes the checksum for the configuration space.

The address range for the checksum is 0x00..0x3e.

Parameters
*devPointer to the PCI device of this MACPHY
*checksumPointer to the buffer where to store the checksum
Returns
void I210_NO_ERROR or an error code

Definition at line 72 of file i210.c.

References checksum(), I210_READ_ERROR, I210_SUCCESS, I210_TARGET_CHECKSUM, and read_flash().

Referenced by write_flash().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enable_bus_master()

static void enable_bus_master ( struct device dev)
static

Definition at line 209 of file i210.c.

References CONFIG, PCI_COMMAND, PCI_COMMAND_MASTER, and pci_or_config16().

Here is the call graph for this function:

◆ init()

static void init ( struct device dev)
static

This function is the driver entry point for the init phase of the PCI bus allocator.

It will program a MAC address into the MACPHY.

Parameters
*devPointer to the used PCI device
Returns
void Nothing is given back

Definition at line 181 of file i210.c.

References BIOS_ERR, BIOS_INFO, BIOS_NOTICE, CB_SUCCESS, mainboard_get_mac_address(), memcmp(), printk, read_mac_adr(), and write_mac_adr().

Referenced by dapc_init(), and mipi_panel_parse_init_commands().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_flash()

static uint32_t read_flash ( struct device dev,
uint32_t  address,
uint32_t  count,
uint16_t buffer 
)
static

This function can read the configuration space of the MACPHY For this purpose, the EEPROM interface is used.

No direct access to the flash memory will be done.

Parameters
*devPointer to the PCI device of this MACPHY
addressAddress inside the flash where reading will start
countNumber of words (16 bit values) to read
*bufferPointer to the buffer where to store read data
Returns
void I210_NO_ERROR or an error code

Definition at line 37 of file i210.c.

References address, buffer, count, I210_DONE, I210_INVALID_PARAM, I210_NOT_READY, I210_READ_ERROR, I210_REG_EEREAD, I210_SUCCESS, PCI_BASE_ADDRESS_0, pci_read_config32(), and wait_done().

Referenced by compute_checksum(), and read_mac_adr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_mac_adr()

static uint32_t read_mac_adr ( struct device dev,
uint8_t mac_adr 
)
static

This function can read the MAC address out of the MACPHY.

Parameters
*devPointer to the PCI device of this MACPHY
*MACAdrPointer to the buffer where to store read MAC address
Returns
void I210_NO_ERROR or an error code

Definition at line 147 of file i210.c.

References I210_INVALID_PARAM, I210_READ_ERROR, I210_SUCCESS, memcpy(), and read_flash().

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wait_done()

static int wait_done ( uint32_t reg,
uint32_t  mask 
)
static

Definition at line 16 of file i210.c.

References I210_NOT_READY, I210_POLL_TIMEOUT_US, I210_SUCCESS, mask, and udelay().

Referenced by read_flash(), and write_flash().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_flash()

static uint32_t write_flash ( struct device dev,
uint32_t  address,
uint32_t  count,
uint16_t buffer 
)
static

This function can write the configuration space of the MACPHY For this purpose, the EEPROM interface is used.

No direct access to the flash memory will be done. This function will update the checksum after a value was changed.

Parameters
*devPointer to the PCI device of this MACPHY
addressAddress inside the flash where writing will start
countNumber of words (16 bit values) to write
*bufferPointer to the buffer where data to write is stored in
Returns
void I210_NO_ERROR or an error code

Definition at line 99 of file i210.c.

References address, buffer, checksum(), compute_checksum(), count, I210_CHECKSUM_ERROR, I210_DONE, I210_FLASH_UPDATE_ERROR, I210_FLUDONE, I210_FLUPD, I210_INVALID_PARAM, I210_NOT_READY, I210_REG_EECTRL, I210_REG_EEWRITE, I210_SUCCESS, I210_WRITE_ERROR, pci_read_config32(), and wait_done().

Referenced by write_mac_adr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_mac_adr()

static uint32_t write_mac_adr ( struct device dev,
uint8_t mac_adr 
)
static

This function can write the MAC address to the MACPHY.

Parameters
*devPointer to the PCI device of this MACPHY
*MACAdrPointer to the buffer where the desired MAC address is
Returns
void I210_NO_ERROR or an error code

Definition at line 165 of file i210.c.

References I210_INVALID_PARAM, memcpy(), and write_flash().

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ __pci_driver

const struct pci_driver i210_driver __pci_driver
static
Initial value:
= {
.ops = &i210_ops,
.vendor = PCI_VID_INTEL,
.devices = i210_device_ids,
}
static const unsigned short i210_device_ids[]
Definition: i210.c:223
static struct device_operations i210_ops
Definition: i210.c:215
#define PCI_VID_INTEL
Definition: pci_ids.h:2157

Definition at line 223 of file i210.c.

◆ i210_device_ids

const unsigned short i210_device_ids[] = { 0x1537, 0x1538, 0x1533, 0 }
static

Definition at line 223 of file i210.c.

◆ i210_ops

struct device_operations i210_ops
static
Initial value:
= {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = init,
}
static void enable_bus_master(struct device *dev)
Definition: i210.c:209
static void init(struct device *dev)
This function is the driver entry point for the init phase of the PCI bus allocator.
Definition: i210.c:181
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691

Definition at line 209 of file i210.c.