/* Try to detect e1000's. */
e = &e1000_state;
- strcpy(e->name, "e1000#0");
- e->name[6] += e1000_instance;
+ strlcpy(e->name, "e1000#0", sizeof(e->name));
+ e->name[6] += e1000_instance;
e1000_probe(e, e1000_instance);
}
static void e1000_init_buf(e)
e1000_t *e;
{
- phys_bytes rx_desc_p, rx_buff_p;
- phys_bytes tx_desc_p, tx_buff_p;
+ phys_bytes rx_buff_p;
+ phys_bytes tx_buff_p;
int i;
/* Number of descriptors. */
{
if ((e->rx_desc = alloc_contig(sizeof(e1000_rx_desc_t) *
e->rx_desc_count, AC_ALIGN4K,
- &rx_desc_p)) == NULL) {
+ &e->rx_desc_p)) == NULL) {
panic("failed to allocate RX descriptors");
}
memset(e->rx_desc, 0, sizeof(e1000_rx_desc_t) * e->rx_desc_count);
{
if ((e->tx_desc = alloc_contig(sizeof(e1000_tx_desc_t) *
e->tx_desc_count, AC_ALIGN4K,
- &tx_desc_p)) == NULL) {
+ &e->tx_desc_p)) == NULL) {
panic("failed to allocate TX descriptors");
}
memset(e->tx_desc, 0, sizeof(e1000_tx_desc_t) * e->tx_desc_count);
/*
* Setup the receive ring registers.
*/
- e1000_reg_write(e, E1000_REG_RDBAL, rx_desc_p);
+ e1000_reg_write(e, E1000_REG_RDBAL, e->rx_desc_p);
e1000_reg_write(e, E1000_REG_RDBAH, 0);
e1000_reg_write(e, E1000_REG_RDLEN, e->rx_desc_count *
sizeof(e1000_rx_desc_t));
/*
* Setup the transmit ring registers.
*/
- e1000_reg_write(e, E1000_REG_TDBAL, tx_desc_p);
+ e1000_reg_write(e, E1000_REG_TDBAL, e->tx_desc_p);
e1000_reg_write(e, E1000_REG_TDBAH, 0);
e1000_reg_write(e, E1000_REG_TDLEN, e->tx_desc_count *
sizeof(e1000_tx_desc_t));
int eeprom_addr_off; /**< Offset of the EERD.ADDR field. */
e1000_rx_desc_t *rx_desc; /**< Receive Descriptor table. */
+ phys_bytes rx_desc_p; /**< Physical Receive Descriptor Address. */
int rx_desc_count; /**< Number of Receive Descriptors. */
char *rx_buffer; /**< Receive buffer returned by malloc(). */
int rx_buffer_size; /**< Size of the receive buffer. */
e1000_tx_desc_t *tx_desc; /**< Transmit Descriptor table. */
+ phys_bytes tx_desc_p; /**< Physical Transmit Descriptor Address. */
int tx_desc_count; /**< Number of Transmit Descriptors. */
char *tx_buffer; /**< Transmit buffer returned by malloc(). */
int tx_buffer_size; /**< Size of the transmit buffer. */