coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
superio.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <device/device.h>
4 #include <device/pnp.h>
5 #include <pc80/keyboard.h>
7 #include <superio/conf_mode.h>
8 
9 #include "it8718f.h"
10 #include "chip.h"
11 
12 static void init(struct device *dev)
13 {
14  const struct superio_ite_it8718f_config *conf;
15  const struct resource *res;
16 
17  if (!dev->enabled)
18  return;
19 
20  switch (dev->path.pnp.device) {
21  case IT8718F_FDC: /* TODO. */
22  break;
23  case IT8718F_PP: /* TODO. */
24  break;
25  case IT8718F_EC:
26  conf = dev->chip_info;
27  res = probe_resource(dev, PNP_IDX_IO0);
28  if (!conf || !res)
29  break;
30  ite_ec_init(res->base, &conf->ec);
31  break;
32  case IT8718F_KBCK:
34  break;
35  case IT8718F_KBCM: /* TODO. */
36  break;
37  case IT8718F_IR: /* TODO. */
38  break;
39  }
40 }
41 
42 static struct device_operations ops = {
44  .set_resources = pnp_set_resources,
45  .enable_resources = pnp_enable_resources,
46  .enable = pnp_enable,
47  .init = init,
48  .ops_pnp_mode = &pnp_conf_mode_870155_aa,
49 };
50 
51 /* TODO: IR. */
52 static struct pnp_info pnp_dev_info[] = {
54  | PNP_MSC0 | PNP_MSC1, 0x0ff8, },
55  { NULL, IT8718F_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
56  { NULL, IT8718F_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, },
60  0x0ff8, 0x0ff8, },
62  | PNP_MSC0, 0x07f8, 0x07f8, },
65  | PNP_DRQ0 | PNP_MSC0, 0x0ff8, 0x0ff8, },
66 };
67 
68 static void enable_dev(struct device *dev)
69 {
71 }
72 
74  CHIP_NAME("ITE IT8718F Super I/O")
75  .enable_dev = enable_dev,
76 };
#define ARRAY_SIZE(a)
Definition: helpers.h:12
const struct pnp_mode_ops pnp_conf_mode_870155_aa
Definition: conf_mode.c:229
struct resource * probe_resource(const struct device *dev, unsigned int index)
See if a resource structure already exists for a given index.
Definition: device_util.c:323
void ite_ec_init(const u16 base, const struct ite_ec_config *const conf)
Definition: env_ctrl.c:274
#define CHIP_NAME(X)
Definition: device.h:32
#define IT8718F_EC
Definition: it8718f.h:14
#define IT8718F_SP1
Definition: it8718f.h:11
#define IT8718F_PP
Definition: it8718f.h:13
#define IT8718F_SP2
Definition: it8718f.h:12
#define IT8718F_KBCM
Definition: it8718f.h:16
#define IT8718F_FDC
Definition: it8718f.h:10
#define IT8718F_KBCK
Definition: it8718f.h:15
#define IT8718F_IR
Definition: it8718f.h:18
struct chip_operations superio_ite_it8718f_ops
Definition: superio.c:73
static void enable_dev(struct device *dev)
Definition: superio.c:68
static struct device_operations ops
Definition: superio.c:42
static struct pnp_info pnp_dev_info[]
Definition: superio.c:52
static void init(struct device *dev)
Definition: superio.c:12
uint8_t pc_keyboard_init(uint8_t probe_aux)
Definition: keyboard.c:229
#define NO_AUX_DEVICE
Definition: keyboard.h:6
#define PNP_MSC1
Definition: pnp.h:53
#define PNP_MSC3
Definition: pnp.h:55
#define PNP_MSC6
Definition: pnp.h:58
#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
#define PNP_MSC0
Definition: pnp.h:52
#define PNP_MSC2
Definition: pnp.h:54
#define PNP_MSC4
Definition: pnp.h:56
#define PNP_MSC5
Definition: pnp.h:57
#define PNP_IDX_IO0
Definition: pnp_def.h:5
void pnp_enable(struct device *dev)
Definition: pnp_device.c:181
void pnp_read_resources(struct device *dev)
Definition: pnp_device.c:114
void pnp_enable_devices(struct device *base_dev, struct device_operations *ops, unsigned int functions, struct pnp_info *info)
Definition: pnp_device.c:371
void pnp_set_resources(struct device *dev)
Definition: pnp_device.c:157
void pnp_enable_resources(struct device *dev)
Definition: pnp_device.c:173
#define NULL
Definition: stddef.h:19
void(* read_resources)(struct device *dev)
Definition: device.h:39
struct pnp_path pnp
Definition: path.h:117
Definition: device.h:107
struct device_path path
Definition: device.h:115
DEVTREE_CONST void * chip_info
Definition: device.h:164
unsigned int enabled
Definition: device.h:122
Definition: pnp.h:37
unsigned int device
Definition: path.h:59
resource_t base
Definition: resource.h:45
struct ite_ec_config ec
Definition: chip.h:9