diff options
author | grehan <grehan@FreeBSD.org> | 2012-05-03 03:11:27 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2012-05-03 03:11:27 +0000 |
commit | a913fe5916677166a9ec486f83637d7b78eb4ec6 (patch) | |
tree | b88b86c0a6c8a12d92ecaa43d3cff92296642c2a /usr.sbin/bhyve/pci_emul.h | |
parent | 9f0c999f8126597eb572b80056df88335dbd0070 (diff) | |
download | FreeBSD-src-a913fe5916677166a9ec486f83637d7b78eb4ec6.zip FreeBSD-src-a913fe5916677166a9ec486f83637d7b78eb4ec6.tar.gz |
Add 16550 uart emulation as a PCI device. This allows it to
be activated as part of the slot config options.
The syntax is:
-s <slotnum>,uart[,stdio]
The stdio parameter instructs the code to perform i/o using
stdin/stdout. It can only be used for one instance.
To allow legacy i/o ports/irqs to be used, a new variant of
the slot command, -S, is introduced. When used to specify a
slot, the device will use legacy resources if it supports
them; otherwise it will be treated the same as the '-s' option.
Specifying the -S option with the uart will first use the 0x3f8/irq 4
config, and the second -S will use 0x2F8/irq 3.
Interrupt delivery is awaiting the arrival of the i/o apic code,
but this works fine in uart(4)'s polled mode.
This code was written by Cynthia Lu @ MIT while an intern at NetApp,
with further work from neel@ and grehan@.
Obtained from: NetApp
Diffstat (limited to 'usr.sbin/bhyve/pci_emul.h')
-rw-r--r-- | usr.sbin/bhyve/pci_emul.h | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h index 588e5ba..19dba99 100644 --- a/usr.sbin/bhyve/pci_emul.h +++ b/usr.sbin/bhyve/pci_emul.h @@ -102,6 +102,7 @@ struct pci_devinst { struct pci_devemu *pi_d; struct vmctx *pi_vmctx; uint8_t pi_bus, pi_slot, pi_func; + uint8_t pi_lintr_pin; char pi_name[PI_NAMESZ]; uint16_t pi_iobase; int pi_bar_getsize; @@ -149,22 +150,25 @@ struct msixcap { uint32_t pba_offset; } __packed; -void init_pci(struct vmctx *ctx); -void pci_parse_slot(char *opt); -void pci_parse_name(char *opt); -void pci_callback(void); -int pci_emul_alloc_bar(struct pci_devinst *pdi, int idx, uint64_t hostbase, - enum pcibar_type type, uint64_t size); -int pci_emul_add_msicap(struct pci_devinst *pi, int msgnum); -void msicap_cfgwrite(struct pci_devinst *pi, int capoff, int offset, - int bytes, uint32_t val); -void msixcap_cfgwrite(struct pci_devinst *pi, int capoff, int offset, - int bytes, uint32_t val); - -void pci_generate_msi(struct pci_devinst *pi, int msgnum); -int pci_msi_enabled(struct pci_devinst *pi); -int pci_msi_msgnum(struct pci_devinst *pi); -void pci_populate_msicap(struct msicap *cap, int msgs, int nextptr); +void init_pci(struct vmctx *ctx); +void msicap_cfgwrite(struct pci_devinst *pi, int capoff, int offset, + int bytes, uint32_t val); +void msixcap_cfgwrite(struct pci_devinst *pi, int capoff, int offset, + int bytes, uint32_t val); +void pci_callback(void); +int pci_emul_alloc_bar(struct pci_devinst *pdi, int idx, uint64_t hostbase, + enum pcibar_type type, uint64_t size); +int pci_emul_add_msicap(struct pci_devinst *pi, int msgnum); +int pci_is_legacy(struct pci_devinst *pi); +void pci_generate_msi(struct pci_devinst *pi, int msgnum); +void pci_lintr_assert(struct pci_devinst *pi); +void pci_lintr_deassert(struct pci_devinst *pi); +int pci_lintr_request(struct pci_devinst *pi, int ivec); +int pci_msi_enabled(struct pci_devinst *pi); +int pci_msi_msgnum(struct pci_devinst *pi); +void pci_parse_name(char *opt); +void pci_parse_slot(char *opt, int legacy); +void pci_populate_msicap(struct msicap *cap, int msgs, int nextptr); static __inline void pci_set_cfgdata8(struct pci_devinst *pi, int offset, uint8_t val) |