coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
superio.c File Reference
#include <device/device.h>
#include <device/pnp.h>
#include <superio/conf_mode.h>
#include <console/console.h>
#include <pc80/keyboard.h>
Include dependency graph for superio.c:

Go to the source code of this file.

Data Structures

struct  logical_devices
 A table describing the logical devices which are present on the supported Super I/O chips. More...
 

Macros

#define LPC47M172   0x14
 
#define FDC37B80X   0x42 /* Same ID: FDC37M70X (a.k.a. FDC37M707) */
 
#define FDC37B78X   0x44
 
#define FDC37B72X   0x4c
 
#define FDC37M81X   0x4d
 
#define FDC37M60X   0x47
 
#define LPC47B27X   0x51 /* a.k.a. LPC47B272 */
 
#define LPC47U33X   0x54
 
#define LPC47M10X   0x59 /* Same ID: LPC47M112, LPC47M13X */
 
#define LPC47M15X   0x60 /* Same ID: LPC47M192 */
 
#define LPC47S45X   0x62
 
#define LPC47B397   0x6f
 
#define A8000   0x77 /* ASUS A8000, a rebranded DME1737(?) */
 
#define DME1737   0x78
 
#define SCH5504   0x79
 
#define SCH3112   0x7c
 
#define SCH3114   0x7d
 
#define SCH5307   0x81 /* Rebranded LPC47B397(?) */
 
#define SCH5027D   0x89
 
#define SCH4304   0x90 /* SCH4304, SCH4307 */
 
#define SCH5147   0xc1
 
#define DEVICE_ID_REG   0x20 /* Device ID register */
 
#define DEVICE_REV_REG   0x21 /* Device revision register */
 
#define DEVICE_TEST7_REG   0x29 /* Device test 7 register */
 
#define MAX_LOGICAL_DEVICES   15
 

Enumerations

enum  {
  LD_FDC , LD_PP , LD_SP1 , LD_SP2 ,
  LD_RTC , LD_KBC , LD_AUX , LD_XBUS ,
  LD_HWM , LD_GAME , LD_PME , LD_MPU401 ,
  LD_RT , LD_ACPI , LD_SMB
}
 A list of all possible logical devices which may be supported by at least one of the Super I/O chips. More...
 

Functions

static void smsc_init (struct device *dev)
 Initialize those logical devices which need a special init. More...
 
static void enable_dev (struct device *dev)
 Enable the logical devices of the Super I/O chip. More...
 

Variables

static int first_time = 1
 
static u8 superio_id = 0
 
static u8 superio_rev = 0
 
static const struct logical_devices logical_device_table []
 
static struct device_operations ops
 Standard device operations. More...
 
static struct pnp_info pnp_dev_info []
 TODO. More...
 
struct chip_operations superio_smsc_smscsuperio_ops
 

Macro Definition Documentation

◆ A8000

#define A8000   0x77 /* ASUS A8000, a rebranded DME1737(?) */

Definition at line 38 of file superio.c.

◆ DEVICE_ID_REG

#define DEVICE_ID_REG   0x20 /* Device ID register */

Definition at line 49 of file superio.c.

◆ DEVICE_REV_REG

#define DEVICE_REV_REG   0x21 /* Device revision register */

Definition at line 50 of file superio.c.

◆ DEVICE_TEST7_REG

#define DEVICE_TEST7_REG   0x29 /* Device test 7 register */

Definition at line 51 of file superio.c.

◆ DME1737

#define DME1737   0x78

Definition at line 39 of file superio.c.

◆ FDC37B72X

#define FDC37B72X   0x4c

Definition at line 29 of file superio.c.

◆ FDC37B78X

#define FDC37B78X   0x44

Definition at line 28 of file superio.c.

◆ FDC37B80X

#define FDC37B80X   0x42 /* Same ID: FDC37M70X (a.k.a. FDC37M707) */

Definition at line 27 of file superio.c.

◆ FDC37M60X

#define FDC37M60X   0x47

Definition at line 31 of file superio.c.

◆ FDC37M81X

#define FDC37M81X   0x4d

Definition at line 30 of file superio.c.

◆ LPC47B27X

#define LPC47B27X   0x51 /* a.k.a. LPC47B272 */

Definition at line 32 of file superio.c.

◆ LPC47B397

#define LPC47B397   0x6f

Definition at line 37 of file superio.c.

◆ LPC47M10X

#define LPC47M10X   0x59 /* Same ID: LPC47M112, LPC47M13X */

Definition at line 34 of file superio.c.

◆ LPC47M15X

#define LPC47M15X   0x60 /* Same ID: LPC47M192 */

Definition at line 35 of file superio.c.

◆ LPC47M172

#define LPC47M172   0x14

Definition at line 26 of file superio.c.

◆ LPC47S45X

#define LPC47S45X   0x62

Definition at line 36 of file superio.c.

◆ LPC47U33X

#define LPC47U33X   0x54

Definition at line 33 of file superio.c.

◆ MAX_LOGICAL_DEVICES

#define MAX_LOGICAL_DEVICES   15

Definition at line 85 of file superio.c.

◆ SCH3112

#define SCH3112   0x7c

Definition at line 41 of file superio.c.

◆ SCH3114

#define SCH3114   0x7d

Definition at line 42 of file superio.c.

◆ SCH4304

#define SCH4304   0x90 /* SCH4304, SCH4307 */

Definition at line 45 of file superio.c.

◆ SCH5027D

#define SCH5027D   0x89

Definition at line 44 of file superio.c.

◆ SCH5147

#define SCH5147   0xc1

Definition at line 46 of file superio.c.

◆ SCH5307

#define SCH5307   0x81 /* Rebranded LPC47B397(?) */

Definition at line 43 of file superio.c.

◆ SCH5504

#define SCH5504   0x79

Definition at line 40 of file superio.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

A list of all possible logical devices which may be supported by at least one of the Super I/O chips.

These values are used as index into the logical_device_table[i].devs array(s).

If you change this enum, you must also adapt the logical_device_table[] array and MAX_LOGICAL_DEVICES!

Enumerator
LD_FDC 
LD_PP 
LD_SP1 
LD_SP2 
LD_RTC 
LD_KBC 
LD_AUX 
LD_XBUS 
LD_HWM 
LD_GAME 
LD_PME 
LD_MPU401 
LD_RT 
LD_ACPI 
LD_SMB 

Definition at line 66 of file superio.c.

Function Documentation

◆ enable_dev()

static void enable_dev ( struct device dev)
static

Enable the logical devices of the Super I/O chip.

TODO: Think about how to handle the case when a mainboard has multiple Super I/O chips soldered on. TODO: Can this code be simplified a bit?

Parameters
devThe device to use.

Definition at line 212 of file superio.c.

References ARRAY_SIZE, BIOS_INFO, DEVICE_ID_REG, DEVICE_REV_REG, DEVICE_TEST7_REG, logical_devices::devs, first_time, pnp_info::function, logical_device_table, LPC47M172, MAX_LOGICAL_DEVICES, ops, pnp_dev_info, pnp_enable_devices(), pnp_enter_conf_mode_55(), pnp_exit_conf_mode_aa(), pnp_read_config(), PNP_SKIP_FUNCTION, pnp_write_config(), printk, superio_id, and superio_rev.

Here is the call graph for this function:

◆ smsc_init()

static void smsc_init ( struct device dev)
static

Initialize those logical devices which need a special init.

Parameters
devThe device to use.

Definition at line 134 of file superio.c.

Variable Documentation

◆ first_time

int first_time = 1
static

Definition at line 54 of file superio.c.

Referenced by enable_dev().

◆ logical_device_table

const struct logical_devices logical_device_table[]
static
Initial value:
= {
{LPC47M172,{0, 3, 4, 2, -1, 7, -1, -1, -1, -1, -1, -1, 10, -1, -1}},
{FDC37B80X,{0, 3, 4, 5, -1, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1}},
{FDC37B78X,{0, 3, 4, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, 10, -1}},
{FDC37B72X,{0, 3, 4, 5, -1, 7, 8, -1, -1, -1, -1, -1, -1, 10, -1}},
{FDC37M81X,{0, 3, 4, 5, -1, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1}},
{FDC37M60X,{0, 3, 4, 5, -1, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1}},
{LPC47B27X,{0, 3, 4, 5, -1, 7, -1, -1, -1, 9, -1, 11, 10, -1, -1}},
{LPC47M10X,{0, 3, 4, 5, -1, 7, -1, -1, -1, 9, 10, 11, -1, -1, -1}},
{LPC47M15X,{0, 3, 4, 5, -1, 7, -1, -1, -1, 9, 10, 11, -1, -1, -1}},
{LPC47S45X,{0, 3, 4, 5, 6, 7, -1, 8, -1, -1, -1, -1, 10, -1, 11}},
{LPC47B397,{0, 3, 4, 5, -1, 7, -1, -1, 8, -1, -1, -1, 10, -1, -1}},
{LPC47U33X,{0, 3, 4, -1, -1, 7, -1, -1, -1, 9, 0, 5, 10, 0, 11}},
{A8000, {0, 3, 4, 5, -1, 7, -1, -1, -1, -1, -1, -1, 10, -1, -1}},
{DME1737, {0, 3, 4, 5, -1, 7, -1, -1, -1, -1, -1, -1, 10, -1, -1}},
{SCH5504, {0, 3, 4, 5, -1, 7, -1, -1, -1, -1, -1, -1, 10, -1, -1}},
{SCH3112, {0, 3, 4, 5, -1, 7, -1, -1, -1, -1, -1, -1, 10, -1, -1}},
{SCH3114, {0, 3, 4, 5, -1, 7, -1, -1, -1, -1, -1, -1, 10, -1, -1}},
{SCH5307, {0, 3, 4, 5, -1, 7, -1, -1, 8, -1, -1, -1, 10, -1, -1}},
{SCH5027D, {0, 3, 4, 5, -1, 7, -1, -1, -1, -1, -1, -1, 10, -1, 11}},
{SCH4304, {0, 3, 4, 5, -1, 7, -1, 11, -1, -1, -1, -1, 10, -1, -1}},
{SCH5147, {0, 3, 4, 5, -1, 7, -1, -1, -1, -1, -1, -1, 10, -1, -1}},
}
#define DME1737
Definition: superio.c:39
#define FDC37M81X
Definition: superio.c:30
#define SCH5147
Definition: superio.c:46
#define SCH5027D
Definition: superio.c:44
#define FDC37M60X
Definition: superio.c:31
#define SCH5504
Definition: superio.c:40
#define LPC47B397
Definition: superio.c:37
#define LPC47M15X
Definition: superio.c:35
#define SCH3112
Definition: superio.c:41
#define FDC37B80X
Definition: superio.c:27
#define SCH4304
Definition: superio.c:45
#define A8000
Definition: superio.c:38
#define SCH5307
Definition: superio.c:43
#define FDC37B72X
Definition: superio.c:29
#define LPC47S45X
Definition: superio.c:36
#define FDC37B78X
Definition: superio.c:28
#define SCH3114
Definition: superio.c:42
#define LPC47M10X
Definition: superio.c:34
#define LPC47M172
Definition: superio.c:26
#define LPC47B27X
Definition: superio.c:32
#define LPC47U33X
Definition: superio.c:33

Referenced by enable_dev().

◆ ops

struct device_operations ops
static
Initial value:
= {
.read_resources = pnp_read_resources,
.set_resources = pnp_set_resources,
.enable_resources = pnp_enable_resources,
.enable = pnp_alt_enable,
.init = smsc_init,
.ops_pnp_mode = &pnp_conf_mode_55_aa,
}
const struct pnp_mode_ops pnp_conf_mode_55_aa
Definition: conf_mode.c:175
void pnp_read_resources(struct device *dev)
Definition: pnp_device.c:114
void pnp_set_resources(struct device *dev)
Definition: pnp_device.c:157
void pnp_alt_enable(struct device *dev)
Definition: pnp_device.c:191
void pnp_enable_resources(struct device *dev)
Definition: pnp_device.c:173
static void smsc_init(struct device *dev)
Initialize those logical devices which need a special init.
Definition: superio.c:134

Standard device operations.

Definition at line 134 of file superio.c.

Referenced by enable_dev().

◆ pnp_dev_info

struct pnp_info pnp_dev_info[]
static
Initial value:
= {
{ NULL, LD_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
{ NULL, LD_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
{ NULL, LD_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
{ NULL, LD_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, },
{ NULL, LD_RTC, },
0x07ff, 0x07ff, },
{ NULL, LD_AUX, },
{ NULL, LD_XBUS, },
{ NULL, LD_HWM, PNP_IO0, 0x07f0, },
{ NULL, LD_GAME, },
{ NULL, LD_PME, },
{ NULL, LD_MPU401, },
{ NULL, LD_RT, PNP_IO0, 0x0780, },
{ NULL, LD_ACPI, },
{ NULL, LD_SMB, },
}
#define PNP_IRQ1
Definition: pnp.h:48
#define PNP_DRQ0
Definition: pnp.h:49
#define PNP_IO1
Definition: pnp.h:43
#define PNP_IO0
Definition: pnp.h:42
#define PNP_IRQ0
Definition: pnp.h:47
@ LD_PME
Definition: superio.c:77
@ LD_GAME
Definition: superio.c:76
@ LD_ACPI
Definition: superio.c:80
@ LD_SP1
Definition: superio.c:69
@ LD_PP
Definition: superio.c:68
@ LD_KBC
Definition: superio.c:72
@ LD_MPU401
Definition: superio.c:78
@ LD_XBUS
Definition: superio.c:74
@ LD_AUX
Definition: superio.c:73
@ LD_SMB
Definition: superio.c:81
@ LD_RT
Definition: superio.c:79
@ LD_RTC
Definition: superio.c:71
@ LD_SP2
Definition: superio.c:70
@ LD_HWM
Definition: superio.c:75
@ LD_FDC
Definition: superio.c:67
#define NULL
Definition: stddef.h:19

TODO.

This table should contain all possible entries for any of the supported Super I/O chips, even if some of them don't have the respective logical devices. That will be handled correctly by our code.

The LD_FOO entries are device markers which tell you the type of the logical device (e.g. whether it's a floppy disk controller or a serial port etc.).

Before using pnp_dev_info[] in pnp_enable_devices() these markers have to be replaced with the real logical device IDs of the respective Super I/O chip. This is done in enable_dev().

TODO: FDC, PP, SP1, SP2, and KBC should work, the rest probably not (yet).

Definition at line 134 of file superio.c.

Referenced by enable_dev().

◆ superio_id

u8 superio_id = 0
static

Definition at line 55 of file superio.c.

Referenced by enable_dev().

◆ superio_rev

u8 superio_rev = 0
static

Definition at line 56 of file superio.c.

Referenced by enable_dev().

◆ superio_smsc_smscsuperio_ops

struct chip_operations superio_smsc_smscsuperio_ops
Initial value:
= {
.enable_dev = enable_dev
}
static void enable_dev(struct device *dev)
Enable the logical devices of the Super I/O chip.
Definition: superio.c:212

Definition at line 212 of file superio.c.