Some more extensions to the FreeBSD compatibility layer.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23043 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-12-01 17:34:59 +00:00
parent 5536ea1018
commit 4a241f2ac3
4 changed files with 87 additions and 4 deletions

View File

@ -515,6 +515,50 @@ pci_get_revid(device_t dev)
}
uint32_t
pci_get_domain(device_t dev)
{
return 0;
}
uint8_t
pci_get_bus(device_t dev)
{
pci_info *info
= &((struct root_device_softc *)dev->root->softc)->pci_info;
return info->bus;
}
uint8_t
pci_get_slot(device_t dev)
{
pci_info *info
= &((struct root_device_softc *)dev->root->softc)->pci_info;
return info->device;
}
uint8_t
pci_get_function(device_t dev)
{
pci_info *info
= &((struct root_device_softc *)dev->root->softc)->pci_info;
return info->function;
}
device_t
pci_find_dbsf(uint32_t domain, uint8_t bus, uint8_t slot, uint8_t func)
{
// We don't support that yet - if we want to support the multi port
// feature of the Broadcom BCM 570x driver, we would have to change
// that.
return NULL;
}
static void
pci_set_command_bit(device_t dev, uint16_t bit)
{

View File

@ -9,6 +9,10 @@
#include <sys/bus.h>
#define PCI_RF_DENSE 0x10000
// ignored on x86
int pci_enable_busmaster(device_t dev);
int pci_enable_io(device_t dev, int reg);
@ -25,6 +29,13 @@ uint8_t pci_get_revid(device_t dev);
uint32_t pci_read_config(device_t dev, int reg, int width);
void pci_write_config(device_t dev, int reg, uint32_t val, int width);
uint32_t pci_get_domain(device_t dev);
uint8_t pci_get_bus(device_t dev);
uint8_t pci_get_slot(device_t dev);
uint8_t pci_get_function(device_t dev);
device_t pci_find_dbsf(uint32_t domain, uint8_t bus, uint8_t slot,
uint8_t func);
int pci_find_extcap(device_t dev, int capability, int *capreg);
int pci_msi_count(device_t dev);
@ -33,4 +44,10 @@ int pci_release_msi(device_t dev);
int pci_msix_count(device_t dev);
int pci_alloc_msix(device_t dev, int *count);
static inline int
pci_get_vpd_ident(device_t dev, const char **identptr)
{
return -1;
}
#endif /* _FBSD_COMPAT_DEV_PCI_PCIVAR_H_ */

View File

@ -1,3 +1,7 @@
/*
* Copyright 2007, Hugo Santos. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _FBSD_COMPAT_SYS_CALLOUT_H_
#define _FBSD_COMPAT_SYS_CALLOUT_H_
@ -16,13 +20,17 @@ struct callout {
};
void callout_init_mtx(struct callout *, struct mtx *, int);
void callout_init_mtx(struct callout *c, struct mtx *mutex, int flags);
int callout_reset(struct callout *, int, void (*)(void *), void *);
#define callout_drain(c) _callout_stop_safe(c, 1)
#define callout_stop(c) _callout_stop_safe(c, 0)
int _callout_stop_safe(struct callout *, int);
#define callout_pending(c) ((c)->c_timer.due > 0)
#define callout_active(c) ((c)->c_timer.due == -1)
// TODO: there is currently no way to find out about this!
static inline void
callout_init(struct callout *c, int mpsafe)
@ -33,4 +41,4 @@ callout_init(struct callout *c, int mpsafe)
callout_init_mtx(c, &Giant, 0);
}
#endif
#endif /* _FBSD_COMPAT_SYS_CALLOUT_H_ */

View File

@ -1,8 +1,18 @@
/*
* Copyright 2007, Hugo Santos. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _FBSD_COMPAT_SYS_PARAM_H_
#define _FBSD_COMPAT_SYS_PARAM_H_
#include <posix/sys/param.h>
/* The version this compatibility layer is based on */
#define __FreeBSD_version 700053
#define MAXBSIZE 0x10000
#define PAGE_SHIFT 12
@ -28,11 +38,15 @@
#define MCLSHIFT 11
#endif
#define MCLBYTES (1 << MCLSHIFT)
#define MCLBYTES (1 << MCLSHIFT)
#define MJUMPAGESIZE PAGE_SIZE
#define MJUM9BYTES (9 * 1024)
#define MJUM16BYTES (16 * 1024)
#define ALIGN_BYTES (sizeof(int) - 1)
#define ALIGN(x) ((((unsigned)x) + ALIGN_BYTES) & ~ALIGN_BYTES)
#define roundup2(x, y) (((x) + ((y) - 1)) & (~((y) - 1)))
#endif
#endif /* _FBSD_COMPAT_SYS_PARAM_H_ */