00001
00002
00011
00012
00013
00014
00015
00016
00017 #include <l4/sys/types.h>
00018 #include <l4/env/errno.h>
00019
00020
00021 #include <l4/generic_io/libio.h>
00022
00023
00024 #include "internal.h"
00025 #include "__macros.h"
00026
00027
00032
00033 int l4io_pci_find_slot(unsigned int bus, unsigned int slot, l4io_pci_dev_t * pci_dev)
00034 {
00035 int err;
00036 CORBA_Environment _env = dice_default_environment;
00037
00038 err = l4_io_pci_find_slot_call(&io_l4id, bus, slot, (l4_io_pci_dev_t *) pci_dev, &_env);
00039
00040
00041 return DICE_ERR(err, &_env);
00042 }
00043
00044 int l4io_pci_find_device(unsigned short vendor, unsigned short device,
00045 l4io_pdev_t start, l4io_pci_dev_t * pci_dev)
00046 {
00047 int err;
00048 CORBA_Environment _env = dice_default_environment;
00049
00050 err = l4_io_pci_find_device_call(&io_l4id, vendor, device, start,
00051 (l4_io_pci_dev_t *) pci_dev, &_env);
00052
00053
00054 return DICE_ERR(err, &_env);
00055 }
00056
00057 int l4io_pci_find_class(unsigned long class,
00058 l4io_pdev_t start, l4io_pci_dev_t * pci_dev)
00059 {
00060 int err;
00061 CORBA_Environment _env = dice_default_environment;
00062
00063 err = l4_io_pci_find_class_call(&io_l4id, class, start, (l4_io_pci_dev_t *)pci_dev, &_env);
00064
00065
00066 return DICE_ERR(err, &_env);
00067 }
00068
00069 int l4io_pci_readb_cfg(l4io_pdev_t pdev, int pos, l4_uint8_t * val)
00070 {
00071 int err;
00072 CORBA_Environment _env = dice_default_environment;
00073
00074 err = l4_io_pci_read_config_byte_call(&io_l4id, pdev, pos, val, &_env);
00075
00076
00077 return DICE_ERR(err, &_env);
00078 }
00079 int l4io_pci_readw_cfg(l4io_pdev_t pdev, int pos, l4_uint16_t * val)
00080 {
00081 int err;
00082 CORBA_Environment _env = dice_default_environment;
00083
00084 err = l4_io_pci_read_config_word_call(&io_l4id, pdev, pos, val, &_env);
00085
00086
00087 return DICE_ERR(err, &_env);
00088 }
00089 int l4io_pci_readl_cfg(l4io_pdev_t pdev, int pos, l4_uint32_t * val)
00090 {
00091 int err;
00092 CORBA_Environment _env = dice_default_environment;
00093
00094 err = l4_io_pci_read_config_dword_call(&io_l4id, pdev, pos, val, &_env);
00095
00096
00097 return DICE_ERR(err, &_env);
00098 }
00099
00100 int l4io_pci_writeb_cfg(l4io_pdev_t pdev, int pos, l4_uint8_t val)
00101 {
00102 int err;
00103 CORBA_Environment _env = dice_default_environment;
00104
00105 err = l4_io_pci_write_config_byte_call(&io_l4id, pdev, pos, val, &_env);
00106
00107
00108 return DICE_ERR(err, &_env);
00109 }
00110 int l4io_pci_writew_cfg(l4io_pdev_t pdev, int pos, l4_uint16_t val)
00111 {
00112 int err;
00113 CORBA_Environment _env = dice_default_environment;
00114
00115 err = l4_io_pci_write_config_word_call(&io_l4id, pdev, pos, val, &_env);
00116
00117
00118 return DICE_ERR(err, &_env);
00119 }
00120 int l4io_pci_writel_cfg(l4io_pdev_t pdev, int pos, l4_uint32_t val)
00121 {
00122 int err;
00123 CORBA_Environment _env = dice_default_environment;
00124
00125 err = l4_io_pci_write_config_dword_call(&io_l4id, pdev, pos, val, &_env);
00126
00127
00128 return DICE_ERR(err, &_env);
00129 }
00130
00131 int l4io_pci_enable(l4io_pdev_t pdev)
00132 {
00133 int err;
00134 CORBA_Environment _env = dice_default_environment;
00135
00136 err = l4_io_pci_enable_device_call(&io_l4id, pdev, &_env);
00137
00138
00139 return DICE_ERR(err, &_env);
00140 }
00141
00142 int l4io_pci_disable(l4io_pdev_t pdev)
00143 {
00144 int err;
00145 CORBA_Environment _env = dice_default_environment;
00146
00147 err = l4_io_pci_disable_device_call(&io_l4id, pdev, &_env);
00148
00149
00150 return DICE_ERR(err, &_env);
00151 }
00152
00153 void l4io_pci_set_master(l4io_pdev_t pdev)
00154 {
00155 int err;
00156 CORBA_Environment _env = dice_default_environment;
00157
00158 err = l4_io_pci_set_master_call(&io_l4id, pdev, &_env);
00159
00160
00161 DICE_ERR(err, &_env);
00162 }
00163
00164 int l4io_pci_set_pm(l4io_pdev_t pdev, int state)
00165 {
00166 int err;
00167 int old = state;
00168 CORBA_Environment _env = dice_default_environment;
00169
00170 err = l4_io_pci_set_power_state_call(&io_l4id, pdev, &old, &_env);
00171
00172
00173 DICE_ERR(err, &_env);
00174
00175 return old;
00176 }