aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/configs/cmpc885.h1
-rw-r--r--include/configs/mcr3000.h1
-rw-r--r--include/env_flags.h2
-rw-r--r--include/fastboot.h9
-rw-r--r--include/ndisc.h35
-rw-r--r--include/net.h7
-rw-r--r--include/net/fastboot.h21
-rw-r--r--include/net/fastboot_tcp.h14
-rw-r--r--include/net/fastboot_udp.h14
-rw-r--r--include/net/ldpaa_eth.h15
-rw-r--r--include/net/tcp.h16
-rw-r--r--include/net6.h40
-rw-r--r--include/phy.h23
-rw-r--r--include/pxe_utils.h10
-rw-r--r--include/tlv_eeprom.h3
15 files changed, 165 insertions, 46 deletions
diff --git a/include/configs/cmpc885.h b/include/configs/cmpc885.h
index b76230e9a4d..545365e1128 100644
--- a/include/configs/cmpc885.h
+++ b/include/configs/cmpc885.h
@@ -9,6 +9,7 @@
/* Definitions for initial stack pointer and data area (in DPRAM) */
#define CFG_SYS_INIT_RAM_ADDR (CONFIG_SYS_IMMR + 0x2800)
#define CFG_SYS_INIT_RAM_SIZE (0x2e00 - 0x2800)
+#define CFG_SYS_INIT_SP (CONFIG_SYS_IMMR + 0x3c00)
/* RAM configuration (note that CFG_SYS_SDRAM_BASE must be zero) */
#define CFG_SYS_SDRAM_BASE 0x00000000
diff --git a/include/configs/mcr3000.h b/include/configs/mcr3000.h
index 6b16b050ff3..a07761fdbb2 100644
--- a/include/configs/mcr3000.h
+++ b/include/configs/mcr3000.h
@@ -14,6 +14,7 @@
/* Definitions for initial stack pointer and data area (in DPRAM) */
#define CFG_SYS_INIT_RAM_ADDR (CONFIG_SYS_IMMR + 0x2800)
#define CFG_SYS_INIT_RAM_SIZE (0x2e00 - 0x2800)
+#define CFG_SYS_INIT_SP (CONFIG_SYS_IMMR + 0x3c00)
/* RAM configuration (note that CFG_SYS_SDRAM_BASE must be zero) */
#define CFG_SYS_SDRAM_BASE 0x00000000
diff --git a/include/env_flags.h b/include/env_flags.h
index 7de58cc57c3..d785f87cdcb 100644
--- a/include/env_flags.h
+++ b/include/env_flags.h
@@ -71,7 +71,7 @@ enum env_flags_varaccess {
#define NET6_FLAGS \
"ip6addr:s," \
"serverip6:s," \
- "gatewayip6:s"
+ "gatewayip6:s,"
#else
#define NET6_FLAGS
#endif
diff --git a/include/fastboot.h b/include/fastboot.h
index 07f4c8fa711..296451f89d4 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -124,6 +124,15 @@ void fastboot_init(void *buf_addr, u32 buf_size);
void fastboot_boot(void);
/**
+ * fastboot_handle_boot() - Shared implementation of system reaction to
+ * fastboot commands
+ *
+ * Making desceisions about device boot state (stay in fastboot, reboot
+ * to bootloader, reboot to OS, etc).
+ */
+void fastboot_handle_boot(int command, bool success);
+
+/**
* fastboot_handle_command() - Handle fastboot command
*
* @cmd_string: Pointer to command string
diff --git a/include/ndisc.h b/include/ndisc.h
index f6f8eb6507c..d0fe3acca4a 100644
--- a/include/ndisc.h
+++ b/include/ndisc.h
@@ -19,6 +19,20 @@ struct nd_msg {
__u8 opt[0];
};
+/* struct rs_msg - ICMPv6 Router Solicitation message format */
+struct rs_msg {
+ struct icmp6hdr icmph;
+ __u8 opt[0];
+};
+
+/* struct ra_msg - ICMPv6 Router Advertisement message format */
+struct ra_msg {
+ struct icmp6hdr icmph;
+ __u32 reachable_time;
+ __u32 retransmission_timer;
+ __u8 opt[0];
+};
+
/* struct echo_msg - ICMPv6 echo request/reply message format */
struct echo_msg {
struct icmp6hdr icmph;
@@ -57,6 +71,11 @@ extern int net_nd_try;
*/
void ndisc_init(void);
+/*
+ * ip6_send_rs() - Send IPv6 Router Solicitation Message
+ */
+void ip6_send_rs(void);
+
/**
* ndisc_receive() - Handle ND packet
*
@@ -78,6 +97,8 @@ void ndisc_request(void);
* Return: 0 if no timeout, -1 otherwise
*/
int ndisc_timeout_check(void);
+bool validate_ra(struct ip6_hdr *ip6);
+int process_ra(struct ip6_hdr *ip6, int len);
#else
static inline void ndisc_init(void)
{
@@ -97,6 +118,20 @@ static inline int ndisc_timeout_check(void)
{
return 0;
}
+
+static inline void ip6_send_rs(void)
+{
+}
+
+static inline bool validate_ra(struct ip6_hdr *ip6)
+{
+ return true;
+}
+
+static inline int process_ra(struct ip6_hdr *ip6, int len)
+{
+ return 0;
+}
#endif
#endif /* __NDISC_H__ */
diff --git a/include/net.h b/include/net.h
index 399af5e0645..785cb1059ef 100644
--- a/include/net.h
+++ b/include/net.h
@@ -484,6 +484,8 @@ extern char net_hostname[32]; /* Our hostname */
#ifdef CONFIG_NET
extern char net_root_path[CONFIG_BOOTP_MAX_ROOT_PATH_LEN]; /* Our root path */
#endif
+/* Indicates whether the pxe path prefix / config file was specified in dhcp option */
+extern char *pxelinux_configfile;
/** END OF BOOTP EXTENTIONS **/
extern u8 net_ethaddr[ARP_HLEN]; /* Our ethernet address */
extern u8 net_server_ethaddr[ARP_HLEN]; /* Boot server enet address */
@@ -504,8 +506,9 @@ extern ushort net_native_vlan; /* Our Native VLAN */
extern int net_restart_wrap; /* Tried all network devices */
enum proto_t {
- BOOTP, RARP, ARP, TFTPGET, DHCP, PING, PING6, DNS, NFS, CDP, NETCONS,
- SNTP, TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL, UDP, NCSI, WGET
+ BOOTP, RARP, ARP, TFTPGET, DHCP, DHCP6, PING, PING6, DNS, NFS, CDP,
+ NETCONS, SNTP, TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT_UDP, FASTBOOT_TCP,
+ WOL, UDP, NCSI, WGET, RS
};
extern char net_boot_file_name[1024];/* Boot File name */
diff --git a/include/net/fastboot.h b/include/net/fastboot.h
deleted file mode 100644
index 68602095d2b..00000000000
--- a/include/net/fastboot.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright (C) 2016 The Android Open Source Project
- */
-
-#ifndef __NET_FASTBOOT_H__
-#define __NET_FASTBOOT_H__
-
-/**********************************************************************/
-/*
- * Global functions and variables.
- */
-
-/**
- * Wait for incoming fastboot comands.
- */
-void fastboot_start_server(void);
-
-/**********************************************************************/
-
-#endif /* __NET_FASTBOOT_H__ */
diff --git a/include/net/fastboot_tcp.h b/include/net/fastboot_tcp.h
new file mode 100644
index 00000000000..6cf29d52e93
--- /dev/null
+++ b/include/net/fastboot_tcp.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2023 The Android Open Source Project
+ */
+
+#ifndef __NET_FASTBOOT_TCP_H__
+#define __NET_FASTBOOT_TCP_H__
+
+/**
+ * Wait for incoming tcp fastboot comands.
+ */
+void fastboot_tcp_start_server(void);
+
+#endif /* __NET_FASTBOOT_TCP_H__ */
diff --git a/include/net/fastboot_udp.h b/include/net/fastboot_udp.h
new file mode 100644
index 00000000000..d4382c0a0e0
--- /dev/null
+++ b/include/net/fastboot_udp.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2016 The Android Open Source Project
+ */
+
+#ifndef __NET_FASTBOOT_H__
+#define __NET_FASTBOOT_H__
+
+/**
+ * Wait for incoming UDP fastboot comands.
+ */
+void fastboot_udp_start_server(void);
+
+#endif /* __NET_FASTBOOT_H__ */
diff --git a/include/net/ldpaa_eth.h b/include/net/ldpaa_eth.h
new file mode 100644
index 00000000000..7474bfaeec3
--- /dev/null
+++ b/include/net/ldpaa_eth.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2023 NXP
+ */
+
+#define LDPAA_ETH_DRIVER_NAME "ldpaa_eth"
+
+/**
+ * ldpaa_eth_get_dpmac_id() - Get the dpmac_id of a DPAA2 ethernet device
+ *
+ * @dev: DPAA2 ethernet udevice pointer
+ * Return: requested dpmac_id
+ */
+
+uint32_t ldpaa_eth_get_dpmac_id(struct udevice *dev);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 322551694f5..c29d4ce24a7 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -259,6 +259,7 @@ union tcp_build_pkt {
* enum tcp_state - TCP State machine states for connection
* @TCP_CLOSED: Need to send SYN to connect
* @TCP_SYN_SENT: Trying to connect, waiting for SYN ACK
+ * @TCP_SYN_RECEIVED: Initial SYN received, waiting for ACK
* @TCP_ESTABLISHED: both server & client have a connection
* @TCP_CLOSE_WAIT: Rec FIN, passed to app for FIN, ACK rsp
* @TCP_CLOSING: Rec FIN, sent FIN, ACK waiting for ACK
@@ -268,6 +269,7 @@ union tcp_build_pkt {
enum tcp_state {
TCP_CLOSED,
TCP_SYN_SENT,
+ TCP_SYN_RECEIVED,
TCP_ESTABLISHED,
TCP_CLOSE_WAIT,
TCP_CLOSING,
@@ -283,14 +285,18 @@ int tcp_set_tcp_header(uchar *pkt, int dport, int sport, int payload_len,
/**
* rxhand_tcp() - An incoming packet handler.
* @pkt: pointer to the application packet
- * @dport: destination UDP port
+ * @dport: destination TCP port
* @sip: source IP address
- * @sport: source UDP port
+ * @sport: source TCP port
+ * @tcp_seq_num: TCP sequential number
+ * @tcp_ack_num: TCP acknowledgment number
+ * @action: TCP action (SYN, ACK, FIN, etc)
* @len: packet length
*/
-typedef void rxhand_tcp(uchar *pkt, unsigned int dport,
- struct in_addr sip, unsigned int sport,
- unsigned int len);
+typedef void rxhand_tcp(uchar *pkt, u16 dport,
+ struct in_addr sip, u16 sport,
+ u32 tcp_seq_num, u32 tcp_ack_num,
+ u8 action, unsigned int len);
void tcp_set_tcp_handler(rxhand_tcp *f);
void rxhand_tcp_f(union tcp_build_pkt *b, unsigned int len);
diff --git a/include/net6.h b/include/net6.h
index 2d7c5a09604..beafc053386 100644
--- a/include/net6.h
+++ b/include/net6.h
@@ -81,8 +81,17 @@ struct udp_hdr {
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00 } } }
+/*
+ * All-routers multicast address is the link-local scope address to reach all
+ * routers.
+ */
+#define ALL_ROUTERS_MULT_ADDR { { { 0xFF, 0x02, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x02 } } }
#define IPV6_LINK_LOCAL_PREFIX 0xfe80
+#define IPV6_LINK_LOCAL_MASK 0xffb0 /* The first 10-bit of address mask. */
/* hop limit for neighbour discovery packets */
#define IPV6_NDISC_HOPLIMIT 255
@@ -166,6 +175,37 @@ struct icmp6hdr {
#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime
} __packed;
+/*
+ * struct icmp6_ra_prefix_info - Prefix Information option of the ICMPv6 message
+ * The Prefix Information option provides hosts with on-link prefixes and
+ * prefixes for Address Autoconfiguration. Refer to RFC 4861 for more info.
+ */
+struct icmp6_ra_prefix_info {
+ u8 type; /* Type is 3 for Prefix Information. */
+ u8 len; /* Len is 4 for Prefix Information. */
+ /* The number of leading bits in the Prefix that are valid. */
+ u8 prefix_len;
+ u8 reserved1:6, /* MUST be ignored by the receiver. */
+ aac:1, /* autonomous address-configuration flag */
+ /* Indicates that this prefix can be used for on-link determination. */
+ on_link:1;
+ /*
+ * The length of time in seconds that the prefix is valid for the
+ * purpose of on-link determination.
+ */
+ __be32 valid_lifetime;
+ /* The length of time addresses remain preferred. */
+ __be32 preferred_lifetime;
+ __be32 reserved2; /* MUST be ignored by the receiver. */
+ /*
+ * Prefix is an IP address or a prefix of an IP address. The Prefix
+ * Length field contains the number of valid leading bits in the prefix.
+ * The bits in the prefix after the prefix length are reserved and MUST
+ * be initialized to zero by the sender and ignored by the receiver.
+ */
+ struct in6_addr prefix;
+};
+
extern struct in6_addr const net_null_addr_ip6; /* NULL IPv6 address */
extern struct in6_addr net_gateway6; /* Our gateways IPv6 address */
extern struct in6_addr net_ip6; /* Our IPv6 addr (0 = unknown) */
diff --git a/include/phy.h b/include/phy.h
index a837fed7235..247223d92be 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -361,20 +361,15 @@ int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id);
*/
static inline bool phy_interface_is_rgmii(struct phy_device *phydev)
{
- return phydev->interface >= PHY_INTERFACE_MODE_RGMII &&
- phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
-}
-
-/**
- * phy_interface_is_sgmii - Convenience function for testing if a PHY interface
- * is SGMII (all variants)
- * @phydev: the phy_device struct
- * @return: true if MII bus is SGMII or false if it is not
- */
-static inline bool phy_interface_is_sgmii(struct phy_device *phydev)
-{
- return phydev->interface >= PHY_INTERFACE_MODE_SGMII &&
- phydev->interface <= PHY_INTERFACE_MODE_QSGMII;
+ switch (phydev->interface) {
+ case PHY_INTERFACE_MODE_RGMII:
+ case PHY_INTERFACE_MODE_RGMII_ID:
+ case PHY_INTERFACE_MODE_RGMII_RXID:
+ case PHY_INTERFACE_MODE_RGMII_TXID:
+ return 1;
+ default:
+ return 0;
+ }
}
bool phy_interface_is_ncsi(void);
diff --git a/include/pxe_utils.h b/include/pxe_utils.h
index 1e5e8424f53..9f195930487 100644
--- a/include/pxe_utils.h
+++ b/include/pxe_utils.h
@@ -93,6 +93,7 @@ typedef int (*pxe_getfile_func)(struct pxe_context *ctx, const char *file_path,
* @bootdir: Directory that files are loaded from ("" if no directory). This is
* allocated
* @pxe_file_size: Size of the PXE file
+ * @use_ipv6: TRUE : use IPv6 addressing, FALSE : use IPv4 addressing
*/
struct pxe_context {
struct cmd_tbl *cmdtp;
@@ -112,6 +113,7 @@ struct pxe_context {
bool allow_abs_path;
char *bootdir;
ulong pxe_file_size;
+ bool use_ipv6;
};
/**
@@ -209,12 +211,14 @@ int format_mac_pxe(char *outbuf, size_t outbuf_len);
* @allow_abs_path: true to allow absolute paths
* @bootfile: Bootfile whose directory loaded files are relative to, NULL if
* none
+ * @use_ipv6: TRUE : use IPv6 addressing
+ * FALSE : use IPv4 addressing
* Return: 0 if OK, -ENOMEM if out of memory, -E2BIG if bootfile is larger than
* MAX_TFTP_PATH_LEN bytes
*/
int pxe_setup_ctx(struct pxe_context *ctx, struct cmd_tbl *cmdtp,
pxe_getfile_func getfile, void *userdata,
- bool allow_abs_path, const char *bootfile);
+ bool allow_abs_path, const char *bootfile, bool use_ipv6);
/**
* pxe_destroy_ctx() - Destroy a PXE context
@@ -251,7 +255,9 @@ int pxe_get_file_size(ulong *sizep);
* "rpi/info", which indicates that all files should be fetched from the
* "rpi/" subdirectory
* @sizep: Size of the PXE file (not bootfile)
+ * @use_ipv6: TRUE : use IPv6 addressing
+ * FALSE : use IPv4 addressing
*/
-int pxe_get(ulong pxefile_addr_r, char **bootdirp, ulong *sizep);
+int pxe_get(ulong pxefile_addr_r, char **bootdirp, ulong *sizep, bool use_ipv6);
#endif /* __PXE_UTILS_H */
diff --git a/include/tlv_eeprom.h b/include/tlv_eeprom.h
index a2c333e7446..fd45e5f6ebb 100644
--- a/include/tlv_eeprom.h
+++ b/include/tlv_eeprom.h
@@ -84,11 +84,12 @@ int read_tlv_eeprom(void *eeprom, int offset, int len, int dev);
* write_tlv_eeprom - Write the entire EEPROM binary data to the hardware
* @eeprom: Pointer to buffer to hold the binary data
* @len : Maximum size of buffer
+ * @dev : EEPROM device to write
*
* Note: this routine does not validate the EEPROM data.
*
*/
-int write_tlv_eeprom(void *eeprom, int len);
+int write_tlv_eeprom(void *eeprom, int len, int dev);
/**
* read_tlvinfo_tlv_eeprom - Read the TLV from EEPROM, and validate