summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_em_osdep.h
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-07-07 02:56:19 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-07-07 02:56:19 +0000
commita2fe356796115a700ec497a65bfdef58b23ff466 (patch)
tree784cf41e5a17d12026f47d87dba73d245e801d25 /sys/dev/pci/if_em_osdep.h
parente8f94f74c0af0f445dedd4ceac1c53a524869ffb (diff)
Sync up to Intel's latest FreeBSD em driver (6.0.5). Adds support
for new chipset revisions embedded in the ESB2 and ICH8 core logic chipsets. The previous attempt at commiting this included an unrelated change to how the I/O base address was being set and this was the cause of the breakage. From: Intel's web-site
Diffstat (limited to 'sys/dev/pci/if_em_osdep.h')
-rw-r--r--sys/dev/pci/if_em_osdep.h96
1 files changed, 64 insertions, 32 deletions
diff --git a/sys/dev/pci/if_em_osdep.h b/sys/dev/pci/if_em_osdep.h
index f8296474b72..70968a04677 100644
--- a/sys/dev/pci/if_em_osdep.h
+++ b/sys/dev/pci/if_em_osdep.h
@@ -1,6 +1,6 @@
/**************************************************************************
-Copyright (c) 2001-2003, Intel Corporation
+Copyright (c) 2001-2006, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
-/* $OpenBSD: if_em_osdep.h,v 1.8 2006/07/05 01:15:30 brad Exp $ */
+/* $OpenBSD: if_em_osdep.h,v 1.9 2006/07/07 02:56:18 brad Exp $ */
/* $FreeBSD: if_em_osdep.h,v 1.11 2003/05/02 21:17:08 pdeuskar Exp $ */
#ifndef _EM_OPENBSD_OS_H_
@@ -65,74 +65,106 @@ struct em_osdep
{
bus_space_tag_t mem_bus_space_tag;
bus_space_handle_t mem_bus_space_handle;
+ bus_space_tag_t io_bus_space_tag;
+ bus_space_handle_t io_bus_space_handle;
+ bus_space_tag_t flash_bus_space_tag;
+ bus_space_handle_t flash_bus_space_handle;
struct device *dev;
struct pci_attach_args em_pa;
bus_size_t em_memsize;
bus_addr_t em_membase;
-
- bus_space_handle_t em_iobhandle;
- bus_space_tag_t em_iobtag;
bus_size_t em_iosize;
bus_addr_t em_iobase;
+ bus_size_t em_flashsize;
+ bus_addr_t em_flashbase;
};
#define E1000_WRITE_FLUSH(hw) E1000_READ_REG(hw, STATUS)
/* Read from an absolute offset in the adapter's memory space */
#define E1000_READ_OFFSET(hw, offset) \
- bus_space_read_4( ((struct em_osdep *)(hw)->back)->mem_bus_space_tag, \
- ((struct em_osdep *)(hw)->back)->mem_bus_space_handle, \
- offset)
+ bus_space_read_4(((struct em_osdep *)(hw)->back)->mem_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->mem_bus_space_handle, \
+ offset)
/* Write to an absolute offset in the adapter's memory space */
#define E1000_WRITE_OFFSET(hw, offset, value) \
- bus_space_write_4( ((struct em_osdep *)(hw)->back)->mem_bus_space_tag, \
- ((struct em_osdep *)(hw)->back)->mem_bus_space_handle, \
- offset, value)
+ bus_space_write_4(((struct em_osdep *)(hw)->back)->mem_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->mem_bus_space_handle, \
+ offset, value)
/* Convert a register name to its offset in the adapter's memory space */
#define E1000_REG_OFFSET(hw, reg) \
((hw)->mac_type >= em_82543 ? E1000_##reg : E1000_82542_##reg)
+/* Register READ/WRITE macros */
+
#define E1000_READ_REG(hw, reg) \
- E1000_READ_OFFSET(hw, E1000_REG_OFFSET(hw, reg))
+ bus_space_read_4(((struct em_osdep *)(hw)->back)->mem_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->mem_bus_space_handle, \
+ ((hw)->mac_type >= em_82543 ? E1000_##reg : E1000_82542_##reg))
#define E1000_WRITE_REG(hw, reg, value) \
- E1000_WRITE_OFFSET(hw, E1000_REG_OFFSET(hw, reg), value)
+ bus_space_write_4(((struct em_osdep *)(hw)->back)->mem_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->mem_bus_space_handle, \
+ ((hw)->mac_type >= em_82543 ? E1000_##reg : E1000_82542_##reg), \
+ value)
#define E1000_READ_REG_ARRAY(hw, reg, index) \
- E1000_READ_OFFSET(hw, E1000_REG_OFFSET(hw, reg) + ((index) << 2))
-
-#define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
+ bus_space_read_4(((struct em_osdep *)(hw)->back)->mem_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->mem_bus_space_handle, \
+ ((hw)->mac_type >= em_82543 ? E1000_##reg : E1000_82542_##reg) \
+ + ((index) << 2))
#define E1000_WRITE_REG_ARRAY(hw, reg, index, value) \
- E1000_WRITE_OFFSET(hw, E1000_REG_OFFSET(hw, reg) + ((index) << 2), value)
+ bus_space_write_4(((struct em_osdep *)(hw)->back)->mem_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->mem_bus_space_handle, \
+ ((hw)->mac_type >= em_82543 ? E1000_##reg : E1000_82542_##reg) \
+ + ((index) << 2), value)
+
+#define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
+#define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
#define E1000_WRITE_REG_ARRAY_BYTE(hw, reg, index, value) \
- bus_space_write_1( ((struct em_osdep *)(hw)->back)->mem_bus_space_tag, \
- ((struct em_osdep *)(hw)->back)->mem_bus_space_handle, \
- E1000_REG_OFFSET(hw, reg) + (index), \
- value)
+ bus_space_write_1(((struct em_osdep *)(hw)->back)->mem_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->mem_bus_space_handle, \
+ ((hw)->mac_type >= em_82543 ? E1000_##reg : E1000_82542_##reg \
+ + index), value)
#define E1000_WRITE_REG_ARRAY_WORD(hw, reg, index, value) \
- bus_space_write_2( ((struct em_osdep *)(hw)->back)->mem_bus_space_tag, \
- ((struct em_osdep *)(hw)->back)->mem_bus_space_handle, \
- E1000_REG_OFFSET(hw, reg) + (index), \
- value)
+ bus_space_write_2(((struct em_osdep *)(hw)->back)->mem_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->mem_bus_space_handle, \
+ ((hw)->mac_type >= em_82543 ? E1000_##reg : E1000_82542_##reg \
+ + (index << 1)), value)
+
+#define E1000_READ_ICH8_REG(hw, reg) \
+ bus_space_read_4(((struct em_osdep *)(hw)->back)->flash_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->flash_bus_space_handle, reg)
+
+#define E1000_READ_ICH8_REG16(hw, reg) \
+ bus_space_read_2(((struct em_osdep *)(hw)->back)->flash_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->flash_bus_space_handle, reg)
+
+#define E1000_WRITE_ICH8_REG(hw, reg, value) \
+ bus_space_write_4(((struct em_osdep *)(hw)->back)->flash_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->flash_bus_space_handle, \
+ reg, value)
-#define E1000_WRITE_REG_ARRAY_DWORD(hw, reg, index, value) \
- E1000_WRITE_OFFSET(hw, E1000_REG_OFFSET(hw, reg) + ((index) << 2), value)
+#define E1000_WRITE_ICH8_REG16(hw, reg, value) \
+ bus_space_write_2(((struct em_osdep *)(hw)->back)->flash_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->flash_bus_space_handle, \
+ reg, value)
#define em_io_read(hw, port) \
- bus_space_read_4(((struct em_osdep *)(hw)->back)->em_iobtag, \
- ((struct em_osdep *)(hw)->back)->em_iobhandle, (port))
+ bus_space_read_4(((struct em_osdep *)(hw)->back)->io_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->io_bus_space_handle, (port))
#define em_io_write(hw, port, value) \
- bus_space_write_4(((struct em_osdep *)(hw)->back)->em_iobtag, \
- ((struct em_osdep *)(hw)->back)->em_iobhandle, \
- (port), (value))
+ bus_space_write_4(((struct em_osdep *)(hw)->back)->io_bus_space_tag, \
+ ((struct em_osdep *)(hw)->back)->io_bus_space_handle, \
+ (port), (value))
#ifdef DEBUG
#define EM_KASSERT(exp,msg) do { if (!(exp)) panic msg; } while (0)