1 //==========================================================================
5 // HAL support code for NMI uEngine uE250 picasso
7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12 // Copyright (C) 2003 Gary Thomas <gary@mind.be>
14 // eCos is free software; you can redistribute it and/or modify it under
15 // the terms of the GNU General Public License as published by the Free
16 // Software Foundation; either version 2 or (at your option) any later version.
18 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
19 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 // You should have received a copy of the GNU General Public License along
24 // with eCos; if not, write to the Free Software Foundation, Inc.,
25 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27 // As a special exception, if other files instantiate templates or use macros
28 // or inline functions from this file, or you compile this file and link it
29 // with other works to produce a work based on this file, this file does not
30 // by itself cause the resulting work to be covered by the GNU General Public
31 // License. However the source code for this file must still be made available
32 // in accordance with section (3) of the GNU General Public License.
34 // This exception does not invalidate any other reasons why a work based on
35 // this file might be covered by the GNU General Public License.
37 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
38 // at http://sources.redhat.com/ecos/ecos-license/
39 // -------------------------------------------
40 //####ECOSGPLCOPYRIGHTEND####
41 //==========================================================================
42 //#####DESCRIPTIONBEGIN####
45 // Contributors: msalter, gthomas
47 // Purpose: PCI support
48 // Description: Implementations of HAL PCI interfaces
50 //####DESCRIPTIONEND####
52 //========================================================================*/
54 #include <pkgconf/hal.h>
55 #include <pkgconf/system.h>
56 #include CYGBLD_HAL_PLATFORM_H
57 #include CYGHWR_MEMORY_LAYOUT_H
59 #include <cyg/infra/cyg_type.h> // base types
60 #include <cyg/infra/cyg_trac.h> // tracing macros
61 #include <cyg/infra/cyg_ass.h> // assertion macros
62 #include <cyg/infra/diag.h> // diag_printf()
64 #include <cyg/hal/hal_io.h> // IO macros
65 #include <cyg/hal/hal_if.h> // calling interface API
66 #include <cyg/hal/hal_arch.h> // Register state info
67 #include <cyg/hal/hal_diag.h>
68 #include <cyg/hal/hal_intr.h> // Interrupt names
69 #include <cyg/hal/hal_cache.h>
70 #include <cyg/io/pci_hw.h>
71 #include <cyg/io/pci.h>
82 cyg_hal_plf_ide_read_uint8(int ctlr, cyg_uint32 reg)
84 return pci_io_read_8(ide_ctrl[ctlr].cmd_bar + reg);
88 cyg_hal_plf_ide_write_uint8(int ctlr, cyg_uint32 reg, cyg_uint8 val)
90 pci_io_write_8(ide_ctrl[ctlr].cmd_bar + reg, val);
94 cyg_hal_plf_ide_read_uint16(int ctlr, cyg_uint32 reg)
96 return pci_io_read_16(ide_ctrl[ctlr].cmd_bar + reg);
100 cyg_hal_plf_ide_write_uint16(int ctlr, cyg_uint32 reg, cyg_uint16 val)
102 pci_io_write_16(ide_ctrl[ctlr].cmd_bar + reg, val);
106 cyg_hal_plf_ide_write_control(int ctlr, cyg_uint32 reg, cyg_uint8 val)
108 pci_io_write_8(ide_ctrl[ctlr].ctl_bar + reg, val);
112 cyg_hal_plf_ide_init(void)
115 cyg_pci_device_id ide_dev = CYG_PCI_NULL_DEVID;
116 cyg_pci_device ide_info;
118 // diag_printf("Initializing IDE controller\n");
120 if (cyg_pci_find_device((cyg_uint16)0x1095, (cyg_uint16)0x0649, &ide_dev)) {
121 cyg_pci_get_device_info(ide_dev, &ide_info);
123 for (i = 0; i < 6; i++) {
124 diag_printf("IDE - base[%d]: %08p, size: %08p, map: %08p\n",
125 i, ide_info.base_address[i], ide_info.base_size[i], ide_info.base_map[i]);
128 for (i = 0; i < MAX_IDE; i++) {
129 ide_ctrl[i].cmd_bar = ide_info.base_map[(2*i)+0] & 0xFFFFFFFE;
130 ide_ctrl[i].ctl_bar = ide_info.base_map[(2*i)+1] & 0xFFFFFFFE;
132 return HAL_IDE_NUM_CONTROLLERS;
134 diag_printf("Can't find IDE controller!\n");
139 #endif // CYGPKG_IO_PCI