summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/drivers')
-rw-r--r--payloads/libpayload/drivers/keyboard.c4
-rw-r--r--payloads/libpayload/drivers/nvram.c2
-rw-r--r--payloads/libpayload/drivers/serial.c12
-rw-r--r--payloads/libpayload/drivers/serial/8250.c10
-rw-r--r--payloads/libpayload/drivers/storage/ahci.c8
-rw-r--r--payloads/libpayload/drivers/storage/ahci_ata.c4
-rw-r--r--payloads/libpayload/drivers/storage/ata.c2
-rw-r--r--payloads/libpayload/drivers/storage/storage.c4
-rw-r--r--payloads/libpayload/drivers/usb/ehci.c2
-rw-r--r--payloads/libpayload/drivers/usb/ohci.c2
-rw-r--r--payloads/libpayload/drivers/usb/usb.c6
-rw-r--r--payloads/libpayload/drivers/usb/usbhid.c2
-rw-r--r--payloads/libpayload/drivers/usb/usbinit.c20
-rw-r--r--payloads/libpayload/drivers/usb/xhci.c8
-rw-r--r--payloads/libpayload/drivers/video/video.c12
15 files changed, 49 insertions, 49 deletions
diff --git a/payloads/libpayload/drivers/keyboard.c b/payloads/libpayload/drivers/keyboard.c
index 8525a3e7fa..6431336863 100644
--- a/payloads/libpayload/drivers/keyboard.c
+++ b/payloads/libpayload/drivers/keyboard.c
@@ -41,7 +41,7 @@ struct layout_maps {
static struct layout_maps *map;
static struct layout_maps keyboard_layouts[] = {
-#ifdef CONFIG_LP_PC_KEYBOARD_LAYOUT_US
+#if IS_ENABLED(CONFIG_LP_PC_KEYBOARD_LAYOUT_US)
{ .country = "us", .map = {
{ /* No modifier */
0x00, 0x1B, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
@@ -97,7 +97,7 @@ static struct layout_maps keyboard_layouts[] = {
}
}},
#endif
-#ifdef CONFIG_LP_PC_KEYBOARD_LAYOUT_DE
+#if IS_ENABLED(CONFIG_LP_PC_KEYBOARD_LAYOUT_DE)
{ .country = "de", .map = {
{ /* No modifier */
0x00, 0x1B, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
diff --git a/payloads/libpayload/drivers/nvram.c b/payloads/libpayload/drivers/nvram.c
index ca689b74e2..c82533173f 100644
--- a/payloads/libpayload/drivers/nvram.c
+++ b/payloads/libpayload/drivers/nvram.c
@@ -60,7 +60,7 @@
* doesn't try to do this on its own.
*/
#define RTC_PORT_STANDARD 0x70
-#ifdef CONFIG_LP_RTC_PORT_EXTENDED_VIA
+#if IS_ENABLED(CONFIG_LP_RTC_PORT_EXTENDED_VIA)
#define RTC_PORT_EXTENDED 0x74
#else
#define RTC_PORT_EXTENDED 0x72
diff --git a/payloads/libpayload/drivers/serial.c b/payloads/libpayload/drivers/serial.c
index 25027755d7..a239ecd95c 100644
--- a/payloads/libpayload/drivers/serial.c
+++ b/payloads/libpayload/drivers/serial.c
@@ -39,7 +39,7 @@ static int serial_is_mem_mapped = 0;
static uint8_t serial_read_reg(int offset)
{
-#ifdef CONFIG_LP_IO_ADDRESS_SPACE
+#if IS_ENABLED(CONFIG_LP_IO_ADDRESS_SPACE)
if (!serial_is_mem_mapped)
return inb(IOBASE + offset);
else
@@ -49,7 +49,7 @@ static uint8_t serial_read_reg(int offset)
static void serial_write_reg(uint8_t val, int offset)
{
-#ifdef CONFIG_LP_IO_ADDRESS_SPACE
+#if IS_ENABLED(CONFIG_LP_IO_ADDRESS_SPACE)
if (!serial_is_mem_mapped)
outb(val, IOBASE + offset);
else
@@ -57,7 +57,7 @@ static void serial_write_reg(uint8_t val, int offset)
writeb(val, MEMBASE + offset);
}
-#ifdef CONFIG_LP_SERIAL_SET_SPEED
+#if IS_ENABLED(CONFIG_LP_SERIAL_SET_SPEED)
static void serial_hardware_init(int speed, int word_bits,
int parity, int stop_bits)
{
@@ -104,7 +104,7 @@ void serial_init(void)
(lib_sysinfo.serial->type == CB_SERIAL_TYPE_MEMORY_MAPPED);
if (!serial_is_mem_mapped) {
-#ifdef CONFIG_LP_IO_ADDRESS_SPACE
+#if IS_ENABLED(CONFIG_LP_IO_ADDRESS_SPACE)
if ((inb(IOBASE + 0x05) == 0xFF) &&
(inb(IOBASE + 0x06) == 0xFF)) {
return;
@@ -118,7 +118,7 @@ void serial_init(void)
serial_hardware_is_present = 1;
-#ifdef CONFIG_LP_SERIAL_SET_SPEED
+#if IS_ENABLED(CONFIG_LP_SERIAL_SET_SPEED)
serial_hardware_init(CONFIG_LP_SERIAL_BAUD_RATE, 8, 0, 1);
#endif
}
@@ -138,7 +138,7 @@ void serial_putchar(unsigned int c)
{
if (!serial_hardware_is_present)
return;
-#ifndef CONFIG_LP_PL011_SERIAL_CONSOLE
+#if !IS_ENABLED(CONFIG_LP_PL011_SERIAL_CONSOLE)
while ((serial_read_reg(0x05) & 0x20) == 0) ;
#endif
serial_write_reg(c, 0x00);
diff --git a/payloads/libpayload/drivers/serial/8250.c b/payloads/libpayload/drivers/serial/8250.c
index bca0057bb3..e9550f3e33 100644
--- a/payloads/libpayload/drivers/serial/8250.c
+++ b/payloads/libpayload/drivers/serial/8250.c
@@ -41,7 +41,7 @@ static uint8_t serial_read_reg(int offset)
{
offset *= lib_sysinfo.serial->regwidth;
-#ifdef CONFIG_LP_IO_ADDRESS_SPACE
+#if IS_ENABLED(CONFIG_LP_IO_ADDRESS_SPACE)
if (!serial_is_mem_mapped)
return inb(IOBASE + offset);
else
@@ -53,7 +53,7 @@ static void serial_write_reg(uint8_t val, int offset)
{
offset *= lib_sysinfo.serial->regwidth;
-#ifdef CONFIG_LP_IO_ADDRESS_SPACE
+#if IS_ENABLED(CONFIG_LP_IO_ADDRESS_SPACE)
if (!serial_is_mem_mapped)
outb(val, IOBASE + offset);
else
@@ -61,7 +61,7 @@ static void serial_write_reg(uint8_t val, int offset)
writeb(val, MEMBASE + offset);
}
-#ifdef CONFIG_LP_SERIAL_SET_SPEED
+#if IS_ENABLED(CONFIG_LP_SERIAL_SET_SPEED)
static void serial_hardware_init(int speed, int word_bits,
int parity, int stop_bits)
{
@@ -106,7 +106,7 @@ void serial_init(void)
(lib_sysinfo.serial->type == CB_SERIAL_TYPE_MEMORY_MAPPED);
if (!serial_is_mem_mapped) {
-#ifdef CONFIG_LP_IO_ADDRESS_SPACE
+#if IS_ENABLED(CONFIG_LP_IO_ADDRESS_SPACE)
if ((inb(IOBASE + 0x05) == 0xFF) &&
(inb(IOBASE + 0x06) == 0xFF)) {
printf("IO space mapped serial not present.");
@@ -118,7 +118,7 @@ void serial_init(void)
#endif
}
-#ifdef CONFIG_LP_SERIAL_SET_SPEED
+#if IS_ENABLED(CONFIG_LP_SERIAL_SET_SPEED)
serial_hardware_init(CONFIG_LP_SERIAL_BAUD_RATE, 8, 0, 1);
#endif
}
diff --git a/payloads/libpayload/drivers/storage/ahci.c b/payloads/libpayload/drivers/storage/ahci.c
index 4eef8435f6..deae9e2471 100644
--- a/payloads/libpayload/drivers/storage/ahci.c
+++ b/payloads/libpayload/drivers/storage/ahci.c
@@ -152,7 +152,7 @@ static int ahci_dev_init(hba_ctrl_t *const ctrl,
switch (port->signature) {
case HBA_PxSIG_ATA:
printf("ahci: ATA drive on port #%d.\n", portnum);
-#ifdef CONFIG_LP_STORAGE_ATA
+#if IS_ENABLED(CONFIG_LP_STORAGE_ATA)
dev->ata_dev.identify = ahci_identify_device;
dev->ata_dev.read_sectors = ahci_ata_read_sectors;
return ata_attach_device(&dev->ata_dev, PORT_TYPE_SATA);
@@ -160,7 +160,7 @@ static int ahci_dev_init(hba_ctrl_t *const ctrl,
break;
case HBA_PxSIG_ATAPI:
printf("ahci: ATAPI drive on port #%d.\n", portnum);
-#ifdef CONFIG_LP_STORAGE_ATAPI
+#if IS_ENABLED(CONFIG_LP_STORAGE_ATAPI)
dev->atapi_dev.identify = ahci_identify_device;
dev->atapi_dev.packet_read_cmd = ahci_packet_read_cmd;
return atapi_attach_device(&dev->atapi_dev, PORT_TYPE_SATA);
@@ -217,7 +217,7 @@ static void ahci_port_probe(hba_ctrl_t *const ctrl,
ahci_dev_init(ctrl, port, portnum);
}
-#ifdef CONFIG_LP_STORAGE_AHCI_ONLY_TESTED
+#if IS_ENABLED(CONFIG_LP_STORAGE_AHCI_ONLY_TESTED)
static u32 working_controllers[] = {
0x8086 | 0x2929 << 16, /* Mobile ICH9 */
0x8086 | 0x1e03 << 16, /* Mobile Panther Point PCH */
@@ -233,7 +233,7 @@ static void ahci_init_pci(pcidev_t dev)
const u16 vendor = pci_read_config16(dev, 0x00);
const u16 device = pci_read_config16(dev, 0x02);
-#ifdef CONFIG_LP_STORAGE_AHCI_ONLY_TESTED
+#if IS_ENABLED(CONFIG_LP_STORAGE_AHCI_ONLY_TESTED)
const u32 vendor_device = pci_read_config32(dev, 0x0);
for (i = 0; i < ARRAY_SIZE(working_controllers); ++i)
if (vendor_device == working_controllers[i])
diff --git a/payloads/libpayload/drivers/storage/ahci_ata.c b/payloads/libpayload/drivers/storage/ahci_ata.c
index a9380b647b..2c916fda49 100644
--- a/payloads/libpayload/drivers/storage/ahci_ata.c
+++ b/payloads/libpayload/drivers/storage/ahci_ata.c
@@ -56,7 +56,7 @@ ssize_t ahci_ata_read_sectors(ata_dev_t *const ata_dev,
printf("ahci: Sector count too high (max. 256).\n");
count = 256;
}
-#ifdef CONFIG_LP_STORAGE_64BIT_LBA
+#if IS_ENABLED(CONFIG_LP_STORAGE_64BIT_LBA)
} else if (ata_dev->read_cmd == ATA_READ_DMA_EXT) {
if (start >= (1ULL << 48)) {
printf("ahci: Sector is not 48-bit addressable.\n");
@@ -84,7 +84,7 @@ ssize_t ahci_ata_read_sectors(ata_dev_t *const ata_dev,
dev->cmdtable->fis[ 6] = (start >> 16) & 0xff;
dev->cmdtable->fis[ 7] = FIS_H2D_DEV_LBA;
dev->cmdtable->fis[ 8] = (start >> 24) & 0xff;
-#ifdef CONFIG_LP_STORAGE_64BIT_LBA
+#if IS_ENABLED(CONFIG_LP_STORAGE_64BIT_LBA)
if (ata_dev->read_cmd == ATA_READ_DMA_EXT) {
dev->cmdtable->fis[ 9] = (start >> 32) & 0xff;
dev->cmdtable->fis[10] = (start >> 40) & 0xff;
diff --git a/payloads/libpayload/drivers/storage/ata.c b/payloads/libpayload/drivers/storage/ata.c
index f1cf28f91e..80178c313d 100644
--- a/payloads/libpayload/drivers/storage/ata.c
+++ b/payloads/libpayload/drivers/storage/ata.c
@@ -212,7 +212,7 @@ int ata_attach_device(ata_dev_t *const dev, const storage_port_t port_type)
ata_strncpy(model, id + 27, sizeof(model));
printf("ata: Identified %s [%s]\n", model, fw);
-#ifdef CONFIG_LP_STORAGE_64BIT_LBA
+#if IS_ENABLED(CONFIG_LP_STORAGE_64BIT_LBA)
if (id[ATA_CMDS_AND_FEATURE_SETS + 1] & (1 << 10)) {
printf("ata: Support for LBA-48 enabled.\n");
dev->read_cmd = ATA_READ_DMA_EXT;
diff --git a/payloads/libpayload/drivers/storage/storage.c b/payloads/libpayload/drivers/storage/storage.c
index ccfd02cc23..c4cfd40293 100644
--- a/payloads/libpayload/drivers/storage/storage.c
+++ b/payloads/libpayload/drivers/storage/storage.c
@@ -28,7 +28,7 @@
*/
#include <libpayload.h>
-#ifdef CONFIG_LP_STORAGE_AHCI
+#if IS_ENABLED(CONFIG_LP_STORAGE_AHCI)
# include <storage/ahci.h>
#endif
#include <storage/storage.h>
@@ -110,7 +110,7 @@ ssize_t storage_read_blocks512(const size_t dev_num,
*/
void storage_initialize(void)
{
-#ifdef CONFIG_LP_STORAGE_AHCI
+#if IS_ENABLED(CONFIG_LP_STORAGE_AHCI)
ahci_initialize();
#endif
}
diff --git a/payloads/libpayload/drivers/usb/ehci.c b/payloads/libpayload/drivers/usb/ehci.c
index bda415ff63..0aa799d09c 100644
--- a/payloads/libpayload/drivers/usb/ehci.c
+++ b/payloads/libpayload/drivers/usb/ehci.c
@@ -873,7 +873,7 @@ ehci_init (unsigned long physical_bar)
return controller;
}
-#ifdef CONFIG_LP_USB_PCI
+#if IS_ENABLED(CONFIG_LP_USB_PCI)
hci_t *
ehci_pci_init (pcidev_t addr)
{
diff --git a/payloads/libpayload/drivers/usb/ohci.c b/payloads/libpayload/drivers/usb/ohci.c
index fed1ce9af4..83bccb8b89 100644
--- a/payloads/libpayload/drivers/usb/ohci.c
+++ b/payloads/libpayload/drivers/usb/ohci.c
@@ -246,7 +246,7 @@ ohci_init (unsigned long physical_bar)
return controller;
}
-#ifdef CONFIG_LP_USB_PCI
+#if IS_ENABLED(CONFIG_LP_USB_PCI)
hci_t *
ohci_pci_init (pcidev_t addr)
{
diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c
index b97ba6fa08..6174d639d2 100644
--- a/payloads/libpayload/drivers/usb/usb.c
+++ b/payloads/libpayload/drivers/usb/usb.c
@@ -530,7 +530,7 @@ set_address (hci_t *controller, usb_speed speed, int hubport, int hubaddr)
break;
case hid_device:
usb_debug ("HID\n");
-#ifdef CONFIG_LP_USB_HID
+#if IS_ENABLED(CONFIG_LP_USB_HID)
dev->init = usb_hid_init;
return dev->address;
#else
@@ -548,7 +548,7 @@ set_address (hci_t *controller, usb_speed speed, int hubport, int hubaddr)
break;
case msc_device:
usb_debug ("MSC\n");
-#ifdef CONFIG_LP_USB_MSC
+#if IS_ENABLED(CONFIG_LP_USB_MSC)
dev->init = usb_msc_init;
return dev->address;
#else
@@ -558,7 +558,7 @@ set_address (hci_t *controller, usb_speed speed, int hubport, int hubaddr)
case hub_device:
if (speed < SUPER_SPEED) {
usb_debug ("hub (2.0)\n");
-#ifdef CONFIG_LP_USB_HUB
+#if IS_ENABLED(CONFIG_LP_USB_HUB)
dev->init = usb_hub_init;
return dev->address;
#else
diff --git a/payloads/libpayload/drivers/usb/usbhid.c b/payloads/libpayload/drivers/usb/usbhid.c
index 0ca45e06b2..3100d37388 100644
--- a/payloads/libpayload/drivers/usb/usbhid.c
+++ b/payloads/libpayload/drivers/usb/usbhid.c
@@ -138,7 +138,7 @@ struct layout_maps {
static const struct layout_maps *map;
static const struct layout_maps keyboard_layouts[] = {
-// #ifdef CONFIG_LP_PC_KEYBOARD_LAYOUT_US
+// #if IS_ENABLED(CONFIG_LP_PC_KEYBOARD_LAYOUT_US)
{ .country = "us", .map = {
{ /* No modifier */
-1, -1, -1, -1, 'a', 'b', 'c', 'd',
diff --git a/payloads/libpayload/drivers/usb/usbinit.c b/payloads/libpayload/drivers/usb/usbinit.c
index 7a5828def7..721fde8a93 100644
--- a/payloads/libpayload/drivers/usb/usbinit.c
+++ b/payloads/libpayload/drivers/usb/usbinit.c
@@ -37,7 +37,7 @@
#include "dwc2.h"
#include <usb/usbdisk.h>
-#ifdef CONFIG_LP_USB_PCI
+#if IS_ENABLED(CONFIG_LP_USB_PCI)
/**
* Initializes USB controller attached to PCI
*
@@ -72,7 +72,7 @@ static int usb_controller_initialize(int bus, int dev, int func)
pciid >> 16, pciid & 0xFFFF, func);
switch (prog_if) {
case 0x00:
-#ifdef CONFIG_LP_USB_UHCI
+#if IS_ENABLED(CONFIG_LP_USB_UHCI)
usb_debug("UHCI controller\n");
uhci_pci_init (pci_device);
#else
@@ -81,7 +81,7 @@ static int usb_controller_initialize(int bus, int dev, int func)
break;
case 0x10:
-#ifdef CONFIG_LP_USB_OHCI
+#if IS_ENABLED(CONFIG_LP_USB_OHCI)
usb_debug("OHCI controller\n");
ohci_pci_init(pci_device);
#else
@@ -90,7 +90,7 @@ static int usb_controller_initialize(int bus, int dev, int func)
break;
case 0x20:
-#ifdef CONFIG_LP_USB_EHCI
+#if IS_ENABLED(CONFIG_LP_USB_EHCI)
usb_debug("EHCI controller\n");
ehci_pci_init(pci_device);
#else
@@ -99,7 +99,7 @@ static int usb_controller_initialize(int bus, int dev, int func)
break;
case 0x30:
-#ifdef CONFIG_LP_USB_XHCI
+#if IS_ENABLED(CONFIG_LP_USB_XHCI)
usb_debug("xHCI controller\n");
xhci_pci_init(pci_device);
#else
@@ -166,7 +166,7 @@ static void usb_scan_pci_bus(int bus)
*/
int usb_initialize(void)
{
-#ifdef CONFIG_LP_USB_PCI
+#if IS_ENABLED(CONFIG_LP_USB_PCI)
usb_scan_pci_bus(0);
#endif
return 0;
@@ -175,19 +175,19 @@ int usb_initialize(void)
hci_t *usb_add_mmio_hc(hc_type type, void *bar)
{
switch (type) {
-#ifdef CONFIG_LP_USB_OHCI
+#if IS_ENABLED(CONFIG_LP_USB_OHCI)
case OHCI:
return ohci_init((unsigned long)bar);
#endif
-#ifdef CONFIG_LP_USB_EHCI
+#if IS_ENABLED(CONFIG_LP_USB_EHCI)
case EHCI:
return ehci_init((unsigned long)bar);
#endif
-#ifdef CONFIG_LP_USB_DWC2
+#if IS_ENABLED(CONFIG_LP_USB_DWC2)
case DWC2:
return dwc2_init(bar);
#endif
-#ifdef CONFIG_LP_USB_XHCI
+#if IS_ENABLED(CONFIG_LP_USB_XHCI)
case XHCI:
return xhci_init((unsigned long)bar);
#endif
diff --git a/payloads/libpayload/drivers/usb/xhci.c b/payloads/libpayload/drivers/usb/xhci.c
index 89930e06df..f336f4d6a7 100644
--- a/payloads/libpayload/drivers/usb/xhci.c
+++ b/payloads/libpayload/drivers/usb/xhci.c
@@ -88,7 +88,7 @@ xhci_init_cycle_ring(transfer_ring_t *const tr, const size_t ring_size)
}
/* On Panther Point: switch ports shared with EHCI to xHCI */
-#ifdef CONFIG_LP_USB_PCI
+#if IS_ENABLED(CONFIG_LP_USB_PCI)
static void
xhci_switch_ppt_ports(pcidev_t addr)
{
@@ -112,7 +112,7 @@ xhci_switch_ppt_ports(pcidev_t addr)
}
#endif
-#ifdef CONFIG_LP_USB_PCI
+#if IS_ENABLED(CONFIG_LP_USB_PCI)
/* On Panther Point: switch all ports back to EHCI */
static void
xhci_switchback_ppt_ports(pcidev_t addr)
@@ -296,7 +296,7 @@ _free_xhci:
return NULL;
}
-#ifdef CONFIG_LP_USB_PCI
+#if IS_ENABLED(CONFIG_LP_USB_PCI)
hci_t *
xhci_pci_init (pcidev_t addr)
{
@@ -411,7 +411,7 @@ xhci_shutdown(hci_t *const controller)
xhci_t *const xhci = XHCI_INST(controller);
xhci_stop(controller);
-#ifdef CONFIG_LP_USB_PCI
+#if IS_ENABLED(CONFIG_LP_USB_PCI)
if (controller->pcidev)
xhci_switchback_ppt_ports(controller->pcidev);
#endif
diff --git a/payloads/libpayload/drivers/video/video.c b/payloads/libpayload/drivers/video/video.c
index 2b8207847b..834a121e19 100644
--- a/payloads/libpayload/drivers/video/video.c
+++ b/payloads/libpayload/drivers/video/video.c
@@ -31,27 +31,27 @@
#include <libpayload.h>
#include <video_console.h>
-#ifdef CONFIG_LP_GEODELX_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_GEODELX_VIDEO_CONSOLE)
extern struct video_console geodelx_video_console;
#endif
-#ifdef CONFIG_LP_COREBOOT_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_COREBOOT_VIDEO_CONSOLE)
extern struct video_console coreboot_video_console;
#endif
-#ifdef CONFIG_LP_VGA_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VGA_VIDEO_CONSOLE)
extern struct video_console vga_video_console;
#endif
static struct video_console *console_list[] =
{
-#ifdef CONFIG_LP_GEODELX_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_GEODELX_VIDEO_CONSOLE)
&geodelx_video_console,
#endif
-#ifdef CONFIG_LP_COREBOOT_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_COREBOOT_VIDEO_CONSOLE)
&coreboot_video_console,
#endif
-#ifdef CONFIG_LP_VGA_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VGA_VIDEO_CONSOLE)
&vga_video_console,
#endif
};