blob: 62acfeb5a7578c000934a88a3c1da1b033473bbf [file] [log] [blame]
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +00001/*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2000 Silicon Integrated System Corporation
5 * Copyright (C) 2000 Ronald G. Minnich <rminnich@gmail.com>
6 * Copyright (C) 2005-2009 coresystems GmbH
7 * Copyright (C) 2006-2009 Carl-Daniel Hailfinger
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef __PROGRAMMER_H__
25#define __PROGRAMMER_H__ 1
26
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +000027#include "flash.h" /* for chipaddr and flashctx */
Carl-Daniel Hailfinger532c7172011-11-04 21:35:26 +000028
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +000029enum programmer {
30#if CONFIG_INTERNAL == 1
31 PROGRAMMER_INTERNAL,
32#endif
33#if CONFIG_DUMMY == 1
34 PROGRAMMER_DUMMY,
35#endif
36#if CONFIG_NIC3COM == 1
37 PROGRAMMER_NIC3COM,
38#endif
39#if CONFIG_NICREALTEK == 1
40 PROGRAMMER_NICREALTEK,
Idwer Vollering004f4b72010-09-03 18:21:21 +000041#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +000042#if CONFIG_NICNATSEMI == 1
43 PROGRAMMER_NICNATSEMI,
Idwer Vollering004f4b72010-09-03 18:21:21 +000044#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +000045#if CONFIG_GFXNVIDIA == 1
46 PROGRAMMER_GFXNVIDIA,
47#endif
48#if CONFIG_DRKAISER == 1
49 PROGRAMMER_DRKAISER,
50#endif
51#if CONFIG_SATASII == 1
52 PROGRAMMER_SATASII,
53#endif
54#if CONFIG_ATAHPT == 1
55 PROGRAMMER_ATAHPT,
56#endif
Jonathan Kollasch7f0f3fa2014-06-01 10:26:23 +000057#if CONFIG_ATAVIA == 1
58 PROGRAMMER_ATAVIA,
59#endif
Kyösti Mälkki72d42f82014-06-01 23:48:31 +000060#if CONFIG_IT8212 == 1
61 PROGRAMMER_IT8212,
62#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +000063#if CONFIG_FT2232_SPI == 1
64 PROGRAMMER_FT2232_SPI,
65#endif
66#if CONFIG_SERPROG == 1
67 PROGRAMMER_SERPROG,
68#endif
69#if CONFIG_BUSPIRATE_SPI == 1
70 PROGRAMMER_BUSPIRATE_SPI,
71#endif
72#if CONFIG_DEDIPROG == 1
73 PROGRAMMER_DEDIPROG,
74#endif
75#if CONFIG_RAYER_SPI == 1
76 PROGRAMMER_RAYER_SPI,
77#endif
Virgil-Adrian Teacada7c5452012-04-30 23:11:06 +000078#if CONFIG_PONY_SPI == 1
79 PROGRAMMER_PONY_SPI,
80#endif
Carl-Daniel Hailfingerb713d2e2011-05-08 00:24:18 +000081#if CONFIG_NICINTEL == 1
82 PROGRAMMER_NICINTEL,
83#endif
Idwer Vollering004f4b72010-09-03 18:21:21 +000084#if CONFIG_NICINTEL_SPI == 1
85 PROGRAMMER_NICINTEL_SPI,
86#endif
Ricardo Ribalda Delgado2a41f0a2014-07-28 20:35:21 +000087#if CONFIG_NICINTEL_EEPROM == 1
88 PROGRAMMER_NICINTEL_EEPROM,
89#endif
Mark Marshall90021f22010-12-03 14:48:11 +000090#if CONFIG_OGP_SPI == 1
91 PROGRAMMER_OGP_SPI,
92#endif
Carl-Daniel Hailfinger9a1105c2011-02-04 21:37:59 +000093#if CONFIG_SATAMV == 1
94 PROGRAMMER_SATAMV,
95#endif
Sven Schnelle5ce5f702011-09-03 18:37:52 +000096#if CONFIG_LINUX_SPI == 1
97 PROGRAMMER_LINUX_SPI,
98#endif
James Lairdc60de0e2013-03-27 13:00:23 +000099#if CONFIG_USBBLASTER_SPI == 1
100 PROGRAMMER_USBBLASTER_SPI,
101#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000102 PROGRAMMER_INVALID /* This must always be the last entry. */
103};
104
Stefan Tauneraf358d62012-12-27 18:40:26 +0000105enum programmer_type {
106 PCI = 1, /* to detect uninitialized values */
107 USB,
108 OTHER,
109};
110
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000111struct dev_entry {
112 uint16_t vendor_id;
113 uint16_t device_id;
114 const enum test_state status;
115 const char *vendor_name;
116 const char *device_name;
117};
118
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000119struct programmer_entry {
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000120 const char *name;
Stefan Tauneraf358d62012-12-27 18:40:26 +0000121 const enum programmer_type type;
122 union {
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000123 const struct dev_entry *const dev;
Stefan Tauneraf358d62012-12-27 18:40:26 +0000124 const char *const note;
125 } devs;
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000126
127 int (*init) (void);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000128
Stefan Tauner305e0b92013-07-17 23:46:44 +0000129 void *(*map_flash_region) (const char *descr, uintptr_t phys_addr, size_t len);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000130 void (*unmap_flash_region) (void *virt_addr, size_t len);
131
Stefan Taunerf80419c2014-05-02 15:41:42 +0000132 void (*delay) (unsigned int usecs);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000133};
134
135extern const struct programmer_entry programmer_table[];
136
Nico Huberbcb2e5a2012-12-30 01:23:17 +0000137int programmer_init(enum programmer prog, const char *param);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000138int programmer_shutdown(void);
139
140enum bitbang_spi_master_type {
141 BITBANG_SPI_INVALID = 0, /* This must always be the first entry. */
142#if CONFIG_RAYER_SPI == 1
143 BITBANG_SPI_MASTER_RAYER,
144#endif
Virgil-Adrian Teacada7c5452012-04-30 23:11:06 +0000145#if CONFIG_PONY_SPI == 1
146 BITBANG_SPI_MASTER_PONY,
147#endif
Idwer Vollering004f4b72010-09-03 18:21:21 +0000148#if CONFIG_NICINTEL_SPI == 1
149 BITBANG_SPI_MASTER_NICINTEL,
150#endif
Carl-Daniel Hailfinger2f436162010-07-28 15:08:35 +0000151#if CONFIG_INTERNAL == 1
152#if defined(__i386__) || defined(__x86_64__)
153 BITBANG_SPI_MASTER_MCP,
154#endif
155#endif
Mark Marshall90021f22010-12-03 14:48:11 +0000156#if CONFIG_OGP_SPI == 1
157 BITBANG_SPI_MASTER_OGP,
158#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000159};
160
161struct bitbang_spi_master {
162 enum bitbang_spi_master_type type;
163
164 /* Note that CS# is active low, so val=0 means the chip is active. */
165 void (*set_cs) (int val);
166 void (*set_sck) (int val);
167 void (*set_mosi) (int val);
168 int (*get_miso) (void);
Carl-Daniel Hailfinger28228882010-09-15 00:17:37 +0000169 void (*request_bus) (void);
170 void (*release_bus) (void);
Carl-Daniel Hailfingerc40cff72011-12-20 00:19:29 +0000171 /* Length of half a clock period in usecs. */
172 unsigned int half_period;
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000173};
174
Carl-Daniel Hailfingera2faddf2013-01-05 23:52:45 +0000175#if NEED_PCI == 1
Patrick Georgi32508eb2012-07-20 20:35:14 +0000176struct pci_dev;
Carl-Daniel Hailfingera2faddf2013-01-05 23:52:45 +0000177
178/* pcidev.c */
Stefan Tauner0ccec8f2014-06-01 23:49:03 +0000179// FIXME: This needs to be local, not global(?)
Carl-Daniel Hailfingera2faddf2013-01-05 23:52:45 +0000180extern struct pci_access *pacc;
181int pci_init_common(void);
182uintptr_t pcidev_readbar(struct pci_dev *dev, int bar);
183struct pci_dev *pcidev_init(const struct dev_entry *devs, int bar);
184/* rpci_write_* are reversible writes. The original PCI config space register
185 * contents will be restored on shutdown.
186 */
187int rpci_write_byte(struct pci_dev *dev, int reg, uint8_t data);
188int rpci_write_word(struct pci_dev *dev, int reg, uint16_t data);
189int rpci_write_long(struct pci_dev *dev, int reg, uint32_t data);
190#endif
191
192#if CONFIG_INTERNAL == 1
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000193struct penable {
194 uint16_t vendor_id;
195 uint16_t device_id;
Stefan Tauner2c20b282012-07-28 19:35:26 +0000196 const enum test_state status;
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000197 const char *vendor_name;
198 const char *device_name;
199 int (*doit) (struct pci_dev *dev, const char *name);
200};
201
202extern const struct penable chipset_enables[];
203
Carl-Daniel Hailfinger580d29a2011-05-05 07:12:40 +0000204enum board_match_phase {
205 P1,
206 P2,
207 P3
208};
209
Carl-Daniel Hailfinger97d5b122011-08-31 16:19:50 +0000210struct board_match {
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000211 /* Any device, but make it sensible, like the ISA bridge. */
212 uint16_t first_vendor;
213 uint16_t first_device;
214 uint16_t first_card_vendor;
215 uint16_t first_card_device;
216
217 /* Any device, but make it sensible, like
218 * the host bridge. May be NULL.
219 */
220 uint16_t second_vendor;
221 uint16_t second_device;
222 uint16_t second_card_vendor;
223 uint16_t second_card_device;
224
Stefan Tauner7bcacb12011-05-26 01:35:19 +0000225 /* Pattern to match DMI entries. May be NULL. */
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000226 const char *dmi_pattern;
227
Stefan Tauner7bcacb12011-05-26 01:35:19 +0000228 /* The vendor / part name from the coreboot table. May be NULL. */
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000229 const char *lb_vendor;
230 const char *lb_part;
231
Carl-Daniel Hailfinger580d29a2011-05-05 07:12:40 +0000232 enum board_match_phase phase;
233
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000234 const char *vendor_name;
235 const char *board_name;
236
237 int max_rom_decode_parallel;
Stefan Tauner2c20b282012-07-28 19:35:26 +0000238 const enum test_state status;
Stefan Tauner7bcacb12011-05-26 01:35:19 +0000239 int (*enable) (void); /* May be NULL. */
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000240};
241
Carl-Daniel Hailfinger97d5b122011-08-31 16:19:50 +0000242extern const struct board_match board_matches[];
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000243
244struct board_info {
245 const char *vendor;
246 const char *name;
Stefan Tauner2c20b282012-07-28 19:35:26 +0000247 const enum test_state working;
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000248#ifdef CONFIG_PRINT_WIKI
249 const char *url;
250 const char *note;
251#endif
252};
253
254extern const struct board_info boards_known[];
255extern const struct board_info laptops_known[];
256#endif
257
258/* udelay.c */
Stefan Taunerf80419c2014-05-02 15:41:42 +0000259void myusec_delay(unsigned int usecs);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000260void myusec_calibrate_delay(void);
Stefan Taunerf80419c2014-05-02 15:41:42 +0000261void internal_sleep(unsigned int usecs);
262void internal_delay(unsigned int usecs);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000263
Carl-Daniel Hailfingerc4224842011-06-09 20:06:34 +0000264#if CONFIG_INTERNAL == 1
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000265/* board_enable.c */
Stefan Tauner600576b2014-06-12 22:57:36 +0000266int selfcheck_board_enables(void);
Stefan Taunerb4e06bd2012-08-20 00:24:22 +0000267int board_parse_parameter(const char *boardstring, const char **vendor, const char **model);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000268void w836xx_ext_enter(uint16_t port);
269void w836xx_ext_leave(uint16_t port);
Carl-Daniel Hailfingerf5e62cb2012-05-06 22:48:01 +0000270void probe_superio_winbond(void);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000271int it8705f_write_enable(uint8_t port);
272uint8_t sio_read(uint16_t port, uint8_t reg);
273void sio_write(uint16_t port, uint8_t reg, uint8_t data);
274void sio_mask(uint16_t port, uint8_t reg, uint8_t data, uint8_t mask);
Carl-Daniel Hailfinger580d29a2011-05-05 07:12:40 +0000275void board_handle_before_superio(void);
276void board_handle_before_laptop(void);
Stefan Taunerfa9fa712012-09-24 21:29:29 +0000277int board_flash_enable(const char *vendor, const char *model, const char *cb_vendor, const char *cb_model);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000278
279/* chipset_enable.c */
280int chipset_flash_enable(void);
281
282/* processor_enable.c */
283int processor_flash_enable(void);
Carl-Daniel Hailfinger580d29a2011-05-05 07:12:40 +0000284#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000285
286/* physmap.c */
Stefan Tauner305e0b92013-07-17 23:46:44 +0000287void *physmap(const char *descr, uintptr_t phys_addr, size_t len);
Stefan Tauner7fb5aa02013-08-14 15:48:44 +0000288void *rphysmap(const char *descr, uintptr_t phys_addr, size_t len);
Niklas Söderlund5d307202013-09-14 09:02:27 +0000289void *physmap_ro(const char *descr, uintptr_t phys_addr, size_t len);
Carl-Daniel Hailfinger43eac032014-03-05 00:16:16 +0000290void *physmap_ro_unaligned(const char *descr, uintptr_t phys_addr, size_t len);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000291void physunmap(void *virt_addr, size_t len);
Carl-Daniel Hailfinger43eac032014-03-05 00:16:16 +0000292void physunmap_unaligned(void *virt_addr, size_t len);
Carl-Daniel Hailfingerc4224842011-06-09 20:06:34 +0000293#if CONFIG_INTERNAL == 1
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000294int setup_cpu_msr(int cpu);
295void cleanup_cpu_msr(void);
296
297/* cbtable.c */
Stefan Taunerb4e06bd2012-08-20 00:24:22 +0000298int cb_parse_table(const char **vendor, const char **model);
299int cb_check_image(uint8_t *bios, int size);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000300
301/* dmi.c */
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000302#if defined(__i386__) || defined(__x86_64__)
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000303extern int has_dmi_support;
304void dmi_init(void);
305int dmi_match(const char *pattern);
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000306#endif // defined(__i386__) || defined(__x86_64__)
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000307
308/* internal.c */
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000309struct superio {
310 uint16_t vendor;
311 uint16_t port;
312 uint16_t model;
313};
Carl-Daniel Hailfingerbfecef62011-04-27 14:34:08 +0000314extern struct superio superios[];
315extern int superio_count;
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000316#define SUPERIO_VENDOR_NONE 0x0
317#define SUPERIO_VENDOR_ITE 0x1
Carl-Daniel Hailfingerf5e62cb2012-05-06 22:48:01 +0000318#define SUPERIO_VENDOR_WINBOND 0x2
Carl-Daniel Hailfingerc4224842011-06-09 20:06:34 +0000319#endif
320#if NEED_PCI == 1
Patrick Georgi32508eb2012-07-20 20:35:14 +0000321struct pci_filter;
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000322struct pci_dev *pci_dev_find_filter(struct pci_filter filter);
Uwe Hermann24c35e42011-07-13 11:22:03 +0000323struct pci_dev *pci_dev_find_vendorclass(uint16_t vendor, uint16_t devclass);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000324struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device);
325struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
326 uint16_t card_vendor, uint16_t card_device);
327#endif
Carl-Daniel Hailfingerd6bb8282012-07-21 17:27:08 +0000328int rget_io_perms(void);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000329#if CONFIG_INTERNAL == 1
330extern int is_laptop;
Carl-Daniel Hailfinger580d29a2011-05-05 07:12:40 +0000331extern int laptop_ok;
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000332extern int force_boardenable;
333extern int force_boardmismatch;
334void probe_superio(void);
Carl-Daniel Hailfingerbfecef62011-04-27 14:34:08 +0000335int register_superio(struct superio s);
Carl-Daniel Hailfingereaacd2d2011-11-09 23:40:00 +0000336extern enum chipbustype internal_buses_supported;
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000337int internal_init(void);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000338#endif
339
340/* hwaccess.c */
341void mmio_writeb(uint8_t val, void *addr);
342void mmio_writew(uint16_t val, void *addr);
343void mmio_writel(uint32_t val, void *addr);
344uint8_t mmio_readb(void *addr);
345uint16_t mmio_readw(void *addr);
346uint32_t mmio_readl(void *addr);
Carl-Daniel Hailfingerccd71c22012-03-01 22:38:27 +0000347void mmio_readn(void *addr, uint8_t *buf, size_t len);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000348void mmio_le_writeb(uint8_t val, void *addr);
349void mmio_le_writew(uint16_t val, void *addr);
350void mmio_le_writel(uint32_t val, void *addr);
351uint8_t mmio_le_readb(void *addr);
352uint16_t mmio_le_readw(void *addr);
353uint32_t mmio_le_readl(void *addr);
354#define pci_mmio_writeb mmio_le_writeb
355#define pci_mmio_writew mmio_le_writew
356#define pci_mmio_writel mmio_le_writel
357#define pci_mmio_readb mmio_le_readb
358#define pci_mmio_readw mmio_le_readw
359#define pci_mmio_readl mmio_le_readl
Carl-Daniel Hailfinger54ce73a2011-05-03 21:49:41 +0000360void rmmio_writeb(uint8_t val, void *addr);
361void rmmio_writew(uint16_t val, void *addr);
362void rmmio_writel(uint32_t val, void *addr);
363void rmmio_le_writeb(uint8_t val, void *addr);
364void rmmio_le_writew(uint16_t val, void *addr);
365void rmmio_le_writel(uint32_t val, void *addr);
366#define pci_rmmio_writeb rmmio_le_writeb
367#define pci_rmmio_writew rmmio_le_writew
368#define pci_rmmio_writel rmmio_le_writel
369void rmmio_valb(void *addr);
370void rmmio_valw(void *addr);
371void rmmio_vall(void *addr);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000372
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000373/* dummyflasher.c */
374#if CONFIG_DUMMY == 1
375int dummy_init(void);
Stefan Tauner305e0b92013-07-17 23:46:44 +0000376void *dummy_map(const char *descr, uintptr_t phys_addr, size_t len);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000377void dummy_unmap(void *virt_addr, size_t len);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000378#endif
379
380/* nic3com.c */
381#if CONFIG_NIC3COM == 1
382int nic3com_init(void);
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000383extern const struct dev_entry nics_3com[];
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000384#endif
385
386/* gfxnvidia.c */
387#if CONFIG_GFXNVIDIA == 1
388int gfxnvidia_init(void);
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000389extern const struct dev_entry gfx_nvidia[];
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000390#endif
391
392/* drkaiser.c */
393#if CONFIG_DRKAISER == 1
394int drkaiser_init(void);
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000395extern const struct dev_entry drkaiser_pcidev[];
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000396#endif
397
398/* nicrealtek.c */
399#if CONFIG_NICREALTEK == 1
400int nicrealtek_init(void);
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000401extern const struct dev_entry nics_realtek[];
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000402#endif
403
404/* nicnatsemi.c */
405#if CONFIG_NICNATSEMI == 1
406int nicnatsemi_init(void);
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000407extern const struct dev_entry nics_natsemi[];
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000408#endif
409
Carl-Daniel Hailfingerb713d2e2011-05-08 00:24:18 +0000410/* nicintel.c */
411#if CONFIG_NICINTEL == 1
412int nicintel_init(void);
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000413extern const struct dev_entry nics_intel[];
Carl-Daniel Hailfingerb713d2e2011-05-08 00:24:18 +0000414#endif
415
Idwer Vollering004f4b72010-09-03 18:21:21 +0000416/* nicintel_spi.c */
417#if CONFIG_NICINTEL_SPI == 1
418int nicintel_spi_init(void);
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000419extern const struct dev_entry nics_intel_spi[];
Idwer Vollering004f4b72010-09-03 18:21:21 +0000420#endif
421
Ricardo Ribalda Delgado2a41f0a2014-07-28 20:35:21 +0000422/* nicintel_eeprom.c */
423#if CONFIG_NICINTEL_EEPROM == 1
424int nicintel_ee_init(void);
425extern const struct dev_entry nics_intel_ee[];
426#endif
427
Mark Marshall90021f22010-12-03 14:48:11 +0000428/* ogp_spi.c */
429#if CONFIG_OGP_SPI == 1
430int ogp_spi_init(void);
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000431extern const struct dev_entry ogp_spi[];
Mark Marshall90021f22010-12-03 14:48:11 +0000432#endif
433
Carl-Daniel Hailfinger9a1105c2011-02-04 21:37:59 +0000434/* satamv.c */
435#if CONFIG_SATAMV == 1
436int satamv_init(void);
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000437extern const struct dev_entry satas_mv[];
Carl-Daniel Hailfinger9a1105c2011-02-04 21:37:59 +0000438#endif
439
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000440/* satasii.c */
441#if CONFIG_SATASII == 1
442int satasii_init(void);
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000443extern const struct dev_entry satas_sii[];
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000444#endif
445
446/* atahpt.c */
447#if CONFIG_ATAHPT == 1
448int atahpt_init(void);
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000449extern const struct dev_entry ata_hpt[];
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000450#endif
451
Jonathan Kollasch7f0f3fa2014-06-01 10:26:23 +0000452/* atavia.c */
453#if CONFIG_ATAVIA == 1
454int atavia_init(void);
455void *atavia_map(const char *descr, uintptr_t phys_addr, size_t len);
456extern const struct dev_entry ata_via[];
457#endif
458
Kyösti Mälkki72d42f82014-06-01 23:48:31 +0000459/* it8212.c */
460#if CONFIG_IT8212 == 1
461int it8212_init(void);
462extern const struct dev_entry devs_it8212[];
463#endif
464
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000465/* ft2232_spi.c */
Jörg Fischer6529b9f2010-07-29 15:54:53 +0000466#if CONFIG_FT2232_SPI == 1
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000467int ft2232_spi_init(void);
Stefan Tauner4b24a2d2012-12-27 18:40:36 +0000468extern const struct dev_entry devs_ft2232spi[];
Jörg Fischer6529b9f2010-07-29 15:54:53 +0000469#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000470
James Lairdc60de0e2013-03-27 13:00:23 +0000471/* usbblaster_spi.c */
472#if CONFIG_USBBLASTER_SPI == 1
473int usbblaster_spi_init(void);
474extern const struct dev_entry devs_usbblasterspi[];
475#endif
476
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000477/* rayer_spi.c */
478#if CONFIG_RAYER_SPI == 1
479int rayer_spi_init(void);
480#endif
481
Virgil-Adrian Teacada7c5452012-04-30 23:11:06 +0000482/* pony_spi.c */
483#if CONFIG_PONY_SPI == 1
484int pony_spi_init(void);
485#endif
486
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000487/* bitbang_spi.c */
Carl-Daniel Hailfingera5bcbce2014-07-19 22:03:29 +0000488int register_spi_bitbang_master(const struct bitbang_spi_master *master);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000489
490/* buspirate_spi.c */
Carl-Daniel Hailfingerc4224842011-06-09 20:06:34 +0000491#if CONFIG_BUSPIRATE_SPI == 1
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000492int buspirate_spi_init(void);
Carl-Daniel Hailfingerc4224842011-06-09 20:06:34 +0000493#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000494
Sven Schnelle5ce5f702011-09-03 18:37:52 +0000495/* linux_spi.c */
496#if CONFIG_LINUX_SPI == 1
497int linux_spi_init(void);
498#endif
499
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000500/* dediprog.c */
Carl-Daniel Hailfingerc4224842011-06-09 20:06:34 +0000501#if CONFIG_DEDIPROG == 1
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000502int dediprog_init(void);
Carl-Daniel Hailfingerc4224842011-06-09 20:06:34 +0000503#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000504
505/* flashrom.c */
506struct decode_sizes {
507 uint32_t parallel;
508 uint32_t lpc;
509 uint32_t fwh;
510 uint32_t spi;
511};
Carl-Daniel Hailfingerc40cff72011-12-20 00:19:29 +0000512// FIXME: These need to be local, not global
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000513extern struct decode_sizes max_rom_decode;
514extern int programmer_may_write;
515extern unsigned long flashbase;
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000516int check_max_decode(enum chipbustype buses, uint32_t size);
Stefan Tauner66652442011-06-26 17:38:17 +0000517char *extract_programmer_param(const char *param_name);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000518
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000519/* spi.c */
520enum spi_controller {
521 SPI_CONTROLLER_NONE,
522#if CONFIG_INTERNAL == 1
523#if defined(__i386__) || defined(__x86_64__)
524 SPI_CONTROLLER_ICH7,
525 SPI_CONTROLLER_ICH9,
David Hendricks4e748392011-02-28 23:58:15 +0000526 SPI_CONTROLLER_IT85XX,
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000527 SPI_CONTROLLER_IT87XX,
528 SPI_CONTROLLER_SB600,
Wei Hu31402ee2014-05-16 21:39:33 +0000529 SPI_CONTROLLER_YANGTZE,
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000530 SPI_CONTROLLER_VIA,
531 SPI_CONTROLLER_WBSIO,
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000532#endif
533#endif
534#if CONFIG_FT2232_SPI == 1
535 SPI_CONTROLLER_FT2232,
536#endif
537#if CONFIG_DUMMY == 1
538 SPI_CONTROLLER_DUMMY,
539#endif
540#if CONFIG_BUSPIRATE_SPI == 1
541 SPI_CONTROLLER_BUSPIRATE,
542#endif
543#if CONFIG_DEDIPROG == 1
544 SPI_CONTROLLER_DEDIPROG,
545#endif
Virgil-Adrian Teacada7c5452012-04-30 23:11:06 +0000546#if CONFIG_OGP_SPI == 1 || CONFIG_NICINTEL_SPI == 1 || CONFIG_RAYER_SPI == 1 || CONFIG_PONY_SPI == 1 || (CONFIG_INTERNAL == 1 && (defined(__i386__) || defined(__x86_64__)))
Michael Karcherb9dbe482011-05-11 17:07:07 +0000547 SPI_CONTROLLER_BITBANG,
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000548#endif
Sven Schnelle5ce5f702011-09-03 18:37:52 +0000549#if CONFIG_LINUX_SPI == 1
550 SPI_CONTROLLER_LINUX,
551#endif
Urja Rannikkoc93f5f12011-09-15 23:38:14 +0000552#if CONFIG_SERPROG == 1
553 SPI_CONTROLLER_SERPROG,
554#endif
James Lairdc60de0e2013-03-27 13:00:23 +0000555#if CONFIG_USBBLASTER_SPI == 1
556 SPI_CONTROLLER_USBBLASTER,
557#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000558};
Michael Karcher62797512011-05-11 17:07:02 +0000559
560#define MAX_DATA_UNSPECIFIED 0
561#define MAX_DATA_READ_UNLIMITED 64 * 1024
562#define MAX_DATA_WRITE_UNLIMITED 256
Carl-Daniel Hailfingera5bcbce2014-07-19 22:03:29 +0000563struct spi_master {
Michael Karcherb9dbe482011-05-11 17:07:07 +0000564 enum spi_controller type;
Stefan Taunerc69c9c82011-11-23 09:13:48 +0000565 unsigned int max_data_read;
566 unsigned int max_data_write;
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +0000567 int (*command)(struct flashctx *flash, unsigned int writecnt, unsigned int readcnt,
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000568 const unsigned char *writearr, unsigned char *readarr);
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +0000569 int (*multicommand)(struct flashctx *flash, struct spi_command *cmds);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000570
Carl-Daniel Hailfingera5bcbce2014-07-19 22:03:29 +0000571 /* Optimized functions for this master */
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +0000572 int (*read)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
Mark Marshallf20b7be2014-05-09 21:16:21 +0000573 int (*write_256)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
574 int (*write_aai)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
Carl-Daniel Hailfingerc40cff72011-12-20 00:19:29 +0000575 const void *data;
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000576};
577
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +0000578int default_spi_send_command(struct flashctx *flash, unsigned int writecnt, unsigned int readcnt,
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000579 const unsigned char *writearr, unsigned char *readarr);
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +0000580int default_spi_send_multicommand(struct flashctx *flash, struct spi_command *cmds);
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +0000581int default_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
Mark Marshallf20b7be2014-05-09 21:16:21 +0000582int default_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
583int default_spi_write_aai(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
Carl-Daniel Hailfingera5bcbce2014-07-19 22:03:29 +0000584int register_spi_master(const struct spi_master *mst);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000585
Kyösti Mälkki78cd0872013-09-14 23:36:57 +0000586/* The following enum is needed by ich_descriptor_tool and ich* code as well as in chipset_enable.c. */
Stefan Taunera8d838d2011-11-06 23:51:09 +0000587enum ich_chipset {
588 CHIPSET_ICH_UNKNOWN,
Stefan Tauner92d6a862013-10-25 00:33:37 +0000589 CHIPSET_ICH,
590 CHIPSET_ICH2345,
Kyösti Mälkki78cd0872013-09-14 23:36:57 +0000591 CHIPSET_ICH6,
Stefan Tauner92d6a862013-10-25 00:33:37 +0000592 CHIPSET_POULSBO, /* SCH U* */
593 CHIPSET_TUNNEL_CREEK, /* Atom E6xx */
594 CHIPSET_CENTERTON, /* Atom S1220 S1240 S1260 */
Kyösti Mälkki78cd0872013-09-14 23:36:57 +0000595 CHIPSET_ICH7,
Stefan Taunera8d838d2011-11-06 23:51:09 +0000596 CHIPSET_ICH8,
597 CHIPSET_ICH9,
598 CHIPSET_ICH10,
599 CHIPSET_5_SERIES_IBEX_PEAK,
600 CHIPSET_6_SERIES_COUGAR_POINT,
Stefan Tauner2abab942012-04-27 20:41:23 +0000601 CHIPSET_7_SERIES_PANTHER_POINT,
Duncan Laurie90eb2262013-03-15 03:12:29 +0000602 CHIPSET_8_SERIES_LYNX_POINT,
603 CHIPSET_8_SERIES_LYNX_POINT_LP,
604 CHIPSET_8_SERIES_WELLSBURG,
Stefan Taunera8d838d2011-11-06 23:51:09 +0000605};
606
Stefan Tauner2abab942012-04-27 20:41:23 +0000607/* ichspi.c */
608#if CONFIG_INTERNAL == 1
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000609extern uint32_t ichspi_bbar;
Stefan Tauner92d6a862013-10-25 00:33:37 +0000610int ich_init_spi(struct pci_dev *dev, void *spibar, enum ich_chipset ich_generation);
Helge Wagnerdd73d832012-08-24 23:03:46 +0000611int via_init_spi(struct pci_dev *dev, uint32_t mmio_base);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000612
Stefan Taunerdbac46c2013-08-13 22:10:41 +0000613/* amd_imc.c */
Rudolf Marek70e14592013-07-25 22:58:56 +0000614int amd_imc_shutdown(struct pci_dev *dev);
615
David Hendricks4e748392011-02-28 23:58:15 +0000616/* it85spi.c */
Carl-Daniel Hailfingerbfecef62011-04-27 14:34:08 +0000617int it85xx_spi_init(struct superio s);
David Hendricks4e748392011-02-28 23:58:15 +0000618
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000619/* it87spi.c */
620void enter_conf_mode_ite(uint16_t port);
621void exit_conf_mode_ite(uint16_t port);
Carl-Daniel Hailfingerbfecef62011-04-27 14:34:08 +0000622void probe_superio_ite(void);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000623int init_superio_ite(void);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000624
Carl-Daniel Hailfingerc4224842011-06-09 20:06:34 +0000625/* mcp6x_spi.c */
626int mcp6x_spi_init(int want_spi);
627
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000628/* sb600spi.c */
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000629int sb600_probe_spi(struct pci_dev *dev);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000630
631/* wbsio_spi.c */
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000632int wbsio_check_for_spi(void);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000633#endif
634
Carl-Daniel Hailfinger532c7172011-11-04 21:35:26 +0000635/* opaque.c */
Carl-Daniel Hailfingera5bcbce2014-07-19 22:03:29 +0000636struct opaque_master {
Carl-Daniel Hailfinger532c7172011-11-04 21:35:26 +0000637 int max_data_read;
638 int max_data_write;
Carl-Daniel Hailfingera5bcbce2014-07-19 22:03:29 +0000639 /* Specific functions for this master */
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +0000640 int (*probe) (struct flashctx *flash);
641 int (*read) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
Mark Marshallf20b7be2014-05-09 21:16:21 +0000642 int (*write) (struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
Carl-Daniel Hailfinger63fd9022011-12-14 22:25:15 +0000643 int (*erase) (struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen);
Carl-Daniel Hailfingerc40cff72011-12-20 00:19:29 +0000644 const void *data;
Carl-Daniel Hailfinger532c7172011-11-04 21:35:26 +0000645};
Carl-Daniel Hailfingera5bcbce2014-07-19 22:03:29 +0000646int register_opaque_master(const struct opaque_master *mst);
Carl-Daniel Hailfinger532c7172011-11-04 21:35:26 +0000647
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +0000648/* programmer.c */
649int noop_shutdown(void);
Stefan Tauner305e0b92013-07-17 23:46:44 +0000650void *fallback_map(const char *descr, uintptr_t phys_addr, size_t len);
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +0000651void fallback_unmap(void *virt_addr, size_t len);
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +0000652void noop_chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr);
653void fallback_chip_writew(const struct flashctx *flash, uint16_t val, chipaddr addr);
654void fallback_chip_writel(const struct flashctx *flash, uint32_t val, chipaddr addr);
Mark Marshallf20b7be2014-05-09 21:16:21 +0000655void fallback_chip_writen(const struct flashctx *flash, const uint8_t *buf, chipaddr addr, size_t len);
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +0000656uint16_t fallback_chip_readw(const struct flashctx *flash, const chipaddr addr);
657uint32_t fallback_chip_readl(const struct flashctx *flash, const chipaddr addr);
658void fallback_chip_readn(const struct flashctx *flash, uint8_t *buf, const chipaddr addr, size_t len);
Carl-Daniel Hailfingera5bcbce2014-07-19 22:03:29 +0000659struct par_master {
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +0000660 void (*chip_writeb) (const struct flashctx *flash, uint8_t val, chipaddr addr);
661 void (*chip_writew) (const struct flashctx *flash, uint16_t val, chipaddr addr);
662 void (*chip_writel) (const struct flashctx *flash, uint32_t val, chipaddr addr);
Mark Marshallf20b7be2014-05-09 21:16:21 +0000663 void (*chip_writen) (const struct flashctx *flash, const uint8_t *buf, chipaddr addr, size_t len);
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +0000664 uint8_t (*chip_readb) (const struct flashctx *flash, const chipaddr addr);
665 uint16_t (*chip_readw) (const struct flashctx *flash, const chipaddr addr);
666 uint32_t (*chip_readl) (const struct flashctx *flash, const chipaddr addr);
667 void (*chip_readn) (const struct flashctx *flash, uint8_t *buf, const chipaddr addr, size_t len);
Carl-Daniel Hailfingerc40cff72011-12-20 00:19:29 +0000668 const void *data;
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +0000669};
Carl-Daniel Hailfingera5bcbce2014-07-19 22:03:29 +0000670int register_par_master(const struct par_master *mst, const enum chipbustype buses);
671struct registered_master {
Carl-Daniel Hailfingerc40cff72011-12-20 00:19:29 +0000672 enum chipbustype buses_supported;
673 union {
Carl-Daniel Hailfingera5bcbce2014-07-19 22:03:29 +0000674 struct par_master par;
675 struct spi_master spi;
676 struct opaque_master opaque;
Carl-Daniel Hailfingerc40cff72011-12-20 00:19:29 +0000677 };
678};
Carl-Daniel Hailfingera5bcbce2014-07-19 22:03:29 +0000679extern struct registered_master registered_masters[];
680extern int registered_master_count;
681int register_master(struct registered_master *mst);
Carl-Daniel Hailfinger8a3c60c2011-12-18 15:01:24 +0000682
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000683/* serprog.c */
Carl-Daniel Hailfingerc4224842011-06-09 20:06:34 +0000684#if CONFIG_SERPROG == 1
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000685int serprog_init(void);
Stefan Taunerf80419c2014-05-02 15:41:42 +0000686void serprog_delay(unsigned int usecs);
Carl-Daniel Hailfingerc4224842011-06-09 20:06:34 +0000687#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000688
689/* serial.c */
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +0000690#ifdef _WIN32
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000691typedef HANDLE fdtype;
Stefan Taunerbb4fed72012-09-01 21:47:19 +0000692#define SER_INV_FD INVALID_HANDLE_VALUE
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000693#else
694typedef int fdtype;
Stefan Taunerbb4fed72012-09-01 21:47:19 +0000695#define SER_INV_FD -1
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000696#endif
697
698void sp_flush_incoming(void);
699fdtype sp_openserport(char *dev, unsigned int baud);
Stefan Tauner184c52c2013-08-23 21:51:32 +0000700int serialport_config(fdtype fd, unsigned int baud);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000701extern fdtype sp_fd;
David Hendricks8bb20212011-06-14 01:35:36 +0000702/* expose serialport_shutdown as it's currently used by buspirate */
703int serialport_shutdown(void *data);
Mark Marshallf20b7be2014-05-09 21:16:21 +0000704int serialport_write(const unsigned char *buf, unsigned int writecnt);
705int serialport_write_nonblock(const unsigned char *buf, unsigned int writecnt, unsigned int timeout, unsigned int *really_wrote);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000706int serialport_read(unsigned char *buf, unsigned int readcnt);
Stefan Tauner00e16082013-04-01 00:45:38 +0000707int serialport_read_nonblock(unsigned char *c, unsigned int readcnt, unsigned int timeout, unsigned int *really_read);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000708
Virgil-Adrian Teacada7c5452012-04-30 23:11:06 +0000709/* Serial port/pin mapping:
710
711 1 CD <-
712 2 RXD <-
713 3 TXD ->
714 4 DTR ->
715 5 GND --
716 6 DSR <-
717 7 RTS ->
718 8 CTS <-
719 9 RI <-
720*/
721enum SP_PIN {
722 PIN_CD = 1,
723 PIN_RXD,
724 PIN_TXD,
725 PIN_DTR,
726 PIN_GND,
727 PIN_DSR,
728 PIN_RTS,
729 PIN_CTS,
730 PIN_RI,
731};
732
733void sp_set_pin(enum SP_PIN pin, int val);
734int sp_get_pin(enum SP_PIN pin);
735
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000736#endif /* !__PROGRAMMER_H__ */