mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-04 07:15:18 +02:00
udelay: move into platform folder
Change-Id: I9910cd1f5850a6f86e26bb1dc4ff26614f0a0964 Signed-off-by: Antonio Vázquez Blanco <antoniovazquezblanco@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/88270 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:

committed by
Anastasia Klimchuk

parent
e5f377c662
commit
51a7275a31
@ -19,6 +19,7 @@
|
|||||||
#include "hwaccess_x86_io.h"
|
#include "hwaccess_x86_io.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
#include "platform/pci.h"
|
#include "platform/pci.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
/* same as serverengines */
|
/* same as serverengines */
|
||||||
static void enter_conf_mode_ec(uint16_t port)
|
static void enter_conf_mode_ec(uint16_t port)
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "platform/pci.h"
|
#include "platform/pci.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
#define PCI_VENDOR_ID_ASMEDIA 0x1b21
|
#define PCI_VENDOR_ID_ASMEDIA 0x1b21
|
||||||
|
|
||||||
|
1
atavia.c
1
atavia.c
@ -21,6 +21,7 @@
|
|||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "platform/pci.h"
|
#include "platform/pci.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
#define PCI_VENDOR_ID_VIA 0x1106
|
#define PCI_VENDOR_ID_VIA 0x1106
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
/* Note that CS# is active low, so val=0 means the chip is active. */
|
/* Note that CS# is active low, so val=0 means the chip is active. */
|
||||||
static void bitbang_spi_set_cs(const struct bitbang_spi_master * const master, int val, void *spi_data)
|
static void bitbang_spi_set_cs(const struct bitbang_spi_master * const master, int val, void *spi_data)
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
/* Change this to #define if you want to test without a serial implementation */
|
/* Change this to #define if you want to test without a serial implementation */
|
||||||
#undef FAKE_COMMUNICATION
|
#undef FAKE_COMMUNICATION
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
/* LIBUSB_CALL ensures the right calling conventions on libusb callbacks.
|
/* LIBUSB_CALL ensures the right calling conventions on libusb callbacks.
|
||||||
* However, the macro is not defined everywhere. m(
|
* However, the macro is not defined everywhere. m(
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
#include "usbdev.h"
|
#include "usbdev.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
/* LIBUSB_CALL ensures the right calling conventions on libusb callbacks.
|
/* LIBUSB_CALL ensures the right calling conventions on libusb callbacks.
|
||||||
* However, the macro is not defined everywhere. m(
|
* However, the macro is not defined everywhere. m(
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "flashchips.h"
|
#include "flashchips.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
#include "writeprotect.h"
|
#include "writeprotect.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
enum emu_chip {
|
enum emu_chip {
|
||||||
EMULATE_NONE,
|
EMULATE_NONE,
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "hwaccess_physmap.h"
|
#include "hwaccess_physmap.h"
|
||||||
#include "chipdrivers.h"
|
#include "chipdrivers.h"
|
||||||
#include "erasure_layout.h"
|
#include "erasure_layout.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
const char flashrom_version[] = FLASHROM_VERSION;
|
const char flashrom_version[] = FLASHROM_VERSION;
|
||||||
|
|
||||||
|
1
ichspi.c
1
ichspi.c
@ -26,6 +26,7 @@
|
|||||||
#include "hwaccess_physmap.h"
|
#include "hwaccess_physmap.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
#include "ich_descriptors.h"
|
#include "ich_descriptors.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
/* Apollo Lake */
|
/* Apollo Lake */
|
||||||
#define APL_REG_FREG12 0xe0 /* 32 Bytes Flash Region 12 */
|
#define APL_REG_FREG12 0xe0 /* 32 Bytes Flash Region 12 */
|
||||||
|
23
include/platform/udelay.h
Normal file
23
include/platform/udelay.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the flashrom project.
|
||||||
|
*
|
||||||
|
* Copyright 2025 Antonio Vázquez Blanco <antoniovazquezblanco@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __UDELAY_H__
|
||||||
|
#define __UDELAY_H__
|
||||||
|
|
||||||
|
void internal_sleep(unsigned int usecs);
|
||||||
|
void default_delay(unsigned int usecs);
|
||||||
|
|
||||||
|
#endif
|
@ -217,10 +217,6 @@ extern const struct board_info boards_known[];
|
|||||||
extern const struct board_info laptops_known[];
|
extern const struct board_info laptops_known[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* udelay.c */
|
|
||||||
void internal_sleep(unsigned int usecs);
|
|
||||||
void default_delay(unsigned int usecs);
|
|
||||||
|
|
||||||
#if CONFIG_INTERNAL == 1
|
#if CONFIG_INTERNAL == 1
|
||||||
/* board_enable.c */
|
/* board_enable.c */
|
||||||
int selfcheck_board_enables(void);
|
int selfcheck_board_enables(void);
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "hwaccess_physmap.h"
|
#include "hwaccess_physmap.h"
|
||||||
#include "hwaccess_x86_io.h"
|
#include "hwaccess_x86_io.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
#define ITE_SUPERIO_PORT1 0x2e
|
#define ITE_SUPERIO_PORT1 0x2e
|
||||||
#define ITE_SUPERIO_PORT2 0x4e
|
#define ITE_SUPERIO_PORT2 0x4e
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Maximum number of bytes that can be transferred at once via the JTAG
|
* Maximum number of bytes that can be transferred at once via the JTAG
|
||||||
|
10
meson.build
10
meson.build
@ -105,16 +105,6 @@ srcs = files(
|
|||||||
'writeprotect_ranges.c',
|
'writeprotect_ranges.c',
|
||||||
)
|
)
|
||||||
|
|
||||||
# Select an appropriate delay implementation for the target OS
|
|
||||||
delay_src = files('udelay.c')
|
|
||||||
if target_machine.system() == 'dos'
|
|
||||||
delay_src = files('udelay_dos.c')
|
|
||||||
endif
|
|
||||||
srcs += delay_src
|
|
||||||
cargs += ['-DCONFIG_DELAY_MINIMUM_SLEEP_US=@0@'.format(
|
|
||||||
get_option('delay_minimum_sleep_us')
|
|
||||||
)]
|
|
||||||
|
|
||||||
# check for required symbols
|
# check for required symbols
|
||||||
if cc.has_function('clock_gettime')
|
if cc.has_function('clock_gettime')
|
||||||
add_project_arguments('-DHAVE_CLOCK_GETTIME=1', language : 'c')
|
add_project_arguments('-DHAVE_CLOCK_GETTIME=1', language : 'c')
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "hwaccess_physmap.h"
|
#include "hwaccess_physmap.h"
|
||||||
#include "platform/pci.h"
|
#include "platform/pci.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
#define PCI_VENDOR_ID_INTEL 0x8086
|
#define PCI_VENDOR_ID_INTEL 0x8086
|
||||||
#define MEMMAP_SIZE 0x1c /* Only EEC, EERD and EEWR are needed. */
|
#define MEMMAP_SIZE 0x1c /* Only EEC, EERD and EEWR are needed. */
|
||||||
|
@ -10,6 +10,16 @@ if host_machine.endian() == 'big'
|
|||||||
add_project_arguments('-D__FLASHROM_BIG_ENDIAN__=1', language : 'c')
|
add_project_arguments('-D__FLASHROM_BIG_ENDIAN__=1', language : 'c')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Select an appropriate delay implementation for the target OS
|
||||||
|
delay_src = files('udelay.c')
|
||||||
|
if target_machine.system() == 'dos'
|
||||||
|
delay_src = files('udelay_dos.c')
|
||||||
|
endif
|
||||||
|
srcs += delay_src
|
||||||
|
cargs += ['-DCONFIG_DELAY_MINIMUM_SLEEP_US=@0@'.format(
|
||||||
|
get_option('delay_minimum_sleep_us')
|
||||||
|
)]
|
||||||
|
|
||||||
# OpenBSD requires libi386 or libamd64 for I/O port handling
|
# OpenBSD requires libi386 or libamd64 for I/O port handling
|
||||||
if host_machine.system() == 'openbsd'
|
if host_machine.system() == 'openbsd'
|
||||||
if host_machine.cpu_family() == 'x86'
|
if host_machine.cpu_family() == 'x86'
|
||||||
@ -32,7 +42,6 @@ if host_machine.system() == 'netbsd'
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
# SunOS requires external libraries for network sockets
|
# SunOS requires external libraries for network sockets
|
||||||
# they are used to support serial devices via network
|
# they are used to support serial devices via network
|
||||||
if host_machine.system() == 'sunos'
|
if host_machine.system() == 'sunos'
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#ifndef __LIBPAYLOAD__
|
#ifndef __LIBPAYLOAD__
|
||||||
|
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
@ -15,6 +15,8 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
enum pony_type {
|
enum pony_type {
|
||||||
TYPE_SI_PROG,
|
TYPE_SI_PROG,
|
||||||
|
@ -341,6 +341,7 @@
|
|||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
#include "usb_device.h"
|
#include "usb_device.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
1
serial.c
1
serial.c
@ -35,6 +35,7 @@
|
|||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "custom_baud.h"
|
#include "custom_baud.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
fdtype sp_fd = SER_INV_FD;
|
fdtype sp_fd = SER_INV_FD;
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "chipdrivers.h"
|
#include "chipdrivers.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
/* According to Serial Flasher Protocol Specification - version 1 */
|
/* According to Serial Flasher Protocol Specification - version 1 */
|
||||||
#define S_ACK 0x06
|
#define S_ACK 0x06
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
static int spidriver_serialport_setup(char *dev)
|
static int spidriver_serialport_setup(char *dev)
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "programmer.h"
|
#include "platform/udelay.h"
|
||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
|
|
||||||
static uint64_t now_us(void) {
|
static uint64_t now_us(void) {
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "hwaccess_physmap.h"
|
#include "hwaccess_physmap.h"
|
||||||
#include "hwaccess_x86_io.h"
|
#include "hwaccess_x86_io.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
#include "platform/udelay.h"
|
||||||
|
|
||||||
#define WBSIO_PORT1 0x2e
|
#define WBSIO_PORT1 0x2e
|
||||||
#define WBSIO_PORT2 0x4e
|
#define WBSIO_PORT2 0x4e
|
||||||
|
Reference in New Issue
Block a user