Here's the great news: From now on you don't have to worry about hitting the right io.h include anymore. Just forget about romcc_io.h and use io.h instead. This cleanup has a number of advantages, like you don't have to guard device/ includes for SMM and pre RAM anymore. This allows to get rid of a number of ifdefs and will generally make the code more readable and understandable. Potentially in the future some of the code in the io.h __PRE_RAM__ path should move to device.h or other device/ includes instead, but that's another incremental change. Change-Id: I356f06110e2e355e9a5b4b08c132591f36fec7d9 Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/2872 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
56 lines
1.5 KiB
C
56 lines
1.5 KiB
C
#ifndef DEVICE_PNP_H
|
|
#define DEVICE_PNP_H
|
|
|
|
#include <stdint.h>
|
|
#include <device/device.h>
|
|
#include <device/pnp_def.h>
|
|
|
|
#if !defined(__PRE_RAM__) && !defined(__SMM__)
|
|
/* Primitive PNP resource manipulation */
|
|
void pnp_write_config(device_t dev, u8 reg, u8 value);
|
|
u8 pnp_read_config(device_t dev, u8 reg);
|
|
void pnp_set_logical_device(device_t dev);
|
|
void pnp_set_enable(device_t dev, int enable);
|
|
int pnp_read_enable(device_t dev);
|
|
void pnp_set_iobase(device_t dev, u8 index, u16 iobase);
|
|
void pnp_set_irq(device_t dev, u8 index, u8 irq);
|
|
void pnp_set_drq(device_t dev, u8 index, u8 drq);
|
|
|
|
/* PNP device operations */
|
|
void pnp_read_resources(device_t dev);
|
|
void pnp_set_resources(device_t dev);
|
|
void pnp_enable_resources(device_t dev);
|
|
void pnp_enable(device_t dev);
|
|
|
|
extern struct device_operations pnp_ops;
|
|
|
|
/* PNP helper operations */
|
|
|
|
struct io_info {
|
|
unsigned mask, set;
|
|
};
|
|
|
|
struct pnp_info {
|
|
struct device_operations *ops;
|
|
unsigned int function; /* Must be at least 16 bits (virtual LDNs)! */
|
|
unsigned int flags;
|
|
#define PNP_IO0 0x001
|
|
#define PNP_IO1 0x002
|
|
#define PNP_IO2 0x004
|
|
#define PNP_IO3 0x008
|
|
#define PNP_IRQ0 0x010
|
|
#define PNP_IRQ1 0x020
|
|
#define PNP_DRQ0 0x040
|
|
#define PNP_DRQ1 0x080
|
|
#define PNP_EN 0x100
|
|
#define PNP_MSC0 0x200
|
|
#define PNP_MSC1 0x400
|
|
struct io_info io0, io1, io2, io3;
|
|
};
|
|
struct resource *pnp_get_resource(device_t dev, unsigned index);
|
|
void pnp_enable_devices(struct device *dev, struct device_operations *ops,
|
|
unsigned int functions, struct pnp_info *info);
|
|
|
|
#endif
|
|
#endif /* DEVICE_PNP_H */
|