summaryrefslogtreecommitdiffstats
path: root/sys/pci/pcivar.h
diff options
context:
space:
mode:
authorse <se@FreeBSD.org>1995-03-21 23:01:06 +0000
committerse <se@FreeBSD.org>1995-03-21 23:01:06 +0000
commit6e667246cd96976e175eec9db61940c42681a155 (patch)
treeb8fe80494fb6a00dba99beff8518fb3df91f57f1 /sys/pci/pcivar.h
parent4f9285470770c38619fdabbc8b376026e3ed4767 (diff)
downloadFreeBSD-src-6e667246cd96976e175eec9db61940c42681a155.zip
FreeBSD-src-6e667246cd96976e175eec9db61940c42681a155.tar.gz
Completely new PCI code:
1) Supports PCI to PCI bridge devices (and tries to initialise them, even if the BIOS is brain dead). 2) Supports shared PCI interrupts. Interrupt handlers now MUST return '0' if they found nothing to do, '1' otherwise. New features tested with i486 systems based on the Intel Saturn and a DEC 4channel Ethernet card only, but expected to work on most systems. The option PCI_REMAP has been removed ! Submitted by: Wolfgang Stanglmeier <wolf@kintaro.cologne.de>
Diffstat (limited to 'sys/pci/pcivar.h')
-rw-r--r--sys/pci/pcivar.h114
1 files changed, 56 insertions, 58 deletions
diff --git a/sys/pci/pcivar.h b/sys/pci/pcivar.h
index 4e62dbf..23bc8ae 100644
--- a/sys/pci/pcivar.h
+++ b/sys/pci/pcivar.h
@@ -1,10 +1,10 @@
/**************************************************************************
**
-** $Id: pcivar.h,v 1.2 1995/02/27 17:17:14 se Exp $
+** $Id: pcivar.h,v 1.3 1995/03/17 04:27:21 davidg Exp $
**
** Declarations for pci device drivers.
**
-** 386bsd / FreeBSD
+** FreeBSD
**
**-------------------------------------------------------------------------
**
@@ -36,10 +36,8 @@
*/
#ifndef __PCI_VAR_H__
-#define __PCI_VAR_H__
+#define __PCI_VAR_H__ "pl2 95/03/21"
-#define PCIVAR_H_PATCHLEVEL "pl1 95/02/27"
-
/*-----------------------------------------------------------------
**
** main pci initialization function.
@@ -60,13 +58,16 @@ void pci_configure (void);
typedef union {
u_long cfg1;
- struct {
+ struct {
u_char enable;
u_char forward;
u_short port;
} cfg2;
+ unsigned tag;
} pcici_t;
+#define sametag(x,y) ((x).tag == (y).tag)
+
/*-----------------------------------------------------------------
**
** Each pci device has an unique device id.
@@ -98,7 +99,7 @@ typedef u_long pcidi_t;
u_long pci_conf_read (pcici_t tag, u_long reg );
void pci_conf_write (pcici_t tag, u_long reg, u_long data);
-
+
/*-----------------------------------------------------------------
**
** The pci driver structure.
@@ -141,7 +142,11 @@ struct pci_device {
*/
extern struct linker_set pcidevice_set;
-
+
+extern unsigned pci_max_burst_len; /* log2 of safe burst transfer length */
+extern unsigned pci_mechanism;
+extern unsigned pci_maxdevice;
+
/*-----------------------------------------------------------------
**
** The pci-devconf interface.
@@ -150,8 +155,8 @@ extern struct linker_set pcidevice_set;
*/
struct pci_info {
- u_short pi_bus;
- u_short pi_device;
+ u_short pi_bus;
+ u_short pi_device;
};
#define PCI_EXT_CONF_LEN (16)
@@ -162,31 +167,18 @@ struct pci_externalize_buffer {
u_long peb_config[PCI_EXT_CONF_LEN];
};
-
-/*-----------------------------------------------------------------
-**
-** Register an additional pci bus for probing.
-** Called by pci-pci bridge handlers.
-**
-**-----------------------------------------------------------------
-*/
-
-int pci_map_bus (pcici_t tag, u_long bus);
-
/*-----------------------------------------------------------------
**
** Map a pci device to physical and virtual memory.
**
-** The va and pa addresses are "in/out" parameters.
-** If they are 0 on entry, the function assigns an address.
-**
-** Entry selects the register in the pci configuration
+** Entry selects the register in the pci configuration
** space, which supplies the size of the region, and
** receives the physical address.
**
-** If there is any error, a message is written, and
-** the function returns with zero.
-** Else it returns with a value different to zero.
+** In case of success the function sets the addresses
+** in *va and *pa, and returns 1.
+** In case of errors a message is written,
+** and the function returns 0.
**
**-----------------------------------------------------------------
*/
@@ -197,59 +189,65 @@ int pci_map_mem (pcici_t tag, u_long entry, u_long * va, u_long * pa);
**
** Map a pci device to an io port area.
**
-** *pa is an "in/out" parameter.
-** If it's 0 on entry, the function assigns an port number..
-**
** Entry selects the register in the pci configuration
** space, which supplies the size of the region, and
** receives the port number.
**
-** If there is any error, a message is written, and
-** the function returns with zero.
-** Else it returns with a value different to zero.
+** In case of success the function sets the port number in pa,
+** and returns 1.
+** In case of errors a message is written,
+** and the function returns 0.
**
**-----------------------------------------------------------------
*/
-int pci_map_port(pcici_t tag, u_long entry, u_short * pa);
-
+int pci_map_port (pcici_t tag, u_long entry, u_short * pa);
+
/*-----------------------------------------------------------------
**
-** Map a pci interrupt to an isa irq line,
-** and enable the interrupt.
+** Map a pci interrupt to an isa irq line, and enable the interrupt.
**
-** func is the interrupt handler, arg is the argument
-** to this function.
+** -----------------
**
-** The maskptr argument should be &bio_imask,
-** &net_imask etc. or NULL.
+** func is the interrupt handler, arg is the argument
+** to the handler (usually a pointer to a softc).
**
-** If there is any error, a message is written, and
-** the function returns with zero.
-** Else it returns with a value different to zero.
+** The maskptr argument should be &bio_imask,
+** &net_imask etc. or NULL.
**
-** A word of caution for FreeBSD 2.0:
+** If there is any error, a message is written, and
+** the function returns with zero.
+** Else it returns with a value different to zero.
**
-** We use the register_intr() function.
+** -----------------
**
-** The interrupt line of the selected device is included
-** into the supplied mask: after the corresponding splXXX
-** this drivers interrupts are blocked.
+** The irq number is read from the configuration space.
+** (Should have been set by the bios).
**
-** But in the interrupt handlers startup code ONLY
-** the interrupt of the driver is blocked, and NOT
-** all interrupts of the spl group.
+** Supports multiple handlers per irq (shared interrupts).
**
-** It may be required to additional block the group
-** interrupts by splXXX() inside the interrupt handler.
+** -----------------
**
-** In pre 2.0 kernels we emulate the register_intr
-** function. The emulating function blocks all interrupts
-** of the group in the interrupt handler prefix code.
+** There is code to support shared edge triggered ints.
+** This relies on the cooperation of the interrupt handlers:
+** they have to return a value <>0 if and only if something
+** was done. Beware of the performance penalty.
**
**-----------------------------------------------------------------
*/
+struct pci_int_desc {
+ struct pci_int_desc * pcid_next;
+ pcici_t pcid_tag;
+ int (*pcid_handler)();
+ void* pcid_argument;
+ unsigned * pcid_maskptr;
+ unsigned pcid_tally;
+ unsigned pcid_mask;
+};
+
int pci_map_int (pcici_t tag, int (*func)(), void* arg, unsigned * maskptr);
+int pci_unmap_int (pcici_t tag);
+
#endif
OpenPOWER on IntegriCloud