Changeset 178673c in mainline for uspace/drv/rootpc/rootpc.c


Ignore:
Timestamp:
2010-11-30T00:38:54Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ab3a851
Parents:
6f9e7fea
Message:

rootia32 driver works for amd64 as well

The driver was renamed to rootpc and is available for both
ia32 and amd64.

The PCI and NS8250 drivers were fixed to be compilable under amd64.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/rootpc/rootpc.c

    r6f9e7fea r178673c  
    2828
    2929/**
    30  * @defgroup root_ia32 Root HW device driver for ia32 platform.
    31  * @brief HelenOS root HW device driver for ia32 platform.
     30 * @defgroup root_pc Root HW device driver for ia32 and amd64 platform.
     31 * @brief HelenOS root HW device driver for ia32 and amd64 platform.
    3232 * @{
    3333 */
     
    5353#include <device/hw_res.h>
    5454
    55 #define NAME "rootia32"
    56 
    57 typedef struct rootia32_child_dev_data {
     55#define NAME "rootpc"
     56
     57typedef struct rootpc_child_dev_data {
    5858        hw_resource_list_t hw_resources;
    59 } rootia32_child_dev_data_t;
    60 
    61 static int rootia32_add_device(device_t *dev);
    62 static void root_ia32_init(void);
     59} rootpc_child_dev_data_t;
     60
     61static int rootpc_add_device(device_t *dev);
     62static void root_pc_init(void);
    6363
    6464/** The root device driver's standard operations. */
    65 static driver_ops_t rootia32_ops = {
    66         .add_device = &rootia32_add_device
     65static driver_ops_t rootpc_ops = {
     66        .add_device = &rootpc_add_device
    6767};
    6868
    6969/** The root device driver structure. */
    70 static driver_t rootia32_driver = {
     70static driver_t rootpc_driver = {
    7171        .name = NAME,
    72         .driver_ops = &rootia32_ops
     72        .driver_ops = &rootpc_ops
    7373};
    7474
     
    8282};
    8383
    84 static rootia32_child_dev_data_t pci_data = {
     84static rootpc_child_dev_data_t pci_data = {
    8585        .hw_resources = {
    8686                1,
     
    8989};
    9090
    91 static hw_resource_list_t *rootia32_get_child_resources(device_t *dev)
    92 {
    93         rootia32_child_dev_data_t *data;
    94        
    95         data = (rootia32_child_dev_data_t *) dev->driver_data;
     91static hw_resource_list_t *rootpc_get_child_resources(device_t *dev)
     92{
     93        rootpc_child_dev_data_t *data;
     94       
     95        data = (rootpc_child_dev_data_t *) dev->driver_data;
    9696        if (NULL == data)
    9797                return NULL;
     
    100100}
    101101
    102 static bool rootia32_enable_child_interrupt(device_t *dev)
     102static bool rootpc_enable_child_interrupt(device_t *dev)
    103103{
    104104        /* TODO */
     
    108108
    109109static resource_iface_t child_res_iface = {
    110         &rootia32_get_child_resources,
    111         &rootia32_enable_child_interrupt
    112 };
    113 
    114 /* Initialized in root_ia32_init() function. */
    115 static device_ops_t rootia32_child_ops;
     110        &rootpc_get_child_resources,
     111        &rootpc_enable_child_interrupt
     112};
     113
     114/* Initialized in root_pc_init() function. */
     115static device_ops_t rootpc_child_ops;
    116116
    117117static bool
    118 rootia32_add_child(device_t *parent, const char *name, const char *str_match_id,
    119     rootia32_child_dev_data_t *drv_data)
     118rootpc_add_child(device_t *parent, const char *name, const char *str_match_id,
     119    rootpc_child_dev_data_t *drv_data)
    120120{
    121121        printf(NAME ": adding new child device '%s'.\n", name);
     
    142142       
    143143        /* Set provided operations to the device. */
    144         child->ops = &rootia32_child_ops;
     144        child->ops = &rootpc_child_ops;
    145145       
    146146        /* Register child device. */
     
    164164}
    165165
    166 static bool rootia32_add_children(device_t *dev)
    167 {
    168         return rootia32_add_child(dev, "pci0", "intel_pci", &pci_data);
     166static bool rootpc_add_children(device_t *dev)
     167{
     168        return rootpc_add_child(dev, "pci0", "intel_pci", &pci_data);
    169169}
    170170
     
    175175 * @return              Zero on success, negative error number otherwise.
    176176 */
    177 static int rootia32_add_device(device_t *dev)
    178 {
    179         printf(NAME ": rootia32_add_device, device handle = %d\n", dev->handle);
     177static int rootpc_add_device(device_t *dev)
     178{
     179        printf(NAME ": rootpc_add_device, device handle = %d\n", dev->handle);
    180180       
    181181        /* Register child devices. */
    182         if (!rootia32_add_children(dev)) {
     182        if (!rootpc_add_children(dev)) {
    183183                printf(NAME ": failed to add child devices for platform "
    184184                    "ia32.\n");
     
    188188}
    189189
    190 static void root_ia32_init(void)
    191 {
    192         rootia32_child_ops.interfaces[HW_RES_DEV_IFACE] = &child_res_iface;
     190static void root_pc_init(void)
     191{
     192        rootpc_child_ops.interfaces[HW_RES_DEV_IFACE] = &child_res_iface;
    193193}
    194194
    195195int main(int argc, char *argv[])
    196196{
    197         printf(NAME ": HelenOS rootia32 device driver\n");
    198         root_ia32_init();
    199         return driver_main(&rootia32_driver);
     197        printf(NAME ": HelenOS rootpc device driver\n");
     198        root_pc_init();
     199        return driver_main(&rootpc_driver);
    200200}
    201201
Note: See TracChangeset for help on using the changeset viewer.