Ticket #14672: 0001-A-PCI-to-ISA-Bridge-header-file-and-a-test-for-it.patch

File 0001-A-PCI-to-ISA-Bridge-header-file-and-a-test-for-it.patch, 22.1 KB (added by Karvjorm, 5 years ago)

A patch for PCI-to-ISA header file and test file.

  • new file headers/os/drivers/pci_isa_bridge.h

    From 4efa731969b5139932ff502bd74f00deee89bea9 Mon Sep 17 00:00:00 2001
    From: Jorma Karvonen <karvonen.jorma@gmail.com>
    Date: Fri, 2 Nov 2018 22:12:27 +0200
    Subject: [PATCH] A PCI-to-ISA Bridge header file and a test for it.
    
    ---
     headers/os/drivers/pci_isa_bridge.h           | 687 ++++++++++++++++++
     .../kernel/drivers/pciisabridge/Jamfile       |   9 +
     .../kernel/drivers/pciisabridge/main.cpp      |  95 +++
     3 files changed, 791 insertions(+)
     create mode 100644 headers/os/drivers/pci_isa_bridge.h
     create mode 100644 src/tests/add-ons/kernel/drivers/pciisabridge/Jamfile
     create mode 100644 src/tests/add-ons/kernel/drivers/pciisabridge/main.cpp
    
    diff --git a/headers/os/drivers/pci_isa_bridge.h b/headers/os/drivers/pci_isa_bridge.h
    new file mode 100644
    index 0000000000..67df0827ee
    - +  
     1/*
     2 * Copyright 2018, Jorma Karvonen, karvonen.jorma_at_gmail.com.
     3 * All rights reserved.
     4 * Distributed under the terms of the MIT License.
     5 *
     6 * PC87200 is a PCI to ISA bus bridge developed by National Semiconductor
     7 * (later acquired by Texas Instruments) in 1999. The new PC99 specification
     8 * required then PC manufacturers to migrate from ISA to PCI system bus.
     9 * PCI-to-ISA Bridge converts PCI transactions to industry-standard
     10 * architecture (ISA) bus transactions and enables PC manufactures to
     11 * add up to four ISA slots to their PC99-compliant systems. ISA bus
     12 * was also used in some computer as an internal bus of the
     13 * computer even after ISA bus slots were removed from the modern
     14 * motherboards.
     15 */
     16
     17#ifndef _PCI_ISA_BRIDGE_H
     18#define _PCI_ISA_BRIDGE_H
     19
     20#include <SupportDefs.h>
     21
     22typedef struct __attribute__ ((packed)) {
     23    /**
     24    * 0 = Disable, 1 = Enable;
     25    */
     26    uint8 io_space: 1;
     27    /**
     28    * 0 = Disable, 1 = Enable;
     29    */
     30    uint8 memory_space: 1;
     31    /**
     32    * 0 = Disable, 1 = Enable;
     33    */
     34    uint8 bus_master: 1;
     35    /**
     36    * Not supported, it must always be set to 0.
     37    */
     38    uint8 speacial_cycles: 1;
     39    /**
     40    * Allow PC87200 to do memory write and invalidate
     41    * cycles, if the PCI cache line register is set to
     42    * 16 bytes (04h). 0 = Disable, 1 = Enable.
     43    */
     44    uint8 memory_write_and_invalidate: 1;
     45    /**
     46    * Read only - This function is not supported in
     47    * PC87200. It is always disabled (bit is set to 0).
     48    */
     49    uint8 vga_palette_snoop_enable: 1;
     50    /**
     51    * Allow PC87200 to check for parity errors on PCI
     52    * cycles for which it is a target, and to assert
     53    * PERR# when a parity error is detected:
     54    * 0 = Disable, 1 = Enable.
     55    */
     56    uint8 parity_error: 1;
     57    /**
     58    * Read only - This function is not supported in
     59    * PC87200. It is always disabled (bit is set to 0).
     60    */
     61    uint8 wait_cycle_control: 1;
     62    /**
     63    * Allow SERR# assertion on detection of special
     64    * errors: 0 = Disable, 1 = Enable.
     65    */
     66    uint8 serr_no: 1;
     67    /**
     68    * Read only - This function is not supported in
     69    * PC87200. It is always disabled (bit is set to 0).
     70    */
     71    uint8 fast_back_to_back_enable: 1;
     72    /**
     73    * Reserved - Set to 0.
     74    */
     75    uint8 reserved10: 6;
     76}  pci_command;
     77
     78typedef struct __attribute__ ((packed)) {
     79    /**
     80    * Reserved - Set to 0.
     81    */
     82    uint8 reserved: 6;
     83    /**
     84    * Fast Back-to-Back Capable - As a target, PC87200
     85    * is capable of accepting fast back-to-back transactions:
     86    * 0 = Disable, 1 = Enable. This bit is always set to 1.
     87    */
     88    uint8 fast_back_to_back_capable: 1;
     89    /**
     90    * Data Parity Detected - This bit is set when:
     91    * 1) The 87200 asserted PERR# or observed PERR# asserted.
     92    * 2) PC87200 is the master for the cycle in which the
     93    * PERR# occurred., and PE is set (F0 Index 04h[6] = 1).
     94    * Write 1 to clear.
     95    */
     96    uint8 data_parity_detected: 1;
     97    /**
     98    * Always 1 (Medium DEVSEL# timing or Reserved)
     99    */
     100    uint8 devsel_no_0: 1;
     101    /**
     102    * 0 = Medium - Always 0 as the PC87200 will always
     103    * respond to cycles for which it is an active target
     104    * with medium DEVSEL# timing.
     105    * 1 = Fast
     106    */
     107    uint8 devsel_no_1: 1;
     108    /**
     109    * Signalled Target Abort - This bit is set whenever
     110    * the 87200 signals a target abort. This occurs when
     111    * an address parity error occurs for an address that
     112    * hits in the  active address decode space of the
     113    * PC87200. Write 1 to clear.
     114    */
     115    uint8 signalled_target_abort: 1;
     116    /**
     117    * Received Target Abort - This bit is set whenever a
     118    * target abort is received while the PC87200 is the
     119    * master for the PCI cycle. Write 1 to clear.
     120    */
     121    uint8 received_target_abort: 1;
     122    /**
     123    * Received Master Abort - This bit is set whenever a
     124    * master abort cycle occurs. A master abort will occur
     125    * when a PCI cycle is not claimed, except for special
     126    * cycles. Write 1 to clear. Register is cleared after
     127    * RMA is read.
     128    */
     129    uint8 received_master_abort: 1;
     130    /**
     131    * Signalled System Error - This bit is set whenever
     132    * PC87200 asserts SERR# active. Write 1 to clear.
     133    */
     134    uint8 signalled_system_error: 1;
     135    /**
     136    * Detected Parity Error - This bit is set whenever
     137    * a parity error is detected. Write 1 to clear.
     138    */
     139    uint8 detected_parity_error: 1;
     140} pci_status;
     141
     142typedef struct __attribute__ ((packed)) {
     143    /** Index 09h. */
     144    uint8 readonly0;
     145    /** Index 0Ah. */
     146    uint8 readonly1;
     147    /** Index 0Bh. */
     148    uint8 readonly2;
     149} pci_class_code;
     150
     151typedef struct __attribute__ ((packed)) {
     152    uint8 pci_latency_timer_value: 4;
     153    /**
     154    * Reserved - Set to 0.
     155    */
     156    uint8 reserved: 4;
     157} pci_latency_timer;
     158
     159typedef struct __attribute__ ((packed)) {
     160    uint8 type: 7;
     161    /**
     162    * Multifunction device (bit7 = 1).
     163    * Not multifunction device (bit7 = 0).
     164    */
     165    uint8 multifunction: 1;
     166} pci_header_type;
     167
     168typedef struct __attribute__ ((packed)) {
     169    /**
     170    * BS8/16 - This bit can not be written. Always = 1.
     171    */
     172    uint8 bs8_slash_16: 1;
     173    /** Reserved - set to 0. */
     174    uint8 reserved: 2;
     175    /**
     176    * Write Buffer - PCI slave write buffer: 0 = Disable; 1 = Enable.
     177    */
     178    uint8 write_buffer: 1;
     179    /**
     180    * Retry PCI Cycles - Retry inbound PCI cycles if data is
     181    * buffered and waiting to go outbound on PCI:
     182    * 0 = No Retry; 1 = Retry.
     183    */
     184    uint8 retry_pci_cycles: 1;
     185    /**
     186    * Single Read Mode - PC87200 accepts only single cycle read
     187    * transfers as a slave on the PCI bus and performs a target
     188    * disconnected with the firs data transferred.
     189    * 0 = Disable; 1 = Enable.
     190    * Note: Bits 6 and 5 emulate the behaviour of first generation
     191    * devices developed for PCI.
     192    */
     193    uint8 single_read_mode: 1;
     194    /**
     195    * Single Write Mode - PC87200 accepts only single cycle write
     196    * transfers as a slave on the PCI bus and performs a target
     197    * disconnect with the first data transferred:
     198    * 0 = Disable (accepts burst write cycles);
     199    * 1 = Enable.
     200    * Note: Bits 6 and 5 emulate the behaviour of first generation
     201    * devices developed for PCI.
     202    */
     203    uint8 single_write_mode: 1;
     204    /** Internal use, do not overwrite. */
     205    uint8 internal_use_do_not_overwrite: 1;
     206} pci_function_control_1;
     207
     208typedef struct __attribute__ ((packed)) {
     209    /** Internal use, do not overwrite. */
     210    uint8 internal_use_do_not_overwite: 1;
     211    /**
     212    * Subtractive Decode - These bits determine the point at which
     213    * the PC87200 accepts cycles that are not claimed by another
     214    * device. The PC87200 defaults to taking subtractive decode
     215    * cycles in the default cycle clock, but can be moved up to the
     216    * Slow Decode cycle point if all other PCI devices decode in
     217    * the fast or medium clocks. Disabling subtractive decode must
     218    * be done with care, as all ISA and ROM cycles are decoded
     219    * subtractively.
     220    * 00 = Default sample (4th clock from FRAME# active)
     221    * 01 = Slow sample (3rd clock from FRAME# active)
     222    * 1x = No subtractive decode.
     223    */
     224    uint8 subtractive_decode: 2;
     225    /**
     226    * Internal use, do not overwrite.
     227    */
     228    uint8 another_internal_use: 1;
     229    /**
     230    * Write Buffer Enable - Allow 16-byte buffering for X-Bus
     231    * to PCI bus writes: 0 = Disable; 1 = Enable.
     232    */
     233    uint8 write_buffer_enable: 1;
     234    /**
     235    * PERR# Signals SERR# - Assert SERR# any time that PERR#
     236    * is asserted or detected active by the PC87200 (allows PERR#
     237    * assertion to be cascaded to NMI (SMI) generation in the
     238    * system): 0 = Disable; 1 = Enable.
     239    */
     240    uint8 perr_signals_serr: 1;
     241    /**
     242    * Internal use, do not overwrite.
     243    */
     244    uint8 again_internal_use: 1;
     245    /**
     246    * Burst to Beat - Bursts are converted to single beats for
     247    * X-Bus to PCI bus reads: 0 = Disable; 1 = Enable.
     248    */
     249    uint8 burst_to_beat: 1;
     250} pci_function_control_2;
     251
     252typedef struct __attribute__ ((packed)) {
     253    /**
     254    * Internal use, do not overwrite.
     255    */
     256    uint8 internal_use0: 1;
     257    /**
     258    * Internal use, do not overwrite.
     259    */
     260    uint8 internal_use1: 1;
     261    /**
     262    * Internal use, do not overwrite.
     263    */
     264    uint8 internal_use2: 1;
     265    /**
     266    * No X-Bus ARB, Buffer Enable - When PC87200 is a PCI target,
     267    * allow buffer PCI transactions without X-Bus arbitration:
     268    * 0 = Disable, 1 = Enable.
     269    */
     270    uint8 no_x_bus_arb: 1;
     271    /**
     272    * Internal use, do not overwrite.
     273    */
     274    uint8 internal_use4: 1;
     275    /**
     276    * Delayed Transactions - Allow delayed transactions on the
     277    * PCI bus: 0 = Disable, 1 = Enable.
     278    */
     279    uint8 delayed_transactions: 1;
     280    /**
     281    * Internal use, do not overwrite.
     282    */
     283    uint8 internal_use5: 1;
     284    /**
     285    * Internal use, do not overwrite.
     286    */
     287    uint8 internal_use6: 1;
     288} pci_function_control_3;
     289
     290typedef struct __attribute__ ((packed)) {
     291    /**
     292    * Internal use, do not overwrite.
     293    */
     294    uint8 internal_use0: 1;
     295    /**
     296    * PCI Retry Cycles - When PC87200 is a PCI target and
     297    * the PCI buffer is empty, allow PCI bus to retry
     298    * cycles.
     299    * 0 = Disable, 1 = Enable.
     300    * This works in conjunction with PCI bus delayed transactions
     301    * bit. F0 Index 42[5] must = 1 for this bit to be valid.
     302    */
     303    uint8 pci_retry_cycles: 1;
     304    /**
     305    * Internal use, do not overwrite.
     306    */
     307    uint8 internal_use1: 1;
     308    /**
     309    * Internal use, do not overwrite.
     310    */
     311    uint8 internal_use2: 1;
     312    /**
     313    * Internal use, do not overwrite.
     314    */
     315    uint8 internal_use3: 1;
     316    /**
     317    * Internal use, do not overwrite.
     318    */
     319    uint8 internal_use4: 1;
     320    /**
     321    * Internal use, do not overwrite.
     322    */
     323    uint8 internal_use5: 1;
     324    /**
     325    * Reserved. Set to 0.
     326    */
     327    uint8 reserved: 1;
     328} pci_function_control_4;
     329
     330typedef struct __attribute__ ((packed)) {
     331    /**
     332    * X-Bus Warm Start.
     333    * Write only: 0 = NOP, 1 = Execute system wide reset (used
     334    * only for clock configuration at power-up).
     335    */
     336    uint8 x_bus_warm_start: 1;
     337    /**
     338    * Internal use, do not overwrite.
     339    */
     340    uint8 internal_use0: 1;
     341    /**
     342    * Internal use, do not overwrite.
     343    */
     344    uint8 internal_use1: 1;
     345    /**
     346    * Internal use, do not overwrite.
     347    */
     348    uint8 internal_use2: 1;
     349    /**
     350    * Internal use, do not overwrite.
     351    */
     352    uint8 internal_use3: 1;
     353    /**
     354    * Internal use, do not overwrite.
     355    */
     356    uint8 internal_use4: 1;
     357    /**
     358    * Internal use, do not overwrite.
     359    */
     360    uint8 internal_use5: 1;
     361    /**
     362    * Internal use, do not overwrite.
     363    */
     364    uint8 internal_use6: 1;
     365} reset_control;
     366
     367typedef struct __attribute__ ((packed)) {
     368    /**
     369    * Determines the divisor of the PCI clock used to generate
     370    * the ISA bus clock.
     371    * 010 = Divide by three (ISA clock = 11MHz).
     372    * 011 = Divide by four (ISA clock = 8.33MHz).
     373    * All other values are invalid and can produce unexpected results.
     374    */
     375    uint8 isa_clock_divisor: 3;
     376    /**
     377    * Internal use, do not overwrite.
     378    */
     379    uint8 internal_use0: 1;
     380    /**
     381    * Internal use, do not overwrite.
     382    */
     383    uint8 internal_use1: 1;
     384    /**
     385    * Internal use, do not overwrite.
     386    */
     387    uint8 internal_use2: 1;
     388    /**
     389    * Internal use, do not overwrite.
     390    */
     391    uint8 internal_use3: 1;
     392    /**
     393    * Internal use, do not overwrite.
     394    */
     395    uint8 internal_use4: 1;
     396} isa_clk;
     397
     398typedef struct __attribute__ ((packed)) {
     399    /**
     400    * 16-bit I/O Recovery - These bits determine the number of
     401    * ISA bus clocks between back-to-back 16 bit I/O read cycles.
     402    * This count is in addition to a preset one-clock delay
     403    * built into the controller.
     404    * 0000 = 1 PCI clock1101 = 14 PCI clocks.
     405    * 0001 = 2 PCI clocks1110 = 15 PCI clocks.
     406    * 1111 = 16 PCI clocks.
     407    */
     408    uint8 isa_16bit_i_o_recovery: 4;
     409    /**
     410    * 8-bit I/O Recovery - These bits determine the number of
     411    * ISA bus clocks between back-to-back 8-bit I/O read cycle.
     412    * This count is in addition to a preset one-clock delay
     413    * built in the controller.
     414    */
     415    uint8 isa_8bit_i_o_recovery: 4;
     416} isa_i_o_recovery_control;
     417
     418typedef struct __attribute__ ((packed)) {
     419    /**
     420    * Internal use, do not overwrite.
     421    */
     422    uint8 internal_use0: 1;
     423    /**
     424    * Internal use, do not overwrite.
     425    */
     426    uint8 internal_use1: 1;
     427    /**
     428    * ROM 1MB Enable - Allow addressing to 512K or 1MB ROM
     429    * (FFF00000h - FFFFFFFFh).
     430    * 0 = Disable, 1 = Enable.
     431    */
     432    uint8 rom_1mb_enable: 1;
     433    /**
     434    * Internal use, do not overwrite.
     435    */
     436    uint8 internal_use2: 1;
     437    /**
     438    * Internal use, do not overwrite.
     439    */
     440    uint8 internal_use3: 1;
     441    /**
     442    * Internal use, do not overwrite.
     443    */
     444    uint8 internal_use4: 1;
     445    /**
     446    * Internal use, do not overwrite.
     447    */
     448    uint8 internal_use5: 1;
     449    /**
     450    * Internal use, do not overwrite.
     451    */
     452    uint8 internal_use6: 1;
     453} rom_at_logic_control;
     454
     455typedef struct __attribute__ ((packed)) {
     456    /**
     457    * Internal use, do not overwrite.
     458    */
     459    uint8 internal_use0: 1;
     460    /**
     461    * Internal use, do not overwrite.
     462    */
     463    uint8 internal_use1: 1;
     464    /**
     465    * Internal use, do not overwrite.
     466    */
     467    uint8 internal_use2: 1;
     468    /**
     469    * Internal use, do not overwrite.
     470    */
     471    uint8 internal_use3: 1;
     472    /**
     473    * Internal use, do not overwrite.
     474    */
     475    uint8 internal_use4: 1;
     476    /**
     477    * BIOS ROM Positive Decode - Selects positive or subtractive
     478    * decoding for accesses to the configured ROM space.
     479    * 0 = Subtractive, 1 = Positive.
     480    */
     481    uint8 bios_rom_positive_decode: 1;
     482    /**
     483    * Reserved - Set to 0.
     484    */
     485    uint8 reserved: 1;
     486    /**
     487    * Internal use, do not overwrite.
     488    */
     489    uint8 internal_use5: 1;
     490} decode_control;
     491
     492typedef struct bridge_configuration_registers {
     493    /**
     494    * Vendor Identification Register.
     495    * Index 00h - 01h.
     496    * Read only.
     497    * Reset Value 100Bh.
     498    */
     499    uint16 vendor_identification_register;
     500
     501    /**
     502    * Device Identification Register
     503    * Index 02h - 03h.
     504    * Read Only.
     505    * Reset Value 0021h.
     506    */
     507    uint16 device_identification_register;
     508
     509    /**
     510    * PCI Command Register.
     511    * Index 04h - 05h.
     512    * Read/Write.
     513    * Reset Value 0107h.
     514    */
     515    pci_command pci_command_register;
     516
     517    /**
     518    * PCI Status Register.
     519    * Index 06h - 07h.
     520    * Read/Write.
     521    * Reset value 0280h.
     522    */
     523    pci_status pci_status_register;
     524   
     525    /**
     526    * Device Revision ID Register.
     527    * Index 08h.
     528    * Read only.
     529    * Reset Value 00h.
     530    */
     531    uint8 device_revision_id_register;
     532   
     533    /**
     534    * PCI Class Code Register.
     535    * Index 09h - 0Bh.
     536    * Read only.
     537    * Reset Value 060100h.
     538    */
     539    pci_class_code pci_class_code_register;
     540   
     541    /**
     542    * PCI Cache Line Size Register.
     543    * Index 0Ch.
     544    * Read/Write. Reserved.
     545    * Reset Value 00h.
     546    */
     547    uint8 pci_cache_line_size_register;
     548   
     549    /**
     550    * PCI Latency Timer Value - The PCI Latency Timer.
     551    * Index 0Dh.
     552    * Read/Write.
     553    * Register prevents system lockup when a slave does
     554    * not respond to a cycle that the PC87200 masters. If the
     555    * value is set to 00h (default), the timer is disabled.
     556    * If the timer is written with any other value, bits [3:0]
     557    * become the four most significant bytes in a timer that
     558    * counts PCI clocks for slave response. The timer is reset
     559    * on each valid data transfer. If the counter expires before
     560    * the next assertion of TRDY# is received, the PC87200
     561    * stops the transaction with a master abort and asserts
     562    * SERR#, if enabled to do so.
     563    * Reset Value 00h.
     564    */
     565    pci_latency_timer pci_latency_timer_register;
     566   
     567    /**
     568    * PCI Header Type Register.
     569    * Index 0Eh.
     570    * Read only.
     571    * This register defines the format of this header.
     572    * This header is of type format 0. Additionally,
     573    * bit 7 defines whether this PCI device is a multifunction
     574    * device (bit7 = 1) or not (bit7 = 0).         
     575    * Reset Value 00h.
     576    */
     577    pci_header_type pci_header_type_register;
     578   
     579    /**
     580    * PCI BIST Register.
     581    * Index 0Fh.
     582    * Read only. Set to 0.
     583    * Reset Value 00h.
     584    */
     585    uint8 pci_bist_register;
     586   
     587    /**
     588    * Reserved registers.
     589    * Index 10h - 3Fh.
     590    * Do not access.
     591    * Reset Value 00h.
     592    */
     593    uint8 reserved[48];
     594   
     595    /**
     596    * PCI Function Control Register 1.
     597    * Index 40h.
     598    * Read/Write.
     599    * Reset value 79h.
     600    */
     601    pci_function_control_1 pci_function_control_register_1;
     602   
     603    /**
     604    * PCI Function Control Register 2.
     605    * Index 41h.
     606    * Read/Write.
     607    * Reset Value 10h.
     608    */
     609    pci_function_control_2 pci_function_control_register_2;
     610
     611    /**
     612    * PCI Function Control Register 3.
     613    * Index 42h.
     614    * Read/Write.
     615    * Reset Value 28h.
     616    */
     617    pci_function_control_3 pci_function_control_register_3;
     618
     619    /**
     620    * PCI Function Control Register 4.
     621    * Index 43h.
     622    * Read/Write.
     623    * Reset Value 46h.
     624    */
     625    pci_function_control_4 pci_function_control_register_4;
     626
     627    /**
     628    * Reset Control Register.
     629    * Index 44h.
     630    * Read/Write.
     631    * Reset Value 00000000b.
     632    */
     633    reset_control reset_control_register;
     634   
     635    /**
     636    * Internal use, do not overwrite.
     637    * Index 45h - 4Fh.
     638    */
     639    uint8 internal_use[11] ;
     640
     641    /**
     642    * ISA CLK Divider.
     643    * Index 50h.
     644    * Read/Write.
     645    * Reset Value 43h.
     646    */
     647    isa_clk isa_clk_divider;
     648   
     649    /**
     650    * ISA I/O Recovery Control Register.
     651    * Index 51h.
     652    * Read/Write.
     653    * Reset Value 43h.
     654    */
     655    isa_i_o_recovery_control isa_i_o_recovery_control_register;
     656   
     657    /**
     658    * ROM/AT Logic Control Register.
     659    * Index 52h.
     660    * Read/Write.
     661    * Reset Value 04h.
     662    */
     663    rom_at_logic_control rom_at_logic_control_register;
     664   
     665    /**
     666    * Internal use, do not overwrite.
     667    * Index 53h - 5Ah.
     668    */
     669    uint8 another_internal_use[8];
     670   
     671    /**
     672    * Decode Control Register 2.
     673    * Index 5Bh.
     674    * Read/Write.
     675    * Reset Value 00h.
     676    */
     677    decode_control decode_control_register_2;
     678   
     679    /**
     680    * Internal use, do not overwrite.
     681    * Index 5Ch - FFh.
     682    */
     683    uint8 third_internal_use[163];
     684}  __attribute__ ((packed)) pci_isa_bridge_configuration_registers;
     685
     686#endif /* _PCI_ISA_BRIDGE_H */
     687
  • new file src/tests/add-ons/kernel/drivers/pciisabridge/Jamfile

    diff --git a/src/tests/add-ons/kernel/drivers/pciisabridge/Jamfile b/src/tests/add-ons/kernel/drivers/pciisabridge/Jamfile
    new file mode 100644
    index 0000000000..35f15b8466
    - +  
     1SubDir HAIKU_TOP src tests add-ons kernel drivers pciisabridge ;
     2
     3UseHeaders [ FDirName $(HAIKU_TOP) headers os drivers ] : true ;
     4
     5Application pciisabridge_test :
     6    main.cpp   
     7    ;
     8
     9
  • new file src/tests/add-ons/kernel/drivers/pciisabridge/main.cpp

    diff --git a/src/tests/add-ons/kernel/drivers/pciisabridge/main.cpp b/src/tests/add-ons/kernel/drivers/pciisabridge/main.cpp
    new file mode 100644
    index 0000000000..99ab80f070
    - +  
     1/*
     2 * Copyright 2018, Jorma Karvonen, karvonen.jorma_at_gmail.com.
     3 * All rights reserved.
     4 * Distributed under the terms of the MIT License.
     5 */
     6
     7#include <stdio.h>
     8#include <pci_isa_bridge.h>
     9
     10int main(int argc, char* argv[])
     11{
     12    pci_isa_bridge_configuration_registers bridge;
     13    bridge.vendor_identification_register = 0xFFFF;
     14
     15    unsigned long arvo = (unsigned long)sizeof(bridge);
     16    if (arvo == (unsigned long)0xFF) {
     17    printf("PCI-to-ISA bridge configuration registers struct size : %lu bytes.\n",
     18         arvo);
     19    } else {
     20        printf("PCI-to-ISA bridge configuration registers struct size "\
     21            " should be %lu bytes, but it is %lu bytes.\n",
     22            (unsigned long)0xFF, arvo);
     23    }
     24
     25    printf("Vendor Identification Register struct size: %lu bytes. \n",
     26    (unsigned long)sizeof(bridge.vendor_identification_register));
     27
     28    printf("Device Identification Register struct size: %lu bytes. \n",
     29    (unsigned long)sizeof(bridge.device_identification_register));
     30
     31    printf("PCI Command Register struct size: %lu bytes. \n",
     32    (unsigned long)sizeof(bridge.pci_command_register));
     33
     34    printf("PCI Status Register struct size: %lu bytes. \n",
     35    (unsigned long)sizeof(bridge.pci_status_register));
     36
     37    printf("Device Revision ID Register struct size: %lu bytes. \n",
     38    (unsigned long)sizeof(bridge.device_revision_id_register));
     39
     40    printf("PCI Class Code Register struct size: %lu bytes.\n",
     41    (unsigned long)sizeof(bridge.pci_class_code_register));
     42
     43    printf("PCI Cache Line Size Register struct size: %lu bytes.\n",
     44    (unsigned long)sizeof(bridge.pci_cache_line_size_register));
     45
     46    printf("PCI Latency Timer Register struct size: %lu bytes.\n",
     47    (unsigned long)sizeof(bridge.pci_latency_timer_register));
     48
     49    printf("PCI Header Type Register struct size: %lu bytes.\n",
     50    (unsigned long)sizeof(bridge.pci_header_type_register));
     51
     52    printf("PCI BIST Register struct size: %lu bytes.\n",
     53    (unsigned long)sizeof(bridge.pci_bist_register));
     54
     55    printf("reserved[48] array size: %lu bytes. \n",
     56    (unsigned long)sizeof(bridge.reserved));
     57
     58    printf("PCI Function Control Register 1 struct size: %lu bytes. \n",
     59    (unsigned long)sizeof(bridge.pci_function_control_register_1));
     60
     61    printf("PCI Function Control Register 2 struct size: %lu bytes. \n",
     62    (unsigned long)sizeof(bridge.pci_function_control_register_2));
     63
     64    printf("PCI Function Control Register 3 struct size: %lu bytes. \n",
     65    (unsigned long)sizeof(bridge.pci_function_control_register_3));
     66
     67    printf("PCI Function Control Register 4 struct size: %lu bytes. \n",
     68    (unsigned long)sizeof(bridge.pci_function_control_register_4));
     69
     70    printf("Reset Control Register struct size: %lu bytes. \n",
     71    (unsigned long)sizeof(bridge.reset_control_register));
     72
     73    printf("internal_use[11] array size: %lu bytes. \n",
     74    (unsigned long)sizeof(bridge.internal_use));
     75
     76    printf("ISA CLK Divider struct size: %lu bytes.\n",
     77    (unsigned long)sizeof(bridge.isa_clk_divider));
     78
     79    printf("ISA I/O Recovery Control Register struct size: %lu bytes. \n",
     80    (unsigned long)sizeof(bridge.isa_i_o_recovery_control_register));
     81
     82    printf("ROM/AT Logic Control Register struct size: %lu bytes. \n",
     83    (unsigned long)sizeof(bridge.rom_at_logic_control_register));
     84
     85    printf("another_intenal_use[8] array size: %lu bytes. \n",
     86    (unsigned long)sizeof(bridge.another_internal_use));
     87
     88    printf("Decode Control Register 2 struct size: %lu bytes. \n",
     89    (unsigned long)sizeof(bridge.decode_control_register_2));
     90
     91    printf("third_Intenal_use[163] array size: %lu bytes. \n",
     92    (unsigned long)sizeof(bridge.third_internal_use));
     93
     94    return 0;
     95}